WIP: Migration to Qt6.

This refs #45.
This commit is contained in:
Kazunari Sekigawa 2021-11-27 12:05:27 +09:00
parent b600eb1b02
commit 2858d4507e
4 changed files with 189 additions and 112 deletions

View File

@ -1,9 +1,9 @@
Relevant KLayout version: 0.27.4<br>
Relevant KLayout version: 0.27.5<br>
Author: Kazzz-S<br>
Last modified: 2021-11-07<br>
Last modified: 2021-11-27<br>
# 1. Introduction
This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.27.4 or later for different 64-bit macOS, including:
This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.27.5 or later for different 64-bit macOS, including:
* Catalina (10.15.7) : the primary development environment
* Big Sur (11.x) : experimental; Apple M1 chip is not tested since the author does not own an M1 Mac
* Monterey (12.x) : -- ditto --
@ -18,15 +18,26 @@ However, they are not actively supported, and DMG packages for them are not prov
Throughout this document, the primary target machine is **Intel x86_64** with **macOS Catalina**.<br>
A **((Notes))** marker indicates special notes for specific operating systems.
# 2. Qt5 Frameworks
By default, the Qt framework is "Qt5" from MacPorts (https://www.macports.org/), which is usually located under:
# 2. Qt6/Qt5 Frameworks
By default, the Qt framework is "Qt6" from Homebrew (https://brew.sh/), which is usually located under:
```
/opt/local/libexec/qt5/
/usr/local/opt/qt@6/
```
Alternatively, you can use "Qt5" from Homebrew (https://brew.sh/), which is usually located under:
"Qt5" is usually located under:
```
/usr/local/opt/qt@5/
```
Alternatively, you can use "Qt6" from MacPorts (https://www.macports.org/), which is usually located under:
```
/opt/local/libexec/qt6/
```
**((Notes))** As of 2021-11-27, MacPorts' Qt6 does not provide `qt6-qtmultimedia`, which causes a build error!!!
"Qt5" is usually located under:
```
/opt/local/libexec/qt5/
```
OR
@ -40,7 +51,6 @@ If you have installed Anaconda3 under $HOME/opt/anaconda3/, make a symbolic link
```
/Applications/anaconda3/ ---> $HOME/opt/anaconda3/
```
**((Notes))** "Qt5" from Homebrew is chosen as the default for **Big Sur** and **Monterey**.
# 3. Script language support: Ruby and Python
Earlier, by default, supported script languages, i.e., Ruby and Python, were those standard ones bundled with the OS.<br>
@ -57,14 +67,14 @@ Big Sur (11.x) and Monterey (12.x) still provide the Python 2.7 binaries to run
However, the latest Xcode 13.1 does not allow us to link the legacy Python 2.7 library with the newly compiled KLayout binaries.<br>
Therefore, Homebrew is adopted as the default environment for Big Sur and Monterey.
The build script **`build4mac.py`** provides several possible combinations of Qt5, Ruy, and Python modules to accommodate such a slightly complex environment.<br>
The build script **`build4mac.py`** provides several possible combinations of Qt[6|5], Ruy, and Python modules to accommodate such a slightly complex environment.<br>
Some typical use cases are described in Section 6.
# 4. Prerequisites
You need to have:
* the latest Xcode and command-line tool kit compliant with each OS
* Qt5 package from MacPorts, Homebrew, or Anaconda3
* optionally Ruby and Python packages from MacPorts, Homebrew, or Anaconda3
* Qt[6|5] package from Homebrew or MacPorts; Qt5 from Anaconda3
* optionally Ruby and Python packages from Homebrew, MacPorts, or Anaconda3
#### For matching versions of Ruby and Python, please also refer to `build4mac_env.py`.
# 5. Command-line options of **`build4mac.py`** are as shown below.
@ -72,12 +82,15 @@ You need to have:
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.
$ [python] ./build4mac.py
$ [python] ./build4mac.py
option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value
--------------------------------------------------------------------------------------+---------------
[-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | qt5macports
[-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | qt6brew
: 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] |
: Qt6MacPorts: use Qt6 from MacPorts |
: Qt6Brew: use Qt6 from Homebrew |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
@ -88,30 +101,31 @@ $ [python] ./build4mac.py
: HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys
: 'HBAuto'] |
: 'HB39', HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.8 from Anaconda3 |
: HB39: use Python 3.9 from Homebrew |
: HBAuto: use the latest Python 3.x auto-detected from Homebrew |
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
: from the source code and use the tools in the same machine |
: ! After confirmation of successful build of 'klayout.app', |
: rerun this script with BOTH: |
: 1) the same options used for building AND |
: 2) <-y|--deploy> OR <-Y|--DEPLOY> |
: optionally with [-v|--verbose <0-3>] |
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
[-?|--?] : print this usage and exit | disabled
[-?|--?] : print this usage and exit | disabled
-----------------------------------------------------------------------------------------+---------------
```
@ -119,12 +133,15 @@ $ [python] ./build4mac.py
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.
$ [python] ./build4mac.py
$ [python] ./build4mac.py
option & argument : descriptions (refer to 'macbuild/build4mac_env.py' for details)| default value
--------------------------------------------------------------------------------------+---------------
[-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | qt5brew
[-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | qt6brew
: 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] |
: Qt6MacPorts: use Qt6 from MacPorts |
: Qt6Brew: use Qt6 from Homebrew |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
@ -135,30 +152,31 @@ $ [python] ./build4mac.py
: HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | hb38
: 'HBAuto'] |
: 'HB39', HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.8 from Anaconda3 |
: HB39: use Python 3.9 from Homebrew |
: HBAuto: use the latest Python 3.x auto-detected from Homebrew |
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
[-m|--make <option>] : option passed to 'make' | '--jobs=4'
[-d|--debug] : enable debug mode build | disabled
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
: from the source code and use the tools in the same machine |
: ! After confirmation of successful build of 'klayout.app', |
: rerun this script with BOTH: |
: 1) the same options used for building AND |
: 2) <-y|--deploy> OR <-Y|--DEPLOY> |
: optionally with [-v|--verbose <0-3>] |
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
[-?|--?] : print this usage and exit | disabled
[-?|--?] : print this usage and exit | disabled
-----------------------------------------------------------------------------------------+---------------
```
@ -167,11 +185,9 @@ In this section, the actual file names and directory names are those obtained on
On different OS, those names differ accordingly.
### 6A. Standard build using the OS-bundled Ruby and Python
0. Install MacPorts, then install Qt5 by
0. Install Homebrew, then install Qt6 by
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
$ brew install qt6
```
1. Invoke **`build4mac.py`** with the default options: **((Notes))** only for Catalina
```
@ -185,24 +201,25 @@ $ ./build4mac.py
$ ./build4mac.py -y
```
The application bundle **`klayout.app`** is located under:<br>
**`ST-qt5MP.pkg.macos-Catalina-release-RsysPsys`** directory, where the three name parts below are important.
**`ST-qt6Brew.pkg.macos-Catalina-release-RsysPsys`** directory, where the three name parts below are important.
* "ST-" means that this is a standard package (LW-, HW-, and EX- are other possibilities explained below).
* "qt5MP" means that Qt5 from MacPorts is used.
* "qt6Brew" means that Qt6 from Homebrew is used.
* "RsysPsys" means that Ruby is OS-bundled; Python is OS-bundled.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
If you use the "-Y" option instead of the "-y" in Step-3, the Qt5 framework is NOT deployed in the application bundle.<br>
Then the directory name will be **`LW-qt5MP.pkg.macos-Catalina-release-RsysPsys`**, where
If you use the "-Y" option instead of the "-y" in Step-3, the Qt6 framework is NOT deployed in the application bundle.<br>
Then the directory name will be **`LW-qt6Brew.pkg.macos-Catalina-release-RsysPsys`**, where
* "LW-" means that this is a lightweight package.
#### If you build KLayout from the source code AND run it on the same machine, the "-Y" option is highly recommended.
### 6B. Fully MacPorts-flavored build with MacPorts Ruby 2.7 and MacPorts Python 3.8
0. Install MacPorts, then install Qt5, Ruby 2.7, and Python 3.8 by
0. Install MacPorts, then install Qt6, Ruby 2.7, and Python 3.8 by
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
$ sudo port install qt6
$ sudo port install qt6-qttools
$ sudo port install ruby27
$ sudo port install python38
$ sudo port install py38-pip
@ -210,67 +227,67 @@ $ sudo port install py38-pip
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5macports -r mp27 -p mp38
$ ./build4mac.py -q qt6macports -r mp27 -p mp38
```
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>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -q qt5macports -r mp27 -p mp38 -Y
$ ./build4mac.py -q qt6macports -r mp27 -p mp38 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38`** directory, where
**`LW-qt6MP.pkg.macos-Catalina-release-Rmp27Pmp38`** directory, where
* "LW-" means that this is a lightweight package.
* "qt5MP" means that Qt5 from MacPorts is used.
* "qt6MP" means that Qt6 from MacPorts is used.
* "Rmp27Pmp38" means that Ruby is 2.7 from MacPorts; Python is 3.8 from MacPorts.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6C. Fully Homebrew-flavored build with Homebrew Ruby 2.7 and Homebrew Python 3.8
0. Install Homebrew, then install Qt5, Ruby 2.7, and Python 3.8 by
0. Install Homebrew, then install Qt6, Ruby 2.7, and Python 3.8 by
```
$ brew install qt@5
$ brew install qt6
$ brew install ruby@2.7
$ brew install python@3.8
```
1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default for Big Sur and Monterey.
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r hb27 -p hb38
$ ./build4mac.py -q qt6brew -r hb27 -p hb38
```
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>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -q qt5brew -r hb27 -p hb38 -Y
$ ./build4mac.py -q qt6brew -r hb27 -p hb38 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38`** directory, where
**`LW-qt6Brew.pkg.macos-Catalina-release-Rhb27Phb38`** directory, where
* "LW-" means that this is a lightweight package.
* "qt5Brew" means that Qt5 from Homebrew is used.
* "qt6Brew" means that Qt6 from Homebrew is used.
* "Rhb27Phb38" means that Ruby is 2.7 from Homebrew; Python is 3.8 from Homebrew.
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.8
0. Install Homebrew, then install Qt5 and Python 3.8 by
0. Install Homebrew, then install Qt6 and Python 3.8 by
```
$ brew install qt@5
$ brew install qt6
$ brew install python@3.8
```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r sys -p hb38
$ ./build4mac.py -q qt6brew -r sys -p hb38
```
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 (including Qt's framework and Python framework) under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -q qt5brew -r sys -p hb38 -y
$ ./build4mac.py -q qt6brew -r sys -p hb38 -y
```
The application bundle **`klayout.app`** is located under:<br>
**`HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38`** directory, where
* "HW-" means that this is a heavyweight package because both Qt5 and Python Frameworks are deployed.
* "qt5Brew" means that Qt5 from Homebrew is used.
**`HW-qt6Brew.pkg.macos-Catalina-release-RsysPhb38`** directory, where
* "HW-" means that this is a heavyweight package because both Qt6 and Python Frameworks are deployed.
* "qt6Brew" means that Qt6 from Homebrew is used.
* "RsysPhb38" means that Ruby is OS-bundled; Python is 3.8 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### Important
@ -321,14 +338,14 @@ makeDMG4mac.py -> macbuild/makeDMG4mac.py
2. Invoke **`makeDMG4mac.py`** with -p and -m options, for example,
```
$ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p ST-qt5MP.pkg.macos-Catalina-release-RsysPsys -m
$ ./makeDMG4mac.py -p ST-qt6Brew.pkg.macos-Catalina-release-RsysPsys -m
```
This command will generate the two files below:<br>
* **`ST-klayout-0.27.4-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.27.4-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file
* **`ST-klayout-0.27.5-macOS-Catalina-1-qt6Brew-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.27.5-macOS-Catalina-1-qt6Brew-RsysPsys.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.<br>
Because we assume some specific versions of non-OS-standard Ruby and Python, updating Homebrew, MacPorts, or Anaconda3 may cause build- and link errors.<br>
In such cases, you need to update the dictionary contents of **`build4mac_env.py`**.
# Final comments

View File

@ -34,25 +34,28 @@ from build4mac_util import *
#-------------------------------------------------------------------------------
def GenerateUsage(platform):
if platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
myQt5 = "qt5brew"
myQt65 = "qt6brew"
myRuby = "hb27"
myPython = "hb38"
moduleset = ('qt5Brew', 'HB27', 'HB38')
moduleset = ('qt6Brew', 'HB27', 'HB38')
else: # with Xcode [ .. 12.4]
myQt5 = "qt5macports"
myQt65 = "qt6brew"
myRuby = "sys"
myPython = "sys"
moduleset = ('qt5MP', 'Sys', 'Sys')
moduleset = ('qt6Brew', 'Sys', 'Sys')
usage = "\n"
usage += "---------------------------------------------------------------------------------------------------------\n"
usage += "<< Usage of 'build4mac.py' >>\n"
usage += " for building KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.\n"
usage += " for building KLayout 0.27.5 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 <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | %s \n" % myQt5
usage += " [-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | %s \n" % myQt65
usage += " : 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] | \n"
usage += " : Qt6MacPorts: use Qt6 from MacPorts | \n"
usage += " : Qt6Brew: use Qt6 from Homebrew | \n"
usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n"
usage += " : Qt5Brew: use Qt5 from Homebrew | \n"
usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n"
@ -63,12 +66,13 @@ def GenerateUsage(platform):
usage += " : HB27: use Ruby 2.7 from Homebrew | \n"
usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n"
usage += " [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython
usage += " : 'HBAuto'] | \n"
usage += " : 'HB39', HBAuto'] | \n"
usage += " : nil: don't bind Python | \n"
usage += " : Sys: use OS-bundled Python 2.7 [ElCapitan -- 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.8 from Anaconda3 | \n"
usage += " : HB39: use Python 3.9 from Homebrew | \n"
usage += " : HBAuto: use the latest Python 3.x auto-detected from Homebrew | \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"
@ -129,7 +133,7 @@ def Get_Default_Config():
sys.exit(1)
if not Machine == "x86_64":
if Machine == "arm64" and (Platform == "Monterey" or Platform == "BigSur"): # with an Apple Silicon Chip
if Machine == "arm64" and Platform in ["Monterey", "BigSur"]: # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -239,6 +243,7 @@ def Parse_CLI_Args(config):
PackagePrefix = config['PackagePrefix']
DeployVerbose = config['DeployVerbose']
ModuleSet = config['ModuleSet']
qt, ruby, python = ModuleSet
#-----------------------------------------------------
# [2] Parse the CLI arguments
@ -246,7 +251,7 @@ def Parse_CLI_Args(config):
p = optparse.OptionParser(usage=Usage)
p.add_option( '-q', '--qt',
dest='type_qt',
help="Qt type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3']" )
help="Qt type=['Qt6MacPorts', 'Qt6Brew', 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3']" )
p.add_option( '-r', '--ruby',
dest='type_ruby',
@ -254,7 +259,7 @@ def Parse_CLI_Args(config):
p.add_option( '-p', '--python',
dest='type_python',
help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'HBAuto']" )
help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'HB39', 'HBAuto']" )
p.add_option( '-n', '--noqtbinding',
action='store_true',
@ -306,7 +311,7 @@ def Parse_CLI_Args(config):
default=False,
help='check usage' )
p.set_defaults( type_qt = "qt5macports",
p.set_defaults( type_qt = "%s" % qt,
type_ruby = "sys",
type_python = "sys",
no_qt_binding = False,
@ -326,6 +331,8 @@ def Parse_CLI_Args(config):
# (A) Determine the Qt type
candidates = dict()
candidates['QT6MACPORTS'] = 'Qt6MacPorts'
candidates['QT6BREW'] = 'Qt6Brew'
candidates['QT5MACPORTS'] = 'Qt5MacPorts'
candidates['QT5BREW'] = 'Qt5Brew'
candidates['QT5ANA3'] = 'Qt5Ana3'
@ -340,12 +347,16 @@ def Parse_CLI_Args(config):
(opt.type_qt, list(candidates.keys())), file=sys.stderr )
print(Usage)
sys.exit(1)
elif ModuleQt == "Qt6MacPorts":
choiceQt65 = 'qt6MP'
elif ModuleQt == "Qt6Brew":
choiceQt65 = 'qt6Brew'
elif ModuleQt == "Qt5MacPorts":
choiceQt5 = 'qt5MP'
choiceQt65 = 'qt5MP'
elif ModuleQt == "Qt5Brew":
choiceQt5 = 'qt5Brew'
choiceQt65 = 'qt5Brew'
elif ModuleQt == "Qt5Ana3":
choiceQt5 = 'qt5Ana3'
choiceQt65 = 'qt5Ana3'
# By default, OS-standard (-bundled) script languages (Ruby and Python) are used
NonOSStdLang = False
@ -405,6 +416,7 @@ def Parse_CLI_Args(config):
candidates['MP38'] = 'MP38'
candidates['HB38'] = 'HB38'
candidates['ANA3'] = 'Ana3'
candidates['HB39'] = 'HB39'
candidates['HBAUTO'] = 'HBAuto'
try:
choicePython = candidates[ opt.type_python.upper() ]
@ -439,6 +451,9 @@ def Parse_CLI_Args(config):
elif choicePython == "Ana3":
ModulePython = 'PythonAnaconda3'
NonOSStdLang = True
elif choicePython == "HB39":
ModulePython = 'Python39Brew'
NonOSStdLang = True
elif choicePython == "HBAuto":
ModulePython = 'PythonAutoBrew'
NonOSStdLang = True
@ -450,7 +465,7 @@ def Parse_CLI_Args(config):
sys.exit(1)
# (D) Set of modules chosen
ModuleSet = ( choiceQt5, choiceRuby, choicePython )
ModuleSet = ( choiceQt65, choiceRuby, choicePython )
NoQtBindings = opt.no_qt_binding
NoQtUiTools = opt.no_qt_uitools
@ -487,10 +502,10 @@ def Parse_CLI_Args(config):
elif DeploymentF:
if (ModuleRuby in RubySys) and (ModulePython in PythonSys):
PackagePrefix = "ST-"
message += "a standard (ST-) package including Qt5 and using OS-bundled Ruby and Python..."
elif ModulePython == 'Python38Brew' or ModulePython == 'PythonAutoBrew':
message += "a standard (ST-) package including Qt[6|5] and using OS-bundled Ruby and Python..."
elif ModulePython in ['Python38Brew', 'Python39Brew', 'PythonAutoBrew']:
PackagePrefix = "HW-"
message += "a heavyweight (HW-) package including Qt5 and Python3.8~ from Homebrew..."
message += "a heavyweight (HW-) package including Qt[6|5] and Python3.8~ from Homebrew..."
else:
PackagePrefix = "EX-"
message += "a package with exceptional (EX-) combinations of different modules..."
@ -563,7 +578,7 @@ def Get_Build_Parameters(config):
mode = "release"
# (B) Modules
(qt, ruby, python) = ModuleSet # ( 'qt5MP', 'Sys', 'Sys' )
(qt, ruby, python) = ModuleSet # ( 'qt6MP', 'Sys', 'Sys' )
ruby_python = "R%sP%s" % ( ruby.lower(), python.lower() )
# (C) Target directories and files
@ -574,8 +589,14 @@ def Get_Build_Parameters(config):
MacBuildDirQAT = MacBuildDir + ".macQAT"
parameters['logfile'] = MacBuildLog
# (D) Qt5
if ModuleQt == 'Qt5MacPorts':
# (D) Qt6|5
if ModuleQt == 'Qt6MacPorts':
parameters['qmake'] = Qt6MacPorts['qmake']
parameters['deploy_tool'] = Qt6MacPorts['deploy']
elif ModuleQt == 'Qt6Brew':
parameters['qmake'] = Qt6Brew['qmake']
parameters['deploy_tool'] = Qt6Brew['deploy']
elif ModuleQt == 'Qt5MacPorts':
parameters['qmake'] = Qt5MacPorts['qmake']
parameters['deploy_tool'] = Qt5MacPorts['deploy']
elif ModuleQt == 'Qt5Brew':
@ -585,6 +606,7 @@ def Get_Build_Parameters(config):
parameters['qmake'] = Qt5Ana3['qmake']
parameters['deploy_tool'] = Qt5Ana3['deploy']
parameters['bin'] = MacBinDir
parameters['build'] = MacBuildDir
parameters['rpath'] = "@executable_path/../Frameworks"
@ -647,8 +669,10 @@ def Run_Build_Command(parameters):
# (C) Target directories and files
MacBuildDirQAT = parameters['build'] + ".macQAT"
# (D) Qt5
cmd_args += " \\\n -qt5"
# (D) Qt[6|5]
# '-qt6' is not yet supported as of 2021-11-27
# Passing '-qt5' with the Qt6 environments looks conflict
#cmd_args += " \\\n -qt5"
cmd_args += " \\\n -qmake %s" % parameters['qmake']
cmd_args += " \\\n -bin %s" % parameters['bin']
cmd_args += " \\\n -build %s" % parameters['build']

View File

@ -32,22 +32,40 @@ else:
del System, Node, Release, MacVersion, Machine, Processor
#-----------------------------------------------------
# [1] Qt
# [1] Qt6 or Qt5
#-----------------------------------------------------
Qts = [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
Qts = [ 'Qt6MacPorts', 'Qt6Brew' ]
Qts += [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
#-----------------------------------------------------
# Whereabout of different components of Qt6
#-----------------------------------------------------
# Qt6 from MacPorts (https://www.macports.org/)
# install with 'sudo port install [qt6|qt6-qttools]'
# [Key Type Name] = 'Qt6MacPorts'
Qt6MacPorts = { 'qmake' : '/opt/local/libexec/qt6/bin/qmake',
'deploy': '/opt/local/libexec/qt6/bin/macdeployqt'
}
# Qt6 from Homebrew (https://brew.sh/)
# install with 'brew install qt6'
# [Key Type Name] = 'Qt6Brew'
Qt6Brew = { 'qmake' : '%s/opt/qt@6/bin/qmake' % DefaultHomebrewRoot,
'deploy': '%s/opt/qt@6/bin/macdeployqt' % DefaultHomebrewRoot
}
#-----------------------------------------------------
# Whereabout of different components of Qt5
#-----------------------------------------------------
# Qt5 from MacPorts (https://www.macports.org/)
# install with 'sudo port install qt5'
# install with 'sudo port install [qt5|qt5-qttools]'
# [Key Type Name] = 'Qt5MacPorts'
Qt5MacPorts = { 'qmake' : '/opt/local/libexec/qt5/bin/qmake',
'deploy': '/opt/local/libexec/qt5/bin/macdeployqt'
}
# Qt5 from Homebrew (https://brew.sh/)
# install with 'brew install qt'
# install with 'brew install qt5'
# [Key Type Name] = 'Qt5Brew'
Qt5Brew = { 'qmake' : '%s/opt/qt@5/bin/qmake' % DefaultHomebrewRoot,
'deploy': '%s/opt/qt@5/bin/macdeployqt' % DefaultHomebrewRoot
@ -203,7 +221,7 @@ RubyDictionary = { 'nil' : None,
PythonNil = [ 'nil' ]
PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave' ]
PythonSys += [ 'PythonCatalina', 'PythonBigSur', 'PythonMonterey' ]
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'Python39Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
Pythons = PythonNil + PythonSys + PythonExt
#-----------------------------------------------------
@ -282,7 +300,7 @@ Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi
}
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python'
# install with 'brew install python@3.8'
# [Key Type Name] = 'HB38'
HBPython38FrameworkPath = '%s/opt/python@3.8/Frameworks/Python.framework' % DefaultHomebrewRoot
Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38FrameworkPath,
@ -290,6 +308,15 @@ Python38Brew = { 'exe': '%s/Versions/3.8/bin/python3.8' % HBPython38Framework
'lib': '%s/Versions/3.8/lib/libpython3.8.dylib' % HBPython38FrameworkPath
}
# Python 3.9 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python@3.9'
# [Key Type Name] = 'HB39'
HBPython39FrameworkPath = '%s/opt/python@3.9/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.8 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
@ -332,6 +359,7 @@ PythonDictionary = { 'nil' : None,
'PythonMonterey' : PythonMonterey,
'Python38MacPorts': Python38MacPorts,
'Python38Brew' : Python38Brew,
'Python39Brew' : Python39Brew,
'PythonAnaconda3' : PythonAnaconda3
}
if _have_Homebrew_Python:

View File

@ -77,13 +77,13 @@ def SetGlobals():
Usage = "\n"
Usage += "---------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
Usage += " for making a DMG file of KLayout 0.27.4 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += " for making a DMG file of KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += "\n"
Usage += "$ [python] ./makeDMG4mac.py\n"
Usage += " option & argument : descriptions | default value\n"
Usage += " ----------------------------------------------------------------------------------+-----------------\n"
Usage += " <-p|--pkg <dir>> : package directory created by `build4mac.py` with [-y|-Y] | ``\n"
Usage += " : like 'ST-qt5MP.pkg.macos-Catalina-release-RsysPsys' | \n"
Usage += " : like 'ST-qt6MP.pkg.macos-Catalina-release-RsysPsys' | \n"
Usage += " <-c|--clean> : clean the work directory | disabled\n"
Usage += " <-m|--make> : make a compressed DMG file | disabled\n"
Usage += " : <-c|--clean> and <-m|--make> are mutually exclusive | \n"
@ -137,7 +137,7 @@ def SetGlobals():
sys.exit(1)
if not Machine == "x86_64":
if Machine == "arm64" and (Platform == "Monterey" or Platform == "BigSur"): # with an Apple Silicon Chip
if Machine == "arm64" and Platform in ["Monterey", "BigSur"]: # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -195,13 +195,17 @@ def SetGlobals():
## To check the contents of the package directory
#
# The package directory name should look like:
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys --- (1)
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
# * ST-qt6MP.pkg.macos-Catalina-release-RsysPsys --- (1)
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb27Phb38
#
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
#
# Generated DMG will be, for example,
# (1) ---> ST-klayout-0.26.1-macOS-Catalina-1-qt5MP-RsysPsys.dmg
# (1) ---> ST-klayout-0.27.5-macOS-Catalina-1-qt6MP-RsysPsys.dmg
#
# @return on success, positive integer in [MB] that tells approx. occupied disc space;
# on failure, -1
@ -238,14 +242,18 @@ def CheckPkgDirectory():
#-----------------------------------------------------------------------------
# [2] Identify (Qt, Ruby, Python) from PkgDir
# * ST-qt6MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb27Phb38
#
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38
# * EX-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
#-----------------------------------------------------------------------------
patQRP = u'(ST|LW|HW|EX)([-])(qt5[0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
patQRP = u'(ST|LW|HW|EX)([-])([qt6|qt5][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
regQRP = re.compile(patQRP)
if not regQRP.match(PkgDir):
print( "! Cannot identify (Qt, Ruby, Python) from the package directory name" )
@ -265,18 +273,18 @@ def CheckPkgDirectory():
#-----------------------------------------------------------------------------
LatestOSMacPorts = Platform == LatestOS
LatestOSMacPorts &= PackagePrefix == "LW"
LatestOSMacPorts &= QtIdentification == "qt5MP"
LatestOSMacPorts &= RubyPythonID == "Rmp27Pmp38"
LatestOSMacPorts &= QtIdentification in ["qt6MP", "qt5MP"]
LatestOSMacPorts &= RubyPythonID in ["Rmp27Pmp38"]
LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW"
LatestOSHomebrew &= QtIdentification == "qt5Brew"
LatestOSHomebrew &= RubyPythonID == "Rhb27Phb38" or RubyPythonID == "Rhb27Phbauto"
LatestOSHomebrew &= QtIdentification in ["qt6Brew", "qt5Brew"]
LatestOSHomebrew &= RubyPythonID in ["Rhb27Phb38", "Rhb27Phb39", "Rhb27Phbauto"]
LatestOSAnaconda3 = Platform == LatestOS
LatestOSAnaconda3 &= PackagePrefix == "LW"
LatestOSAnaconda3 &= QtIdentification == "qt5Ana3"
LatestOSAnaconda3 &= RubyPythonID == "Rana3Pana3"
LatestOSAnaconda3 &= QtIdentification in ["qt5Ana3"]
LatestOSAnaconda3 &= RubyPythonID in ["Rana3Pana3"]
if LatestOSMacPorts:
mydic = DicLightWeight["ports"]