#!/usr/bin/env python # -*- coding: utf-8 -*- #=============================================================================== # File: "macbuild/build4mac.py" # # The top Python script for building KLayout (http://www.klayout.de/index.php) # version 0.26.1 or later on different Apple Mac OSX platforms. #=============================================================================== from __future__ import print_function # to use print() of Python 3 in Python >= 2.7 import sys import os import shutil import glob import platform import optparse import subprocess #------------------------------------------------------------------------------- ## To import global dictionaries of different modules and utility functions #------------------------------------------------------------------------------- mydir = os.path.dirname(os.path.abspath(__file__)) sys.path.append( mydir + "/macbuild" ) from build4mac_env import * from build4mac_util import * #------------------------------------------------------------------------------- ## To set global variables including present directory and platform info. #------------------------------------------------------------------------------- def SetGlobals(): global ProjectDir # project directory where "build.sh" exists global Usage # string on usage global BuildBash # the main build Bash script global Platform # platform global ModuleQt # Qt module to be used global ModuleRuby # Ruby module to be used global ModulePython # Python module to be used global NonOSStdLang # True if non-OS-standard language is chosen global NoQtBindings # True if not creating Qt bindings for Ruby scripts global MakeOptions # options passed to `make` global DebugMode # True if debug mode build global CheckComOnly # True if only for checking the command line parameters to "build.sh" global DeploymentF # True if fully (including Qt's Frameworks) deploy the binaries for bundles global DeploymentP # True if partially deploy the binaries excluding Qt's Frameworks global PackagePrefix # the package prefix: 'ST-', 'LW-', 'HW-', or 'EX-' global DeployVerbose # -verbose=<0-3> level passed to 'macdeployqt' tool global Version # KLayout's version global ModuleSet # (Qt, Ruby, Python)-tuple # auxiliary variables on platform global System # 6-tuple from platform.uname() global Node # - do - global Release # - do - global Version # - do - global Machine # - do - global Processor # - do - global Bit # machine bit-size Usage = "\n" Usage += "---------------------------------------------------------------------------------------------------------\n" Usage += "<< Usage of 'build4mac.py' >>\n" Usage += " for building KLayout 0.26.1 or later on different Apple Mac OSX platforms.\n" Usage += "\n" Usage += "$ [python] ./build4mac.py \n" Usage += " option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value\n" Usage += " --------------------------------------------------------------------------------------+---------------\n" Usage += " [-q|--qt ] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | qt5macports \n" Usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n" Usage += " : Qt5Brew: use Qt5 from Homebrew | \n" Usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n" Usage += " [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP26', 'HB27', 'Ana3'] | sys \n" Usage += " : nil: don't bind Ruby | \n" Usage += " : Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | \n" Usage += " : MP26: use Ruby 2.6 from MacPorts | \n" Usage += " : HB27: use Ruby 2.7 from Homebrew | \n" Usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n" Usage += " [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3'] | sys \n" Usage += " : nil: don't bind Python | \n" Usage += " : Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] | \n" Usage += " : MP38: use Python 3.8 from MacPorts | \n" Usage += " : HB38: use Python 3.8 from Homebrew | \n" Usage += " : Ana3: use Python 3.7 from Anaconda3 | \n" Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n" Usage += " [-m|--make