Merge remote-tracking branch 'origin/master' into wip

This commit is contained in:
Matthias Koefferlein 2022-09-01 00:27:33 +02:00
commit cb3369e9be
9 changed files with 296 additions and 219 deletions

View File

@ -1,9 +1,9 @@
Relevant KLayout version: 0.27.9<br>
Relevant KLayout version: 0.27.10<br>
Author: Kazzz-S<br>
Last modified: 2022-05-08<br>
Last modified: 2022-07-28<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.10 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,26 +18,15 @@ 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/
```
"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:
# 2. Qt5 Frameworks
By default, the Qt framework is "Qt5" from MacPorts (https://www.macports.org/), which is usually located under:
```
/opt/local/libexec/qt5/
```
Alternatively, you can use "Qt5" from Homebrew (https://brew.sh/), which is usually located under:
```
/usr/local/opt/qt@5/
```
OR
@ -51,6 +40,7 @@ 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>
@ -68,14 +58,14 @@ However, the latest Xcode 13.1 does not allow us to link the legacy Python 2.7 l
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
* 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,32 +73,28 @@ 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.10 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
: 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
[-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'] |
: '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 |
[-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
@ -135,32 +121,28 @@ $ [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.10 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
: 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
[-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'] |
: '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 |
[-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled
[-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled
@ -188,9 +170,11 @@ 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
```
@ -204,33 +188,32 @@ $ ./build4mac.py
$ ./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).
3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
@ -238,26 +221,26 @@ $ ./build4mac.py -q qt6macports -r mp27 -p mp38
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).
3. Run **`build4mac.py`** again with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
@ -265,45 +248,45 @@ $ ./build4mac.py -q qt6brew -r hb27 -p hb38
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>
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
```
@ -324,7 +307,7 @@ $ ./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:
```
@ -348,14 +331,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-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.10-macOS-Catalina-1-qt5MP-RsysPsys.dmg`** ---(1) the main DMG file
* **`ST-klayout-0.27.10-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

View File

@ -10,6 +10,7 @@
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,45 +35,41 @@ from build4mac_util import *
#-------------------------------------------------------------------------------
def GenerateUsage(platform):
if platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
myQt65 = "qt6brew"
myRuby = "hb27"
myQt5 = "qt5brew"
myRuby = "hb31"
myPython = "hb38"
moduleset = ('qt6Brew', 'HB27', 'HB38')
moduleset = ('qt5Brew', 'HB31', 'HB38')
else: # with Xcode [ .. 12.4]
myQt65 = "qt6brew"
myQt5 = "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.10 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" % myQt5
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 += " [-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 += " : '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 += " [-P|--buildPymod] : build and deploy Pymod (*.whl and *.egg) for LW-*.dmg | disabled\n"
usage += " [-n|--noqtbinding] : don't create Qt bindings for ruby scripts | disabled\n"
@ -134,7 +131,7 @@ def Get_Default_Config():
sys.exit(1)
if not Machine == "x86_64":
if Machine == "arm64" and Platform in ["Monterey", "BigSur"]: # with an Apple Silicon Chip
if Machine == "arm64" and (Platform == "Monterey" or Platform == "BigSur"): # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -149,35 +146,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 +221,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,15 +375,15 @@ 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']" )
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',
help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'HB39', 'HBAuto']" )
help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'HBAuto']" )
p.add_option( '-P', '--buildPymod',
action='store_true',
@ -328,8 +442,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 +456,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,8 +477,6 @@ 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'
@ -379,16 +491,12 @@ 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'
choiceQt5 = 'qt5MP'
elif ModuleQt == "Qt5Brew":
choiceQt65 = 'qt5Brew'
choiceQt5 = 'qt5Brew'
elif ModuleQt == "Qt5Ana3":
choiceQt65 = 'qt5Ana3'
choiceQt5 = 'qt5Ana3'
# By default, OS-standard (-bundled) script languages (Ruby and Python) are used
NonOSStdLang = False
@ -397,8 +505,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 +533,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'
@ -448,7 +556,6 @@ 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() ]
@ -483,9 +590,6 @@ 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
@ -497,7 +601,7 @@ def Parse_CLI_Args(config):
sys.exit(1)
# (D) Set of modules chosen
ModuleSet = ( choiceQt65, choiceRuby, choicePython )
ModuleSet = ( choiceQt5, choiceRuby, choicePython )
# (E) Set other parameters
BuildPymod = opt.build_pymod
@ -543,10 +647,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..."
elif ModulePython in ['Python38Brew', 'Python39Brew', 'PythonAutoBrew']:
message += "a standard (ST-) package including Qt5 and using OS-bundled Ruby and Python..."
elif ModulePython == 'Python38Brew' or ModulePython == 'PythonAutoBrew':
PackagePrefix = "HW-"
message += "a heavyweight (HW-) package including Qt[6|5] and Python3.8~ from Homebrew..."
message += "a heavyweight (HW-) package including Qt5 and Python3.8~ from Homebrew..."
else:
PackagePrefix = "EX-"
message += "a package with exceptional (EX-) combinations of different modules..."
@ -629,7 +733,7 @@ def Get_Build_Parameters(config):
mode = "release"
# (B) Modules
(qt, ruby, python) = ModuleSet # ( 'qt6Brew', 'Sys', 'Sys' )
(qt, ruby, python) = ModuleSet # ( 'qt5MP', 'Sys', 'Sys' )
ruby_python = "R%sP%s" % ( ruby.lower(), python.lower() )
# (C) Target directories and files
@ -640,14 +744,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
if ModuleQt == 'Qt5MacPorts':
parameters['qmake'] = Qt5MacPorts['qmake']
parameters['deploy_tool'] = Qt5MacPorts['deploy']
elif ModuleQt == 'Qt5Brew':
@ -657,7 +755,6 @@ 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"
@ -681,6 +778,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,7 +804,7 @@ def Get_Build_Parameters(config):
# <pymod> will be built if:
# BuildPymod = True
# Platform = [ 'Monterey', 'BigSur', 'Catalina' ]
# ModuleRuby = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
# ModuleRuby = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
# ModulePython = [ 'Python38MacPorts', 'Python38Brew',
# 'PythonAnaconda3', 'PythonAutoBrew' ]
parameters['BuildPymod'] = BuildPymod
@ -716,7 +814,7 @@ 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' ]:
@ -739,7 +837,7 @@ 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' ]
#---------------------------------------------------------------------------
@ -751,7 +849,7 @@ 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' ]:
return 0
@ -889,8 +987,8 @@ def Run_Build_Command(parameters):
# (C) Target directories and files
MacBuildDirQAT = parameters['build'] + ".macQAT"
# (D) Qt5 | Qt6 (Homebrew)
#cmd_args += " \\\n -qt5" # make 'build.sh' detect the Qt type automatically
# (D) Qt5
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']
@ -1487,15 +1585,18 @@ def Deploy_Binaries_For_Bundle(config, parameters):
#----------------------------------------------------------------------------------
# Typical usage of 'pip' after installation of the DMG package
#
# $ 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 +1622,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 Qt5, 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

