Skip to content

Commit 74561b6

Browse files
authored
Merge pull request #193 from jcfr/update-from-manylinux2014-to-manylinux_2_24
Add support for multiple manylinux versions
2 parents efbfbc4 + 709278f commit 74561b6

6 files changed

+39
-38
lines changed

CMakeLists.txt

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,10 @@ message(STATUS "SuperBuild - ITKPythonPackage_WHEEL_NAME:${ITKPythonPackage_WHEE
1616

1717
option(ITKPythonPackage_USE_TBB "Build and use oneTBB in the ITK python package" ON)
1818

19-
set(libpath "lib")
20-
if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
21-
set(libpath "lib64")
22-
endif()
2319
if(ITK_SOURCE_DIR)
24-
set(TBB_DIR "${ITK_SOURCE_DIR}/../oneTBB-prefix/${libpath}/cmake/TBB")
20+
set(TBB_DIR "${ITK_SOURCE_DIR}/../oneTBB-prefix/lib/cmake/TBB")
2521
else()
26-
set(TBB_DIR "${CMAKE_BINARY_DIR}/../oneTBB-prefix/${libpath}/cmake/TBB")
22+
set(TBB_DIR "${CMAKE_BINARY_DIR}/../oneTBB-prefix/lib/cmake/TBB")
2723
endif()
2824
set(tbb_args )
2925
if(ITKPythonPackage_USE_TBB)
@@ -93,7 +89,7 @@ if(ITKPythonPackage_SUPERBUILD)
9389

9490
set(ITK_REPOSITORY "https://github.com/InsightSoftwareConsortium/ITK.git")
9591

96-
# ITK nightly-master 2022-07-04
92+
# ITK nightly-master 2022-07-05
9793
set(ITK_GIT_TAG "c44a7731f2")
9894

9995
#-----------------------------------------------------------------------------
@@ -116,6 +112,7 @@ if(ITKPythonPackage_SUPERBUILD)
116112
-DTBB_TEST:BOOL=OFF
117113
-DCMAKE_BUILD_TYPE:STRING=Release
118114
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_BINARY_DIR}/../oneTBB-prefix
115+
-DCMAKE_INSTALL_LIBDIR:STRING=lib # Skip default initialization by GNUInstallDirs CMake module
119116
${ep_common_cmake_cache_args}
120117
-DCMAKE_BUILD_TYPE:STRING=Release
121118
BUILD_BYPRODUCTS "${TBB_DIR}/TBBConfig.cmake"

scripts/dockcross-manylinux-build-module-wheels.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,11 @@
1717
# scripts/dockcross-manylinux-build-module-wheels.sh cp39
1818
#
1919

20+
MANYLINUX_VERSION=_2_28
21+
IMAGE_TAG=20220705-b1eb184
22+
2023
# Generate dockcross scripts
21-
docker run --rm dockcross/manylinux2014-x64:20211011-a315bdc > /tmp/dockcross-manylinux-x64
24+
docker run --rm dockcross/manylinux${MANYLINUX_VERSION}-x64:${IMAGE_TAG} > /tmp/dockcross-manylinux-x64
2225
chmod u+x /tmp/dockcross-manylinux-x64
2326

2427
script_dir=$(cd $(dirname $0) || exit 1; pwd)

scripts/dockcross-manylinux-build-wheels.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
#
88
# scripts/dockcross-manylinux-build-wheels.sh cp39
99

10+
MANYLINUX_VERSION=_2_28
11+
IMAGE_TAG=20220705-b1eb184
12+
1013
# Generate dockcross scripts
11-
docker run --rm dockcross/manylinux2014-x64:20211011-a315bdc > /tmp/dockcross-manylinux-x64
14+
docker run --rm dockcross/manylinux${MANYLINUX_VERSION}-x64:${IMAGE_TAG} > /tmp/dockcross-manylinux-x64
1215
chmod u+x /tmp/dockcross-manylinux-x64
1316

1417
script_dir=$(cd $(dirname $0) || exit 1; pwd)

scripts/internal/manylinux-build-common.sh

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
set -e -x
55

66
script_dir=$(cd $(dirname $0) || exit 1; pwd)
7-
# Workaround broken FindPython3 in CMake 3.17
8-
if test -e /usr/share/cmake-3.17/Modules/FindPython/Support.cmake; then
9-
sudo cp ${script_dir}/Support.cmake /usr/share/cmake-3.17/Modules/FindPython/
10-
fi
117

128
# Versions can be restricted by passing them in as arguments to the script
139
# For example,
@@ -28,7 +24,7 @@ else
2824
fi
2925

3026
# i686 or x86_64 ?
31-
case $(uname -p) in
27+
case $(uname -m) in
3228
i686)
3329
ARCH=x86
3430
;;
@@ -39,22 +35,22 @@ case $(uname -p) in
3935
ARCH=aarch64
4036
;;
4137
*)
42-
die "Unknown architecture $(uname -p)"
38+
die "Unknown architecture $(uname -m)"
4339
;;
4440
esac
4541

