Skip to content

Commit

Permalink
Merge pull request #268 from proppy/klayout
Browse files Browse the repository at this point in the history
misc: add klayout
  • Loading branch information
proppy authored Dec 23, 2022
2 parents c7b61c5 + 81f3bed commit c8cc9a7
Show file tree
Hide file tree
Showing 4 changed files with 167 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/Build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
26 changes: 26 additions & 0 deletions misc/klayout/build.sh
Original file line number Diff line number Diff line change
@@ -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/
53 changes: 53 additions & 0 deletions misc/klayout/force-python-dynamic-link.patch
Original file line number Diff line number Diff line change
@@ -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
77 changes: 77 additions & 0 deletions misc/klayout/meta.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c8cc9a7

Please sign in to comment.