#!/usr/bin/env python3 # -*- 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. #=============================================================================== import sys import os import codecs import shutil import glob import platform import optparse import subprocess import pprint #------------------------------------------------------------------------------- ## 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 generate the OS-wise usage strings and the default module set # # @param[in] platform platform name # # @return (usage, moduleset)-tuple #------------------------------------------------------------------------------- def GenerateUsage(platform): if platform.upper() in [ "VENTURA", "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ] myQt56 = "qt5brew" myRuby = "hb32" myPython = "hb39" moduleset = ('qt5Brew', 'HB32', 'HB39') else: # with Xcode [ .. 12.4]; 'sys' for Python has been restored in 0.28.3 myQt56 = "qt5macports" myRuby = "sys" myPython = "sys" moduleset = ('qt5MP', 'Sys', 'Sys') usage = "\n" usage += "---------------------------------------------------------------------------------------------------------\n" usage += "<< Usage of 'build4mac.py' >>\n" usage += " for building KLayout 0.28.6 or later on different Apple macOS / 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', | %s \n" % myQt56 usage += " : 'Qt6MacPorts', 'Qt6Brew'] | \n" usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n" usage += " : Qt5Brew: use Qt5 from Homebrew | \n" usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n" usage += " : Qt6MacPorts: use Qt6 from MacPorts (*) | \n" usage += " : Qt6Brew: use Qt6 from Homebrew (*) | \n" usage += " : (*) migration to Qt6 is ongoing | \n" usage += " [-r|--ruby ] : case-insensitive type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3', | %s \n" % myRuby usage += " : 'MP32', HB32'] | \n" usage += " : nil: don't bind Ruby | \n" usage += " : Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | \n" usage += " : MP31: use Ruby 3.1 from MacPorts | \n" usage += " : HB31: use Ruby 3.1 from Homebrew | \n" usage += " : Ana3: use Ruby 3.1 from Anaconda3 | \n" usage += " : MP32: use Ruby 3.2 from MacPorts | \n" usage += " : HB32: use Ruby 3.2 from Homebrew | \n" usage += " [-p|--python ] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython usage += " : 'MP39', HB39', 'HBAuto'] | \n" usage += " : nil: don't bind Python | \n" usage += " : Sys: use OS-bundled Python 2.7 up to 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.9 from Anaconda3 | \n" usage += " : MP39: use Python 3.9 from MacPorts | \n" usage += " : HB39: use Python 3.9 from Homebrew | \n" usage += " : HBAuto: use the latest Python 3.x auto-detected from Homebrew | \n" usage += " [-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled\n" usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled\n" usage += " [-u|--noqtuitools] : don't include uitools in Qt binding | disabled\n" usage += " [-m|--make