-
Notifications
You must be signed in to change notification settings - Fork 872
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update manylinux images * FFI now built as a per-platform static library * Explicitly set minimum macOS deployment target * Try enabling Windows (as an experiment) * Disable aarch64-linux, aarch64-windows
- Loading branch information
Showing
5 changed files
with
129 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/usr/bin/env python3 | ||
# Copyright (C) 2024 Efabless Corporation | ||
# | ||
# Permission to use, copy, modify, and/or distribute this software for any | ||
# purpose with or without fee is hereby granted, provided that the above | ||
# copyright notice and this permission notice appear in all copies. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | ||
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | ||
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | ||
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | ||
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | ||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | ||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | ||
""" | ||
This runs the cibuildwheel step from the wheels workflow locally. | ||
""" | ||
|
||
import os | ||
import yaml | ||
import platform | ||
import subprocess | ||
|
||
__dir__ = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
workflow = yaml.safe_load(open(os.path.join(__dir__, "wheels.yml"))) | ||
|
||
env = os.environ.copy() | ||
|
||
steps = workflow["jobs"]["build_wheels"]["steps"] | ||
cibw_step = None | ||
for step in steps: | ||
if (step.get("uses") or "").startswith("pypa/cibuildwheel"): | ||
cibw_step = step | ||
break | ||
|
||
for key, value in cibw_step["env"].items(): | ||
if key.endswith("WIN") or key.endswith("MAC"): | ||
continue | ||
env[key] = value | ||
|
||
env["CIBW_ARCHS"] = os.getenv("CIBW_ARCHS") or platform.machine() | ||
subprocess.check_call(["cibuildwheel"], env=env) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
set -e | ||
set -x | ||
|
||
# Build-time dependencies | ||
## Linux Docker Images | ||
if command -v yum &> /dev/null; then | ||
yum install -y libffi-devel flex bison | ||
fi | ||
|
||
if command -v apk &> /dev/null; then | ||
apk add libffi-dev flex bison | ||
fi | ||
|
||
## macOS/Windows Native | ||
## Software installed by default: https://github.com/actions/runner-images | ||
|
||
### macOS: flex and bison are already installed on macOS | ||
|
||
### Windows: TODO: check if this actually works | ||
if command -v choco &> /dev/null; then | ||
choco install flex bison | ||
end | ||
|
||
# Build Static FFI (platform-dependent but not Python version dependent) | ||
cd ffi | ||
./configure --prefix=$PWD/pfx | ||
make install -j$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu) | ||
rm -rf ./pfx/lib/libffi.so* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
set -e | ||
set -x | ||
|
||
# Build boost | ||
cd ./boost | ||
## Delete the artefacts from previous builds (if any) | ||
rm -rf ./pfx | ||
## Bootstrap bjam | ||
./bootstrap.sh --prefix=./pfx | ||
## Build Boost against current version of Python, only for | ||
## static linkage (Boost is statically linked because system boost packages | ||
## wildly vary in versions, including the libboost_python3 version) | ||
./b2\ | ||
-j$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)\ | ||
--prefix=./pfx\ | ||
--with-filesystem\ | ||
--with-system\ | ||
--with-python\ | ||
cxxflags="$(python3-config --includes) -std=c++17 -fPIC"\ | ||
cflags="$(python3-config --includes) -fPIC"\ | ||
link=static\ | ||
variant=release\ | ||
install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,3 +51,4 @@ __pycache__ | |
/build | ||
/venv | ||
/boost | ||
/ffi |