Merge branch 'issue-1237' into network-drc

This commit is contained in:
Matthias Koefferlein 2023-01-17 20:45:00 +01:00
commit bd79467b4b
17 changed files with 331 additions and 196 deletions

View File

@ -1,13 +1,13 @@
Relevant KLayout version: 0.28.2<br>
Relevant KLayout version: 0.28.3<br>
Author: Kazzz-S<br>
Last modified: 2022-12-24<br>
Last modified: 2023-01-13<br>
# 1. Introduction
This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.2 or later for different 64-bit macOS, including:
This directory **`macbuild`** contains various files required for building KLayout (http://www.klayout.de/) version 0.28.3 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
* Big Sur (11.x) : experimental; Apple (M1|M2) chip is not tested since the author does not own an (M1|M2) Mac
* Monterey (12.x) : -- ditto --
* Ventura (13.x) : planning
* Ventura (13.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 are not provided.
@ -27,7 +27,7 @@ The default Qt framework is "Qt5" from MacPorts (https://www.macports.org/), whi
/opt/local/libexec/qt5/
```
**((Notes))** For **Big Sur** and **Monterey**
**((Notes))** For **Big Sur**, **Monterey**, and **Ventura**
The default Qt framework is "Qt5" from Homebrew (https://brew.sh/), which is usually located under:
```
@ -54,10 +54,9 @@ $ /usr/bin/ruby -v
$ /usr/bin/python --version
Python 2.7.16
```
This configuration WAS possible only for macOS Catalina (10.15.7).<br>
However, it is no longer supported since KLayout version 0.28.x~ uses some Python3-specific features.
Therefore, MacPorts' Ruby 3.1 and Python 3.8 are adopted as the default environment for Catalina.
In contrast, Homebrew's Ruby 3.1 and Python 3.8 are the default environment for Big Sur and Monterey.
Note that this configuration for backward compatibility is possible only for macOS Catalina (10.15.7).<br>
In contrast, Homebrew's Ruby 3.1 and Python 3.9 are the default environment for Big Sur, Monterey, and Ventura.<br>
Since Python 2.7 is already deprecated, using MacPorts' or Homebrew's Ruby 3.1 and Python 3.9 are also recommended for Catalina.
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.
@ -74,33 +73,35 @@ You need to have the followings:
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.28 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.28.3 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=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', | qt5macports
: 'Qt6MacPorts', 'Qt6Brew'] |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
: 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'] | mp31
: nil: don't bind Ruby |
: Sys: use OS-bundled Ruby [2.0 - 2.6] depending on OS |
: 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', 'MP38', 'HB38', 'Ana3', | mp38
: HB39', 'HBAuto'] |
: nil: don't bind Python |
: 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 |
[-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 |
: 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 |
: 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
: 'MP39', HB39', 'HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 up to Catalina |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.9 from Anaconda3 |
: MP39: use Python 3.9 from MacPorts |
: 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
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
@ -109,50 +110,52 @@ $ [python] ./build4mac.py
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs, including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
: from the source code and use the tools in the same machine |
: ! After confirmation of 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> |
: optionally with [-v|--verbose <0-3>] |
: from the source code and use the tools in the same machine |
: ! 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> |
: optionally with [-v|--verbose <0-3>] |
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
[-?|--?] : print this usage and exit | disabled
-----------------------------------------------------------------------------------------+---------------
```
**((Notes))** For **Big Sur** and **Monterey**
**((Notes))** For **Big Sur**, **Monterey**, and **Ventura**
```
---------------------------------------------------------------------------------------------------------
<< Usage of 'build4mac.py' >>
for building KLayout 0.28 or later on different Apple macOS / Mac OSX platforms.
for building KLayout 0.28.3 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=['Qt5MacPorts', 'Qt5Brew', 'Qt5Ana3', | qt5brew
: 'Qt6MacPorts', 'Qt6Brew'] |
: Qt5MacPorts: use Qt5 from MacPorts |
: Qt5Brew: use Qt5 from Homebrew |
: Qt5Ana3: use Qt5 from Anaconda3 |
: 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 |
: 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', 'MP38', 'HB38', 'Ana3', | hb38
: HB39', 'HBAuto'] |
: nil: don't bind Python |
: 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 |
[-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 |
: 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 |
: 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', | hb39
: 'MP39', HB39', 'HBAuto'] |
: nil: don't bind Python |
: Sys: use OS-bundled Python 2.7 up to Catalina |
: MP38: use Python 3.8 from MacPorts |
: HB38: use Python 3.8 from Homebrew |
: Ana3: use Python 3.9 from Anaconda3 |
: MP39: use Python 3.9 from MacPorts |
: 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
[-u|--noqtuitools] : don't include uitools in Qt binding | disabled
@ -161,15 +164,15 @@ $ [python] ./build4mac.py
[-c|--checkcom] : check command-line and exit without building | disabled
[-y|--deploy] : deploy executables and dylibs, including Qt's Frameworks | disabled
[-Y|--DEPLOY] : deploy executables and dylibs for those who built KLayout | disabled
: from the source code and use the tools in the same machine |
: ! After confirmation of 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> |
: optionally with [-v|--verbose <0-3>] |
: from the source code and use the tools in the same machine |
: ! 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> |
: optionally with [-v|--verbose <0-3>] |
[-v|--verbose <0-3>] : verbose level of `macdeployqt' (effective with -y only) | 1
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
: 0 = no output, 1 = error/warning (default), |
: 2 = normal, 3 = debug |
[-?|--?] : print this usage and exit | disabled
-----------------------------------------------------------------------------------------+---------------
```
@ -178,20 +181,51 @@ $ [python] ./build4mac.py
In this section, the actual file and directory names are those obtained on macOS Catalina.<br>
On different OS, those names differ accordingly.
### 6A. 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
### 6A. Standard build using the OS-bundled Ruby and Python **((Notes))** only for Catalina
0. Install MacPorts, then install Qt5 by
```
$ 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).
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-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).
* "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 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 3.1 and MacPorts Python 3.9
0. Install MacPorts, then install Qt5, Ruby 3.1, and Python 3.9 by
```
$ sudo port install coreutils
$ sudo port install findutils
$ sudo port install qt5
$ sudo port install ruby31
$ sudo port install python38
$ sudo port install py38-pip
$ sudo port install python39
$ sudo port install py39-pip
```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5macports -r mp31 -p mp38
$ ./build4mac.py -q qt5macports -r mp31 -p mp39
```
2. Confirm successful build (it will take about one hour, depending on your machine spec).
3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
@ -199,26 +233,26 @@ $ ./build4mac.py -q qt5macports -r mp31 -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 qt5macports -r mp31 -p mp38 -Y
$ ./build4mac.py -q qt5macports -r mp31 -p mp39 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38`** directory, where
**`LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp39`** directory, where
* "LW-" means this is a lightweight package.
* "qt5MP" means that Qt5 from MacPorts is used.
* "Rmp31Pmp38" means that Ruby is 3.1 from MacPorts; Python is 3.8 from MacPorts.
* "Rmp31Pmp39" means that Ruby is 3.1 from MacPorts; Python is 3.9 from MacPorts.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6B. 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
### 6C. Fully Homebrew-flavored build with Homebrew Ruby 3.1 and Homebrew Python 3.9
0. Install Homebrew, then install Qt5, Ruby 3.1, and Python 3.9 by
```
$ brew install qt@5
$ brew install ruby@3.1
$ brew install python@3.8
$ brew install python@3.9
```
1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default for Big Sur and Monterey.
1. Invoke **`build4mac.py`** with the following options: **((Notes))** These options are the default for Big Sur, Monterey, and Ventura.
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r hb31 -p hb38
$ ./build4mac.py -q qt5brew -r hb31 -p hb39
```
2. Confirm successful build (it will take about one hour, depending on your machine spec).
3. Rerun **`build4mac.py`** with the same options used in 1. PLUS "-Y" to deploy executables and libraries under **`klayout.app`** bundle.<br>
@ -226,47 +260,47 @@ $ ./build4mac.py -q qt5brew -r hb31 -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 qt5brew -r hb31 -p hb38 -Y
$ ./build4mac.py -q qt5brew -r hb31 -p hb39 -Y
```
The application bundle **`klayout.app`** is located under:<br>
**`LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb38`** directory, where
**`LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb39`** directory, where
* "LW-" means this is a lightweight package.
* "qt5Brew" means that Qt5 from Homebrew is used.
* "Rhb31Phb38" means that Ruby is 3.1 from Homebrew; Python is 3.8 from Homebrew.
* "Rhb31Phb39" means that Ruby is 3.1 from Homebrew; Python is 3.9 from Homebrew.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
### 6C. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.8
0. Install Homebrew, then install Qt5 and Python 3.8 by
### 6D. Partially Homebrew-flavored build with System Ruby and Homebrew Python 3.9
0. Install Homebrew, then install Qt5 and Python 3.9 by
```
$ brew install qt@5
$ brew install python@3.8
$ brew install python@3.9
```
1. Invoke **`build4mac.py`** with the following options:
```
$ cd /where/'build.sh'/exists
$ ./build4mac.py -q qt5brew -r sys -p hb38
$ ./build4mac.py -q qt5brew -r sys -p hb39
```
2. Confirm successful build (it will take about one hour, depending on your machine spec).
3. Rerun **`build4mac.py`** 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 qt5brew -r sys -p hb38 -y
$ ./build4mac.py -q qt5brew -r sys -p hb39 -y
```
The application bundle **`klayout.app`** is located under:<br>
**`HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb38`** directory, where
**`HW-qt5Brew.pkg.macos-Catalina-release-RsysPhb39`** directory, where
* "HW-" means 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.
* "RsysPhb39" means that Ruby is OS-bundled; Python is 3.9 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.
### 6D. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.1 and Anaconda3 Python 3.8
### 6E. Fully Anaconda3-flavored build with Anaconda3 Ruby 3.1 and Anaconda3 Python 3.9
0. Install Anaconda3, then install Ruby 3.1 by
```
$ conda install ruby
$ conda install ruby=3.1.2
```
1. Invoke **`build4mac.py`** with the following options:
```
@ -285,21 +319,21 @@ $ ./build4mac.py -q qt5ana3 -r ana3 -p ana3 -Y
**`LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3`** directory, where
* "LW-" means this is a lightweight package.
* "qt5Ana3" means that Qt5 from Anaconda3 is used.
* "Rana3Pana3" means that Ruby (3.1) is from Anaconda3; Python (3.8) is from Anaconda3.
* "Rana3Pana3" means that Ruby (3.1) is from Anaconda3; Python (3.9) is from Anaconda3.
4. Copy/move the generated application bundle **`klayout.app`** to your **`/Applications`** directory for installation.
5. You may have to set the `PYTHONHOME` environment variable like:
```
export PYTHONHOME=$HOME/opt/anaconda3
```
### 6E. Other combinations
Logically, several module combinations other than 6A through 6D are possible, including `nil` choice.<br>
### 6F. Other combinations
Logically, several 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.
----
# 7. Making a DMG installer
You can make a DMG installer using another Python script **`makeDMG4mac.py`**.
You can make a DMG installer using another Python script **`makeDMG4mac.py`**.<br>
This script requires a directory generated by **`build4mac.py`** with the [-y|-Y] option (refer to 6A through 6D).
1. Make a symbolic link (if it does not exist) from the parent directory (where **`build.sh`** exists) to **`makeDMG4mac.py`**, that is,
@ -309,11 +343,11 @@ makeDMG4mac.py -> macbuild/makeDMG4mac.py
2. Invoke **`makeDMG4mac.py`** with -p and -m options, for example,
```
$ cd /where/'build.sh'/exists
$ ./makeDMG4mac.py -p LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38 -m
$ ./makeDMG4mac.py -p LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp39 -m
```
This command will generate the two files below:<br>
* **`LW-klayout-0.28.2-macOS-Catalina-1-qt5MP-Rmp31Pmp38.dmg`** ---(1) the main DMG file
* **`LW-klayout-0.28.2-macOS-Catalina-1-qt5MP-Rmp31Pmp38.dmg.md5`** ---(2) MD5-value text file
* **`LW-klayout-0.28.3-macOS-Catalina-1-qt5MP-Rmp31Pmp39.dmg`** ---(1) the main DMG file
* **`LW-klayout-0.28.3-macOS-Catalina-1-qt5MP-Rmp31Pmp39.dmg.md5`** ---(2) MD5-value text file
# Known issues
Because we assume some specific versions of non-OS-standard Ruby and Python, updating MacPorts, Homebrew, or Anaconda3 may cause build- and link errors.<br>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 206 KiB

After

Width:  |  Height:  |  Size: 209 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 KiB

After

Width:  |  Height:  |  Size: 208 KiB

View File

@ -33,21 +33,21 @@ from build4mac_util import *
# @return (usage, moduleset)-tuple
#-------------------------------------------------------------------------------
def GenerateUsage(platform):
if platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
if platform.upper() in [ "VENTURA", "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
myQt56 = "qt5brew"
myRuby = "hb31"
myPython = "hb38"
moduleset = ('qt5Brew', 'HB31', 'HB38')
else: # with Xcode [ .. 12.4]; 'sys' for Python has been abolished in 0.28
myPython = "hb39"
moduleset = ('qt5Brew', 'HB31', 'HB39')
else: # with Xcode [ .. 12.4]; 'sys' for Python has been restored in 0.28.3
myQt56 = "qt5macports"
myRuby = "mp31"
myPython = "mp38"
moduleset = ('qt5MP', 'MP31', 'MP38')
myRuby = "sys"
myPython = "sys"
moduleset = ('qt5MP', 'Sys', 'Sys')
usage = "\n"
usage += "---------------------------------------------------------------------------------------------------------\n"
usage += "<< Usage of 'build4mac.py' >>\n"
usage += " for building KLayout 0.28 or later on different Apple macOS / Mac OSX platforms.\n"
usage += " for building KLayout 0.28.3 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"
@ -66,12 +66,14 @@ def GenerateUsage(platform):
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', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython
usage += " : HB39', 'HBAuto'] | \n"
usage += " [-p|--python <type>] : case-insensitive type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', | %s \n" % myPython
usage += " : 'MP39', HB39', 'HBAuto'] | \n"
usage += " : nil: don't bind Python | \n"
usage += " : Sys: use OS-bundled Python 2.7 up to 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 += " : Ana3: use Python 3.9 from Anaconda3 | \n"
usage += " : MP39: use Python 3.9 from MacPorts | \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"
@ -112,7 +114,9 @@ def Get_Default_Config():
sys.exit(1)
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
if release == 21:
if release == 22:
Platform = "Ventura"
elif release == 21:
Platform = "Monterey"
elif release == 20:
Platform = "BigSur"
@ -134,7 +138,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 in ["Ventura", "Monterey", "BigSur"]: # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -148,10 +152,14 @@ def Get_Default_Config():
Usage, ModuleSet = GenerateUsage(Platform)
# Set the default modules
if Platform == "Monterey":
if Platform == "Ventura":
ModuleQt = "Qt5Brew"
ModuleRuby = "RubyMonterey"
ModulePython = "PythonMonterey"
ModuleRuby = "Ruby31Brew"
ModulePython = "Python38Brew"
elif Platform == "Monterey":
ModuleQt = "Qt5Brew"
ModuleRuby = "Ruby31Brew"
ModulePython = "Python38Brew"
elif Platform == "BigSur":
ModuleQt = "Qt5Brew"
ModuleRuby = "RubyBigSur"
@ -302,7 +310,7 @@ def ApplyPatch2KLayoutQtPri4Ruby3(config):
# (A) Check Platform
#----------------------------------------------------------------
Platform = config['Platform']
if Platform in [ "Monterey" ]:
if Platform in [ "Ventura", "Monterey" ]:
return
elif Platform in [ "BigSur", "Catalina" ]: # take care
pass
@ -386,7 +394,7 @@ def Parse_CLI_Args(config):
p.add_option( '-p', '--python',
dest='type_python',
help="Python type=['nil', 'MP38', 'HB38', 'Ana3', 'HB39', 'HBAuto']" )
help="Python type=['nil', 'Sys', 'MP38', 'HB38', 'Ana3', 'MP39', 'HB39', 'HBAuto']" )
p.add_option( '-P', '--buildPymod',
action='store_true',
@ -444,10 +452,10 @@ def Parse_CLI_Args(config):
default=False,
help='check usage' )
if Platform.upper() in [ "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
if Platform.upper() in [ "VENTURA", "MONTEREY", "BIGSUR" ]: # with Xcode [13.1 .. ]
p.set_defaults( type_qt = "qt5brew",
type_ruby = "hb31",
type_python = "hb38",
type_python = "hb39",
build_pymod = False,
no_qt_binding = False,
no_qt_uitools = False,
@ -460,8 +468,8 @@ def Parse_CLI_Args(config):
checkusage = False )
else: # with Xcode [ .. 12.4]
p.set_defaults( type_qt = "qt5macports",
type_ruby = "mp31",
type_python = "mp38",
type_ruby = "sys",
type_python = "sys",
build_pymod = False,
no_qt_binding = False,
no_qt_uitools = False,
@ -528,7 +536,9 @@ def Parse_CLI_Args(config):
ModuleRuby = 'nil'
elif choiceRuby == "Sys":
choiceRuby = "Sys"
if Platform == "Monterey":
if Platform == "Ventura":
ModuleRuby = 'RubyVentura'
elif Platform == "Monterey":
ModuleRuby = 'RubyMonterey'
elif Platform == "BigSur":
ModuleRuby = 'RubyBigSur'
@ -561,10 +571,11 @@ def Parse_CLI_Args(config):
# (C) Determine the Python type
candidates = dict()
candidates['NIL'] = 'nil'
# candidates['SYS'] = 'Sys' # has been abolished in 0.28
candidates['SYS'] = 'Sys' # has been restored in 0.28.3
candidates['MP38'] = 'MP38'
candidates['HB38'] = 'HB38'
candidates['ANA3'] = 'Ana3'
candidates['MP39'] = 'MP39'
candidates['HB39'] = 'HB39'
candidates['HBAUTO'] = 'HBAuto'
try:
@ -577,10 +588,8 @@ def Parse_CLI_Args(config):
if choicePython == "nil":
ModulePython = 'nil'
elif choicePython == "Sys":
if Platform == "Monterey":
ModulePython = 'PythonMonterey'
elif Platform == "BigSur":
ModulePython = 'PythonBigSur'
if Platform in [ "Ventura", "Monterey", "BigSur" ]:
raise Exception( "! Cannot choose the 'sys' Python on <%s>" % Platform )
elif Platform == "Catalina":
ModulePython = 'PythonCatalina'
elif Platform == "Mojave":
@ -600,6 +609,8 @@ def Parse_CLI_Args(config):
elif choicePython == "Ana3":
ModulePython = 'PythonAnaconda3'
NonOSStdLang = True
elif choicePython == "MP39":
ModulePython = 'Python39MacPorts'
elif choicePython == "HB39":
ModulePython = 'Python39Brew'
NonOSStdLang = True
@ -832,9 +843,9 @@ def Get_Build_Parameters(config):
parameters['ModulePython'] = ModulePython
PymodDistDir = dict()
if Platform in [ 'Monterey', 'BigSur', 'Catalina' ]:
if Platform in [ 'Ventura', 'Monterey', 'BigSur', 'Catalina' ]:
if ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]:
if ModulePython in ['Python38MacPorts']:
if ModulePython in [ 'Python38MacPorts', 'Python39MacPorts' ]:
PymodDistDir[ModulePython] = 'dist-MP3'
elif ModulePython in [ 'Python38Brew', 'Python39Brew', 'PythonAutoBrew' ]:
PymodDistDir[ModulePython] = 'dist-HB3'
@ -855,10 +866,10 @@ def Build_pymod(parameters):
#---------------------------------------------------------------------------
# [1] <pymod> will be built if:
# BuildPymod = True
# Platform = [ 'Monterey', 'BigSur', 'Catalina' ]
# Platform = [ 'Ventura', 'Monterey', 'BigSur', 'Catalina' ]
# ModuleRuby = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
# ModulePython = [ 'Python38MacPorts', 'Python38Brew',
# 'PythonAnaconda3', 'Python39Brew', 'PythonAutoBrew' ]
# ModulePython = [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3',
# 'Python39MacPorts', 'Python39Brew', 'PythonAutoBrew' ]
#---------------------------------------------------------------------------
BuildPymod = parameters['BuildPymod']
Platform = parameters['Platform']
@ -866,11 +877,12 @@ def Build_pymod(parameters):
ModulePython = parameters['ModulePython']
if not BuildPymod:
return 0
if not Platform in [ 'Monterey', 'BigSur', 'Catalina' ]:
if not Platform in [ 'Ventura', 'Monterey', 'BigSur', 'Catalina' ]:
return 0
elif not ModuleRuby in [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]:
return 0
elif not ModulePython in [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', 'Python39Brew', 'PythonAutoBrew' ]:
elif not ModulePython in [ 'Python38MacPorts', 'Python38Brew', 'PythonAnaconda3', \
'Python39MacPorts', 'Python39Brew', 'PythonAutoBrew' ]:
return 0
#--------------------------------------------------------------------
@ -882,14 +894,18 @@ def Build_pymod(parameters):
# Using MacPorts
if PymodDistDir[ModulePython] == 'dist-MP3':
addIncPath = "/opt/local/include"
addLibPath = "/opt/local/lib"
# Using Homebrew
elif PymodDistDir[ModulePython] == 'dist-HB3':
addIncPath = "%s/include" % DefaultHomebrewRoot # defined in "build4mac_env.py"
# Using Anaconda3
addLibPath = "%s/lib" % DefaultHomebrewRoot # defined in "build4mac_env.py"
elif PymodDistDir[ModulePython] == 'dist-ana3':
addIncPath = "/Applications/anaconda3/include"
addLibPath = "/Applications/anaconda3/lib"
else:
addIncPath = ""
addLibPath = ""
if not addIncPath == "":
try:
cpath = os.environ['CPATH']
@ -898,6 +914,14 @@ def Build_pymod(parameters):
else:
os.environ['CPATH'] = "%s:%s" % (addIncPath, cpath)
if not addLibPath == "":
try:
ldpath = os.environ['LDFLAGS']
except KeyError:
os.environ['LDFLAGS'] = '-L%s' % addLibPath
else:
os.environ['LDFLAGS'] = '-L%s %s' % (addLibPath, ldpath)
#--------------------------------------------------------------------
# [3] Set different command line parameters for building <pymod>
#--------------------------------------------------------------------
@ -1542,13 +1566,17 @@ def Deploy_Binaries_For_Bundle(config, parameters):
# drwxr-xr-x 4 kazzz-s admin 128 12 16 21:40 Versions
#-----------------------------------------------------------------------------------------------
deploymentPython38HB = (ModulePython == 'Python38Brew')
deploymentPython39HB = (ModulePython == 'Python39Brew')
deploymentPythonAutoHB = (ModulePython == 'PythonAutoBrew')
if (deploymentPython38HB or deploymentPythonAutoHB) and NonOSStdLang:
if (deploymentPython38HB or deploymentPython39HB or deploymentPythonAutoHB) and NonOSStdLang:
from build4mac_util import WalkFrameworkPaths, PerformChanges
if deploymentPython38HB:
HBPythonFrameworkPath = HBPython38FrameworkPath
pythonHBVer = "3.8" # 'pinned' to this version as of KLayout version 0.26.7 (2020-09-13)
elif deploymentPython39HB:
HBPythonFrameworkPath = HBPython39FrameworkPath
pythonHBVer = "3.9" # 'pinned' to this version as of KLayout version 0.28.2 (2023-01-02)
elif deploymentPythonAutoHB:
HBPythonFrameworkPath = HBPythonAutoFrameworkPath
pythonHBVer = HBPythonAutoVersion

View File

@ -84,7 +84,7 @@ Qt6Brew = { 'qmake' : '%s/opt/qt@6/bin/qmake' % DefaultHomebrewRoot,
#-----------------------------------------------------
RubyNil = [ 'nil' ]
RubySys = [ 'RubyElCapitan', 'RubySierra', 'RubyHighSierra', 'RubyMojave' ]
RubySys += [ 'RubyCatalina', 'RubyBigSur', 'RubyMonterey' ]
RubySys += [ 'RubyCatalina', 'RubyBigSur', 'RubyMonterey', 'RubyVentura' ]
RubyExt = [ 'Ruby31MacPorts', 'Ruby31Brew', 'RubyAnaconda3' ]
Rubies = RubyNil + RubySys + RubyExt
@ -174,6 +174,16 @@ RubyMonterey = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % MontereySDK
}
# Bundled with Ventura (14.x)
# Refer to the "Catalina" section above
# [Key Type Name] = 'Sys'
VenturaSDK = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
RubyVentura = { 'exe': '/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby',
'inc': '%s/System/Library/Frameworks/Ruby.framework/Headers' % VenturaSDK,
'inc2': '%s/System/Library/Frameworks/Ruby.framework/Headers/ruby' % VenturaSDK,
'lib': '%s/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/libruby.tbd' % VenturaSDK
}
# Ruby 3.1 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# install with 'sudo port install ruby31'
# [Key Type Name] = 'MP31'
@ -210,6 +220,7 @@ RubyDictionary = { 'nil' : None,
'RubyCatalina' : RubyCatalina,
'RubyBigSur' : RubyBigSur,
'RubyMonterey' : RubyMonterey,
'RubyVentura' : RubyVentura,
'Ruby31MacPorts': Ruby31MacPorts,
'Ruby31Brew' : Ruby31Brew,
'RubyAnaconda3' : RubyAnaconda3
@ -221,7 +232,8 @@ RubyDictionary = { 'nil' : None,
PythonNil = [ 'nil' ]
PythonSys = [ 'PythonElCapitan', 'PythonSierra', 'PythonHighSierra', 'PythonMojave' ]
PythonSys += [ 'PythonCatalina', 'PythonBigSur', 'PythonMonterey' ]
PythonExt = [ 'Python38MacPorts', 'Python38Brew', 'Python39Brew', 'PythonAnaconda3', 'PythonAutoBrew' ]
PythonExt = [ 'Python38MacPorts', 'Python39MacPorts', 'Python38Brew', 'Python39Brew' ]
PythonExt += [ 'PythonAnaconda3', 'PythonAutoBrew' ]
Pythons = PythonNil + PythonSys + PythonExt
#-----------------------------------------------------
@ -299,6 +311,14 @@ Python38MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versi
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/libpython3.8.dylib'
}
# Python 3.9 from MacPorts (https://www.macports.org/) *+*+*+ EXPERIMENTAL *+*+*+
# install with 'sudo port install python39'
# [Key Type Name] = 'MP38'
Python39MacPorts= { 'exe': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/bin/python3.9',
'inc': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/include/python3.9',
'lib': '/opt/local/Library/Frameworks/Python.framework/Versions/3.9/lib/libpython3.9.dylib'
}
# Python 3.8 from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
# install with 'brew install python@3.8'
# [Key Type Name] = 'HB38'
@ -321,9 +341,9 @@ Python39Brew = { 'exe': '%s/Versions/3.9/bin/python3.9' % HBPython39Framework
# The standard installation deploys the tool under $HOME/opt/anaconda3/.
# If so, you need to make a symbolic link: /Applications/anaconda3 ---> $HOME/opt/anaconda3/
# [Key Type Name] = 'Ana3'
PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.8',
'inc': '/Applications/anaconda3/include/python3.8',
'lib': '/Applications/anaconda3/lib/libpython3.8.dylib'
PythonAnaconda3 = { 'exe': '/Applications/anaconda3/bin/python3.9',
'inc': '/Applications/anaconda3/include/python3.9',
'lib': '/Applications/anaconda3/lib/libpython3.9.dylib'
}
# Latest Python from Homebrew *+*+*+ EXPERIMENTAL *+*+*+
@ -358,6 +378,7 @@ PythonDictionary = { 'nil' : None,
'PythonBigSur' : PythonBigSur,
'PythonMonterey' : PythonMonterey,
'Python38MacPorts': Python38MacPorts,
'Python39MacPorts': Python39MacPorts,
'Python38Brew' : Python38Brew,
'Python39Brew' : Python39Brew,
'PythonAnaconda3' : PythonAnaconda3

View File

@ -77,7 +77,7 @@ def SetGlobals():
Usage = "\n"
Usage += "---------------------------------------------------------------------------------------------------------\n"
Usage += "<< Usage of 'makeDMG4mac.py' >>\n"
Usage += " for making a DMG file of KLayout 0.28 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += " for making a DMG file of KLayout 0.28.3 or later on different Apple macOS / Mac OSX platforms.\n"
Usage += "\n"
Usage += "$ [python] ./makeDMG4mac.py\n"
Usage += " option & argument : descriptions | default value\n"
@ -105,7 +105,11 @@ def SetGlobals():
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
LatestOS = ""
if release == 21:
if release == 22:
GenOSName = "macOS"
Platform = "Ventura"
LatestOS = Platform
elif release == 21:
GenOSName = "macOS"
Platform = "Monterey"
LatestOS = Platform
@ -137,7 +141,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 in ["Ventura", "Monterey", "BigSur"]: # with an Apple Silicon Chip
print("")
print( "### Your Mac equips an Apple Silicon Chip ###" )
print("")
@ -251,8 +255,9 @@ def CheckPkgDirectory():
print( "" )
return -1
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------------------------
# [2] Identify (Qt, Ruby, Python) from PkgDir
# * ST-qt5MP.pkg.macos-Catalina-release-RsysPsys # 'ST' has been restored in 0.28.3
# * LW-qt5Ana3.pkg.macos-Catalina-release-Rana3Pana3
# * LW-qt5Brew.pkg.macos-Catalina-release-Rhb31Phb38
# * LW-qt5MP.pkg.macos-Catalina-release-Rmp31Pmp38
@ -263,8 +268,8 @@ def CheckPkgDirectory():
# * LW-qt6Brew.pkg.macos-Catalina-release-Rhb31Phb38
# * LW-qt6MP.pkg.macos-Catalina-release-Rmp31Pmp38
# * HW-qt6Brew.pkg.macos-Catalina-release-RsysPhb38
#-----------------------------------------------------------------------------
patQRP = u'(LW|HW|EX)([-])([qt5|qt6][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" )
@ -292,7 +297,7 @@ def CheckPkgDirectory():
LatestOSMacPorts = Platform == LatestOS
LatestOSMacPorts &= PackagePrefix == "LW"
LatestOSMacPorts &= QtIdentification in ["qt5MP", "qt6MP"]
LatestOSMacPorts &= RubyPythonID in ["Rmp31Pmp38"]
LatestOSMacPorts &= RubyPythonID in ["Rmp31Pmp38", "Rmp31Pmp39"]
LatestOSHomebrew = Platform == LatestOS
LatestOSHomebrew &= PackagePrefix == "LW"

View File

@ -16,14 +16,16 @@ import subprocess
#
# @return matching platform name on success; "" on failure
#------------------------------------------------------------------------------
def Test_My_Platform( platforms=['Catalina', 'BigSur', 'Monterey' ] ):
def Test_My_Platform( platforms=[ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ] ):
(System, Node, Release, MacVersion, Machine, Processor) = platform.uname()
if not System == "Darwin":
return ""
release = int( Release.split(".")[0] ) # take the first of ['19', '0', '0']
if release == 21:
if release == 22:
Platform = "Ventura"
elif release == 21:
Platform = "Monterey"
elif release == 20:
Platform = "BigSur"
@ -52,7 +54,7 @@ def Test_My_Platform( platforms=['Catalina', 'BigSur', 'Monterey' ] ):
#------------------------------------------------------------------------------
def Get_Build_Target_Dict():
buildTargetDic = dict()
# buildTargetDic[0] = 'std' # has been abolished in 0.28
buildTargetDic[0] = 'std' # has been restored in 0.28.3
buildTargetDic[1] = 'ports'
buildTargetDic[2] = 'brew'
buildTargetDic[3] = 'brewHW'
@ -81,11 +83,11 @@ 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', '%sMacPorts' % qtType, '-r', 'sys', '-p', 'sys' ]
elif target == "ports":
buildOp["ports"] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP31', '-p', 'MP38' ]
buildOp["ports"] = [ '-q', '%sMacPorts' % qtType, '-r', 'MP31', '-p', 'MP39' ]
elif target == "brew":
buildOp["brew"] = [ '-q', '%sBrew' % qtType, '-r', 'HB31', '-p', 'HB38' ]
buildOp["brew"] = [ '-q', '%sBrew' % qtType, '-r', 'HB31', '-p', 'HB39' ]
elif target == "brewHW":
buildOp["brewHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB38' ]
buildOp["brewHW"] = [ '-q', '%sBrew' % qtType, '-r', 'sys', '-p', 'HB39' ]
elif target == "ana3":
buildOp["ana3"] = [ '-q', '%sAna3' % qtType, '-r', 'Ana3', '-p', 'Ana3' ]
elif target == "brewA":
@ -119,11 +121,11 @@ def Get_QAT_Directory( targetDic, platform ):
if target == "std":
dirQAT["std"] = '%sMP.build.macos-%s-release-RsysPsys.macQAT' % (qtType, platform)
elif target == "ports":
dirQAT["ports"] = '%sMP.build.macos-%s-release-Rmp31Pmp38.macQAT' % (qtType, platform)
dirQAT["ports"] = '%sMP.build.macos-%s-release-Rmp31Pmp39.macQAT' % (qtType, platform)
elif target == "brew":
dirQAT["brew"] = '%sBrew.build.macos-%s-release-Rhb31Phb38.macQAT' % (qtType, platform)
dirQAT["brew"] = '%sBrew.build.macos-%s-release-Rhb31Phb39.macQAT' % (qtType, platform)
elif target == "brewHW":
dirQAT["brewHW"] = '%sBrew.build.macos-%s-release-RsysPhb38.macQAT' % (qtType, platform)
dirQAT["brewHW"] = '%sBrew.build.macos-%s-release-RsysPhb39.macQAT' % (qtType, platform)
elif target == "ana3":
dirQAT["ana3"] = '%sAna3.build.macos-%s-release-Rana3Pana3.macQAT' % (qtType, platform)
elif target == "brewA":
@ -160,13 +162,13 @@ def Get_Package_Options( targetDic, platform, srlDMG, makeflag ):
packOp["std"] = [ '-p', 'ST-%sMP.pkg.macos-%s-release-RsysPsys' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ports":
packOp["ports"] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp31Pmp38' % (qtType, platform),
packOp["ports"] = [ '-p', 'LW-%sMP.pkg.macos-%s-release-Rmp31Pmp39' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brew":
packOp["brew"] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb31Phb38' % (qtType, platform),
packOp["brew"] = [ '-p', 'LW-%sBrew.pkg.macos-%s-release-Rhb31Phb39' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "brewHW":
packOp["brewHW"] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb38' % (qtType, platform),
packOp["brewHW"] = [ '-p', 'HW-%sBrew.pkg.macos-%s-release-RsysPhb39' % (qtType, platform),
'-s', '%d' % srlDMG, '%s' % flag ]
elif target == "ana3":
packOp["ana3"] = [ '-p', 'LW-%sAna3.pkg.macos-%s-release-Rana3Pana3' % (qtType, platform),
@ -195,25 +197,24 @@ def Parse_CommandLine_Arguments():
global Upload # operation flag
global SrlDMG # DMG serial number
global Dropbox # Dropbox directory
global DryRun # True for dry-run
platform = Test_My_Platform()
if platform in [ "Monterey", "BigSur" ]:
targetopt = "1,2,3,4"
elif platform in ["Catalina"]:
if platform in [ "Ventura", "Monterey", "BigSur" ]:
targetopt = "1,2,3,4"
else:
targetopt = ""
targetopt = "0,1,2,3,4"
Usage = "\n"
Usage += "--------------------------------------------------------------------------------------------------\n"
Usage += "----------------------------------------------------------------------------------------------------------\n"
Usage += " nightlyBuild.py [EXPERIMENTAL] \n"
Usage += " << To execute the jobs for making KLayout's DMGs for macOS Catalina, Big Sur, or Monterey >>\n"
Usage += " << To execute the jobs for making KLayout's DMGs for macOS Catalina, Big Sur, Monterey, or Ventura >>\n"
Usage += "\n"
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>] : 1='ports', 2='brew', 3='brewHW', 4='ana3', | '%s'\n" % targetopt
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"
@ -222,6 +223,7 @@ def Parse_CommandLine_Arguments():
Usage += " [--check] : check the QA Test results | disabled\n"
Usage += " [--makedmg|--cleandmg <srlno>] : make or clean DMGs | disabled\n"
Usage += " [--upload <dropbox>] : upload DMGs to $HOME/Dropbox/klayout/<dropbox> | disabled\n"
Usage += " [--dryrun] : dry-run for --build option | disabled\n"
Usage += " [-?|--?] : print this usage and exit | disabled\n"
Usage += " | \n"
Usage += " To use this script, make a symbolic link in the project root by: | \n"
@ -235,7 +237,7 @@ def Parse_CommandLine_Arguments():
Usage += " (5) $ ./nightlyBuild.py --makedmg 1 | \n"
Usage += " (6) $ ./nightlyBuild.py --upload '0.28.2' | \n"
Usage += " (7) $ ./nightlyBuild.py --cleandmg 1 | \n"
Usage += "---------------------------------------------------------------------------+----------------------\n"
Usage += "---------------------------------------------------------------------------+------------------------------\n"
p = optparse.OptionParser( usage=Usage )
p.add_option( '--qt',
@ -282,6 +284,12 @@ def Parse_CommandLine_Arguments():
dest='upload',
help='upload to Dropbox' )
p.add_option( '--dryrun',
action='store_true',
dest='dry_run',
default=False,
help='dry-run' )
p.add_option( '-?', '--??',
action='store_true',
dest='checkusage',
@ -297,6 +305,7 @@ def Parse_CommandLine_Arguments():
makedmg = "",
cleandmg = "",
upload = "",
dry_run = False,
checkusage = False )
opt, args = p.parse_args()
@ -304,9 +313,9 @@ def Parse_CommandLine_Arguments():
print(Usage)
quit()
myPlatform = Test_My_Platform( ['Catalina', 'BigSur', 'Monterey' ] )
myPlatform = Test_My_Platform( [ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ] )
if myPlatform == "":
print( "! Current platform is not ['Catalina', 'BigSur', 'Monterey' ]" )
print( "! Current platform is not [ 'Catalina', 'BigSur', 'Monterey', 'Ventura' ]" )
print(Usage)
quit()
@ -316,10 +325,15 @@ def Parse_CommandLine_Arguments():
print(Usage)
quit()
targetIdx = list()
for target in [ int(item) for item in opt.targets.split(",") ]:
if not target in targetIdx:
targetIdx.append(target) # first appeared and non-duplicated index
targetDic = Get_Build_Target_Dict()
Target = list()
for idx in sorted( list( set( [ int(item) for item in opt.targets.split(",") ] ) ) ):
if idx in range(1, 7): # '0' has been abolished in 0.28
for idx in targetIdx:
if idx in range(0, 7): # '0' has been restored in 0.28.3
Target.append( targetDic[idx] )
Build = opt.build
@ -329,6 +343,7 @@ def Parse_CommandLine_Arguments():
MakeDMG = False
CleanDMG = False
Upload = False
DryRun = opt.dry_run
if not opt.makedmg == "":
MakeDMG = True
@ -360,7 +375,7 @@ 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
if key == "ana3" and QtType == 6: # anaconda3 does not provide Qt6 so far
continue
command1 = [ pyBuilder ] + buildOp[key]
@ -368,9 +383,13 @@ def Build_Deploy():
command2 = [ pyBuilder ] + buildOp[key] + ['-y']
else:
command2 = [ pyBuilder ] + buildOp[key] + ['-Y']
print(command1)
print(command2)
#continue
if DryRun:
print( "### Target = <%s> ###" % key )
print(command1)
print(command2)
print( "" )
continue
if subprocess.call( command1, shell=False ) != 0:
print( "", file=sys.stderr )

View File

@ -85,6 +85,7 @@ static const char *cm_symbols[] = {
"cm_cancel",
"cm_redraw",
"cm_screenshot",
"cm_screenshot_to_clipboard",
"cm_save_layer_props",
"cm_load_layer_props",
"cm_save_bookmarks",

View File

@ -36,6 +36,7 @@
#include <QDateTime>
#include <QUrl>
#include <QMimeData>
#include <QClipboard>
#if defined(__APPLE__) && (QT_VERSION < 0x050401)
// A workaround for the issue of Qt 4.8.x when handling "File Reference URL" in OSX
@ -2162,6 +2163,18 @@ MainWindow::cm_screenshot ()
}
}
void
MainWindow::cm_screenshot_to_clipboard ()
{
if (current_view ()) {
QImage screenshot = current_view ()->get_screenshot ();
QClipboard *clipboard = QGuiApplication::clipboard();
clipboard->setImage(screenshot);
} else {
throw tl::Exception (tl::to_string (QObject::tr ("No view open to create a screenshot from")));
}
}
void
MainWindow::cm_save_current_cell_as ()
{
@ -3939,6 +3952,8 @@ MainWindow::menu_activated (const std::string &symbol)
cm_load_bookmarks ();
} else if (symbol == "cm_screenshot") {
cm_screenshot ();
} else if (symbol == "cm_screenshot_to_clipboard") {
cm_screenshot_to_clipboard ();
} else if (symbol == "cm_save_current_cell_as") {
cm_save_current_cell_as ();
} else if (symbol == "cm_save") {
@ -4297,6 +4312,7 @@ public:
menu_entries.push_back (lay::menu_item ("cm_setup", "setup:edit", at, tl::to_string (QObject::tr ("Setup"))));
menu_entries.push_back (lay::separator ("misc_group", at));
menu_entries.push_back (lay::menu_item ("cm_screenshot", "screenshot:edit", at, tl::to_string (QObject::tr ("Screenshot(Print)"))));
menu_entries.push_back (lay::menu_item ("cm_screenshot_to_clipboard", "screenshot_to_clipboard:edit", at, tl::to_string (QObject::tr ("Screenshot to clipboard"))));
menu_entries.push_back (lay::menu_item ("cm_layout_props", "layout_props:edit", at, tl::to_string (QObject::tr ("Layout Properties"))));
menu_entries.push_back (lay::menu_item ("cm_layout_stats", "layout_stats:edit", at, tl::to_string (QObject::tr ("Layout Statistics"))));
menu_entries.push_back (lay::separator ("layer_group", at));

View File

@ -780,6 +780,7 @@ private:
void cm_save_bookmarks ();
void cm_load_bookmarks ();
void cm_screenshot ();
void cm_screenshot_to_clipboard ();
void cm_save_current_cell_as ();
void cm_save ();
void cm_save_as ();

View File

@ -74,25 +74,35 @@ void check_error ()
if (PyErr_GivenExceptionMatches (exc_type.get (), PyExc_SyntaxError) && PyTuple_Check (exc_value.get ()) && PyTuple_Size (exc_value.get ()) >= 2) {
const char *sourcefile = 0;
std::string sourcefile_arg;
int line = 0;
std::string msg;
std::string msg = "syntax error (could not parse exception)";
const char *msg_arg = 0, *sourcefile_arg = 0, *text_arg = 0;
int line_arg = 0, column_arg = 0;
if (exc_value && PyArg_ParseTuple (exc_value.get (), "s(siis)", &msg_arg, &sourcefile_arg, &line_arg, &column_arg, &text_arg)) {
try {
// build a Ruby-like message
msg = sourcefile_arg;
msg += ":";
msg += tl::to_string (line_arg);
msg += ": ";
msg += msg_arg;
if (exc_value && PyTuple_Check (exc_value.get ()) && PyTuple_Size (exc_value.get ()) >= 2) {
sourcefile = sourcefile_arg;
line = line_arg;
std::string msg_arg = python2c<std::string> (PyTuple_GetItem (exc_value.get (), 0));
} else {
msg = "syntax error";
PyObject *args = PyTuple_GetItem (exc_value.get (), 1);
if (PyTuple_Check (args) && PyTuple_Size (args) >= 3) {
sourcefile_arg = python2c<std::string> (PyTuple_GetItem (args, 0));
sourcefile = sourcefile_arg.c_str ();
line = python2c<int> (PyTuple_GetItem (args, 1));
// Not used: column_arg = python2c<int> (PyTuple_GetItem (args, 2);
}
// build a Ruby-like message
msg = sourcefile_arg;
msg += ":";
msg += tl::to_string (line);
msg += ": ";
msg += msg_arg;
}
} catch (...) {
// ignore exceptions here
}
if (! backtrace.empty () && ! sourcefile) {