Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated the macOS build system to work with Sequoia #1872

Merged
merged 2 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
190 changes: 100 additions & 90 deletions macbuild/ReadMe.md

Large diffs are not rendered by default.

Binary file modified macbuild/Resources/KLayoutDMG-BackQt5.logoist
Binary file not shown.
Binary file modified macbuild/Resources/KLayoutDMG-BackQt5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified macbuild/Resources/KLayoutDMG-BackQt6.logoist
Binary file not shown.
Binary file modified macbuild/Resources/KLayoutDMG-BackQt6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified macbuild/Resources/script-bundle-A.zip
Binary file not shown.
Binary file modified macbuild/Resources/script-bundle-B.zip
Binary file not shown.
Binary file modified macbuild/Resources/script-bundle-H.zip
Binary file not shown.
Binary file modified macbuild/Resources/script-bundle-P.zip
Binary file not shown.
Binary file modified macbuild/Resources/script-bundle-S.zip
Binary file not shown.
313 changes: 149 additions & 164 deletions macbuild/build4mac.py

Large diffs are not rendered by default.

95 changes: 58 additions & 37 deletions macbuild/build4mac_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Here are dictionaries of ...
# different modules for building KLayout (http://www.klayout.de/index.php)
# version 0.29.0 or later on different Apple Mac OSX platforms.
# version 0.29.7 or later on different Apple Mac OSX platforms.
#
# This file is imported by 'build4mac.py' script.
#===============================================================================
Expand Down Expand Up @@ -129,7 +129,7 @@
# for the previous states.
#-----------------------------------------------------
RubyNil = [ 'nil' ]
RubySys = [ 'RubyMonterey', 'RubyVentura', 'RubySonoma' ]
RubySys = [ 'RubyMonterey', 'RubyVentura', 'RubySonoma', 'RubySequoia' ]
RubyExt = [ 'Ruby33MacPorts', 'Ruby33Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt

Expand Down Expand Up @@ -178,11 +178,21 @@
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % SonomaXcSDK
}

# Bundled with Sequoia (15.x)
# [Key Type Name] = 'Sys'
SequoiaXcSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
SequoiaCLTSDK = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
RubySequoia = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % SequoiaXcSDK,
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % SequoiaXcSDK,
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % SequoiaXcSDK
}

# Ruby 3.3 from MacPorts (https://www.macports.org/)
# install with 'sudo port install ruby33'
# [Key Type Name] = 'MP33'
Ruby33MacPorts = { 'exe': '/opt/local/bin/ruby3.3',
'inc': '/opt/local/include/ruby-3.3.4',
'inc': '/opt/local/include/ruby-3.3.5',
'lib': '/opt/local/lib/libruby.3.3.dylib'
}

Expand All @@ -209,6 +219,7 @@
'RubyMonterey' : RubyMonterey,
'RubyVentura' : RubyVentura,
'RubySonoma' : RubySonoma,
'RubySequoia' : RubySequoia,
'Ruby33MacPorts': Ruby33MacPorts,
'Ruby33Brew' : Ruby33Brew,
'RubyAnaconda3' : RubyAnaconda3
Expand All @@ -223,10 +234,10 @@
# for the previous states.
#-----------------------------------------------------
PythonNil = [ 'nil' ]
PythonSys = [ 'PythonMonterey', 'PythonVentura', 'PythonSonoma' ]
PythonExt = [ 'Python39MacPorts', 'Python39Brew' ]
PythonExt += [ 'Python311MacPorts', 'Python311Brew' ]
PythonExt += [ 'PythonAnaconda3', 'PythonAutoBrew' ]
PythonSys = [ 'PythonMonterey', 'PythonVentura', 'PythonSonoma', 'PythonSequoia' ]
PythonExt = [ 'Python311MacPorts', 'Python312MacPorts' ]
PythonExt += [ 'Python311Brew', 'Python312Brew', 'PythonAutoBrew' ]
PythonExt += [ 'PythonAnaconda3' ]
Pythons = PythonNil + PythonSys + PythonExt

#-----------------------------------------------------
Expand Down Expand Up @@ -259,13 +270,14 @@
'lib': '%s/Python3.framework/Versions/3.9/lib/libpython3.9.dylib' % SonomaPy3FW
}

# Python 3.9 from MacPorts (https://www.macports.org/)
# install with 'sudo port install python39'
# [Key Type Name] = 'MP39'
Python39MacPorts = { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9',
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9',
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib'
}
# Bundled with Sequoia (15.x)
# [Key Type Name] = 'Sys'
SequoiaPy3FWXc = "/Applications/Xcode.app/Contents/Developer/Library/Frameworks"
SequoiaPy3FW = "/Library/Developer/CommandLineTools/Library/Frameworks"
PythonSequoia = { 'exe': '%s/Python3.framework/Versions/3.9/bin/python3.9' % SequoiaPy3FW,
'inc': '%s/Python3.framework/Versions/3.9/include/python3.9' % SequoiaPy3FW,
'lib': '%s/Python3.framework/Versions/3.9/lib/libpython3.9.dylib' % SequoiaPy3FW
}

