Updated the Mac build system to include the migration to Qt6

This commit is contained in:
Kazunari Sekigawa 2022-10-10 11:36:50 +09:00
parent 1c361ff17f
commit 4b1f256570
13 changed files with 437 additions and 268 deletions

View File

@ -1,15 +1,15 @@
Relevant KLayout version: 0.27.9<br>
Relevant KLayout version: 0.27.11<br>
Author: Kazzz-S<br>
Last modified: 2022-05-08<br>
Last modified: 2022-10-10<br>
# 1. Introduction
This directory **`macbuild`** contains different files required for building KLayout (http://www.klayout.de/) version 0.27.9 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.11 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 --
Building KLayout for the previous operating systems listed below should still be possible. <br>
However, they are not actively supported, and DMG packages for them are not provided.
However, they are not actively supported, and DMG packages are not provided.
* Mojave (10.14)
* High Sierra (10.13)
* Sierra (10.12)
@ -18,40 +18,33 @@ 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. Qt6/Qt5 Frameworks
By default, the Qt framework is "Qt6" from Homebrew (https://brew.sh/), which is usually located under:
```
/usr/local/opt/qt@6/
```
# 2. Qt Frameworks
**((Notes))** For **Catalina**
"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:
The default Qt framework is "Qt5" from MacPorts (https://www.macports.org/), which is usually located under:
```
/opt/local/libexec/qt5/
```
OR
**((Notes))** For **Big Sur** and **Monterey**
"Qt5" from Anaconda3 (https://www.anaconda.com/), which is usually located under:
The default Qt framework is "Qt5" from Homebrew (https://brew.sh/), which is usually located under:
```
/usr/local/opt/qt@5/
```
You can also choose "Qt5" from Anaconda3 (https://www.anaconda.com/), which is usually located under:
```
$HOME/opt/anaconda3/pkgs/qt-{version}
```
If you have installed Anaconda3 under $HOME/opt/anaconda3/, make a symbolic link:
```
/Applications/anaconda3/ ---> $HOME/opt/anaconda3/
```
The migration work to "Qt6" is ongoing. You can try to use it; however, you will encounter some build and runtime errors.
For example, as of 2021-11-27, MacPorts' Qt6 does not provide `qt6-qtmultimedia`, which causes a build error.
# 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>
This configuration is possible only for macOS Catalina (10.15.7).<br>
@ -63,19 +56,19 @@ $ /usr/bin/python --version
Python 2.7.16
```
Big Sur (11.x) and Monterey (< 12.3) still provide the Python 2.7 binaries to run various legacy applications.<br>
Big Sur (11.x) and Monterey (< 12.3) still provide Python 2.7 binaries to run various legacy applications.<br>
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>
Moreover, Monterey (12.3.1) finally eliminated the Python 2.7 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 Qt[6|5], Ruy, and Python modules to accommodate such a slightly complex environment.<br>
The build script **`build4mac.py`** provides several possible combinations of Qt5, 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
* Qt[6|5] package from Homebrew or MacPorts; Qt5 from Anaconda3
* optionally Ruby and Python packages from Homebrew, MacPorts, or Anaconda3
You need to have the followings:
* 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
#### 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.
@ -83,26 +76,27 @@ You need to have:
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.27.9 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.27.11 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
--------------------------------------------------------------------------------------+---------------
[-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | qt6brew
: 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] |
: Qt6MacPorts: use Qt6 from MacPorts |
: Qt6Brew: use Qt6 from Homebrew |
[-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', | qt5macports
: 'Qt6MacPorts', 'Qt6Brew'] |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
[-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3'] | sys
: Qt6MacPorts: use Qt6 from MacPorts (*) |
: Qt6Brew: use Qt6 from Homebrew (*) |
: (*) migration to Qt6 is ongoing |
[-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3'] | sys
: nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS |
: MP27: use Ruby 2.7 from MacPorts |
: HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 |
: MP31: use Ruby 3.1 from MacPorts |
: HB31: use Ruby 3.1 from Homebrew |
: Ana3: use Ruby 3.1 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | sys
: 'HB39', HBAuto'] |
: HB39', 'HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] |
: MP38: use Python 3.8 from MacPorts |
@ -119,7 +113,7 @@ $ [python] ./build4mac.py
[-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', |
: ! After confirmation of the successful build of 'klayout.app', |
: rerun this script with BOTH: |
: 1) the same options used for building AND |
: 2) <-y|--deploy> OR <-Y|--DEPLOY> |
@ -135,26 +129,27 @@ $ [python] ./build4mac.py
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.27.9 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.27.11 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
--------------------------------------------------------------------------------------+---------------
[-q|--qt <type>] : case-insensitive type=['Qt6MacPorts', 'Qt6Brew', | qt6brew
: 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3'] |
: Qt6MacPorts: use Qt6 from MacPorts |
: Qt6Brew: use Qt6 from Homebrew |
[-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', | qt5brew
: 'Qt6MacPorts', 'Qt6Brew'] |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
[-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3'] | hb27
: Qt6MacPorts: use Qt6 from MacPorts (*) |
: Qt6Brew: use Qt6 from Homebrew (*) |
: (*) migration to Qt6 is ongoing |
[-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3'] | hb31
: nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS |
: MP27: use Ruby 2.7 from MacPorts |
: HB27: use Ruby 2.7 from Homebrew |
: Ana3: use Ruby 2.5 from Anaconda3 |
: MP31: use Ruby 3.1 from MacPorts |
: HB31: use Ruby 3.1 from Homebrew |
: Ana3: use Ruby 3.1 from Anaconda3 |
[-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | hb38
: 'HB39', HBAuto'] |
: HB39', 'HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 [ElCapitan -- Catalina] |
: MP38: use Python 3.8 from MacPorts |
@ -171,7 +166,7 @@ $ [python] ./build4mac.py
[-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', |
: ! After confirmation of the successful build of 'klayout.app', |
: rerun this script with BOTH: |
: 1) the same options used for building AND |
: 2) <-y|--deploy> OR <-Y|--DEPLOY> |
@ -188,122 +183,123 @@ 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 Homebrew, then install Qt6 by
0. Install MacPorts, then install Qt5 by
```
$ brew install qt6
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
```
1. Invoke **`build4mac.py`** with the default options: **((Notes))** only for Catalina
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py
```
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 (including Qt's framework) under **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed in this step.
```
$ ./build4mac.py -y
```
The application bundle **`klayout.app`** is located under:<br>
**`ST-qt6Brew.pkg.macos-Catalina-release-RsysPsys`** directory, where the three name parts below are important.
**`ST-qt5MP.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).
* "qt6Brew" means that Qt6 from Homebrew is used.
* "qt5MP" means that Qt5 from MacPorts 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 Qt6 framework is NOT deployed in the application bundle.<br>
Then the directory name will be **`LW-qt6Brew.pkg.macos-Catalina-release-RsysPsys`**, where
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
* "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 Qt6, Ruby 2.7, and Python 3.8 by
### 6B. Fully MacPorts-flavored build with MacPorts Ruby 3.1 and MacPorts Python 3.8
0. Install MacPorts, then install Qt5, Ruby 3.1, and Python 3.8 by
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt6
$ sudo port install qt6-qttools
$ sudo port install ruby27
$ sudo port install qt5
$ sudo port install ruby31
$ sudo port install python38
$ sudo port install py38-pip
```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt6macports -r mp27 -p mp38
$ ./build4mac.py -q qt5macports -r mp31 -p mp38
```
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>
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.<br>
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/**.
```
$ ./build4mac.py -q qt6macports -r mp27 -p mp38 -Y
$ ./build4mac.py -q qt5macports -r mp31 -p mp38 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt6MP.pkg.macos-Catalina-release-Rmp27Pmp38`** directory, where
**`LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38`** directory, where
* "LW-" means that this is a lightweight package.
* "qt6MP" means that Qt6 from MacPorts is used.
* "Rmp27Pmp38" means that Ruby is 2.7 from MacPorts; Python is 3.8 from MacPorts.
* "qt5MP" means that Qt5 from MacPorts is used.
* "Rmp31Pmp38" means that Ruby is 3.1 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 Qt6, Ruby 2.7, and Python 3.8 by
### 6C. Fully Homebrew-flavored build with Homebrew Ruby 3.1 and Homebrew Python 3.8
0. Install Homebrew, then install Qt5, Ruby 3.1, and Python 3.8 by
```
$ brew install qt6
$ brew install ruby@2.7
$ brew install qt@5
$ brew install ruby@3.1
$ 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 qt6brew -r hb27 -p hb38
$ ./build4mac.py -q qt5brew -r hb31 -p hb38
```
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>
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.<br>
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/**.
```
$ ./build4mac.py -q qt6brew -r hb27 -p hb38 -Y
$ ./build4mac.py -q qt5brew -r hb31 -p hb38 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt6Brew.pkg.macos-Catalina-release-Rhb27Phb38`** directory, where
**`LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb38`** directory, where
* "LW-" means that this is a lightweight package.
* "qt6Brew" means that Qt6 from Homebrew is used.
* "Rhb27Phb38" means that Ruby is 2.7 from Homebrew; Python is 3.8 from Homebrew.
* "qt5Brew" means that Qt5 from Homebrew is used.
* "Rhb31Phb38" means that Ruby is 3.1 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 Qt6 and Python 3.8 by
0. Install Homebrew, then install Qt5 and Python 3.8 by
```
$ brew install qt6
$ brew install qt@5
$ brew install python@3.8
```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt6brew -r sys -p hb38
$ ./build4mac.py -q qt5brew -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>
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 and Python frameworks) under the **`klayout.app`** bundle.<br>
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.
```
$ ./build4mac.py -q qt6brew -r sys -p hb38 -y
$ ./build4mac.py -q qt5brew -r sys -p hb38 -y
```
The application bundle **`klayout.app`** is located under:<br>
**`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.
**`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.
* "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
So far, the deployment of Homebrew Ruby is not supported. <br>
Therefore, if you intend to use the "-y" option for deployment, you need to use the "-r sys" option for building.
### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 2.5 and Anaconda3 Python 3.8
0. Install Anaconda3, then install Ruby 2.5 by
### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.1 and Anaconda3 Python 3.8
0. Install Anaconda3, then install Ruby 3.1 by
```
$ conda install ruby
```
@ -312,7 +308,7 @@ $ conda install ruby
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5ana3 -r ana3 -p ana3
```
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>
The buddy command-line tools (strm*) will also be deployed under **klayout.app/Contents/Buddy/** in this step.<br>
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/**.
@ -324,16 +320,16 @@ $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 -Y
**`LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3`** directory, where
* "LW-" means that this is a lightweight package.
* "qt5Ana3" means that Qt5 from Anaconda3 is used.
* "Rana3Pana3" means that Ruby (2.5) is from Anaconda3; Python (3.8) is from Anaconda3.
* "Rana3Pana3" means that Ruby (3.1) is from Anaconda3; Python (3.8) is from Anaconda3.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
5. You may have to set `PYTHONHOME` environment variable like:
5. You may have to set the `PYTHONHOME` environment variable like:
```
export PYTHONHOME=$HOME/opt/anaconda3
```
### 6F. Other combinations
Logically, several different module combinations other than 6A. through 6E. are possible, including `nil` choice.<br>
If you choose such a combination, the resultant package directory name will begin with **`EX-`** (exceptional).
Logically, several different module combinations other than 6A through 6E are possible, including `nil` choice.<br>
The resultant package directory name will begin with **`EX-`** (exceptional) if you choose such a combination.
----
@ -348,19 +344,19 @@ 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-qt6Brew.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>
* **`ST-klayout-0.27.9-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.27.9-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file
* **`ST-klayout-0.27.11-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.27.11-macOS-Catalina-1-qt5MP-RsysPsys.dmg.md5`** ---(2) MD5-value text file
# Known issues
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>
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>
In such cases, you need to update the dictionary contents of **`build4mac_env.py`**.
# Final comments
No need to say, KLayout is a great tool! <br>
With the object-oriented script language (both Ruby and Python) support, our error-prone layout jobs can be greatly simplified and speed-up.<br>
No need to say KLayout is a great tool! <br>
With the object-oriented script language (both Ruby and Python) support, our error-prone layout jobs can be greatly simplified and sped up.<br>
Building KLayout from its source code is not difficult. Try it with your favorite environment!
[End of File]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 205 KiB

View File

@ -7,9 +7,9 @@
# The top Python script for building KLayout (http://www.klayout.de/index.php)
# version 0.26.1 or later on different Apple Mac OSX platforms.
#===============================================================================
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
import sys
import os
import codecs
import shutil
import glob
import platform
@ -34,39 +34,40 @@ from build4mac_util import *
#-------------------------------------------------------------------------------
def GenerateUsage(platform):
if platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
myQt65 = "qt6brew"
myRuby = "hb27"
myQt56 = "qt5brew"
myRuby = "hb31"
myPython = "hb38"
moduleset = ('qt6Brew', 'HB27', 'HB38')
moduleset = ('qt5Brew', 'HB31', 'HB38')
else: # with Xcode [ .. 12.4]
myQt65 = "qt6brew"
myQt56 = "qt5macports"
myRuby = "sys"
myPython = "sys"
moduleset = ('qt6Brew', 'Sys', 'Sys')
moduleset = ('qt5MP', 'Sys', 'Sys')
usage = "\n"
usage += "---------------------------------------------------------------------------------------------------------\n"
usage += "<< Usage of 'build4mac.py' >>\n"
usage += " for building KLayout 0.27.9 or later on different Apple macOS / Mac OSX platforms.\n"
usage += " for building KLayout 0.27.11 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=['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 += " [-q|--qt <type>] : case-insensitive type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', | %s \n" % myQt56
usage += " : 'Qt6MacPorts', 'Qt6Brew'] | \n"
usage += " : Qt5MacPorts: use Qt5 from MacPorts | \n"
usage += " : Qt5Brew: use Qt5 from Homebrew | \n"
usage += " : Qt5Ana3: use Qt5 from Anaconda3 | \n"
usage += " [-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3'] | %s \n" % myRuby
usage += " : Qt6MacPorts: use Qt6 from MacPorts (*) | \n"
usage += " : Qt6Brew: use Qt6 from Homebrew (*) | \n"
usage += " : (*) migration to Qt6 is ongoing | \n"
usage += " [-r|--ruby <type>] : case-insensitive type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3'] | %s \n" % myRuby
usage += " : nil: don't bind Ruby | \n"
usage += " : Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS | \n"
usage += " : MP27: use Ruby 2.7 from MacPorts | \n"
usage += " : HB27: use Ruby 2.7 from Homebrew | \n"
usage += " : Ana3: use Ruby 2.5 from Anaconda3 | \n"
usage += " : MP31: use Ruby 3.1 from MacPorts | \n"
usage += " : HB31: use Ruby 3.1 from Homebrew | \n"
usage += " : Ana3: use Ruby 3.1 from Anaconda3 | \n"
usage += " [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython
usage += " : 'HB39', 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"
@ -83,7 +84,7 @@ def GenerateUsage(platform):
usage += " [-y|--deploy] : deploy executables and dylibs including Qt's Frameworks | disabled\n"
usage += " [-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled\n"
usage += " : from the source code and use the tools in the same machine | \n"
usage += " : ! After confirmation of successful build of 'klayout.app', | \n"
usage += " : ! After confirmation of the uccessful build of 'klayout.app', | \n"
usage += " : rerun this script with BOTH: | \n"
usage += " : 1) the same options used for building AND | \n"
usage += " : 2) <-y|--deploy> OR <-Y|--DEPLOY> | \n"
@ -149,35 +150,35 @@ def Get_Default_Config():
# Set the default modules
if Platform == "Monterey":
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5Brew"
ModuleRuby = "RubyMonterey"
ModulePython = "PythonMonterey"
elif Platform == "BigSur":
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5Brew"
ModuleRuby = "RubyBigSur"
ModulePython = "PythonBigSur"
elif Platform == "Catalina":
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5MacPorts"
ModuleRuby = "RubyCatalina"
ModulePython = "PythonCatalina"
elif Platform == "Mojave":
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5MacPorts"
ModuleRuby = "RubyMojave"
ModulePython = "PythonMojave"
elif Platform == "HighSierra":
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5MacPorts"
ModuleRuby = "RubyHighSierra"
ModulePython = "PythonHighSierra"
elif Platform == "Sierra":
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5MacPorts"
ModuleRuby = "RubySierra"
ModulePython = "PythonSierra"
elif Platform == "ElCapitan":
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5MacPorts"
ModuleRuby = "RubyElCapitan"
ModulePython = "PythonElCapitan"
else:
ModuleQt = "Qt6Brew"
ModuleQt = "Qt5MacPorts"
ModuleRuby = "nil"
ModulePython = "nil"
@ -224,6 +225,123 @@ def Get_Default_Config():
config['Processor'] = Processor # - do -
return config
#------------------------------------------------------------------------------
## To apply a workaround patch to "./src/klayout.pri" to work with Ruby 3.x.
#
# @param[in] config dictionary containing the default configuration
#
# @return void
#------------------------------------------------------------------------------
def ApplyPatch2KLayoutQtPri4Ruby3(config):
#----------------------------------------------------------------
# [1] Check if the previous patch exists
#----------------------------------------------------------------
priMaster = "./src/klayout.pri"
priOriginal = "./src/klayout.pri.org"
if os.path.exists(priOriginal):
shutil.copy2( priOriginal, priMaster )
os.remove( priOriginal )
#----------------------------------------------------------------
# [2] Not using Ruby?
#----------------------------------------------------------------
ModuleRuby = config['ModuleRuby']
if ModuleRuby == 'nil':
return;
#----------------------------------------------------------------
# [3] Get the Ruby version code as done in "build.sh"
#----------------------------------------------------------------
rubyExe = RubyDictionary[ModuleRuby]['exe']
oneline = "puts (RbConfig::CONFIG['MAJOR'] || 0).to_i*10000+(RbConfig::CONFIG['MINOR'] || 0).to_i*100+(RbConfig::CONFIG['TEENY'] || 0).to_i"
command = [ '%s' % rubyExe, '-rrbconfig', '-e', '%s' % oneline ]
verCode = subprocess.check_output( command, encoding='utf-8' ).strip() # like 3.1.2 => "30102"
verInt = int(verCode)
verMajor = verInt // 10000
verMinor = (verInt - verMajor * 10000) // 100
verTeeny = (verInt - verMajor * 10000) - (verMinor * 100)
# print( verMajor, verMinor, verTeeny )
# quit()
if verMajor < 3:
return;
#-----------------------------------------------------------------------------------------------
# [4] The two buggy Apple compilers below flag errors like:
#
# /Applications/anaconda3/include/ruby-3.1.0/ruby/internal/intern/vm.h:383:1: error: \
# '__declspec' attributes are not enabled; use '-fdeclspec' or '-fms-extensions' to \
# enable support for __declspec attributes RBIMPL_ATTR_NORETURN()
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Problematic in <Catalina> with
# Apple clang version 12.0.0 (clang-1200.0.32.29)
# Target: x86_64-apple-darwin19.6.0
# Thread model: posix
#
# Problematic in <Big Sur> with
# Apple clang version 13.0.0 (clang-1300.0.29.30)
# Target: x86_64-apple-darwin20.6.0
# Thread model: posix
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Non-problematic in <Monterey> with
# Apple clang version 13.1.6 (clang-1316.0.21.2.5)
# Target: x86_64-apple-darwin21.6.0
# Thread model: posix
#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Refer to https://github.com/nginx/unit/issues/653
# https://github.com/nginx/unit/issues/653#issuecomment-1062129080
#
# Pass "-fdeclspec" option to the QMAKE_CXXFLAGS macro via the "./src/klayout.pri" file like:
"""
# <build4mac.py> applied this patch for Mac to work with Ruby 3.x
mac {
QMAKE_CXXFLAGS += -fdeclspec
}
# <build4mac.py> applied this patch for Mac to work with Ruby 3.x
"""
#-----------------------------------------------------------------------------------------------
#----------------------------------------------------------------
# (A) Check Platform
#----------------------------------------------------------------
Platform = config['Platform']
if Platform in [ "Monterey" ]:
return
elif Platform in [ "BigSur", "Catalina" ]: # take care
pass
else:
return # the results are not tested and unknown
#----------------------------------------------------------------
# (B) Check ./src/klayout.pri and apply the patch if necessary
#----------------------------------------------------------------
keystring = "<build4mac.py> applied this patch for Mac to work with Ruby 3.x"
patPatch = r"(^#)([ ]*)(%s)([ ]*$)" % keystring
regPatch = re.compile(patPatch)
foundKey1 = False
foundKey2 = False
with codecs.open( priMaster, "r", "utf-8" ) as file:
allLines = file.readlines()
file.close()
for line in allLines:
if regPatch.match( line.strip() ):
if not foundKey1:
foundKey1 = True
continue
elif not foundKey2:
foundKey2 = True
break
if foundKey1 and foundKey2:
return
shutil.copy2( priMaster, priOriginal )
with codecs.open( priMaster, "a", "utf-8" ) as file:
file.write( "# %s\n" % keystring )
file.write( "mac {\n" )
file.write( " QMAKE_CXXFLAGS += -fdeclspec\n" )
file.write( "}\n" )
file.write( "# %s\n" % keystring )
return
#------------------------------------------------------------------------------
## To parse the command line parameters
#
@ -261,11 +379,11 @@ def Parse_CLI_Args(config):
p = optparse.OptionParser(usage=Usage)
p.add_option( '-q', '--qt',
dest='type_qt',
help="Qt type=['Qt6MacPorts', 'Qt6Brew', 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3']" )
help="Qt type=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', 'Qt6MacPorts', 'Qt6Brew']" )
p.add_option( '-r', '--ruby',
dest='type_ruby',
help="Ruby type=['nil', 'Sys', 'MP27', 'HB27', 'Ana3']" )
help="Ruby type=['nil', 'Sys', 'MP31', 'HB31', 'Ana3']" )
p.add_option( '-p', '--python',
dest='type_python',
@ -328,8 +446,8 @@ def Parse_CLI_Args(config):
help='check usage' )
if Platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
p.set_defaults( type_qt = "qt6brew",
type_ruby = "hb27",
p.set_defaults( type_qt = "qt5brew",
type_ruby = "hb31",
type_python = "hb38",
build_pymod = False,
no_qt_binding = False,
@ -342,7 +460,7 @@ def Parse_CLI_Args(config):
deploy_verbose = "1",
checkusage = False )
else: # with Xcode [ .. 12.4]
p.set_defaults( type_qt = "qt6brew",
p.set_defaults( type_qt = "qt5macports",
type_ruby = "sys",
type_python = "sys",
build_pymod = False,
@ -363,11 +481,11 @@ 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'
candidates['QT6MACPORTS'] = 'Qt6MacPorts'
candidates['QT6BREW'] = 'Qt6Brew'
try:
ModuleQt = candidates[ opt.type_qt.upper() ]
except KeyError:
@ -379,16 +497,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":
choiceQt65 = 'qt5MP'
choiceQt56 = 'qt5MP'
elif ModuleQt == "Qt5Brew":
choiceQt65 = 'qt5Brew'
choiceQt56 = 'qt5Brew'
elif ModuleQt == "Qt5Ana3":
choiceQt65 = 'qt5Ana3'
choiceQt56 = 'qt5Ana3'
elif ModuleQt == "Qt6MacPorts":
choiceQt56 = 'qt6MP'
elif ModuleQt == "Qt6Brew":
choiceQt56 = 'qt6Brew'
# By default, OS-standard (-bundled) script languages (Ruby and Python) are used
NonOSStdLang = False
@ -397,8 +515,8 @@ def Parse_CLI_Args(config):
candidates = dict()
candidates['NIL'] = 'nil'
candidates['SYS'] = 'Sys'
candidates['MP27'] = 'MP27'
candidates['HB27'] = 'HB27'
candidates['MP31'] = 'MP31'
candidates['HB31'] = 'HB31'
candidates['ANA3'] = 'Ana3'
try:
choiceRuby = candidates[ opt.type_ruby.upper() ]
@ -425,11 +543,11 @@ def Parse_CLI_Args(config):
ModuleRuby = 'RubySierra'
elif Platform == "ElCapitan":
ModuleRuby = 'RubyElCapitan'
elif choiceRuby == "MP27":
ModuleRuby = 'Ruby27MacPorts'
elif choiceRuby == "MP31":
ModuleRuby = 'Ruby31MacPorts'
NonOSStdLang = True
elif choiceRuby == "HB27":
ModuleRuby = 'Ruby27Brew'
elif choiceRuby == "HB31":
ModuleRuby = 'Ruby31Brew'
NonOSStdLang = True
elif choiceRuby == "Ana3":
ModuleRuby = 'RubyAnaconda3'
@ -497,7 +615,7 @@ def Parse_CLI_Args(config):
sys.exit(1)
# (D) Set of modules chosen
ModuleSet = ( choiceQt65, choiceRuby, choicePython )
ModuleSet = ( choiceQt56, choiceRuby, choicePython )
# (E) Set other parameters
BuildPymod = opt.build_pymod
@ -543,10 +661,10 @@ def Parse_CLI_Args(config):
elif DeploymentF:
if (ModuleRuby in RubySys) and (ModulePython in PythonSys):
PackagePrefix = "ST-"
message += "a standard (ST-) package including Qt[6|5] and using OS-bundled Ruby and Python..."
message += "a standard (ST-) package including Qt[5|6] and using OS-bundled Ruby and Python..."
elif ModulePython in ['Python38Brew', 'Python39Brew', 'PythonAutoBrew']:
PackagePrefix = "HW-"
message += "a heavyweight (HW-) package including Qt[6|5] and Python3.8~ from Homebrew..."
message += "a heavyweight (HW-) package including Qt[5|6] and Python3.8~ from Homebrew..."
else:
PackagePrefix = "EX-"
message += "a package with exceptional (EX-) combinations of different modules..."
@ -640,14 +758,8 @@ def Get_Build_Parameters(config):
MacBuildDirQAT = MacBuildDir + ".macQAT"
parameters['logfile'] = MacBuildLog
# (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':
# (D) Qt5|6
if ModuleQt == 'Qt5MacPorts':
parameters['qmake'] = Qt5MacPorts['qmake']
parameters['deploy_tool'] = Qt5MacPorts['deploy']
elif ModuleQt == 'Qt5Brew':
@ -656,7 +768,12 @@ def Get_Build_Parameters(config):
elif ModuleQt == 'Qt5Ana3':
parameters['qmake'] = Qt5Ana3['qmake']
parameters['deploy_tool'] = Qt5Ana3['deploy']
elif ModuleQt == 'Qt6MacPorts':
parameters['qmake'] = Qt6MacPorts['qmake']
parameters['deploy_tool'] = Qt6MacPorts['deploy']
elif ModuleQt == 'Qt6Brew':
parameters['qmake'] = Qt6Brew['qmake']
parameters['deploy_tool'] = Qt6Brew['deploy']
parameters['bin'] = MacBinDir
parameters['build'] = MacBuildDir
@ -681,6 +798,7 @@ def Get_Build_Parameters(config):
# (H) about Ruby
if ModuleRuby != "nil":
ApplyPatch2KLayoutQtPri4Ruby3( config )
parameters['ruby'] = RubyDictionary[ModuleRuby]['exe']
parameters['rbinc'] = RubyDictionary[ModuleRuby]['inc']
parameters['rblib'] = RubyDictionary[ModuleRuby]['lib']
@ -706,8 +824,8 @@ def Get_Build_Parameters(config):
# <pymod> will be built if:
# BuildPymod = True
# Platform = [ 'Monterey', 'BigSur', 'Catalina' ]
# ModuleRuby = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
# ModulePython = [ 'Python38MacPorts', 'Python38Brew',
# ModuleRuby = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
# ModulePython = [ 'Python38MacPorts', 'Python38Brew', 'Python39Brew',
# 'PythonAnaconda3', 'PythonAutoBrew' ]
parameters['BuildPymod'] = BuildPymod
parameters['Platform'] = Platform
@ -716,10 +834,10 @@ def Get_Build_Parameters(config):
PymodDistDir = dict()
if Platform in [ 'Monterey', 'BigSur', 'Catalina' ]:
if ModuleRuby in [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]:
if ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]:
if ModulePython in ['Python38MacPorts']:
PymodDistDir[ModulePython] = 'dist-MP3'
elif ModulePython in [ 'Python38Brew', 'PythonAutoBrew' ]:
elif ModulePython in [ 'Python38Brew', 'Python39Brew', 'PythonAutoBrew' ]:
PymodDistDir[ModulePython] = 'dist-HB3'
elif ModulePython in [ 'PythonAnaconda3' ]:
PymodDistDir[ModulePython] = 'dist-ana3'
@ -739,9 +857,9 @@ def Build_pymod(parameters):
# [1] <pymod> will be built if:
# BuildPymod = True
# Platform = [ 'Monterey', 'BigSur', 'Catalina' ]
# ModuleRuby = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
# ModuleRuby = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
# ModulePython = [ 'Python38MacPorts', 'Python38Brew',
# 'PythonAnaconda3', 'PythonAutoBrew' ]
# 'PythonAnaconda3', 'Python39Brew', 'PythonAutoBrew' ]
#---------------------------------------------------------------------------
BuildPymod = parameters['BuildPymod']
Platform = parameters['Platform']
@ -751,9 +869,9 @@ def Build_pymod(parameters):
return 0
if not Platform in [ 'Monterey', 'BigSur', 'Catalina' ]:
return 0
elif not ModuleRuby in [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]:
elif not ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]:
return 0
elif not ModulePython in [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]:
elif not ModulePython in [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'Python39Brew', 'PythonAutoBrew' ]:
return 0
#--------------------------------------------------------------------
@ -1490,12 +1608,18 @@ def Deploy_Binaries_For_Bundle(config, parameters):
# $ cd /Applications/klayout.app/Contents/MacOS/
# $ ./start-console.py
#
# Python 3.8.12 (default, Oct 13 2021, 06:42:19)
# [Clang 12.0.0 (clang-1200.0.32.29)] on darwin
# $ /Applications/klayout.app/Contents/MacOS/start-console.py
# Warning: Populating font family aliases took 195 ms. Replace uses of missing font\
# family "Monospace" with one that exists to avoid this cost.
# Python 3.7.8 (default, Jul 4 2020, 10:17:17)
# [Clang 11.0.3 (clang-1103.0.32.62)] on darwin
# Type "help", "copyright", "credits" or "license" for more information.
# (KLayout Python Console)
# >>> import pip
# >>> pip.main( ['install', 'numpy', 'scipy', 'pandas', 'matplotlib'] )
# >>> pip.main( ['install', 'numpy'] )
# >>> pip.main( ['install', 'scipy'] )
# >>> pip.main( ['install', 'pandas'] )
# >>> pip.main( ['install', 'matplotlib'] )
#----------------------------------------------------------------------------------
pip_module = "%s/Versions/%s/lib/python%s/site-packages/pip/__init__.py" % \
(pythonFrameworkPath, pythonHBVer, pythonHBVer)
@ -1521,18 +1645,18 @@ def Deploy_Binaries_For_Bundle(config, parameters):
file.write(line)
#-------------------------------------------------------------
# [10] Special deployment of Ruby2.7 from Homebrew?
# [10] Special deployment of Ruby3.1 from Homebrew?
#-------------------------------------------------------------
deploymentRuby27HB = (ModuleRuby == 'Ruby27Brew')
if deploymentRuby27HB and NonOSStdLang:
deploymentRuby31HB = (ModuleRuby == 'Ruby31Brew')
if deploymentRuby31HB and NonOSStdLang:
print( "" )
print( " [10] You have reached optional deployment of Ruby from %s ..." % HBRuby27Path )
print( " [10] You have reached optional deployment of Ruby from %s ..." % HBRuby31Path )
print( " [!!!] Sorry, the deployed package will not work properly since deployment of" )
print( " Ruby2.7 from Homebrew is not yet supported." )
print( " Since you have Homebrew development environment, there two options:" )
print( " (1) Retry to make a package with '-Y|--DEPLOY' option." )
print( " This will not deploy any of Qt[6|5], Python, and Ruby from Homebrew." )
print( " This will not deploy any of Qt[5|6], Python, and Ruby from Homebrew." )
print( " Instead, the package will directly use those Frameworks and libraries" )
print( " in your Homebrew environment." )
print( " (2) Rebuild KLayout with '-r|--ruby <nil|Sys>' option depending on your preference." )

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#===============================================================================
@ -32,30 +32,13 @@ else:
del System, Node, Release, MacVersion, Machine, Processor
#-----------------------------------------------------
# [1] Qt6 or Qt5
# [1] Qt5 or Qt6
#-----------------------------------------------------
Qts = [ 'Qt6MacPorts', 'Qt6Brew' ]
Qts += [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
Qts = [ 'Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3' ]
Qts += [ 'Qt6MacPorts', 'Qt6Brew' ]
#-----------------------------------------------------
# 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
# Whereabouts of different components of Qt5
#-----------------------------------------------------
# Qt5 from MacPorts (https://www.macports.org/)
# install with 'sudo port install [qt5|qt5-qttools]'
@ -79,17 +62,34 @@ Qt5Ana3 = { 'qmake' : '/Applications/anaconda3/bin/qmake',
'deploy': '/Applications/anaconda3/bin/macdeployqt'
}
#-------------------------------------------------------------------------
# Whereabouts of different components of Qt6 *+*+*+ EXPERIMENTAL *+*+*+
#-------------------------------------------------------------------------
# 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
}
#-----------------------------------------------------
# [2] Ruby
#-----------------------------------------------------
RubyNil = [ 'nil' ]
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave' ]
RubySys += [ 'RubyCatalina', 'RubyBigSur', 'RubyMonterey' ]
RubyExt = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
RubyExt = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt
#-----------------------------------------------------
# Whereabout of different components of Ruby
# Whereabouts of different components of Ruby
#-----------------------------------------------------
# Bundled with Yosemite (10.10)
# !!! Yosemite is no longer supported (KLayout 0.26 ~) but remains here to keep the record of
@ -174,30 +174,30 @@ RubyMonterey = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % MontereySDK
}
# Ruby 2.7 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# install with 'sudo port install ruby27'
# [Key Type Name] = 'MP27'
Ruby27MacPorts = { 'exe': '/opt/local/bin/ruby2.7',
'inc': '/opt/local/include/ruby-2.7.0',
'lib': '/opt/local/lib/libruby.2.7.dylib'
# Ruby 3.1 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# install with 'sudo port install ruby31'
# [Key Type Name] = 'MP31'
Ruby31MacPorts = { 'exe': '/opt/local/bin/ruby3.1',
'inc': '/opt/local/include/ruby-3.1.2',
'lib': '/opt/local/lib/libruby.3.1.dylib'
}
# Ruby 2.7 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install ruby'
# [Key Type Name] = 'HB27'
HBRuby27Path = '%s/opt/ruby@2.7' % DefaultHomebrewRoot
Ruby27Brew = { 'exe': '%s/bin/ruby' % HBRuby27Path,
'inc': '%s/include/ruby-2.7.0' % HBRuby27Path,
'lib': '%s/lib/libruby.2.7.dylib' % HBRuby27Path
# Ruby 3.1 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install ruby@3.1'
# [Key Type Name] = 'HB31'
HBRuby31Path = '%s/opt/ruby@3.1' % DefaultHomebrewRoot
Ruby31Brew = { 'exe': '%s/bin/ruby' % HBRuby31Path,
'inc': '%s/include/ruby-3.1.0' % HBRuby31Path,
'lib': '%s/lib/libruby.3.1.dylib' % HBRuby31Path
}
# Ruby 2.5 bundled with anaconda3 installed under /Applications/anaconda3/ *+*+*+ EXPERIMENTAL *+*+*+
# Ruby 3.1 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/
# [Key Type Name] = 'Ana3'
RubyAnaconda3 = { 'exe': '/Applications/anaconda3/bin/ruby',
'inc': '/Applications/anaconda3/include/ruby-2.5.0',
'lib': '/Applications/anaconda3/lib/libruby.2.5.1.dylib'
'inc': '/Applications/anaconda3/include/ruby-3.1.0',
'lib': '/Applications/anaconda3/lib/libruby.3.1.dylib'
}
# Consolidated dictionary kit for Ruby
@ -210,8 +210,8 @@ RubyDictionary = { 'nil' : None,
'RubyCatalina' : RubyCatalina,
'RubyBigSur' : RubyBigSur,
'RubyMonterey' : RubyMonterey,
'Ruby27MacPorts': Ruby27MacPorts,
'Ruby27Brew' : Ruby27Brew,
'Ruby31MacPorts': Ruby31MacPorts,
'Ruby31Brew' : Ruby31Brew,
'RubyAnaconda3' : RubyAnaconda3
}
@ -225,7 +225,7 @@ PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'Python39Brew', 'PythonAnacon
Pythons = PythonNil + PythonSys + PythonExt
#-----------------------------------------------------
# Whereabout of different components of Python
# Whereabouts of different components of Python
#-----------------------------------------------------
# Bundled with Yosemite (10.10)
# !!! Yosemite is no longer supported but remains here to keep the record of the directory structure

View File

@ -1,4 +1,4 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
#=============================================================================================
@ -11,7 +11,6 @@
# 1) https://el-tramo.be/guides/fancy-dmg/
# 2) https://github.com/andreyvit/create-dmg.git
#=============================================================================================
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
from time import sleep
import sys
import os
@ -77,13 +76,13 @@ def SetGlobals():
Usage = "\n"
Usage += "---------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
Usage += " for making a DMG file of KLayout 0.27.5 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += " for making a DMG file of KLayout 0.27.11 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-qt6MP.pkg.macos-Catalina-release-RsysPsys' | \n"
Usage += " : like 'ST-qt5MP.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"
@ -159,7 +158,7 @@ def SetGlobals():
RubyPythonID = ""
KLVersion = GetKLayoutVersionFrom( "./version.sh" )
OccupiedDS = -1
BackgroundPNG = "KLayoutDMG-Back.png"
BackgroundPNG = None
VolumeIcons = "KLayoutHDD.icns"
AppleScriptDMG = "macbuild/Resources/KLayoutDMG.applescript"
WorkDMG = "work-KLayout.dmg"
@ -195,17 +194,17 @@ def SetGlobals():
## To check the contents of the package directory
#
# The package directory name should look like:
# * 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
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys --- (1)
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb38
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38
#
# * ST-qt6MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb31Phb38
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp31Pmp38
#
# Generated DMG will be, for example,
# (1) ---> ST-klayout-0.27.5-macOS-Catalina-1-qt6MP-RsysPsys.dmg
# (1) ---> ST-klayout-0.27.11-macOS-Catalina-1-qt5MP-RsysPsys.dmg
#
# @return on success, positive integer in [MB] that tells approx. occupied disc space;
# on failure, -1
@ -221,6 +220,7 @@ def CheckPkgDirectory():
global PackagePrefix
global QtIdentification
global RubyPythonID
global BackgroundPNG
global LatestOSMacPorts
global LatestOSHomebrew
global LatestOSAnaconda3
@ -242,18 +242,17 @@ 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-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb27Phb38
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb38
# * HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38
# * EX-qt5MP.pkg.macos-Catalina-release-Rmp27Pmp38
# * EX-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38
#
# * ST-qt6MP.pkg.macos-Catalina-release-RsysPsys
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp31Pmp38
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb31Phb38
#-----------------------------------------------------------------------------
patQRP = u'(ST|LW|HW|EX)([-])([qt6|qt5][0-9A-Za-z]+)([.]pkg[.])([A-Za-z]+[-][A-Za-z]+[-]release[-])([0-9A-Za-z]+)'
patQRP = u'(ST|LW|HW|EX)([-])([qt5|qt6][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" )
@ -267,19 +266,26 @@ def CheckPkgDirectory():
PackagePrefix = pkgdirComponents[0]
QtIdentification = pkgdirComponents[2]
RubyPythonID = pkgdirComponents[5]
if QtIdentification.find('qt5') == 0:
BackgroundPNG = "KLayoutDMG-BackQt5.png"
elif QtIdentification.find('qt6') == 0:
BackgroundPNG = "KLayoutDMG-BackQt6.png"
else:
BackgroundPNG = None
raise Exception( "! neither qt5 nor qt6" )
#-----------------------------------------------------------------------------
# [3] Check if the "LatestOS" with MacPorts / Homebrew / Anaconda3
#-----------------------------------------------------------------------------
LatestOSMacPorts = Platform == LatestOS
LatestOSMacPorts &= PackagePrefix == "LW"
LatestOSMacPorts &= QtIdentification in ["qt6MP", "qt5MP"]
LatestOSMacPorts &= RubyPythonID in ["Rmp27Pmp38"]
LatestOSMacPorts &= QtIdentification in ["qt5MP", "qt6MP"]
LatestOSMacPorts &= RubyPythonID in ["Rmp31Pmp38"]
LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW"
LatestOSHomebrew &= QtIdentification in ["qt6Brew", "qt5Brew"]
LatestOSHomebrew &= RubyPythonID in ["Rhb27Phb38", "Rhb27Phb39", "Rhb27Phbauto"]
LatestOSHomebrew &= QtIdentification in ["qt5Brew", "qt6Brew"]
LatestOSHomebrew &= RubyPythonID in ["Rhb31Phb38", "Rhb31Phb39", "Rhb31Phbauto"]
LatestOSAnaconda3 = Platform == LatestOS
LatestOSAnaconda3 &= PackagePrefix == "LW"

View File

@ -1,7 +1,6 @@
#! /usr/bin/env python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import print_function # to use print() of Python 3 in Python >= 2.7
import sys
import os
import shutil
@ -71,23 +70,28 @@ def Get_Build_Target_Dict():
# @return a dictionary; key=mnemonic, value=build option list
#------------------------------------------------------------------------------
def Get_Build_Options( targetDic ):
if QtType == 5:
qtType = "Qt5"
else:
qtType = "Qt6"
buildOp = dict()
for key in targetDic.keys():
target = targetDic[key]
if target == "std": # use 'Qt5MacPorts' that provides Qt 5.15.2~ to run on "Big Sur", too
buildOp["std"] = [ '-q', 'Qt5MacPorts', '-r', 'sys', '-p', 'sys' ]
buildOp["std"] = [ '-q', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ]
elif target == "ports":
buildOp["ports"] = [ '-q', 'Qt5MacPorts', '-r', 'MP27', '-p', 'MP38' ]
buildOp["ports"] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP31', '-p', 'MP38' ]
elif target == "brew":
buildOp["brew"] = [ '-q', 'Qt5Brew', '-r', 'HB27', '-p', 'HB38' ]
buildOp["brew"] = [ '-q', '%sBrew' % qtType, '-r', 'HB31', '-p', 'HB38' ]
elif target == "brewHW":
buildOp["brewHW"] = [ '-q', 'Qt5Brew', '-r', 'sys', '-p', 'HB38' ]
buildOp["brewHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB38' ]
elif target == "ana3":
buildOp["ana3"] = [ '-q', 'Qt5Ana3', '-r', 'Ana3', '-p', 'Ana3' ]
buildOp["ana3"] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ]
elif target == "brewA":
buildOp["brewA"] = [ '-q', 'Qt5Brew', '-r', 'HB27', '-p', 'HBAuto' ]
buildOp["brewA"] = [ '-q', '%sBrew' % qtType, '-r', 'HB31', '-p', 'HBAuto' ]
elif target == "brewAHW":
buildOp["brewAHW"] = [ '-q', 'Qt5Brew', '-r', 'sys', '-p', 'HBAuto' ]
buildOp["brewAHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HBAuto' ]
if WithPymod:
buildOp["ports"] = buildOp["ports"] + ['--buildPymod']
@ -104,23 +108,28 @@ def Get_Build_Options( targetDic ):
# @return a dictionary; key=mnemonic, value=".macQAT" directory
#------------------------------------------------------------------------------
def Get_QAT_Directory( targetDic, platform ):
if QtType == 5:
qtType = "qt5"
else:
qtType = "qt6"
dirQAT = dict()
for key in targetDic.keys():
target = targetDic[key]
if target == "std":
dirQAT["std"] = 'qt5MP.build.macos-%s-release-RsysPsys.macQAT' % platform
dirQAT["std"] = '%sMP.build.macos-%s-release-RsysPsys.macQAT' % (qtType, platform)
elif target == "ports":
dirQAT["ports"] = 'qt5MP.build.macos-%s-release-Rmp27Pmp38.macQAT' % platform
dirQAT["ports"] = '%sMP.build.macos-%s-release-Rmp31Pmp38.macQAT' % (qtType, platform)
elif target == "brew":
dirQAT["brew"] = 'qt5Brew.build.macos-%s-release-Rhb27Phb38.macQAT' % platform
dirQAT["brew"] = '%sBrew.build.macos-%s-release-Rhb31Phb38.macQAT' % (qtType, platform)
elif target == "brewHW":
dirQAT["brewHW"] = 'qt5Brew.build.macos-%s-release-RsysPhb38.macQAT' % platform
dirQAT["brewHW"] = '%sBrew.build.macos-%s-release-RsysPhb38.macQAT' % (qtType, platform)
elif target == "ana3":
dirQAT["ana3"] = 'qt5Ana3.build.macos-%s-release-Rana3Pana3.macQAT' % platform
dirQAT["ana3"] = '%sAna3.build.macos-%s-release-Rana3Pana3.macQAT' % (qtType, platform)
elif target == "brewA":
dirQAT["brewA"] = 'qt5Brew.build.macos-%s-release-Rhb27Phbauto.macQAT' % platform
dirQAT["brewA"] = '%sBrew.build.macos-%s-release-Rhb31Phbauto.macQAT' % (qtType, platform)
elif target == "brewAHW":
dirQAT["brewAHW"] = 'qt5Brew.build.macos-%s-release-RsysPhbauto.macQAT' % platform
dirQAT["brewAHW"] = '%sBrew.build.macos-%s-release-RsysPhbauto.macQAT' % (qtType, platform)
return dirQAT
#------------------------------------------------------------------------------
@ -134,6 +143,11 @@ def Get_QAT_Directory( targetDic, platform ):
# @return a dictionary; key=mnemonic, value=build option list
#------------------------------------------------------------------------------
def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
if QtType == 5:
qtType = "qt5"
else:
qtType = "qt6"
if makeflag:
flag = '-m'
else:
@ -143,25 +157,25 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
for key in targetDic.keys():
target = targetDic[key]
if target == "std":
packOp["std"] = [ '-p', 'ST-qt5MP.pkg.macos-%s-release-RsysPsys' % platform,
packOp["std"] = [ '-p', 'ST-%sMP.pkg.macos-%s-release-RsysPsys' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ports":
packOp["ports"] = [ '-p', 'LW-qt5MP.pkg.macos-%s-release-Rmp27Pmp38' % platform,
packOp["ports"] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp31Pmp38' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brew":
packOp["brew"] = [ '-p', 'LW-qt5Brew.pkg.macos-%s-release-Rhb27Phb38' % platform,
packOp["brew"] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb31Phb38' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewHW":
packOp["brewHW"] = [ '-p', 'HW-qt5Brew.pkg.macos-%s-release-RsysPhb38' % platform,
packOp["brewHW"] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb38' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ana3":
packOp["ana3"] = [ '-p', 'LW-qt5Ana3.pkg.macos-%s-release-Rana3Pana3' % platform,
packOp["ana3"] = [ '-p', 'LW-%sAna3.pkg.macos-%s-release-Rana3Pana3' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewA":
packOp["brewA"] = [ '-p', 'LW-qt5Brew.pkg.macos-%s-release-Rhb27Phbauto' % platform,
packOp["brewA"] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb31Phbauto' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewAHW":
packOp["brewAHW"] = [ '-p', 'HW-qt5Brew.pkg.macos-%s-release-RsysPhbauto' % platform,
packOp["brewAHW"] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhbauto' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
return packOp
@ -170,6 +184,7 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
#------------------------------------------------------------------------------
def Parse_CommandLine_Arguments():
global Usage # usage
global QtType # Qt type
global Target # target list
global Build # operation flag
global WithPymod # operation flag
@ -197,8 +212,10 @@ def Parse_CommandLine_Arguments():
Usage += "$ [python] nightlyBuild.py\n"
Usage += " option & argument : comment on option if any | default value\n"
Usage += " ------------------------------------------------------------------------+--------------\n"
Usage += " [--qt <type>] : 5='qt5', 6='qt6' (migration to Qt6 is ongoing) | 5\n"
Usage += " [--target <list>] : 0='std', 1='ports', 2='brew', 3='brewHW', 4='ana3', | '%s'\n" % targetopt
Usage += " 5='brewA', 6='brewAHW' | \n"
Usage += " * with --qt=6, use --target='2,3' (4 is ignored) | \n"
Usage += " [--build] : build and deploy | disabled\n"
Usage += " [--pymod] : build and deploy Pymod, too | disabled\n"
Usage += " [--test] : run the QA Test | disabled\n"
@ -216,11 +233,15 @@ def Parse_CommandLine_Arguments():
Usage += " (3) $ ./nightlyBuild.py --test | \n"
Usage += " (4) $ ./nightlyBuild.py --check (confirm the QA Test results) | \n"
Usage += " (5) $ ./nightlyBuild.py --makedmg 1 | \n"
Usage += " (6) $ ./nightlyBuild.py --upload '0.27.9' | \n"
Usage += " (6) $ ./nightlyBuild.py --upload '0.27.11' | \n"
Usage += " (7) $ ./nightlyBuild.py --cleandmg 1 | \n"
Usage += "---------------------------------------------------------------------------+----------------------\n"
p = optparse.OptionParser( usage=Usage )
p.add_option( '--qt',
dest='qt_type',
help='Qt5 or Qt6 (5)' )
p.add_option( '--target',
dest='targets',
help='build target list' )
@ -267,7 +288,8 @@ def Parse_CommandLine_Arguments():
default=False,
help='check usage' )
p.set_defaults( targets = "%s" % targetopt,
p.set_defaults( qt_type = "5",
targets = "%s" % targetopt,
build = False,
with_pymod = False,
qa_test = False,
@ -288,6 +310,12 @@ def Parse_CommandLine_Arguments():
print(Usage)
quit()
QtType = int(opt.qt_type)
if not QtType in [5, 6]:
print( "! Invalid Qt type <%d>" % QtType )
print(Usage)
quit()
targetDic = Get_Build_Target_Dict()
Target = list()
for idx in sorted( list( set( [ int(item) for item in opt.targets.split(",") ] ) ) ):
@ -332,6 +360,9 @@ def Build_Deploy():
buildOp = Get_Build_Options( Get_Build_Target_Dict() )
for key in Target:
if key == 4 and QtType == 6: # anaconda3 does not provide Qt6 so far
continue
command1 = [ pyBuilder ] + buildOp[key]
if key in [ "std", "brewHW", "brewAHW" ] :
command2 = [ pyBuilder ] + buildOp[key] + ['-y']
@ -380,6 +411,9 @@ def Run_QATest( exclude ):
dirQAT = Get_QAT_Directory( Get_Build_Target_Dict(), myPlatform )
for key in Target:
if key == 4 and QtType == 6: # anaconda3 does not provide Qt6 so far
continue
command1 = [ pyRunnerQAT ] + [ '--run', '--exclude', '%s' % exclude ]
print( dirQAT[key], command1 )
#continue
@ -412,6 +446,9 @@ def Check_QATest_Results( lines ):
dirQAT = Get_QAT_Directory( Get_Build_Target_Dict(), myPlatform )
for key in Target:
if key == 4 and QtType == 6: # anaconda3 does not provide Qt6 so far
continue
os.chdir( dirQAT[key] )
logfile = glob.glob( "*.log" )
command1 = [ tailCommand ] + [ '-n', '%d' % lines ] + logfile
@ -450,6 +487,9 @@ def DMG_Make( srlDMG ):
os.mkdir( stashDMG )
for key in Target:
if key == 4 and QtType == 6: # anaconda3 does not provide Qt6 so far
continue
command1 = [ pyDMGmaker ] + packOp[key]
print(command1)
#continue
@ -487,6 +527,9 @@ def DMG_Clean( srlDMG ):
shutil.rmtree( stashDMG )
for key in Target:
if key == 4 and QtType == 6: # anaconda3 does not provide Qt6 so far
continue
command1 = [ pyDMGmaker ] + packOp[key]
print(command1)
#continue