Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

misc: add klayout #268

Merged
merged 1 commit into from
Dec 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exit 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

filed #269 since this seems more widespread.

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log a github issue to get this upstream

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suspect @klayoutmatthias link statically intentionally.

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