# Python 3.11 from MacPorts (https://www.macports.org/)
# install with 'sudo port install python311'
Expand All @@ -275,13 +287,12 @@
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib'
}

# Python 3.9 from Homebrew
# install with 'brew install [email protected]'
# [Key Type Name] = 'HB39'
HBPython39FrameworkPath = '%s/opt/[email protected]/Frameworks/Python.framework' % DefaultHomebrewRoot
Python39Brew = { 'exe': '%s/Versions/3.9/bin/python3.9' % HBPython39FrameworkPath,
'inc': '%s/Versions/3.9/include/python3.9' % HBPython39FrameworkPath,
'lib': '%s/Versions/3.9/lib/libpython3.9.dylib' % HBPython39FrameworkPath
# Python 3.12 from MacPorts (https://www.macports.org/)
# install with 'sudo port install python312'
# [Key Type Name] = 'MP312'
Python312MacPorts = { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.12/bin/python3.12',
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12',
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.12/lib/libpython3.12.dylib'
}

# Python 3.11 from Homebrew
Expand All @@ -293,19 +304,28 @@
'lib': '%s/Versions/3.11/lib/libpython3.11.dylib' % HBPython311FrameworkPath
}

# Python 3.11 bundled with anaconda3 installed under /Applications/anaconda3/
# Python 3.12 from Homebrew
# install with 'brew install [email protected]'
# [Key Type Name] = 'HB312'
HBPython312FrameworkPath = '%s/opt/[email protected]/Frameworks/Python.framework' % DefaultHomebrewRoot
Python312Brew = { 'exe': '%s/Versions/3.12/bin/python3.12' % HBPython312FrameworkPath,
'inc': '%s/Versions/3.12/include/python3.12' % HBPython312FrameworkPath,
'lib': '%s/Versions/3.12/lib/libpython3.12.dylib' % HBPython312FrameworkPath
}

# Python 3.12 bundled with anaconda3 installed under /Applications/anaconda3/
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
# [Key Type Name] = 'Ana3'
PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.11',
'inc': '/Applications/anaconda3/include/python3.11',
'lib': '/Applications/anaconda3/lib/libpython3.11.dylib'
PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.12',
'inc': '/Applications/anaconda3/include/python3.12',
'lib': '/Applications/anaconda3/lib/libpython3.12.dylib'
}

