diff --git a/macbuild/ReadMe.md b/macbuild/ReadMe.md index 5a748d12b..c5f20d882 100644 --- a/macbuild/ReadMe.md +++ b/macbuild/ReadMe.md @@ -1,9 +1,9 @@ -Relevant KLayout version: 0.28.4
+Relevant KLayout version: 0.28.6
Author: Kazzz-S
-Last modified: 2023-02-01
+Last modified: 2023-03-19
# 1. Introduction -This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.4 or later for different 64-bit macOS, including: +This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.6 or later for different 64-bit macOS, including: * Catalina (10.15.7) : the primary development environment * Big Sur (11.x) : experimental; Apple (M1|M2) chip is not tested since the author does not own an (M1|M2) Mac * Monterey (12.x) : -- ditto -- @@ -73,7 +73,7 @@ You need to have the followings: ``` --------------------------------------------------------------------------------------------------------- << Usage of 'build4mac.py' >> - for building KLayout 0.28.4 or later on different Apple macOS / Mac OSX platforms. + for building KLayout 0.28.6 or later on different Apple macOS / Mac OSX platforms. $ [python] ./build4mac.py option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value @@ -130,7 +130,7 @@ $ [python] ./build4mac.py ``` --------------------------------------------------------------------------------------------------------- << Usage of 'build4mac.py' >> - for building KLayout 0.28.4 or later on different Apple macOS / Mac OSX platforms. + for building KLayout 0.28.6 or later on different Apple macOS / Mac OSX platforms. $ [python] ./build4mac.py option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value @@ -236,7 +236,7 @@ $ ./build4mac.py -q qt5macports -r mp32 -p mp39 2. Confirm successful build (it will take about one hour, depending on your machine spec). 3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.
- If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl, \*.egg) will be built and deployed under **klayout.app/Contents/pymod-dist/**. + If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl) will be built and deployed under **klayout.app/Contents/pymod-dist/**. ``` $ ./build4mac.py -q qt5macports -r mp32 -p mp39 -Y @@ -263,7 +263,7 @@ $ ./build4mac.py -q qt5brew -r hb32 -p hb39 2. Confirm successful build (it will take about one hour, depending on your machine spec). 3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.
- If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl, \*.egg) will be built and deployed under **klayout.app/Contents/pymod-dist/**. + If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl) will be built and deployed under **klayout.app/Contents/pymod-dist/**. ``` $ ./build4mac.py -q qt5brew -r hb32 -p hb39 -Y @@ -316,7 +316,7 @@ $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 2. Confirm successful build (it will take about one hour, depending on your machine spec). 3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.
- If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl, \*.egg) will be built and deployed under **klayout.app/Contents/pymod-dist/**. + If you use `--buildPymod` option in Step-1 and Step-3, the KLayout Python Module (\*.whl) will be built and deployed under **klayout.app/Contents/pymod-dist/**. ``` $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 -Y @@ -352,8 +352,8 @@ $ cd /where/'build.sh'/exists $ ./makeDMG4mac.py -p LW-qt5MP.pkg.macos-Catalina-release-Rmp32Pmp39 -m ``` This command will generate the two files below:
-* **`LW-klayout-0.28.4-macOS-Catalina-1-qt5MP-Rmp32Pmp39.dmg`** ---(1) the main DMG file -* **`LW-klayout-0.28.4-macOS-Catalina-1-qt5MP-Rmp32Pmp39.dmg.md5`** ---(2) MD5-value text file +* **`LW-klayout-0.28.6-macOS-Catalina-1-qt5MP-Rmp32Pmp39.dmg`** ---(1) the main DMG file +* **`LW-klayout-0.28.6-macOS-Catalina-1-qt5MP-Rmp32Pmp39.dmg.md5`** ---(2) MD5-value text file # Known issues Because we assume some specific versions of non-OS-standard Ruby and Python, updating MacPorts, Homebrew, or Anaconda3 may cause build- and link errors.
diff --git a/macbuild/Resources/script-bundle-A.zip b/macbuild/Resources/script-bundle-A.zip index 62eb59202..e2d9b79a3 100644 Binary files a/macbuild/Resources/script-bundle-A.zip and b/macbuild/Resources/script-bundle-A.zip differ diff --git a/macbuild/Resources/script-bundle-B.zip b/macbuild/Resources/script-bundle-B.zip index d8a0f180a..db93f4476 100644 Binary files a/macbuild/Resources/script-bundle-B.zip and b/macbuild/Resources/script-bundle-B.zip differ diff --git a/macbuild/Resources/script-bundle-P.zip b/macbuild/Resources/script-bundle-P.zip index ea537d9fb..779b9a8f9 100644 Binary files a/macbuild/Resources/script-bundle-P.zip and b/macbuild/Resources/script-bundle-P.zip differ diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index fcfd4712b..29fe89936 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -47,7 +47,7 @@ def GenerateUsage(platform): usage = "\n" usage += "---------------------------------------------------------------------------------------------------------\n" usage += "<< Usage of 'build4mac.py' >>\n" - usage += " for building KLayout 0.28.4 or later on different Apple macOS / Mac OSX platforms.\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" @@ -905,19 +905,31 @@ def Build_pymod(parameters): PymodDistDir = parameters['pymod_dist'] # Using MacPorts if PymodDistDir[ModulePython] == 'dist-MP3': + addBinPath = "/opt/local/bin" addIncPath = "/opt/local/include" addLibPath = "/opt/local/lib" # Using Homebrew elif PymodDistDir[ModulePython] == 'dist-HB3': - addIncPath = "%s/include" % DefaultHomebrewRoot # defined in "build4mac_env.py" - addLibPath = "%s/lib" % DefaultHomebrewRoot # defined in "build4mac_env.py" + addBinPath = "%s/bin" % DefaultHomebrewRoot # defined in "build4mac_env.py" + addIncPath = "%s/include" % DefaultHomebrewRoot # -- ditto -- + addLibPath = "%s/lib" % DefaultHomebrewRoot # -- ditto -- elif PymodDistDir[ModulePython] == 'dist-ana3': + addBinPath = "/Applications/anaconda3/bin" addIncPath = "/Applications/anaconda3/include" addLibPath = "/Applications/anaconda3/lib" else: + addBinPath = "" addIncPath = "" addLibPath = "" + if not addBinPath == "": + try: + bpath = os.environ['PATH'] + except KeyError: + os.environ['PATH'] = addBinPath + else: + os.environ['PATH'] = "%s:%s" % (addBinPath, bpath) + if not addIncPath == "": try: cpath = os.environ['CPATH'] @@ -937,10 +949,11 @@ def Build_pymod(parameters): #-------------------------------------------------------------------- # [3] Set different command line parameters for building #-------------------------------------------------------------------- - cmd1_args = " setup.py build \\\n" - cmd2_args = " setup.py bdist_wheel \\\n" - cmd3_args = " setup.py bdist_egg \\\n" - cmd4_args = " setup.py clean --all \\\n" + cmd1_args = " -m setup build \\\n" + cmd2_args = " -m setup bdist_wheel \\\n" + deloc_cmd = " delocate-wheel --ignore-missing-dependencies" + cmd3_args = " \\\n" + cmd4_args = " -m setup clean --all \\\n" #-------------------------------------------------------------------- # [4] Make the consolidated command lines @@ -958,7 +971,7 @@ def Build_pymod(parameters): command2 += " test ${PIPESTATUS[0]} -eq 0" # tee always exits with 0 command3 = "time" - command3 += " \\\n %s \\\n" % parameters['python'] + command3 += " \\\n %s \\\n" % deloc_cmd command3 += cmd3_args command3 += " 2>&1 | tee -a %s; \\\n" % parameters['logfile'] command3 += " test ${PIPESTATUS[0]} -eq 0" # tee always exits with 0 @@ -986,6 +999,7 @@ def Build_pymod(parameters): print( "") print( " ", command4 ) print( "" ) + if parameters['check_cmd_only']: return 0 @@ -1011,11 +1025,26 @@ def Build_pymod(parameters): print( "", file=sys.stderr ) return 1 - ret = subprocess.call( command3, shell=True ) + #--------------------------------------------------------------------------------------------------------- + # Copy and relink library dependencies for wheel. + # In this step, the "delocate-wheel" command using the desired Python must be found in the PATH. + # Refer to: https://github.com/Kazzz-S/klayout/issues/49#issuecomment-1432154118 + # https://pypi.org/project/delocate/ + #--------------------------------------------------------------------------------------------------------- + cmd3_args = glob.glob( "dist/*.whl" ) # like ['dist/klayout-0.28.6-cp39-cp39-macosx_12_0_x86_64.whl'] + if len(cmd3_args) == 1: + command3 = "time" + command3 += " \\\n %s \\\n" % deloc_cmd + command3 += " %s \\\n" % cmd3_args[0] + command3 += " 2>&1 | tee -a %s; \\\n" % parameters['logfile'] + command3 += " test ${PIPESTATUS[0]} -eq 0" # tee always exits with 0 + ret = subprocess.call( command3, shell=True ) + else: + ret = 1 if ret != 0: print( "", file=sys.stderr ) print( "-------------------------------------------------------------", file=sys.stderr ) - print( "!!! <%s>: failed to build " % myscript, file=sys.stderr ) + print( "!!! <%s>: failed to " % myscript, file=sys.stderr ) print( "-------------------------------------------------------------", file=sys.stderr ) print( "", file=sys.stderr ) return 1 diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py index 3c84c9de1..86d44bb0d 100755 --- a/macbuild/build4mac_env.py +++ b/macbuild/build4mac_env.py @@ -196,7 +196,7 @@ Ruby31MacPorts = { 'exe': '/opt/local/bin/ruby3.1', # install with 'sudo port install ruby32' # [Key Type Name] = 'MP32' Ruby32MacPorts = { 'exe': '/opt/local/bin/ruby3.2', - 'inc': '/opt/local/include/ruby-3.2.0', + 'inc': '/opt/local/include/ruby-3.2.1', 'lib': '/opt/local/lib/libruby.3.2.dylib' }