From 8c64e2bbaa8ad36f511b93815faf14e107f04e42 Mon Sep 17 00:00:00 2001 From: Kazunari Sekigawa Date: Mon, 8 Jan 2018 07:04:25 +0900 Subject: [PATCH 1/4] To use the latest "anaconda2" 5.0.1 This refs #4 and #19. --- macbuild/build4mac_env.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/macbuild/build4mac_env.py b/macbuild/build4mac_env.py index 3f85594ff..1017493fd 100755 --- a/macbuild/build4mac_env.py +++ b/macbuild/build4mac_env.py @@ -141,26 +141,26 @@ PythonHighSierra= { 'exe': '/System/Library/Frameworks/Python.framework/Versions 'lib': '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib' } -# Using anaconda (https://www.anaconda.com/download/#macos): *+*+*+ EXPERIMENTAL *+*+*+ -# If the path to your `conda` command is '$HOME/anaconda/bin/conda' +# Using anaconda2 (https://www.anaconda.com/download/#macos) 5.0.1: *+*+*+ EXPERIMENTAL *+*+*+ +# If the path to your `conda` command is '$HOME/anaconda2/bin/conda' # and your Python environment was prepared by: $ conda create -n py27klayout python=2.7 # # No additional modules are added in the beginning. # [Key Type Name] = 'Ana27' -Anaconda27 = { 'exe': '$HOME/anaconda/envs/py27klayout/bin/python2.7' , - 'inc': '$HOME/anaconda/envs/py27klayout/include/python2.7', - 'lib': '$HOME/anaconda/envs/py27klayout/lib/libpython2.7.dylib' +Anaconda27 = { 'exe': '$HOME/anaconda2/envs/py27klayout/bin/python2.7' , + 'inc': '$HOME/anaconda2/envs/py27klayout/include/python2.7', + 'lib': '$HOME/anaconda2/envs/py27klayout/lib/libpython2.7.dylib' } -# Using anaconda (https://www.anaconda.com/download/#macos): *+*+*+ EXPERIMENTAL *+*+*+ -# If the path to your `conda` command is '$HOME/anaconda/bin/conda' +# Using anaconda2 (https://www.anaconda.com/download/#macos) 5.0.1l: *+*+*+ EXPERIMENTAL *+*+*+ +# If the path to your `conda` command is '$HOME/anaconda2/bin/conda' # and your Python environment was prepared by: $ conda create -n py36klayout python=3.6 # # No additional modules are added in the beginning. # [Key Type Name] = 'Ana36' -Anaconda36 = { 'exe': '$HOME/anaconda/envs/py36klayout/bin/python3.6' , - 'inc': '$HOME/anaconda/envs/py36klayout/include/python3.6m', - 'lib': '$HOME/anaconda/envs/py36klayout/lib/libpython3.6m.dylib' +Anaconda36 = { 'exe': '$HOME/anaconda2/envs/py36klayout/bin/python3.6' , + 'inc': '$HOME/anaconda2/envs/py36klayout/include/python3.6m', + 'lib': '$HOME/anaconda2/envs/py36klayout/lib/libpython3.6m.dylib' } # Python 3.6 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+ From 10e48eef96f7ba3bb778c8686ebaa7fd466fda04 Mon Sep 17 00:00:00 2001 From: Kazunari Sekigawa Date: Mon, 8 Jan 2018 16:57:56 +0900 Subject: [PATCH 2/4] To use the latest "anaconda2" 5.0.1 This refs #4 and #19. --- macbuild/ReadMe.md | 71 +++++++++++++ macbuild/ReadMe.txt | 55 +++++++--- macbuild/build4mac.py | 208 +++++++++++++++++++++++-------------- macbuild/build4mac_env.py | 8 +- macbuild/build4mac_util.py | 4 +- 5 files changed, 251 insertions(+), 95 deletions(-) create mode 100644 macbuild/ReadMe.md diff --git a/macbuild/ReadMe.md b/macbuild/ReadMe.md new file mode 100644 index 000000000..8db196198 --- /dev/null +++ b/macbuild/ReadMe.md @@ -0,0 +1,71 @@ +<< Draft Version 0.003>> Relevant KLayout version: 0.25.1 + +# 1. Introduction: +This directory "macbuild" contains different files required for building KLayout version 0.25 or later for different Max OSX including: +* Yosemite (10.10) +* El Capitan (10.11) +* Sierra (10.12) +* High Sierra (10.13) + +By default, Qt framework is "Qt5" from Mac Ports (https://www.macports.org/) which is usually located under: +``` +/opt/local/libexec/qt5/ +``` + +### IMPORTANT: +``` +* Please DO NOT USE "Qt 5.10.x" which is problematic in showing your design in the main canvas. +* Please USE "Qt 5.9.x" instead. +* Building with Qt4 will lead to some compile errors. +``` +Also by default, supported script languages, i.e, Ruby and Python, are those standard ones bundled with the OS. + +# 2. Non-OS-standard script language support +You may want to use a non-OS-standard script language such as Python 3.6 from Aanaconda2 (https://www.anaconda.com/download/#macos) in combination with KLayout. + +Since Anacoda(2) is a popular Python development environment, this is worth trying. +Unfortunately, however, some dynamic linkage problems are observed as of today. +On the other hand, Python 3.6 provided by Mac Ports is usable. +Please try this (refer to 3B below) if you feel it's useful. + +# 3. Use-cases: +### 3A. Debug build using the OS-standard script languages: +1. Make a symbolic link from the parent directory (where 'build.sh' exists) to + 'build4mac.py', that is, +``` + build4mac.py -> macbuild/build4mac.py +``` +2. Invoke 'build4mac.py' with appropriate options ("-d" for debug build): +``` +$ cd /where/'build.sh'/exists +$ ./build4mac.py -d +``` +3. Confirm successful build. +4. Run 'build4mac.py' again with the same options used in 2. PLUS "-y" to deploy executables and libraries under "klayout.app" bundle. +``` +$ ./build4mac.py -d -y +``` +5. Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your "/Applications" directory for installation. + +### 3B. Release build using the non-OS-standard Ruby 2.4 and Python 3.6 both from MacPorts: +1. Make a symbolic link from the parent directory (where 'build.sh' exists) to 'build4mac.py', that is, +``` +build4mac.py -> macbuild/build4mac.py +``` +2. Invoke 'build4mac.py' with appropriate options: +``` +$ cd /where/'build.sh'/exists +$ ./build4mac.py -r mp24 -p mp36 +``` +3. Confirm successful build. +4. Run 'build4mac.py' again with the same options used in 2. PLUS "-Y" to deploy executables and libraries under "klayout.app" bundle. +``` +$ ./build4mac.py -r mp24 -p mp36 -Y +``` +* [-Y|--DEPOLY] option deploys KLayout's dylibs and executables only. +That is, paths to other modules (Ruby, Python, and Qt5 Frameworks) are remained unchanged (absolute paths in your development environment). + +5. Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your "/Applications" directory. + +By: Kazzz (January 08, 2018) +[End of File] diff --git a/macbuild/ReadMe.txt b/macbuild/ReadMe.txt index cb2b7749f..1bd8f735b 100644 --- a/macbuild/ReadMe.txt +++ b/macbuild/ReadMe.txt @@ -1,4 +1,5 @@ -<< Draft Version 0.002>> +<< Draft Version 0.003>> +Relevant KLayout version: 0.25.1 1. Introduction: This directory "macbuild" contains different files required for building KLayout @@ -8,32 +9,60 @@ * Sierra (10.12) * High Sierra (10.13) - By default, Qt framework is Qt5 from Mac Ports (https://www.macports.org/) which - is usually located under: + By default, Qt framework is "Qt5" from Mac Ports (https://www.macports.org/) which is + usually located under: /opt/local/libexec/qt5/ + + * Please DO NOT USE "5.10.x" which is problematic in showing your design in the main canvas. + * Please USE "5.9.x" instead. + * Building with Qt4 will lead to some compile errors. + Also by default, supported script languages, i.e, Ruby and Python, are those standard ones bundled with the OS. - However, you are able to choose other options like Python from Anaconda. - : - : (to be updated) - : - : -2. How to use: +2. Non-OS-standard script language support + You may want to use a non-OS-standard script language such as Python 3.6 from + Aanaconda2 (https://www.anaconda.com/download/#macos) in combination with KLayout. + Since Anacoda(2) is a popular Python development environment, this is worth trying. + Unfortunately, however, some dynamic linkage problems are observed as of today. + + On the other hand, Python 3.6 provided by Mac Ports is usable. + Please try this (refer to 3B below) if you feel it's useful. + +3. Use-cases +3A. Debug build using the OS-standard script languages: (1) Make a symbolic link from the parent directory (where 'build.sh' exists) to 'build4mac.py', that is, build4mac.py -> macbuild/build4mac.py - - (2) Invoke 'build4mac.py' with appropriate options, for example, for debug-build: + (2) Invoke 'build4mac.py' with appropriate options ("-d" for debug build): $ cd /where/'build.sh'/exists $ ./build4mac.py -d - (3) Confirm successful build. - (4) Run 'build4mac.py' again with the same options used in (2) PLUS "-y" to deploy executables and libraries under "klayout.app" bundle. $ ./build4mac.py -d -y + (5) Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your + "/Applications" directory for installation. + +3B. Release build using the non-OS-standard Ruby 2.4 and Python 3.6 both from MacPorts: + (1) Make a symbolic link from the parent directory (where 'build.sh' exists) to + 'build4mac.py', that is, + build4mac.py -> macbuild/build4mac.py + (2) Invoke 'build4mac.py' with appropriate options: + $ cd /where/'build.sh'/exists + $ ./build4mac.py -r mp24 -p mp36 + (3) Confirm successful build. + (4) Run 'build4mac.py' again with the same options used in (2) PLUS "-Y" + to deploy executables and libraries under "klayout.app" bundle. + $ ./build4mac.py -r mp24 -p mp36 -Y + * [-Y|--DEPOLY] option deploys KLayout's dylibs and executables only. + That is, paths to other modules (Ruby, Python, and Qt5 Frameworks) are + remained unchanged (absolute paths in your development environment). + (5) Copy/move generated bundles ("klayout.app" and "klayout.scripts/") to your + "/Applications" directory. + +By: Kazzz (January 08, 2018) [End of File] diff --git a/macbuild/build4mac.py b/macbuild/build4mac.py index 21f8fd439..7887a1293 100755 --- a/macbuild/build4mac.py +++ b/macbuild/build4mac.py @@ -17,7 +17,7 @@ import optparse import subprocess #------------------------------------------------------------------------------- -## To import global dictionaries of different modules +## To import global dictionaries of different modules and utility functions #------------------------------------------------------------------------------- mydir = os.path.dirname(os.path.abspath(__file__)) sys.path.append( mydir + "/macbuild" ) @@ -35,11 +35,13 @@ def SetGlobals(): 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 Deployment # True if deploying the binaries for a package + global DeploymentF # True if fully (including Qt's Frameworks) deploy the binaries for bundles + global DeploymentP # True if partially deploy the binaries for non-OS-standard script language user global DeployVerbose # -verbose=<0-3> level passed to 'macdeployqt' tool global Version # KLayout's version # auxiliary variables on platform @@ -52,35 +54,38 @@ def SetGlobals(): global Bit # machine bit-size Usage = "\n" - Usage += "---------------------------------------------------------------------------------------------\n" + Usage += "--------------------------------------------------------------------------------------------------------\n" Usage += "<< Usage of 'build4mac.py' >>\n" Usage += " for building KLayout 0.25 or later on different Apple Mac OSX platforms.\n" Usage += "\n" - Usage += "$ [python] build4mac.py \n" - Usage += " option & argument : comment on option if any | default value\n" - Usage += " -----------------------------------------------------------------------+---------------\n" - Usage += " : * key type names below are case insensitive * | \n" - Usage += " : 'nil' = not to support the script language | \n" - Usage += " : 'Sys' = using the OS standard script language | \n" - Usage += " : Refer to 'macbuild/build4mac_env.py' for details| \n" - Usage += " [-q|--qt ] : type=['Qt4MacPorts', 'Qt5MacPorts'] | qt5macports \n" - Usage += " [-r|--ruby ] : type=['nil', 'Sys', 'Src24', 'MP24'] | sys \n" - Usage += " [-p|--python ] : type=['nil', 'Sys', 'Ana27', 'Ana36', 'MP36'] | sys \n" - Usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled \n" - Usage += " [-m|--make