@@ -5,8 +5,12 @@ ARG PLATFORM=x86_64
55ARG DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-14/root
66ARG LD_LIBRARY_PATH_ARG=${DEVTOOLSET_ROOTPATH}/usr/lib64:${DEVTOOLSET_ROOTPATH}/usr/lib:${DEVTOOLSET_ROOTPATH}/usr/lib64/dyninst:${DEVTOOLSET_ROOTPATH}/usr/lib/dyninst
77ARG PREPEND_PATH=/usr/local/bin:${DEVTOOLSET_ROOTPATH}/usr/bin:
8+ ARG MANYLINUX_BUILDARCH=${BUILDARCH}
9+ ARG MANYLINUX_DISABLE_CLANG=0
10+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON=0
811
9- FROM $BASEIMAGE AS runtime_base
12+
13+ FROM $BASEIMAGE AS runtime_base_packages
1014ARG POLICY
1115ARG PLATFORM
1216ARG DEVTOOLSET_ROOTPATH
@@ -42,29 +46,49 @@ RUN manylinux-entrypoint /build_scripts/install-runtime-packages.sh && rm -rf /b
4246
4347COPY build_scripts/build_utils.sh /build_scripts/
4448
49+
50+ # prepare cross-compilation support
51+ FROM --platform=linux/${MANYLINUX_BUILDARCH} ghcr.io/mayeut/static-clang:21.1.3.0 AS static_clang_bin
52+ FROM runtime_base_packages AS static_clang_prepare
53+ ARG MANYLINUX_DISABLE_CLANG
54+ COPY build_scripts/install-clang-static.sh /build_scripts/
55+ RUN --mount=type=bind,target=/clang,from=static_clang_bin \
56+ mkdir -p /tmp/cross-compiler && \
57+ cp -rf /clang/opt/clang/* /tmp/cross-compiler/ && \
58+ /build_scripts/install-clang-static.sh /tmp/cross-compiler
59+ FROM scratch AS static_clang
60+ COPY --from=static_clang_prepare /tmp/cross-compiler /
61+
62+
63+ FROM runtime_base_packages AS runtime_base
4564COPY build_scripts/install-autoconf.sh /build_scripts/
46- RUN export AUTOCONF_ROOT=autoconf-2.72 && \
65+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
66+ export AUTOCONF_ROOT=autoconf-2.72 && \
4767 export AUTOCONF_HASH=afb181a76e1ee72832f6581c0eddf8df032b83e2e0239ef79ebedc4467d92d6e && \
4868 export AUTOCONF_DOWNLOAD_URL=http://ftp.gnu.org/gnu/autoconf && \
49- manylinux- entrypoint /build_scripts/install-autoconf.sh
69+ /tmp/cross-compiler/ entrypoint /build_scripts/install-autoconf.sh
5070
5171COPY build_scripts/install-automake.sh /build_scripts/
52- RUN export AUTOMAKE_ROOT=automake-1.18.1 && \
72+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
73+ export AUTOMAKE_ROOT=automake-1.18.1 && \
5374 export AUTOMAKE_HASH=63e585246d0fc8772dffdee0724f2f988146d1a3f1c756a3dc5cfbefa3c01915 && \
5475 export AUTOMAKE_DOWNLOAD_URL=http://ftp.gnu.org/gnu/automake && \
55- manylinux- entrypoint /build_scripts/install-automake.sh
76+ /tmp/cross-compiler/ entrypoint /build_scripts/install-automake.sh
5677
5778COPY build_scripts/install-libtool.sh /build_scripts/
58- RUN export LIBTOOL_ROOT=libtool-2.5.4 && \
79+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
80+ export LIBTOOL_ROOT=libtool-2.5.4 && \
5981 export LIBTOOL_HASH=da8ebb2ce4dcf46b90098daf962cffa68f4b4f62ea60f798d0ef12929ede6adf && \
6082 export LIBTOOL_DOWNLOAD_URL=http://ftp.gnu.org/gnu/libtool && \
61- manylinux- entrypoint /build_scripts/install-libtool.sh
83+ /tmp/cross-compiler/ entrypoint /build_scripts/install-libtool.sh
6284
6385COPY build_scripts/install-libxcrypt.sh /build_scripts/
64- RUN export LIBXCRYPT_VERSION=4.4.38 && \
86+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
87+ export LIBXCRYPT_VERSION=4.4.38 && \
6588 export LIBXCRYPT_HASH=80304b9c306ea799327f01d9a7549bdb28317789182631f1b54f4511b4206dd6 && \
6689 export LIBXCRYPT_DOWNLOAD_URL=https://github.com/besser82/libxcrypt/releases/download && \
67- manylinux-entrypoint /build_scripts/install-libxcrypt.sh
90+ /tmp/cross-compiler/entrypoint /build_scripts/install-libxcrypt.sh
91+
6892
6993FROM runtime_base AS build_base
7094COPY build_scripts/install-build-packages.sh /build_scripts/
@@ -73,81 +97,111 @@ RUN manylinux-entrypoint /build_scripts/install-build-packages.sh
7397
7498FROM build_base AS build_git
7599COPY build_scripts/build-curl.sh /build_scripts/
76- RUN export CURL_ROOT=curl-8.16.0 && \
100+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
101+ export CURL_ROOT=curl-8.16.0 && \
77102 export CURL_HASH=a21e20476e39eca5a4fc5cfb00acf84bbc1f5d8443ec3853ad14c26b3c85b970 && \
78103 export CURL_DOWNLOAD_URL=https://curl.haxx.se/download && \
79- manylinux- entrypoint /build_scripts/build-curl.sh
104+ /tmp/cross-compiler/ entrypoint /build_scripts/build-curl.sh
80105COPY build_scripts/build-git.sh /build_scripts/
81- RUN export GIT_ROOT=git-2.51.0 && \
106+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
107+ export GIT_ROOT=git-2.51.0 && \
82108 export GIT_HASH=3d531799d2cf2cac8e294ec6e3229e07bfca60dc6c783fe69e7712738bef7283 && \
83109 export GIT_DOWNLOAD_URL=https://www.kernel.org/pub/software/scm/git && \
84- manylinux-entrypoint /build_scripts/build-git.sh
110+ /tmp/cross-compiler/entrypoint /build_scripts/build-git.sh
111+
85112
86113FROM build_base AS build_sqlite3
87114COPY build_scripts/build-sqlite3.sh /build_scripts/
88- RUN export SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3500400 && \
115+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
116+ export SQLITE_AUTOCONF_ROOT=sqlite-autoconf-3500400 && \
89117 export SQLITE_AUTOCONF_HASH=a3db587a1b92ee5ddac2f66b3edb41b26f9c867275782d46c3a088977d6a5b18 && \
90118 export SQLITE_AUTOCONF_DOWNLOAD_URL=https://www.sqlite.org/2025 && \
91- manylinux-entrypoint /build_scripts/build-sqlite3.sh
119+ /tmp/cross-compiler/entrypoint /build_scripts/build-sqlite3.sh
120+
92121
93122FROM build_base AS build_tcl_tk
94123COPY build_scripts/build-tcltk.sh /build_scripts/
95- RUN export TCL_ROOT=tcl8.6.17 && \
124+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
125+ export TCL_ROOT=tcl8.6.17 && \
96126 export TCL_HASH=a3903371efcce8a405c5c245d029e9f6850258a60fa3761c4d58995610949b31 && \
97127 export TCL_DOWNLOAD_URL=https://prdownloads.sourceforge.net/tcl && \
98128 export TK_ROOT=tk8.6.17 && \
99129 export TK_HASH=e4982df6f969c08bf9dd858a6891059b4a3f50dc6c87c10abadbbe2fc4838946 && \
100- manylinux-entrypoint /build_scripts/build-tcltk.sh
130+ /tmp/cross-compiler/entrypoint /build_scripts/build-tcltk.sh
131+
101132
102133FROM build_base AS build_mpdecimal
103134COPY build_scripts/build-mpdecimal.sh /build_scripts/
104- RUN export MPDECIMAL_ROOT=mpdecimal-4.0.0 && \
135+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
136+ export MPDECIMAL_ROOT=mpdecimal-4.0.0 && \
105137 export MPDECIMAL_HASH=942445c3245b22730fd41a67a7c5c231d11cb1b9936b9c0f76334fb7d0b4468c && \
106138 export MPDECIMAL_DOWNLOAD_URL=https://www.bytereef.org/software/mpdecimal/releases && \
107- manylinux- entrypoint /build_scripts/build-mpdecimal.sh
139+ /tmp/cross-compiler/ entrypoint /build_scripts/build-mpdecimal.sh
108140
109141
110142FROM --platform=${BUILDPLATFORM} ghcr.io/sigstore/cosign/cosign:v2.5.0 AS cosign-bin
111143
144+
112145FROM build_base AS build_cpython
113146COPY --from=build_tcl_tk /manylinux-buildfs /
114147COPY --from=build_mpdecimal /manylinux-buildfs /
115148COPY --from=build_sqlite3 /manylinux-buildfs /
116149RUN if command -v apk >/dev/null 2>&1; then ldconfig /; else ldconfig; fi
117150COPY build_scripts/build-openssl.sh /build_scripts/
118- RUN export OPENSSL_ROOT=openssl-3.5.4 && \
151+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
152+ export OPENSSL_ROOT=openssl-3.5.4 && \
119153 export OPENSSL_HASH=967311f84955316969bdb1d8d4b983718ef42338639c621ec4c34fddef355e99 && \
120154 export OPENSSL_DOWNLOAD_URL=https://github.com/openssl/openssl/releases/download/${OPENSSL_ROOT} && \
121- manylinux- entrypoint /build_scripts/build-openssl.sh
155+ /tmp/cross-compiler/ entrypoint /build_scripts/build-openssl.sh
122156COPY --from=cosign-bin /ko-app/cosign /usr/local/bin/cosign
123157COPY build_scripts/build-cpython.sh /build_scripts/
124158
159+
125160FROM build_cpython AS build_cpython38
126- RUN manylinux-entrypoint /build_scripts/build-cpython.sh lukasz@langa.pl https://github.com/login/oauth 3.8.20
161+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
162+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
163+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh lukasz@langa.pl https://github.com/login/oauth 3.8.20
127164
128165FROM build_cpython AS build_cpython39
129- RUN manylinux-entrypoint /build_scripts/build-cpython.sh lukasz@langa.pl https://github.com/login/oauth 3.9.24
166+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
167+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
168+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh lukasz@langa.pl https://github.com/login/oauth 3.9.24
130169
131170FROM build_cpython AS build_cpython310
132- RUN manylinux-entrypoint /build_scripts/build-cpython.sh pablogsal@python.org https://accounts.google.com 3.10.19
171+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
172+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
173+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh pablogsal@python.org https://accounts.google.com 3.10.19
133174
134175FROM build_cpython AS build_cpython311
135- RUN manylinux-entrypoint /build_scripts/build-cpython.sh pablogsal@python.org https://accounts.google.com 3.11.14
176+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
177+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
178+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh pablogsal@python.org https://accounts.google.com 3.11.14
136179
137180FROM build_cpython AS build_cpython312
138- RUN manylinux-entrypoint /build_scripts/build-cpython.sh thomas@python.org https://accounts.google.com 3.12.12
181+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
182+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
183+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh thomas@python.org https://accounts.google.com 3.12.12
139184
140185FROM build_cpython AS build_cpython313
141- RUN manylinux-entrypoint /build_scripts/build-cpython.sh thomas@python.org https://accounts.google.com 3.13.8
186+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
187+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
188+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh thomas@python.org https://accounts.google.com 3.13.8
142189
143190FROM build_cpython AS build_cpython313_nogil
144- RUN manylinux-entrypoint /build_scripts/build-cpython.sh thomas@python.org https://accounts.google.com 3.13.8 nogil
191+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
192+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
193+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh thomas@python.org https://accounts.google.com 3.13.8 nogil
145194
146195FROM build_cpython AS build_cpython314
147- RUN manylinux-entrypoint /build_scripts/build-cpython.sh hugo@python.org https://github.com/login/oauth 3.14.0
196+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
197+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
198+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh hugo@python.org https://github.com/login/oauth 3.14.0
148199
149200FROM build_cpython AS build_cpython314_nogil
150- RUN manylinux-entrypoint /build_scripts/build-cpython.sh hugo@python.org https://github.com/login/oauth 3.14.0 nogil
201+ ARG MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
202+ RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
203+ /tmp/cross-compiler/entrypoint /build_scripts/build-cpython.sh hugo@python.org https://github.com/login/oauth 3.14.0 nogil
204+
151205
152206FROM runtime_base
153207COPY --from=build_tcl_tk /manylinux-rootfs /
0 commit comments