Skip to content

Commit b831ab0

Browse files
authored
Merge pull request #228 from thewtex/aarch64-module-wheels
ENH: Add support for building Linux ARM module wheels
2 parents 866b728 + 00627c3 commit b831ab0

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

scripts/dockcross-manylinux-download-cache-and-build-module-wheels.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,4 +74,8 @@ fi
7474
cp -a ITKPythonPackage/oneTBB-prefix ./
7575

7676
set -- "${FORWARD_ARGS[@]}"; # Restore initial argument list
77-
./ITKPythonPackage/scripts/dockcross-manylinux-build-module-wheels.sh "$@"
77+
if [[ "${TARBALL_SPECIALIZATION}" = "-manylinux_2_28_aarch64" ]]; then
78+
./ITKPythonPackage/scripts/manylinux_2_28_aarch64-build-module-wheels.sh "$@"
79+
else
80+
./ITKPythonPackage/scripts/dockcross-manylinux-build-module-wheels.sh "$@"
81+
fi
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
3+
# Run this script inside a dockcross container to build Python wheels for an aarch ITK module.
4+
cd /work
5+
yum -y install sudo
6+
/opt/python/cp39-cp39/bin/python -m pip install -r /ITKPythonPackage/requirements-dev.txt
7+
for PYBIN in "${PYBINARIES[@]}"; do
8+
${PYBIN}/pip install -r /ITKPythonPackage/requirements-dev.txt
9+
done
10+
11+
"/ITKPythonPackage/scripts/internal/manylinux-build-module-wheels.sh" "$@"
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
# Run this script to build the Python wheel packages for Linux for an ITK
4+
# external module.
5+
#
6+
# Versions can be restricted by passing them in as arguments to the script
7+
# For example,
8+
#
9+
# scripts/manylinux_2_28_aarch64-build-module-wheels.sh cp39
10+
#
11+
# Shared libraries can be included in the wheel by exporting them to LD_LIBRARY_PATH before
12+
# running this script.
13+
#
14+
# For example,
15+
#
16+
# export LD_LIBRARY_PATH="/path/to/OpenCL.so:/path/to/OpenCL.so.1.2"
17+
# scripts/dockcross-manylinux-build-module-wheels.sh cp39
18+
#
19+
20+
MANYLINUX_VERSION=_2_28
21+
IMAGE_TAG=latest
22+
23+
script_dir=$(cd $(dirname $0) || exit 1; pwd)
24+
25+
mkdir -p $(pwd)/tools
26+
chmod 777 $(pwd)/tools
27+
# Build wheels
28+
mkdir -p dist
29+
DOCKER_ARGS="-v $(pwd)/dist:/work/dist/ -v $script_dir/..:/ITKPythonPackage -v $(pwd)/tools:/tools"
30+
# Mount any shared libraries
31+
if [[ -n ${LD_LIBRARY_PATH} ]]; then
32+
for libpath in ${LD_LIBRARY_PATH//:/ }; do
33+
DOCKER_ARGS+=" -v ${libpath}:/usr/lib64/$(basename -- ${libpath})"
34+
done
35+
fi
36+
37+
docker run --privileged --rm tonistiigi/binfmt --install all
38+
docker run --rm -it $DOCKER_ARGS -v $(pwd):/work/ quay.io/pypa/manylinux${MANYLINUX_VERSION}_aarch64:${IMAGE_TAG} "/ITKPythonPackage/scripts/internal/manylinux-aarch64-build-module-wheels.sh" "$@"

0 commit comments

Comments
 (0)