4642
# Install prerequirements
47-
export PATH=/work/tools/doxygen-1.8.11/bin:$PATH
48-
case $(uname -p) in
43+
export PATH=/work/tools/doxygen-1.8.16/bin:$PATH
44+
case $(uname -m) in
4945
i686)
5046
ARCH=x86
5147
;;
5248
x86_64)
5349
if ! type doxygen > /dev/null 2>&1; then
5450
mkdir -p /work/tools
5551
pushd /work/tools > /dev/null 2>&1
56-
curl https://data.kitware.com/api/v1/file/5c0aa4b18d777f2179dd0a71/download -o doxygen-1.8.11.linux.bin.tar.gz
57-
tar -xvzf doxygen-1.8.11.linux.bin.tar.gz
52+
curl https://data.kitware.com/api/v1/file/62c4d615bddec9d0c46cb705/download -o doxygen-1.8.16.linux.bin.tar.gz
53+
tar -xvzf doxygen-1.8.16.linux.bin.tar.gz
5854
popd > /dev/null 2>&1
5955
fi
6056
;;
@@ -63,13 +59,13 @@ case $(uname -p) in
6359
if ! type doxygen > /dev/null 2>&1; then
6460
mkdir -p /work/tools
6561
pushd /work/tools > /dev/null 2>&1
66-
curl https://data.kitware.com/api/v1/file/6086e4b02fa25629b93ac66e/download -o doxygen-1.8.11.linux.aarch64.bin.tar.gz
67-
tar -xvzf doxygen-1.8.11.linux.aarch64.bin.tar.gz
62+
curl https://data.kitware.com/api/v1/file/62c4ed58bddec9d0c46f1388/download -o doxygen-1.8.16.linux.aarch64.bin.tar.gz
63+
tar -xvzf doxygen-1.8.16.linux.aarch64.bin.tar.gz
6864
popd > /dev/null 2>&1
6965
fi
7066
;;
7167
*)
72-
die "Unknown architecture $(uname -p)"
68+
die "Unknown architecture $(uname -m)"
7369
;;
7470
esac
7571
if ! type ninja > /dev/null 2>&1; then
@@ -84,4 +80,6 @@ if ! type ninja > /dev/null 2>&1; then
8480
popd
8581
fi
8682

87-
echo "Building wheels for $ARCH"
83+
MANYLINUX_VERSION=_2_28
84+
85+
echo "Building wheels for $ARCH using manylinux${MANYLINUX_VERSION}"

scripts/internal/manylinux-build-module-wheels.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ source "${script_dir}/manylinux-build-common.sh"
6161

6262
# Set up library paths in container so that shared libraries can be added to wheels
6363
sudo ldconfig
64-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/work/oneTBB-prefix/lib64:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
64+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/work/oneTBB-prefix/lib:/usr/lib:/usr/lib64:/usr/local/lib:/usr/local/lib64
6565