# Latest Python from Homebrew
# install with 'brew install python'
# There can be multiple candidates such as: (python, python3, python@3, [email protected], [email protected],
# [email protected], python@3.11, [email protected], [email protected] )
# [email protected], python@3.12, [email protected], [email protected] )
# Hard to tell which is going to be available to the user. Picking the last one.
# [Key Type Name] = 'HBAuto'
HBPythonAutoFrameworkPath = ""
Expand All @@ -330,19 +350,19 @@
'lib': glob.glob( "%s/%s/lib/*.dylib" % ( HBAutoFrameworkVersionPath, HBPythonAutoVersion ) )[0]
}
"""
# when I have [python3, python@3, python@3.8, python@3.9, [email protected], [email protected]]
# when I have [python3, python@3, python@3.11, python@3.12]
print(HBPythonAutoFrameworkPath)
print(HBAutoFrameworkVersionPath)
print(HBPythonAutoVersion)
print(PythonAutoBrew)
quit()

/usr/local/opt/python@3.11/Frameworks/Python.framework
/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions
3.11
{ 'exe': '/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/bin/python3.11',
'inc': '/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/include/python3.11',
'lib': '/usr/local/opt/python@3.11/Frameworks/Python.framework/Versions/3.11/lib/libpython3.11.dylib'
/usr/local/opt/python@3.12/Frameworks/Python.framework
/usr/local/opt/python@3.12/Frameworks/Python.framework/Versions
3.12
{ 'exe': '/usr/local/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/bin/python3.12',
'inc': '/usr/local/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/include/python3.12',
'lib': '/usr/local/opt/python@3.12/Frameworks/Python.framework/Versions/3.12/lib/libpython3.12.dylib'
}
"""
except Exception as e:
Expand All @@ -357,11 +377,12 @@
'PythonMonterey' : PythonMonterey,
'PythonVentura' : PythonVentura,
'PythonSonoma' : PythonSonoma,
'Python39MacPorts' : Python39MacPorts,
'PythonSequoia' : PythonSequoia,
'Python312MacPorts': Python312MacPorts,
'Python312Brew' : Python312Brew,
'PythonAnaconda3' : PythonAnaconda3,
'Python311MacPorts': Python311MacPorts,
'Python39Brew' : Python39Brew,
'Python311Brew' : Python311Brew,
'PythonAnaconda3' : PythonAnaconda3
'Python311Brew' : Python311Brew
}
if _have_Homebrew_Python:
PythonDictionary['PythonAutoBrew'] = PythonAutoBrew
Expand Down
2 changes: 1 addition & 1 deletion macbuild/build4mac_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Here are utility functions and classes ...
# for building KLayout (http://www.klayout.de/index.php)
# version 0.29.0 or later on different Apple Mac OSX platforms.
# version 0.29.7 or later on different Apple Mac OSX platforms.
#
# This file is imported by 'build4mac.py' script.
#========================================================================================
Expand Down
4 changes: 2 additions & 2 deletions macbuild/macQAT.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# File: "macbuild/macQAT.py"
#
# The top Python script to run "ut_runner" after building KLayout
# (http://www.klayout.de/index.php) version 0.29.0 or later on different Apple
# ßMac OSX platforms.
# (http://www.klayout.de/index.php) version 0.29.7 or later on different
# Apple Mac OSX platforms.
#
# This script must be copied to a "*.macQAT/" directory to run.
#===============================================================================
Expand Down
4 changes: 2 additions & 2 deletions macbuild/macQAT.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# File: "macbuild/macQAT.sh"
#
# The top Bash script to run "ut_runner" after building KLayout
# (http://www.klayout.de/index.php) version 0.25.17 or later on different Apple
# Mac OSX platforms.
# (http://www.klayout.de/index.php) version 0.29.7 or later on different
# Apple Mac OSX platforms.
#
# This script must be copied to a "*.macQAT/" directory to run.
#===============================================================================
Expand Down
4 changes: 2 additions & 2 deletions macbuild/macQAT2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# File: "macbuild/macQAT2.sh"
#
# The top Bash script to run "ut_runner" after building KLayout
# (http://www.klayout.de/index.php) version 0.28.17 or later on different Apple
# Mac OSX platforms.
# (http://www.klayout.de/index.php) version 0.29.7 or later on different
# Apple Mac OSX platforms.
#
# This script must be copied to a directory that can be found in $PATH.
#===============================================================================
Expand Down
49 changes: 27 additions & 22 deletions macbuild/makeDMG4mac.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def SetGlobals():
Usage = "\n"
Usage += "---------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
Usage += " for making a DMG file of KLayout 0.29.0 or later on different Apple macOS platforms.\n"
Usage += " for making a DMG file of KLayout 0.29.7 or later on different Apple macOS platforms.\n"
Usage += "\n"
Usage += "$ [python] ./makeDMG4mac.py\n"
Usage += " option & argument : descriptions | default value\n"
Expand Down Expand Up @@ -106,7 +106,11 @@ def SetGlobals():

release = int( Release.split(".")[0] ) # take the first of ['21', '0', '0']
LatestOS = ""
if release == 23:
if release == 24:
GenOSName = "macOS"
Platform = "Sequoia"
LatestOS = Platform
elif release == 23:
GenOSName = "macOS"
Platform = "Sonoma"
LatestOS = Platform
Expand All @@ -126,7 +130,8 @@ def SetGlobals():
sys.exit(1)

if not Machine == "x86_64":
if Machine == "arm64" and Platform in ["Sonoma", "Ventura", "Monterey"]: # with an Apple Silicon Chip
# with an Apple Silicon Chip?
if Machine == "arm64" and Platform in ["Sequoia", "Sonoma", "Ventura", "Monterey"]:
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
Expand Down Expand Up @@ -213,17 +218,17 @@ def SetGlobals():
## To check the contents of the package directory
#
# The package directory name should look like:
# * ST-qt5MP.pkg.macos-Monterey-release-RsysPsys
# * LW-qt5Ana3.pkg.macos-Monterey-release-Rana3Pana3
# * LW-qt6Brew.pkg.macos-Monterey-release-Rhb33Phb311 --- (1)
# * LW-qt5MP.pkg.macos-Monterey-release-Rmp33Pmp311
# * HW-qt6Brew.pkg.macos-Monterey-release-RsysPhb311
# * ST-qt5MP.pkg.macos-Sonoma-release-RsysPsys
# * LW-qt5Ana3.pkg.macos-Sonoma-release-Rana3Pana3
# * LW-qt6Brew.pkg.macos-Sonoma-release-Rhb33Phb312 --- (1)
# * LW-qt5MP.pkg.macos-Sonoma-release-Rmp33Pmp312
# * HW-qt6Brew.pkg.macos-Sonoma-release-RsysPhb311
#
# * ST-qt6MP.pkg.macos-Monterey-release-RsysPsys
# * LW-qt6MP.pkg.macos-Monterey-release-Rmp33Pmp311
# * ST-qt6MP.pkg.macos-Sonoma-release-RsysPsys
# * LW-qt6MP.pkg.macos-Sonoma-release-Rmp33Pmp312
#
# Generated DMG will be, for example,
# (1) ---> LW-klayout-0.29.0-macOS-Monterey-1-qt6Brew-Rhb33Phb311.dmg
# (1) ---> LW-klayout-0.29.7-macOS-Sonoma-1-qt6Brew-Rhb33Phb312.dmg
#
# @return on success, positive integer in [MB] that tells approx. occupied disc space;
# on failure, -1
Expand Down Expand Up @@ -263,15 +268,15 @@ def CheckPkgDirectory():

