From 83384baed76ca722105b84f8606db01a1147ea03 Mon Sep 17 00:00:00 2001 From: Johan Euphrosine Date: Wed, 21 Dec 2022 18:03:18 +0900 Subject: [PATCH] misc: add klayout --- .github/workflows/Build.yml | 11 +++ misc/klayout/build.sh | 26 +++++++ misc/klayout/force-python-dynamic-link.patch | 53 ++++++++++++++ misc/klayout/meta.yaml | 77 ++++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 misc/klayout/build.sh create mode 100644 misc/klayout/force-python-dynamic-link.patch create mode 100644 misc/klayout/meta.yaml diff --git a/.github/workflows/Build.yml b/.github/workflows/Build.yml index f42e21f01..a8d6c1903 100644 --- a/.github/workflows/Build.yml +++ b/.github/workflows/Build.yml @@ -740,3 +740,14 @@ jobs: steps: - uses: actions/checkout@v3 - uses: ./ci + + #66 + klayout-linux-py37: + runs-on: "ubuntu-20.04" + env: + PACKAGE: "misc/klayout" + OS_NAME: "linux" + PYTHON_VERSION: "3.7" + steps: + - uses: actions/checkout@v3 + - uses: ./ci diff --git a/misc/klayout/build.sh b/misc/klayout/build.sh new file mode 100644 index 000000000..fae4acf34 --- /dev/null +++ b/misc/klayout/build.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +set -e +set -x + +# Identify OS +UNAME_OUT="$(uname -s)" +case "${UNAME_OUT}" in + Linux*) OS=Linux;; + *) OS="${UNAME_OUT}" + echo "Unknown OS: ${OS}" + exit;; +esac + +cd ${SRC_DIR} +./build.sh -build "${SRC_DIR}/build" -python "${PYTHON}" -expert -without-qtbinding -libpng -libexpat -dry-run + +cd ${SRC_DIR}/build +make V=1 -j$CPU_COUNT +make V=1 install + +cd ${SRC_DIR}/bin-release +cp -a klayout strm* ${PREFIX}/bin/ +cp -a *.so* ${PREFIX}/lib/ +mkdir -p ${PREFIX}/lib/klayout/ +cp -ar pymod *_plugins ${PREFIX}/lib/klayout/ diff --git a/misc/klayout/force-python-dynamic-link.patch b/misc/klayout/force-python-dynamic-link.patch new file mode 100644 index 000000000..ea5dfd558 --- /dev/null +++ b/misc/klayout/force-python-dynamic-link.patch @@ -0,0 +1,53 @@ +diff --git a/build.sh b/build.sh +index e49c132e5..a035474bc 100755 +--- a/build.sh ++++ b/build.sh +@@ -412,35 +412,8 @@ if [ "$PYTHON" != "" ] && [ "$PYTHON" != "-" ]; then + + # Get Python installation files + if [ "$PYTHONLIBFILE" = "" ]; then +- PYTHONLIBFILENAME=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_vars('LDLIBRARY')[0])" 2>/dev/null` +- if [ "$PYTHONLIBFILENAME" = "" ]; then +- PYTHONLIBFILENAME=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_vars('LIBRARY')[0])" 2>/dev/null` +- fi +- if [ "$PYTHONLIBFILENAME" = "" ]; then +- PYTHONLIBFILENAME=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_vars('LDLIBRARY')[0])" 2>/dev/null` +- fi +- if [ "$PYTHONLIBFILENAME" = "" ]; then +- PYTHONLIBFILENAME=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_vars('LIBRARY')[0])" 2>/dev/null` +- fi +- if [ "$PYTHONLIBFILENAME" = "" ]; then +- echo "*** WARNING: Could not get Python library name" +- else +- PYTHONLIBFILEPATH=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_vars('LIBDIR')[0])" 2>/dev/null` +- if [ "$PYTHONLIBFILEPATH" = "" ]; then +- PYTHONLIBFILEPATH=`$PYTHON -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_vars('LIBDIR')[0])" 2>/dev/null` +- fi +- if [ "$PYTHONLIBFILEPATH" = "" ]; then +- echo "*** WARNING: Could not get Python library path" +- else +- PYTHONLIBFILE="$PYTHONLIBFILEPATH/$PYTHONLIBFILENAME" +- if [ ! -f "$PYTHONLIBFILE" ]; then +- echo " INFO: Python library not in default path, trying to use MULTIARCH" +- PYTHONMULTIARCH=`$PYTHON -c "import sysconfig; print(sysconfig.get_config_vars('MULTIARCH')[0])" 2>/dev/null` +- PYTHONLIBFILE="$PYTHONLIBFILEPATH/$PYTHONMULTIARCH/$PYTHONLIBFILENAME" +- fi +- echo " Python library found: $PYTHONLIBFILE" +- fi +- fi ++ PYTHONLIBFILE=-lpython`$PYTHON -c "import sysconfig; print(sysconfig.get_config_vars('LDVERSION')[0])" 2>/dev/null` ++ echo " Python library found: $PYTHONLIBFILE" + fi + + if [ "$PYTHONINCLUDE" = "" ]; then +@@ -537,8 +510,8 @@ if [ "$PYTHONINCLUDE" != "" ]; then + echo "*** ERROR: wrong -pyinc path: $PYTHONINCLUDE/Python does not exist or is not a file" + exit 1 + fi +- if [ ! -f "$PYTHONLIBFILE" ]; then +- echo "*** ERROR: wrong -pylib path: $PYTHONLIBFILE does not exist or not a file" ++ if [[ ! ${PYTHONLIBFILE} == -lpython3* ]]; then ++ echo "*** ERROR: wrong -pylib path: $PYTHONLIBFILE does not look like a python library name" + exit 1 + fi + else diff --git a/misc/klayout/meta.yaml b/misc/klayout/meta.yaml new file mode 100644 index 000000000..2b8f1cfde --- /dev/null +++ b/misc/klayout/meta.yaml @@ -0,0 +1,77 @@ +# Use `conda-build-prepare` before building for a better version string. +{% set version = '%s_%04i_%s'|format(GIT_DESCRIBE_TAG, GIT_DESCRIBE_NUMBER|int, GIT_DESCRIBE_HASH or 'gUNKNOWN') %} + +{% set python_version = PYTHON_VERSION | default('3.7') %} +{% set py_suffix = 'py%s'|format(python_version|replace('.', '')) %} + +package: + name: klayout + version: {{ version }} + +source: + git_url: https://github.com/KLayout/klayout.git + git_rev: master + patches: + - force-python-dynamic-link.patch + +build: + # number: 201803050325 + number: {{ environ.get('DATE_NUM') }} + # string: 20180305_0325_py37 + string: {{ environ.get('DATE_STR') }}_{{ py_suffix }} + script_env: + - CI + - CONDA_OUT + - TEST_PACKAGE + +requirements: + build: + - make + - {{ compiler('cxx') }} + - {{ cdt('mesa-libgl-devel') }} # [linux] + - {{ cdt('mesa-dri-drivers') }} # [linux] + - {{ cdt('libselinux') }} # [linux] + - {{ cdt('libxdamage') }} # [linux] + - {{ cdt('libxxf86vm') }} # [linux] + - {{ cdt('libxext') }} # [linux] + - {{ cdt('libxfixes') }} # [linux] + - {{ cdt('libxau') }} # [linux] + - {{ cdt('libxcb') }} # [linux] + - {{ cdt('expat') }} # [linux] + - {{ cdt('libpng') }} # [linux] + host: + - python {{ python_version }} + - ruby + - qt + - zlib + run: + - python {{ python_version }} + - ruby + - qt + - zlib + +test: + commands: + - klayout -v + +about: + home: https://www.klayout.de/ + summary: 'Your Mask Layout Friend' + description: | + - View: Fast and accurate viewing of huge layout files + - Edit: Draw, modify and transform hierarchical layout + - Generate: Script layout generators, PCells and layout transformation tools + - Analyze: Search, verify, and measure layout and code analysis scripts + license: GPL-2.0-or-later + license_family: GPL + license_file: LICENSE + doc_url: https://www.klayout.de/doc.html + dev_url: https://github.com/KLayout/klayout + +extra: + recipe-maintainers: + - curtisma + - klayoutmatthias + - proppy + - flaport + - joamatab