This commit is contained in:
Matthias Koefferlein 2020-03-08 22:21:01 +01:00
commit 415a1a97f9
4 changed files with 57 additions and 30 deletions

View File

@ -1,4 +1,4 @@
Relevant KLayout version: 0.26.1 Relevant KLayout version: 0.26.4
# 1. Introduction # 1. Introduction
This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.26.1 or later for different 64-bit Mac OSXs including: This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.26.1 or later for different 64-bit Mac OSXs including:
@ -61,11 +61,11 @@ $ [python] ./build4mac.py
: Qt5MacPorts: use Qt5 from MacPorts | : Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew | : Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 | : Qt5Ana3: use Qt5 from Anaconda3 |
[-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP26', 'HB26', 'Ana3'] | sys [-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP26', 'HB27', 'Ana3'] | sys
: nil: don't bind Ruby | : nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | : Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS |
: MP26: use Ruby 2.6 from MacPorts | : MP26: use Ruby 2.6 from MacPorts |
: HB26: use Ruby 2.6 from Homebrew | : HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 | : Ana3: use Ruby 2.5 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP37', 'HB37', 'Ana3'] | sys [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP37', 'HB37', 'Ana3'] | sys
: nil: don't bind Python | : nil: don't bind Python |
@ -139,22 +139,22 @@ $ ./build4mac.py -q qt5macports -r mp26 -p mp37 -Y
* "Rmp26Pmp37" means that Ruby is 2.6 from MacPorts; Python is 3.7 from MacPorts. * "Rmp26Pmp37" means that Ruby is 2.6 from MacPorts; Python is 3.7 from MacPorts.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation. 4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6C. Fully Homebrew-flavored build with Homebrew Ruby 2.6 and Homebrew Python 3.7 ### 6C. Fully Homebrew-flavored build with Homebrew Ruby 2.7 and Homebrew Python 3.7
``` ```
$ cd /where/'build.sh'/exists $ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r hb26 -p hb37 $ ./build4mac.py -q qt5brew -r hb27 -p hb37
``` ```
2. Confirm successful build (it will take about one hour depending on your machine spec). 2. Confirm successful build (it will take about one hour depending on your machine spec).
3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br> 3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed in this step. The buddy command-line tools (strm*) will also be deployed in this step.
``` ```
$ ./build4mac.py -q qt5brew -r hb26 -p hb37 -Y $ ./build4mac.py -q qt5brew -r hb27 -p hb37 -Y
``` ```
The application bundle **`klayout.app`** is located under:<br> The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5Brew.pkg.macos-Catalina-release-Rhb26Phb37`** directory, where **`LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb37`** directory, where
* "LW-" means that this is a lightweight package. * "LW-" means that this is a lightweight package.
* "qt5Brew" means that Qt5 from Homebrew is used. * "qt5Brew" means that Qt5 from Homebrew is used.
* "Rhb26Phb37" means that Ruby is 2.6 from Homebrew; Python is 3.7 from Homebrew. * "Rhb27Phb37" means that Ruby is 2.7 from Homebrew; Python is 3.7 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation. 4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6D. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.7 ### 6D. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.7
@ -220,8 +220,8 @@ $ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p ST-qt5MP.pkg.macos-Catalina-release-RsysPsys -m $ ./makeDMG4mac.py -p ST-qt5MP.pkg.macos-Catalina-release-RsysPsys -m
``` ```
This command will generate the two files below:<br> This command will generate the two files below:<br>
* **`ST-klayout-0.26.1-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file * **`ST-klayout-0.26.4-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.26.1-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file * **`ST-klayout-0.26.4-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file
# Known issues # 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.<br> Because we assume some specific versions of non-OS-standard Ruby and Python, updating MacPorts, Homebrew, or Anaconda3 may cause build- and link errors.<br>

View File