@ -85,7 +85,7 @@ Qt5Ana3 = { 'qmake' : '/Applications/anaconda3/bin/qmake',
RubyNil = [ 'nil' ]
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave' ]
RubySys += [ 'RubyCatalina', 'RubyBigSur', 'RubyMonterey' ]
RubyExt = [ 'Ruby27MacPorts', 'Ruby27Brew', 'RubyAnaconda3' ]
RubyExt = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt
#-----------------------------------------------------
@ -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
}

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.5 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += " for making a DMG file of KLayout 0.27.10 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"
@ -137,7 +137,7 @@ def SetGlobals():
sys.exit(1)
if not Machine == "x86_64":
if Machine == "arm64" and Platform in ["Monterey", "BigSur"]: # with an Apple Silicon Chip
if Machine == "arm64" and (Platform == "Monterey" or Platform == "BigSur"): # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -195,17 +195,13 @@ 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
#
# Generated DMG will be, for example,
# (1) ---> ST-klayout-0.27.5-macOS-Catalina-1-qt6MP-RsysPsys.dmg
# (1) ---> ST-klayout-0.26.1-macOS-Catalina-1-qt5MP-RsysPsys.dmg
#
# @return on success, positive integer in [MB] that tells approx. occupied disc space;
# on failure, -1
@ -242,18 +238,14 @@ 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
#-----------------------------------------------------------------------------
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[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" )
@ -273,18 +265,18 @@ def CheckPkgDirectory():
#-----------------------------------------------------------------------------
LatestOSMacPorts = Platform == LatestOS
LatestOSMacPorts &= PackagePrefix == "LW"
LatestOSMacPorts &= QtIdentification in ["qt6MP", "qt5MP"]
LatestOSMacPorts &= RubyPythonID in ["Rmp27Pmp38"]
LatestOSMacPorts &= QtIdentification == "qt5MP"
LatestOSMacPorts &= RubyPythonID == "Rmp31Pmp38"
LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW"
LatestOSHomebrew &= QtIdentification in ["qt6Brew", "qt5Brew"]
LatestOSHomebrew &= RubyPythonID in ["Rhb27Phb38", "Rhb27Phb39", "Rhb27Phbauto"]
LatestOSHomebrew &= QtIdentification == "qt5Brew"
LatestOSHomebrew &= RubyPythonID == "Rhb31Phb38" or RubyPythonID == "Rhb31Phbauto"
LatestOSAnaconda3 = Platform == LatestOS
LatestOSAnaconda3 &= PackagePrefix == "LW"
LatestOSAnaconda3 &= QtIdentification in ["qt5Ana3"]
LatestOSAnaconda3 &= RubyPythonID in ["Rana3Pana3"]
LatestOSAnaconda3 &= QtIdentification == "qt5Ana3"
LatestOSAnaconda3 &= RubyPythonID == "Rana3Pana3"
if LatestOSMacPorts:
mydic = DicLightWeight["ports"]

View File

@ -77,15 +77,15 @@ def Get_Build_Options( targetDic ):
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' ]
elif target == "ports":
buildOp["ports"] = [ '-q', 'Qt5MacPorts', '-r', 'MP27', '-p', 'MP38' ]
buildOp["ports"] = [ '-q', 'Qt5MacPorts', '-r', 'MP31', '-p', 'MP38' ]
elif target == "brew":
buildOp["brew"] = [ '-q', 'Qt5Brew', '-r', 'HB27', '-p', 'HB38' ]
buildOp["brew"] = [ '-q', 'Qt5Brew', '-r', 'HB31', '-p', 'HB38' ]
elif target == "brewHW":
buildOp["brewHW"] = [ '-q', 'Qt5Brew', '-r', 'sys', '-p', 'HB38' ]
elif target == "ana3":
buildOp["ana3"] = [ '-q', 'Qt5Ana3', '-r', 'Ana3', '-p', 'Ana3' ]
elif target == "brewA":
buildOp["brewA"] = [ '-q', 'Qt5Brew', '-r', 'HB27', '-p', 'HBAuto' ]
buildOp["brewA"] = [ '-q', 'Qt5Brew', '-r', 'HB31', '-p', 'HBAuto' ]
elif target == "brewAHW":
buildOp["brewAHW"] = [ '-q', 'Qt5Brew', '-r', 'sys', '-p', 'HBAuto' ]
@ -110,15 +110,15 @@ def Get_QAT_Directory( targetDic, platform ):
if target == "std":
dirQAT["std"] = 'qt5MP.build.macos-%s-release-RsysPsys.macQAT' % platform
elif target == "ports":
dirQAT["ports"] = 'qt5MP.build.macos-%s-release-Rmp27Pmp38.macQAT' % platform
dirQAT["ports"] = 'qt5MP.build.macos-%s-release-Rmp31Pmp38.macQAT' % platform
elif target == "brew":
dirQAT["brew"] = 'qt5Brew.build.macos-%s-release-Rhb27Phb38.macQAT' % platform
dirQAT["brew"] = 'qt5Brew.build.macos-%s-release-Rhb31Phb38.macQAT' % platform
elif target == "brewHW":
dirQAT["brewHW"] = 'qt5Brew.build.macos-%s-release-RsysPhb38.macQAT' % platform
elif target == "ana3":
dirQAT["ana3"] = 'qt5Ana3.build.macos-%s-release-Rana3Pana3.macQAT' % platform
elif target == "brewA":
dirQAT["brewA"] = 'qt5Brew.build.macos-%s-release-Rhb27Phbauto.macQAT' % platform
dirQAT["brewA"] = 'qt5Brew.build.macos-%s-release-Rhb31Phbauto.macQAT' % platform
elif target == "brewAHW":
dirQAT["brewAHW"] = 'qt5Brew.build.macos-%s-release-RsysPhbauto.macQAT' % platform
return dirQAT
@ -146,10 +146,10 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
packOp["std"] = [ '-p', 'ST-qt5MP.pkg.macos-%s-release-RsysPsys' % platform,
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ports":
packOp["ports"] = [ '-p', 'LW-qt5MP.pkg.macos-%s-release-Rmp27Pmp38' % platform,
packOp["ports"] = [ '-p', 'LW-qt5MP.pkg.macos-%s-release-Rmp31Pmp38' % platform,
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brew":
packOp["brew"] = [ '-p', 'LW-qt5Brew.pkg.macos-%s-release-Rhb27Phb38' % platform,
packOp["brew"] = [ '-p', 'LW-qt5Brew.pkg.macos-%s-release-Rhb31Phb38' % platform,
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewHW":
packOp["brewHW"] = [ '-p', 'HW-qt5Brew.pkg.macos-%s-release-RsysPhb38' % platform,
@ -158,7 +158,7 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
packOp["ana3"] = [ '-p', 'LW-qt5Ana3.pkg.macos-%s-release-Rana3Pana3' % platform,
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewA":
packOp["brewA"] = [ '-p', 'LW-qt5Brew.pkg.macos-%s-release-Rhb27Phbauto' % platform,
packOp["brewA"] = [ '-p', 'LW-qt5Brew.pkg.macos-%s-release-Rhb31Phbauto' % platform,
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewAHW":
packOp["brewAHW"] = [ '-p', 'HW-qt5Brew.pkg.macos-%s-release-RsysPhbauto' % platform,
@ -216,7 +216,7 @@ 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.10' | \n"
Usage += " (7) $ ./nightlyBuild.py --cleandmg 1 | \n"
Usage += "---------------------------------------------------------------------------+----------------------\n"

View File

@ -41,6 +41,7 @@
#include "tlAssert.h"
#include <cstddef>
#include <cmath>
#include <string>
#include <vector>
#include <iterator>