|
16 | 16 | # /tmp/dockcross-manylinux-x64 -a "$DOCKER_ARGS" manylinux-build-module-wheels.sh |
17 | 17 | # |
18 | 18 |
|
| 19 | +# ----------------------------------------------------------------------- |
| 20 | +# Script argument parsing |
| 21 | +# |
| 22 | +usage() |
| 23 | +{ |
| 24 | + echo "Usage: |
| 25 | + manylinux-build-module-wheels |
| 26 | + [ -h | --help ] show usage |
| 27 | + [ -c | --cmake_options ] space-separated string of CMake options to forward to the module (e.g. \"-DBUILD_TESTING=OFF\") |
| 28 | + [ -x | --exclude_libs ] semicolon-separated library names to exclude when repairing wheel (e.g. \"libcuda.so\") |
| 29 | + [ python_version ] build wheel for a specific python version. (e.g. cp39)" |
| 30 | + exit 2 |
| 31 | +} |
| 32 | + |
| 33 | +PARSED_ARGS=$(getopt -a -n dockcross-manylinux-download-cache-and-build-module-wheels \ |
| 34 | + -o hc:x: --long help,cmake_options:,exclude_libs: -- "$@") |
| 35 | +eval set -- "$PARSED_ARGS" |
| 36 | + |
| 37 | +while : |
| 38 | +do |
| 39 | + case "$1" in |
| 40 | + -h | --help) usage; break ;; |
| 41 | + -c | --cmake_options) CMAKE_OPTIONS="$2" ; shift 2 ;; |
| 42 | + -x | --exclude_libs) EXCLUDE_LIBS="$2" ; shift 2 ;; |
| 43 | + --) shift; break ;; |
| 44 | + *) echo "Unexpected option: $1."; |
| 45 | + usage; break ;; |
| 46 | + esac |
| 47 | +done |
| 48 | + |
| 49 | +PYTHON_VERSION="$@" |
| 50 | +# ----------------------------------------------------------------------- |
| 51 | + |
19 | 52 | # ----------------------------------------------------------------------- |
20 | 53 | # These variables are set in common script: |
21 | 54 | # |
@@ -66,13 +99,19 @@ for PYBIN in "${PYBINARIES[@]}"; do |
66 | 99 | -DBUILD_TESTING:BOOL=OFF \ |
67 | 100 | -DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE} \ |
68 | 101 | -DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIR} \ |
| 102 | + ${CMAKE_OPTIONS} \ |
69 | 103 | || exit 1 |
70 | 104 | ${PYBIN}/python setup.py clean |
71 | 105 | done |
72 | 106 |
|
73 | 107 | if test "${ARCH}" == "x64"; then |
| 108 | + # Make sure auditwheel is installed for this python exe before importing |
| 109 | + # it in auditwheel_whitelist_monkeypatch.py |
| 110 | + sudo ${Python3_EXECUTABLE} -m pip install auditwheel |
74 | 111 | for whl in dist/*linux_$(uname -p).whl; do |
75 | | - auditwheel repair ${whl} -w /work/dist/ |
| 112 | + # Repair wheel using monkey patch to exclude shared libraries provided in whitelist |
| 113 | + ${Python3_EXECUTABLE} "${script_dir}/auditwheel_whitelist_monkeypatch.py" \ |
| 114 | + repair ${whl} -w /work/dist/ --whitelist "${EXCLUDE_LIBS}" |
76 | 115 | rm ${whl} |
77 | 116 | done |
78 | 117 | fi |
|
0 commit comments