@ -67,11 +67,11 @@ def SetGlobals():
Usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n" Usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n"
Usage += " : Qt5Brew: use Qt5 from Homebrew | \n" Usage += " : Qt5Brew: use Qt5 from Homebrew | \n"
Usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n" Usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n"
Usage += " [-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP26', 'HB26', 'Ana3'] | sys \n" Usage += " [-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP26', 'HB27', 'Ana3'] | sys \n"
Usage += " : nil: don't bind Ruby | \n" Usage += " : nil: don't bind Ruby | \n"
Usage += " : Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | \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 += " : MP26: use Ruby 2.6 from MacPorts | \n"
Usage += " : HB26: use Ruby 2.6 from Homebrew | \n" Usage += " : HB27: use Ruby 2.7 from Homebrew | \n"
Usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n" Usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n"
Usage += " [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP37', 'HB37', 'Ana3'] | sys \n" Usage += " [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP37', 'HB37', 'Ana3'] | sys \n"
Usage += " : nil: don't bind Python | \n" Usage += " : nil: don't bind Python | \n"
@ -191,7 +191,7 @@ def ParseCommandLineArguments():
p.add_option( '-r', '--ruby', p.add_option( '-r', '--ruby',
dest='type_ruby', dest='type_ruby',
help="Ruby type=['nil', 'Sys', 'MP26', 'HB26', 'Ana3']" ) help="Ruby type=['nil', 'Sys', 'MP26', 'HB27', 'Ana3']" )
p.add_option( '-p', '--python', p.add_option( '-p', '--python',
dest='type_python', dest='type_python',
@ -289,7 +289,7 @@ def ParseCommandLineArguments():
candidates['NIL'] = 'nil' candidates['NIL'] = 'nil'
candidates['SYS'] = 'Sys' candidates['SYS'] = 'Sys'
candidates['MP26'] = 'MP26' candidates['MP26'] = 'MP26'
candidates['HB26'] = 'HB26' candidates['HB27'] = 'HB27'
candidates['ANA3'] = 'Ana3' candidates['ANA3'] = 'Ana3'
try: try:
choiceRuby = candidates[ opt.type_ruby.upper() ] choiceRuby = candidates[ opt.type_ruby.upper() ]
@ -315,8 +315,8 @@ def ParseCommandLineArguments():
elif choiceRuby == "MP26": elif choiceRuby == "MP26":
ModuleRuby = 'Ruby26MacPorts' ModuleRuby = 'Ruby26MacPorts'
NonOSStdLang = True NonOSStdLang = True
elif choiceRuby == "HB26": elif choiceRuby == "HB27":
ModuleRuby = 'Ruby26Brew' ModuleRuby = 'Ruby27Brew'
NonOSStdLang = True NonOSStdLang = True
elif choiceRuby == "Ana3": elif choiceRuby == "Ana3":
ModuleRuby = 'RubyAnaconda3' ModuleRuby = 'RubyAnaconda3'
@ -632,8 +632,11 @@ def DeployBinariesForBundle():
# +-- Frameworks/+ # +-- Frameworks/+
# | +-- '*.framework' # | +-- '*.framework'
# | +-- '*.dylib' # | +-- '*.dylib'
# | +-- 'db_plugins' --slink--> ../MacOS/db_plugins/
# +-- MacOS/+ # +-- MacOS/+
# | +-- 'klayout' # | +-- 'klayout'
# | +-- db_plugins/
# | +-- lay_plugins/
# +-- Buddy/+ # +-- Buddy/+
# +-- 'strm2cif' # +-- 'strm2cif'
# +-- 'strm2dxf' # +-- 'strm2dxf'
@ -714,8 +717,8 @@ def DeployBinariesForBundle():
os.chdir(ProjectDir) os.chdir(ProjectDir)
#------------------------------------------------------------------- #-------------------------------------------------------------------
# copy the contents of the plugin directories to a place next to the application # Copy the contents of the plugin directories to a place next to
# binary # the application binary
#------------------------------------------------------------------- #-------------------------------------------------------------------
for piDir in [ "db_plugins", "lay_plugins" ]: for piDir in [ "db_plugins", "lay_plugins" ]:
os.makedirs( os.path.join( targetDirM, piDir )) os.makedirs( os.path.join( targetDirM, piDir ))
@ -751,13 +754,34 @@ def DeployBinariesForBundle():
exit() exit()
''' '''
#----------------------------------------------------------------------------------
# (D) Make a symbolic link
# 'db_plugins' --slink--> ../MacOS/db_plugins/
# under Frameworks/, which is required for the command line Buddy tools.
#
# Ref. https://github.com/KLayout/klayout/issues/460#issuecomment-571803458
#
# :
# +-- Frameworks/+
# | +-- '*.framework'
# | +-- '*.dylib'
# | +-- 'db_plugins' --slink--> ../MacOS/db_plugins/
# +-- MacOS/+
# | +-- 'klayout'
# | +-- db_plugins/
# | +-- lay_plugins/
# :
#----------------------------------------------------------------------------------
os.chdir( targetDirF )
os.symlink( "../MacOS/db_plugins/", "./db_plugins" )
print( " [5] Setting and changing the identification names among KLayout's libraries ..." ) print( " [5] Setting and changing the identification names among KLayout's libraries ..." )
#------------------------------------------------------------- #-------------------------------------------------------------
# [5] Set the identification names for KLayout's libraries # [5] Set the identification names for KLayout's libraries
# and make the library aware of the locations of libraries # and make the library aware of the locations of libraries
# on which it depends; that is, inter-library dependency # on which it depends; that is, inter-library dependency
#------------------------------------------------------------- #-------------------------------------------------------------
os.chdir( targetDirF )
ret = SetChangeIdentificationNameOfDyLib( depDicOrdinary, pathDic ) ret = SetChangeIdentificationNameOfDyLib( depDicOrdinary, pathDic )
if not ret == 0: if not ret == 0:
msg = "!!! Failed to set and change to new identification names !!!" msg = "!!! Failed to set and change to new identification names !!!"
@ -984,11 +1008,11 @@ def DeployBinariesForBundle():
#------------------------------------------------------------- #-------------------------------------------------------------
# [10] Special deployment of Ruby2.6 from Homebrew? # [10] Special deployment of Ruby2.6 from Homebrew?
#------------------------------------------------------------- #-------------------------------------------------------------
deploymentRuby26HB = (ModuleRuby == 'Ruby26Brew') deploymentRuby26HB = (ModuleRuby == 'Ruby27Brew')
if deploymentRuby26HB and NonOSStdLang: if deploymentRuby26HB and NonOSStdLang:
print( "" ) print( "" )
print( " [10] You have reached optional deployment of Ruby from %s ..." % HBRuby26Path ) print( " [10] You have reached optional deployment of Ruby from %s ..." % HBRuby27Path )
print( " [!!!] Sorry, the deployed package will not work properly since deployment of" ) print( " [!!!] Sorry, the deployed package will not work properly since deployment of" )
print( " Ruby2.6 from Homebrew is not yet supported." ) print( " Ruby2.6 from Homebrew is not yet supported." )
print( " Since you have Homebrew development environment, there two options:" ) print( " Since you have Homebrew development environment, there two options:" )

View File

@ -54,7 +54,7 @@ Qt5Ana3 = { 'qmake' : '%s/opt/anaconda3/bin/qmake' % MyHome,
#----------------------------------------------------- #-----------------------------------------------------
RubyNil = [ 'nil' ] RubyNil = [ 'nil' ]
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave', 'RubyCatalina' ] RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave', 'RubyCatalina' ]
RubyExt = [ 'Ruby26MacPorts', 'Ruby26Brew', 'RubyAnaconda3' ] RubyExt = [ 'Ruby26MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt Rubies = RubyNil + RubySys + RubyExt
#----------------------------------------------------- #-----------------------------------------------------
@ -117,13 +117,13 @@ Ruby26MacPorts = { 'exe': '/opt/local/bin/ruby2.6',
'lib': '/opt/local/lib/libruby.2.6.dylib' 'lib': '/opt/local/lib/libruby.2.6.dylib'
} }
# Ruby 2.6 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Ruby 2.7 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install ruby' # install with 'brew install ruby'
# [Key Type Name] = 'HB26' # [Key Type Name] = 'HB27'
HBRuby26Path = '/usr/local/Cellar/ruby/2.6.5' HBRuby27Path = '/usr/local/Cellar/ruby/2.7.0'
Ruby26Brew = { 'exe': '%s/bin/ruby' % HBRuby26Path, Ruby27Brew = { 'exe': '%s/bin/ruby' % HBRuby27Path,
'inc': '%s/include/ruby-2.6.0' % HBRuby26Path, 'inc': '%s/include/ruby-2.7.0' % HBRuby27Path,
'lib': '%s/lib/libruby.2.6.dylib' % HBRuby26Path 'lib': '%s/lib/libruby.2.7.dylib' % HBRuby27Path
} }
# Ruby 2.5 bundled with anaconda3 installed under $HOME/opt/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+ # Ruby 2.5 bundled with anaconda3 installed under $HOME/opt/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
@ -143,7 +143,7 @@ RubyDictionary = { 'nil' : None,
'RubyMojave' : RubyMojave, 'RubyMojave' : RubyMojave,
'RubyCatalina' : RubyCatalina, 'RubyCatalina' : RubyCatalina,
'Ruby26MacPorts': Ruby26MacPorts, 'Ruby26MacPorts': Ruby26MacPorts,
'Ruby26Brew' : Ruby26Brew, 'Ruby27Brew' : Ruby27Brew,
'RubyAnaconda3' : RubyAnaconda3 'RubyAnaconda3' : RubyAnaconda3
} }
@ -213,7 +213,7 @@ Python37MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi
# Python 3.7 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+ # Python 3.7 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python' # install with 'brew install python'
# [Key Type Name] = 'HB37' # [Key Type Name] = 'HB37'
HBPython37FrameworkPath = '/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework' HBPython37FrameworkPath = '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework'
Python37Brew = { 'exe': '%s/Versions/3.7/bin/python3.7m' % HBPython37FrameworkPath, Python37Brew = { 'exe': '%s/Versions/3.7/bin/python3.7m' % HBPython37FrameworkPath,
'inc': '%s/Versions/3.7/include/python3.7m' % HBPython37FrameworkPath, 'inc': '%s/Versions/3.7/include/python3.7m' % HBPython37FrameworkPath,
'lib': '%s/Versions/3.7/lib/libpython3.7m.dylib' % HBPython37FrameworkPath 'lib': '%s/Versions/3.7/lib/libpython3.7m.dylib' % HBPython37FrameworkPath

View File

@ -134,8 +134,11 @@ def SetChangeIdentificationNameOfDyLib( libdic, pathDic ):
# +-- Frameworks/+ # +-- Frameworks/+
# | +-- '*.framework' # | +-- '*.framework'
# | +-- '*.dylib' # | +-- '*.dylib'
# | +-- 'db_plugins' --slink--> ../MacOS/db_plugins/
# +-- MacOS/+ # +-- MacOS/+
# | +-- 'klayout' # | +-- 'klayout'
# | +-- db_plugins/
# | +-- lay_plugins/
# +-- Buddy/+ # +-- Buddy/+
# +-- 'strm2cif' # +-- 'strm2cif'
# +-- 'strm2dxf' # +-- 'strm2dxf'