Skip to content

Commit 05c0cd3

Browse files
committed
Enhance manylinux build process by ensuring ccache and ninja are installed; add fallback mechanisms for missing tools. Update FFTW configuration to disable Fortran and MPI for improved compatibility.
1 parent 72d3307 commit 05c0cd3

1 file changed

Lines changed: 74 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 74 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,59 @@ jobs:
7777
CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28
7878
CIBW_BEFORE_ALL_LINUX: |
7979
set -eux
80-
# Install ccache and minimal build deps in the manylinux container
80+
81+
# --- Ensure ccache & ninja exist inside the manylinux container ---
82+
have_ccache=0
8183
if command -v dnf >/dev/null 2>&1; then
8284
dnf -y install ccache pkgconfig ninja-build || true
8385
elif command -v yum >/dev/null 2>&1; then
8486
yum -y install ccache pkgconfig ninja-build || true
87+
elif command -v microdnf >/dev/null 2>&1; then
88+
microdnf -y install ccache pkgconfig ninja-build || true
89+
fi
90+
if command -v ccache >/dev/null 2>&1; then
91+
have_ccache=1
92+
else
93+
# Fallback: fetch a static ccache binary (no package manager needed)
94+
arch="$(uname -m)"
95+
ver="4.9.1"
96+
url_x86_64="https://github.com/ccache/ccache/releases/download/v${ver}/ccache-${ver}-linux-x86_64.tar.xz"
97+
url_aarch64="https://github.com/ccache/ccache/releases/download/v${ver}/ccache-${ver}-linux-aarch64.tar.xz"
98+
url="${url_x86_64}"
99+
[ "$arch" = "aarch64" ] && url="${url_aarch64}"
100+
curl -fsSL "${url}" -o /tmp/ccache.tar.xz
101+
mkdir -p /usr/local/ccache && tar -xJf /tmp/ccache.tar.xz -C /usr/local/ccache --strip-components=1
102+
ln -sf /usr/local/ccache/bin/ccache /usr/local/bin/ccache
103+
have_ccache=1
85104
fi
86105
87-
# Extract cached sources from /project (mounted by cibuildwheel)
106+
# Ensure ninja exists too (fallback to portable binary if needed)
107+
if ! command -v ninja >/dev/null 2>&1; then
108+
curl -fsSL -o /usr/local/bin/ninja https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip
109+
# some images have no unzip; use busybox if present, else fetch static:
110+
if command -v unzip >/dev/null 2>&1; then
111+
tmpd="$(mktemp -d)" && mv /usr/local/bin/ninja "$tmpd/ninja.zip"
112+
unzip -p "$tmpd/ninja.zip" > /usr/local/bin/ninja && chmod +x /usr/local/bin/ninja
113+
else
114+
# fallback: use curl to a pre-unzipped mirror if you have one; or install unzip via dnf/yum above
115+
echo "ninja fallback requires unzip; please enable unzip in package install above" >&2
116+
exit 1
117+
fi
118+
fi
119+
120+
# --- Build prerequisites we cache (FFTW & Boost headers) ---
88121
mkdir -p /opt/fftw /opt/boost/include
89122
tar -xzf /project/build-cache/fftw-3.3.10.tar.gz -C /tmp
90123
tar -xzf /project/build-cache/boost_1_84_0.tar.gz -C /tmp
91124
92-
# Build FFTW (shared, threads; no fortran/mpi)
93125
pushd /tmp/fftw-3.3.10
94-
./configure --prefix=/opt/fftw --enable-shared --enable-threads
126+
./configure --prefix=/opt/fftw --enable-shared --enable-threads --disable-fortran --disable-mpi
95127
make -j"$(nproc)"
96128
make install
97129
popd
98130
99-
# Header-only Boost "install"
100131
cp -r /tmp/boost_1_84_0/boost /opt/boost/include/
132+
101133
CIBW_ENVIRONMENT_LINUX: >
102134
PKG_CONFIG_PATH=/opt/fftw/lib/pkgconfig
103135
CMAKE_PREFIX_PATH=/opt/fftw
@@ -171,23 +203,59 @@ jobs:
171203
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux_2_28
172204
CIBW_BEFORE_ALL_LINUX: |
173205
set -eux
206+
207+
# --- Ensure ccache & ninja exist inside the manylinux container ---
208+
have_ccache=0
174209
if command -v dnf >/dev/null 2>&1; then
175210
dnf -y install ccache pkgconfig ninja-build || true
176211
elif command -v yum >/dev/null 2>&1; then
177212
yum -y install ccache pkgconfig ninja-build || true
213+
elif command -v microdnf >/dev/null 2>&1; then
214+
microdnf -y install ccache pkgconfig ninja-build || true
215+
fi
216+
if command -v ccache >/dev/null 2>&1; then
217+
have_ccache=1
218+
else
219+
# Fallback: fetch a static ccache binary (no package manager needed)
220+
arch="$(uname -m)"
221+
ver="4.9.1"
222+
url_x86_64="https://github.com/ccache/ccache/releases/download/v${ver}/ccache-${ver}-linux-x86_64.tar.xz"
223+
url_aarch64="https://github.com/ccache/ccache/releases/download/v${ver}/ccache-${ver}-linux-aarch64.tar.xz"
224+
url="${url_x86_64}"
225+
[ "$arch" = "aarch64" ] && url="${url_aarch64}"
226+
curl -fsSL "${url}" -o /tmp/ccache.tar.xz
227+
mkdir -p /usr/local/ccache && tar -xJf /tmp/ccache.tar.xz -C /usr/local/ccache --strip-components=1
228+
ln -sf /usr/local/ccache/bin/ccache /usr/local/bin/ccache
229+
have_ccache=1
178230
fi
179231
232+
# Ensure ninja exists too (fallback to portable binary if needed)
233+
if ! command -v ninja >/dev/null 2>&1; then
234+
curl -fsSL -o /usr/local/bin/ninja https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-linux.zip
235+
# some images have no unzip; use busybox if present, else fetch static:
236+
if command -v unzip >/dev/null 2>&1; then
237+
tmpd="$(mktemp -d)" && mv /usr/local/bin/ninja "$tmpd/ninja.zip"
238+
unzip -p "$tmpd/ninja.zip" > /usr/local/bin/ninja && chmod +x /usr/local/bin/ninja
239+
else
240+
# fallback: use curl to a pre-unzipped mirror if you have one; or install unzip via dnf/yum above
241+
echo "ninja fallback requires unzip; please enable unzip in package install above" >&2
242+
exit 1
243+
fi
244+
fi
245+
246+
# --- Build prerequisites we cache (FFTW & Boost headers) ---
180247
mkdir -p /opt/fftw /opt/boost/include
181248
tar -xzf /project/build-cache/fftw-3.3.10.tar.gz -C /tmp
182249
tar -xzf /project/build-cache/boost_1_84_0.tar.gz -C /tmp
183250
184251
pushd /tmp/fftw-3.3.10
185-
./configure --prefix=/opt/fftw --enable-shared --enable-threads
252+
./configure --prefix=/opt/fftw --enable-shared --enable-threads --disable-fortran --disable-mpi
186253
make -j"$(nproc)"
187254
make install
188255
popd
189256
190257
cp -r /tmp/boost_1_84_0/boost /opt/boost/include/
258+
191259
CIBW_ENVIRONMENT_LINUX: >
192260
PKG_CONFIG_PATH=/opt/fftw/lib/pkgconfig
193261
CMAKE_PREFIX_PATH=/opt/fftw

0 commit comments

Comments
 (0)