6666
# Compile wheels re-using standalone project and archive cache
6767
for PYBIN in "${PYBINARIES[@]}"; do
@@ -78,8 +78,8 @@ for PYBIN in "${PYBINARIES[@]}"; do
7878
version=$(basename $(dirname ${PYBIN}))
7979
# Remove "m" -- not present in Python 3.8 and later
8080
version=${version:0:9}
81-
itk_build_dir=/work/$(basename /ITKPythonPackage/ITK-${version}*-manylinux2014_${ARCH})
82-
ln -fs /ITKPythonPackage/ITK-${version}*-manylinux2014_${ARCH} $itk_build_dir
81+
itk_build_dir=/work/$(basename /ITKPythonPackage/ITK-${version}*-manylinux${MANYLINUX_VERSION}_${ARCH})
82+
ln -fs /ITKPythonPackage/ITK-${version}*-manylinux${MANYLINUX_VERSION}_${ARCH} $itk_build_dir
8383
if [[ ! -d ${itk_build_dir} ]]; then
8484
echo 'ITK build tree not available!' 1>&2
8585
exit 1
@@ -95,7 +95,7 @@ for PYBIN in "${PYBINARIES[@]}"; do
9595
-DITK_USE_SYSTEM_SWIG:BOOL=ON \
9696
-DWRAP_ITK_INSTALL_COMPONENT_IDENTIFIER:STRING=PythonWheel \
9797
-DSWIG_EXECUTABLE:FILEPATH=${itk_build_dir}/Wrapping/Generators/SwigInterface/swig/bin/swig \
98-
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -p)-linux-gnu \
98+
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -m)-linux-gnu \
9999
-DBUILD_TESTING:BOOL=OFF \
100100
-DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
101101
-DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
@@ -108,7 +108,7 @@ if test "${ARCH}" == "x64"; then
108108
# Make sure auditwheel is installed for this python exe before importing
109109
# it in auditwheel_whitelist_monkeypatch.py
110110
sudo ${Python3_EXECUTABLE} -m pip install auditwheel
111-
for whl in dist/*linux_$(uname -p).whl; do
111+
for whl in dist/*linux_$(uname -m).whl; do
112112
# Repair wheel using monkey patch to exclude shared libraries provided in whitelist
113113
${Python3_EXECUTABLE} "${script_dir}/auditwheel_whitelist_monkeypatch.py" \
114114
repair ${whl} -w /work/dist/ --whitelist "${EXCLUDE_LIBS}"
@@ -117,6 +117,6 @@ if test "${ARCH}" == "x64"; then
117117
fi
118118
if compgen -G "dist/itk*-linux*.whl" > /dev/null; then
119119
for itk_wheel in dist/itk*-linux*.whl; do
120-
mv ${itk_wheel} ${itk_wheel/linux/manylinux2014}
120+
mv ${itk_wheel} ${itk_wheel/linux/manylinux${MANYLINUX_VERSION}}
121121
done
122122
fi

scripts/internal/manylinux-build-wheels.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ pushd /work/ITK-source > /dev/null 2>&1
3434
cmake -DITKPythonPackage_BUILD_PYTHON:PATH=0 -G Ninja ../
3535
ninja
3636
popd > /dev/null 2>&1
37-
tbb_dir=/work/oneTBB-prefix/lib64/cmake/TBB
37+
tbb_dir=/work/oneTBB-prefix/lib/cmake/TBB
3838
# So auditwheel can find the libs
3939
sudo ldconfig
40-
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/work/oneTBB-prefix/lib64:/usr/lib:/usr/lib64
40+
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/work/oneTBB-prefix/lib:/usr/lib:/usr/lib64
4141

4242
SINGLE_WHEEL=0
4343

@@ -56,7 +56,7 @@ for PYBIN in "${PYBINARIES[@]}"; do
5656
build_type="Release"
5757
compile_flags="-O3 -DNDEBUG"
5858
source_path=/work/ITK-source/ITK
59-
build_path=/work/ITK-$(basename $(dirname ${PYBIN}))-manylinux2014_${ARCH}
59+
build_path=/work/ITK-$(basename $(dirname ${PYBIN}))-manylinux${MANYLINUX_VERSION}_${ARCH}
6060
SETUP_PY_CONFIGURE="${script_dir}/../setup_py_configure.py"
6161
SKBUILD_CMAKE_INSTALL_PREFIX=$(${Python3_EXECUTABLE} -c "from skbuild.constants import CMAKE_INSTALL_DIR; print(CMAKE_INSTALL_DIR)")
6262

@@ -81,7 +81,7 @@ for PYBIN in "${PYBINARIES[@]}"; do
8181
-DITK_WRAP_double:BOOL=ON \
8282
-DITK_WRAP_complex_double:BOOL=ON \
8383
-DITK_WRAP_IMAGE_DIMS:STRING="2;3;4" \
84-
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -p)-linux-gnu \
84+
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -m)-linux-gnu \
8585
-DCMAKE_CXX_FLAGS:STRING="$compile_flags" \
8686
-DCMAKE_C_FLAGS:STRING="$compile_flags" \
8787
-DCMAKE_BUILD_TYPE:STRING="${build_type}" \
@@ -110,7 +110,7 @@ for PYBIN in "${PYBINARIES[@]}"; do
110110
-DBUILD_TESTING:BOOL=OFF \
111111
-DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \
112112
-DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \
113-
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -p)-linux-gnu \
113+
-DCMAKE_CXX_COMPILER_TARGET:STRING=$(uname -m)-linux-gnu \
114114
-DCMAKE_CXX_FLAGS:STRING="$compile_flags" \
115115
-DCMAKE_C_FLAGS:STRING="$compile_flags" \
116116
-DCMAKE_BUILD_TYPE:STRING="${build_type}" \
@@ -167,13 +167,13 @@ done
167167

168168
if test "${ARCH}" == "x64"; then
169169
sudo /opt/python/cp39-cp39/bin/pip3 install auditwheel wheel
170-
# This step will fixup the wheel switching from 'linux' to 'manylinux2014' tag
171-
for whl in dist/itk_*linux_$(uname -p).whl; do
172-
/opt/python/cp39-cp39/bin/auditwheel repair --plat manylinux2014_x86_64 ${whl} -w /work/dist/
170+
# This step will fixup the wheel switching from 'linux' to 'manylinux<version>' tag
171+
for whl in dist/itk_*linux_$(uname -m).whl; do
172+
/opt/python/cp39-cp39/bin/auditwheel repair --plat manylinux${MANYLINUX_VERSION}_x86_64 ${whl} -w /work/dist/
173173
rm ${whl}
174174
done
175175
else
176-
for whl in dist/itk_*$(uname -p).whl; do
176+
for whl in dist/itk_*$(uname -m).whl; do
177177
auditwheel repair ${whl} -w /work/dist/
178178
rm ${whl}
179179
done

0 commit comments

Comments
 (0)