#-----------------------------------------------------------------------------------------------
# [2] Identify (Qt, Ruby, Python) from PkgDir
# * ST-qt5MP.pkg.macos-Monterey-release-RsysPsys
# * LW-qt5Ana3.pkg.macos-Monterey-release-Rana3Pana3
# * LW-qt6Brew.pkg.macos-Monterey-release-Rhb33Phb311
# * LW-qt5MP.pkg.macos-Monterey-release-Rmp33Pmp311
# * HW-qt6Brew.pkg.macos-Monterey-release-RsysPhb311
# * EX-qt5MP.pkg.macos-Monterey-release-Rhb33Pmp311
# * ST-qt5MP.pkg.macos-Sonoma-release-RsysPsys
# * LW-qt5Ana3.pkg.macos-Sonoma-release-Rana3Pana3
# * LW-qt6Brew.pkg.macos-Sonoma-release-Rhb33Phb312
# * LW-qt5MP.pkg.macos-Sonoma-release-Rmp33Pmp312
# * HW-qt6Brew.pkg.macos-Sonoma-release-RsysPhb311
# * EX-qt5MP.pkg.macos-Sonoma-release-Rhb33Pmp312
#
# * ST-qt6MP.pkg.macos-Monterey-release-RsysPsys
# * LW-qt6MP.pkg.macos-Monterey-release-Rmp33Pmp311
# * ST-qt6MP.pkg.macos-Sonoma-release-RsysPsys
# * LW-qt6MP.pkg.macos-Sonoma-release-Rmp33Pmp312
#-----------------------------------------------------------------------------------------------
# 0 1 2 3 4 5 6 7
patQRP = u'(ST|LW|HW|EX)([-])([qt5|qt6][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-])(release|debug)([-])([0-9A-Za-z]+)'
Expand Down Expand Up @@ -314,12 +319,12 @@ def CheckPkgDirectory():
LatestOSMacPorts = Platform == LatestOS
LatestOSMacPorts &= PackagePrefix == "LW"
LatestOSMacPorts &= QtIdentification in [ "qt5MP", "qt6MP" ]
LatestOSMacPorts &= RubyPythonID in [ "Rmp33Pmp311", "Rmp33Pmp39" ]
LatestOSMacPorts &= RubyPythonID in [ "Rmp33Pmp312", "Rmp33Pmp311" ]

LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW"
LatestOSHomebrew &= QtIdentification in [ "qt5Brew", "qt6Brew", "qt5MP", "qt6MP" ] # "qt[5|6]MP" are the alternatives
LatestOSHomebrew &= RubyPythonID in [ "Rhb33Phb311", "Rhb33Phb39", "Rhb33Phbauto" ]
LatestOSHomebrew &= RubyPythonID in [ "Rhb33Phb312", "Rhb33Phb311", "Rhb33Phbauto" ]

LatestOSAnaconda3 = Platform == LatestOS
LatestOSAnaconda3 &= PackagePrefix == "LW"
Expand All @@ -329,7 +334,7 @@ def CheckPkgDirectory():
LatestOSHomebrewH = Platform == LatestOS
LatestOSHomebrewH &= PackagePrefix == "HW"
LatestOSHomebrewH &= QtIdentification in [ "qt5Brew", "qt6Brew", "qt5MP", "qt6MP" ] # "qt[5|6]MP" are the alternatives
LatestOSHomebrewH &= RubyPythonID in [ "RsysPhb311", "RsysPhb39", "RsysPhbauto" ] # Sys-Homebrew hybrid
LatestOSHomebrewH &= RubyPythonID in [ "RsysPhb311", "RsysPhbauto" ] # Sys-Homebrew hybrid

if LatestOSSys:
mydic = DicStdLightHeavyW["std"]
Expand Down
Loading
Loading