@@ -63,55 +63,77 @@ jobs:
6363 - name : Build wheels with cibuildwheel (${{ matrix.arch }})
6464 uses : pypa/cibuildwheel@v2.21.3
6565 env :
66- # Build the three CPython versions; skip PyPy/musl
6766 CIBW_BUILD : cp310-* cp311-* cp312-*
6867 CIBW_SKIP : pp* *-musllinux_*
69-
70- # Run natively per arch; fix the manylinux image explicitly
7168 CIBW_ARCHS_LINUX : ${{ matrix.arch }}
7269 ${{ matrix.image_var }} : manylinux_2_28
7370
74- # Inside the manylinux container: install toolchain + FFTW + Boost headers
71+ # Install build tools + FFTW + Boost headers; robust ccache fallback (pkg -> prebuilt -> source)
7572 CIBW_BEFORE_ALL_LINUX : |
7673 set -eux
77- if command -v dnf >/dev/null 2>&1; then
78- dnf -y install ccache pkgconfig ninja-build unzip make which curl ca-certificates xz tar gzip fftw fftw-devel boost-devel || true
79- elif command -v yum >/dev/null 2>&1; then
80- yum -y install ccache pkgconfig ninja-build unzip make which curl ca-certificates xz tar gzip fftw fftw-devel boost-devel || true
81- elif command -v microdnf >/dev/null 2>&1; then
82- microdnf -y install ccache pkgconfig ninja-build unzip make which curl ca-certificates xz tar gzip fftw fftw-devel boost-devel || true
83- elif command -v apt-get >/dev/null 2>&1; then
84- apt-get update -y
85- apt-get install -y --no-install-recommends \
86- ccache pkg-config ninja-build unzip make curl ca-certificates xz-utils tar gzip libfftw3-3 libfftw3-dev libboost-all-dev
87- else
88- echo "No supported package manager found in this manylinux image" >&2
89- exit 1
90- fi
91-
92- # Fallback portable ccache if the package isn't available
93- command -v ccache >/dev/null || {
94- ver=4.11.3
74+
75+ pm_install() {
76+ if command -v dnf >/dev/null 2>&1; then
77+ dnf -y install pkgconfig ninja-build unzip make which curl ca-certificates xz tar gzip cmake gcc-c++ fftw fftw-devel boost-devel libzstd libzstd-devel || true
78+ elif command -v yum >/dev/null 2>&1; then
79+ yum -y install pkgconfig ninja-build unzip make which curl ca-certificates xz tar gzip cmake gcc-c++ fftw fftw-devel boost-devel libzstd libzstd-devel || true
80+ elif command -v microdnf >/dev/null 2>&1; then
81+ microdnf -y install pkgconfig ninja-build unzip make which curl ca-certificates xz tar gzip cmake gcc-c++ fftw fftw-devel boost-devel libzstd libzstd-devel || true
82+ elif command -v apt-get >/dev/null 2>&1; then
83+ apt-get update -y
84+ apt-get install -y --no-install-recommends \
85+ pkg-config ninja-build unzip make curl ca-certificates xz-utils tar gzip cmake g++ \
86+ libfftw3-3 libfftw3-dev libboost-all-dev zstd libzstd-dev
87+ else
88+ echo "No supported package manager found" >&2
89+ exit 1
90+ fi
91+ }
92+
93+ install_ccache() {
94+ # 1) Try package manager
95+ if command -v dnf >/devnull 2>&1; then dnf -y install ccache || true; fi
96+ if command -v yum >/devnull 2>&1; then yum -y install ccache || true; fi
97+ if command -v microdnf >/devnull 2>&1; then microdnf -y install ccache || true; fi
98+ if command -v apt-get >/devnull 2>&1; then apt-get install -y --no-install-recommends ccache || true; fi
99+ if command -v ccache >/dev/null 2>&1; then return 0; fi
100+
101+ # 2) Try official prebuilt tarball
102+ ver="4.11.3"
95103 arch="$(uname -m)"
96104 url="https://github.com/ccache/ccache/releases/download/v${ver}/ccache-${ver}-linux-${arch}.tar.xz"
97- curl -fsSL "$url" -o /tmp/ccache.tar.xz
98- mkdir -p /usr/local/ccache && tar -xJf /tmp/ccache.tar.xz -C /usr/local/ccache --strip-components=1
99- ln -sf /usr/local/ccache/bin/ccache /usr/local/bin/ccache
105+ if curl -fsSL "$url" -o /tmp/ccache.tar.xz; then
106+ mkdir -p /usr/local/ccache
107+ tar -xJf /tmp/ccache.tar.xz -C /usr/local/ccache --strip-components=1
108+ ln -sf /usr/local/ccache/bin/ccache /usr/local/bin/ccache
109+ fi
110+ if command -v ccache >/dev/null 2>&1; then return 0; fi
111+
112+ # 3) Build from source with CMake (last resort)
113+ src="4.11.3"
114+ tmpd="$(mktemp -d)"
115+ curl -fsSL "https://github.com/ccache/ccache/releases/download/v${src}/ccache-${src}.tar.gz" -o "${tmpd}/ccache.tar.gz"
116+ tar -xzf "${tmpd}/ccache.tar.gz" -C "${tmpd}"
117+ cmake -S "${tmpd}/ccache-${src}" -B "${tmpd}/build" -DCMAKE_BUILD_TYPE=Release
118+ cmake --build "${tmpd}/build" -j"$(nproc)"
119+ cmake --install "${tmpd}/build"
120+ ln -sf /usr/local/bin/ccache /usr/local/ccache/bin/ccache || true
100121 }
101122
102- # Clean, fast builds; rely on OS FFTW; Boost headers from OS (no libboost linkage)
123+ pm_install
124+ install_ccache
125+ command -v ccache >/dev/null || { echo "ccache still missing"; exit 1; }
126+
103127 CIBW_ENVIRONMENT_LINUX : >
104128 CC=gcc
105129 CXX=g++
106130 CCACHE_DIR=/project/.ccache
107131 CMAKE_ARGS="-G Ninja -DHF_USE_OPENMP=ON -DHF_USE_FFTW_THREADS=ON -DBOOST_INCLUDEDIR=/usr/include -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
108132 CMAKE_BUILD_PARALLEL_LEVEL=$(nproc)
109133
110- # auditwheel will vendor libfftw3*.so into the wheel
111134 CIBW_REPAIR_WHEEL_COMMAND_LINUX : >
112135 bash -lc 'auditwheel repair -w {dest_dir} {wheel}'
113136
114- # Smoke test each built wheel
115137 CIBW_TEST_REQUIRES : numpy
116138 CIBW_TEST_COMMAND : |
117139 python - <<'PY'
@@ -196,7 +218,7 @@ jobs:
196218 name : Publish to PyPI
197219 needs : [sdist, wheels-linux, wheels-macos]
198220 runs-on : ubuntu-latest
199- environment : cpp_hf_env # must match your Trusted Publisher env name
221+ environment : cpp_hf_env
200222 permissions :
201223 contents : read
202224 id-token : write
0 commit comments