Skip to content

Commit 19a7e4e

Browse files
committed
feat: use cross-compilation to build images
1 parent 9e7b93e commit 19a7e4e

File tree

8 files changed

+216
-52
lines changed

8 files changed

+216
-52
lines changed

.github/workflows/build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ jobs:
5050
("i686", "ubuntu-24.04", ("manylinux2014", "manylinux_2_28", "manylinux_2_34", "musllinux_1_2")),
5151
("armv7l", "ubuntu-24.04-arm", ("manylinux_2_31", "musllinux_1_2")),
5252
("riscv64", "ubuntu-24.04", ("manylinux_2_39", "musllinux_1_2")),
53+
("ppc64le", "ubuntu-24.04", ("manylinux2014", "manylinux_2_28", "manylinux_2_34", "musllinux_1_2",)),
54+
("s390x", "ubuntu-24.04", ("musllinux_1_2",)),
5355
]
5456
expanded = [{"policy": policy, "platform": platform, "runner": runner} for platform, runner, policies in reduced for policy in policies]
5557
print(json.dumps(expanded, indent=2))
@@ -79,7 +81,7 @@ jobs:
7981
fetch-depth: 50
8082

8183
- name: Set up QEMU
82-
if: matrix.platform == 'riscv64'
84+
if: matrix.platform == 'ppc64le' || matrix.platform == 'riscv64' || matrix.platform == 's390x'
8385
uses: docker/setup-qemu-action@v3
8486

8587
- name: Set up Docker Buildx

.travis.yml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,10 @@ jobs:
2828
include:
2929
- arch: s390x
3030
env: POLICY="manylinux2014" PLATFORM="s390x"
31-
- arch: ppc64le
32-
env: POLICY="manylinux2014" PLATFORM="ppc64le"
3331
- arch: s390x
3432
env: POLICY="manylinux_2_28" PLATFORM="s390x"
35-
- arch: ppc64le
36-
env: POLICY="manylinux_2_28" PLATFORM="ppc64le"
3733
- arch: s390x
3834
env: POLICY="manylinux_2_34" PLATFORM="s390x"
39-
- arch: ppc64le
40-
env: POLICY="manylinux_2_34" PLATFORM="ppc64le"
41-
- arch: s390x
42-
env: POLICY="musllinux_1_2" PLATFORM="s390x"
43-
- arch: ppc64le
44-
env: POLICY="musllinux_1_2" PLATFORM="ppc64le"
4535

4636
before_install:
4737
- if [ -d "${HOME}/buildx-cache/.buildx-cache-${POLICY}_${PLATFORM}" ]; then cp -rlf ${HOME}/buildx-cache/.buildx-cache-${POLICY}_${PLATFORM} ./; fi

build.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,58 @@ export DEVTOOLSET_ROOTPATH
8080
export PREPEND_PATH
8181
export LD_LIBRARY_PATH_ARG
8282

83+
# cross-compilation tools platform, installed in any case
84+
if [ "${MANYLINUX_BUILDARCH:-}" == "" ]; then
85+
if [ "${MANYLINUX_BUILD_FRONTEND}" == "podman" ]; then
86+
MANYLINUX_BUILDARCH=$(podman version -f "{{.Server.Arch}}")
87+
else
88+
MANYLINUX_BUILDARCH=$(docker version -f "{{.Server.Arch}}")
89+
fi
90+
if [ "${MANYLINUX_BUILDARCH}" == "arm" ]; then
91+
MANYLINUX_BUILDARCH="arm/v7"
92+
fi
93+
fi
94+
export MANYLINUX_BUILDARCH
95+
96+
# cross-compilation tools usage, by default, only on amd64/arm64
97+
if [ "${MANYLINUX_DISABLE_CLANG:-}" == "" ]; then
98+
if [ "${MANYLINUX_BUILDARCH}" == "amd64" ] || [ "${MANYLINUX_BUILDARCH}" == "arm64" ]; then
99+
MANYLINUX_DISABLE_CLANG=0
100+
else
101+
MANYLINUX_DISABLE_CLANG=1
102+
fi
103+
fi
104+
if [ "${MANYLINUX_DISABLE_CLANG}" != "0" ]; then
105+
MANYLINUX_DISABLE_CLANG=1 # integer bool like
106+
fi
107+
export MANYLINUX_DISABLE_CLANG
108+
109+
# cross-compilation tools usage when building cpython, default depends on PEP11
110+
if [ "${MANYLINUX_DISABLE_CLANG_FOR_CPYTHON:-}" == "" ]; then
111+
MANYLINUX_DISABLE_CLANG_FOR_CPYTHON=0
112+
if [ "${POLICY:0:9}" == "manylinux" ]; then
113+
case "${PLATFORM}" in
114+
aarch64|x86_64) MANYLINUX_DISABLE_CLANG_FOR_CPYTHON=1;; # gcc is Tier-1, clang is Tier-2
115+
armv7l) MANYLINUX_DISABLE_CLANG_FOR_CPYTHON=1;; # gcc is Tier-3, clang not supported at all
116+
s390x) MANYLINUX_DISABLE_CLANG_FOR_CPYTHON=1;; # gcc is Tier-3, clang not supported at all
117+
*) ;;
118+
esac
119+
fi
120+
fi
121+
if [ "${MANYLINUX_DISABLE_CLANG_FOR_CPYTHON}" != "0" ]; then
122+
MANYLINUX_DISABLE_CLANG_FOR_CPYTHON=1 # integer bool like
123+
fi
124+
export MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
125+
126+
83127
MANYLINUX_IMAGE="quay.io/pypa/${POLICY}_${PLATFORM}:${COMMIT_SHA}"
84128

85129
BUILD_ARGS_COMMON=(
86130
"--platform=linux/${GOARCH}"
87131
"--pull=true"
88132
--build-arg POLICY --build-arg PLATFORM --build-arg BASEIMAGE
89133
--build-arg DEVTOOLSET_ROOTPATH --build-arg PREPEND_PATH --build-arg LD_LIBRARY_PATH_ARG
134+
--build-arg MANYLINUX_BUILDARCH --build-arg MANYLINUX_DISABLE_CLANG --build-arg MANYLINUX_DISABLE_CLANG_FOR_CPYTHON
90135
--rm -t "${MANYLINUX_IMAGE}"
91136
-f docker/Dockerfile docker/
92137
)

docker/Dockerfile

Lines changed: 84 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,12 @@ ARG PLATFORM=x86_64
55
ARG DEVTOOLSET_ROOTPATH=/opt/rh/gcc-toolset-14/root
66
ARG LD_LIBRARY_PATH_ARG=${DEVTOOLSET_ROOTPATH}/usr/lib64:${DEVTOOLSET_ROOTPATH}/usr/lib:${DEVTOOLSET_ROOTPATH}/usr/lib64/dyninst:${DEVTOOLSET_ROOTPATH}/usr/lib/dyninst
77
ARG 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
1014
ARG POLICY
1115
ARG PLATFORM
1216
ARG DEVTOOLSET_ROOTPATH
@@ -42,29 +46,49 @@ RUN manylinux-entrypoint /build_scripts/install-runtime-packages.sh && rm -rf /b
4246

4347
COPY 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:20.1.8.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
4564
COPY 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

5171
COPY 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

5778
COPY 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

6385
COPY 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

6993
FROM runtime_base AS build_base
7094
COPY build_scripts/install-build-packages.sh /build_scripts/
@@ -73,81 +97,111 @@ RUN manylinux-entrypoint /build_scripts/install-build-packages.sh
7397

7498
FROM build_base AS build_git
7599
COPY build_scripts/build-curl.sh /build_scripts/
76-
RUN export CURL_ROOT=curl-8.15.0 && \
100+
RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
101+
export CURL_ROOT=curl-8.15.0 && \
77102
export CURL_HASH=d85cfc79dc505ff800cb1d321a320183035011fa08cb301356425d86be8fc53c && \
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
80105
COPY 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

86113
FROM build_base AS build_sqlite3
87114
COPY 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

93122
FROM build_base AS build_tcl_tk
94123
COPY 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

102133
FROM build_base AS build_mpdecimal
103134
COPY 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

110142
FROM --platform=${BUILDPLATFORM} ghcr.io/sigstore/cosign/cosign:v2.5.0 AS cosign-bin
111143

144+
112145
FROM build_base AS build_cpython
113146
COPY --from=build_tcl_tk /manylinux-buildfs /
114147
COPY --from=build_mpdecimal /manylinux-buildfs /
115148
COPY --from=build_sqlite3 /manylinux-buildfs /
116149
RUN if command -v apk >/dev/null 2>&1; then ldconfig /; else ldconfig; fi
117150
COPY build_scripts/build-openssl.sh /build_scripts/
118-
RUN export OPENSSL_ROOT=openssl-3.5.2 && \
151+
RUN --mount=type=bind,from=static_clang,target=/tmp/cross-compiler,ro \
152+
export OPENSSL_ROOT=openssl-3.5.2 && \
119153
export OPENSSL_HASH=c53a47e5e441c930c3928cf7bf6fb00e5d129b630e0aa873b08258656e7345ec && \
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
122156
COPY --from=cosign-bin /ko-app/cosign /usr/local/bin/cosign
123157
COPY build_scripts/build-cpython.sh /build_scripts/
124158

159+
125160
FROM build_cpython AS build_cpython38
126-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] 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 [email protected] https://github.com/login/oauth 3.8.20
127164

128165
FROM build_cpython AS build_cpython39
129-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://github.com/login/oauth 3.9.23
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 [email protected] https://github.com/login/oauth 3.9.23
130169

131170
FROM build_cpython AS build_cpython310
132-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://accounts.google.com 3.10.18
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 [email protected] https://accounts.google.com 3.10.18
133174

134175
FROM build_cpython AS build_cpython311
135-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://accounts.google.com 3.11.13
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 [email protected] https://accounts.google.com 3.11.13
136179

137180
FROM build_cpython AS build_cpython312
138-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://accounts.google.com 3.12.11
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 [email protected] https://accounts.google.com 3.12.11
139184

140185
FROM build_cpython AS build_cpython313
141-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://accounts.google.com 3.13.7
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 [email protected] https://accounts.google.com 3.13.7
142189

143190
FROM build_cpython AS build_cpython313_nogil
144-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://accounts.google.com 3.13.7 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 [email protected] https://accounts.google.com 3.13.7 nogil
145194

146195
FROM build_cpython AS build_cpython314
147-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://github.com/login/oauth 3.14.0rc2
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 [email protected] https://github.com/login/oauth 3.14.0rc2
148199

149200
FROM build_cpython AS build_cpython314_nogil
150-
RUN manylinux-entrypoint /build_scripts/build-cpython.sh [email protected] https://github.com/login/oauth 3.14.0rc2 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 [email protected] https://github.com/login/oauth 3.14.0rc2 nogil
204+
151205

152206
FROM runtime_base
153207
COPY --from=build_tcl_tk /manylinux-rootfs /

docker/build_scripts/build-cpython.sh

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ tar -xJf "Python-${CPYTHON_VERSION}.tar.xz"
3535
pushd "Python-${CPYTHON_VERSION}"
3636
PREFIX="/opt/_internal/cpython-${CPYTHON_VERSION}"
3737
mkdir -p "${PREFIX}/lib"
38-
CFLAGS_EXTRA=""
38+
LDFLAGS_EXTRA=""
3939
CONFIGURE_ARGS=(--disable-shared --with-ensurepip=no)
4040

4141
if [ "${4:-}" == "nogil" ]; then
@@ -45,7 +45,7 @@ fi
4545

4646
if [ "${AUDITWHEEL_POLICY}" == "manylinux2014" ] ; then
4747
# Python 3.11+
48-
export TCLTK_LIBS="-ltk8.6 -ltcl8.6"
48+
export TCLTK_LIBS="-L/usr/local/lib -ltk8.6 -ltcl8.6"
4949
fi
5050

5151
if [ "${BASE_POLICY}_${AUDITWHEEL_ARCH}" == "manylinux_armv7l" ]; then
@@ -55,30 +55,26 @@ elif [ "${BASE_POLICY}_${AUDITWHEEL_ARCH}" == "musllinux_armv7l" ]; then
5555
fi
5656

5757
case "${CPYTHON_VERSION}" in
58-
3.8.*|3.9.*|3.10.*) sed -i "s|/usr/local/include/sqlite3|/opt/_internal/sqlite3/include|g ; s|sqlite_extra_link_args = ()|sqlite_extra_link_args = ('-Wl,--enable-new-dtags,-rpath=/opt/_internal/sqlite3/lib',)|g" setup.py;;
58+
3.8.*|3.9.*|3.10.*) sed -i "s|/usr/local/include/sqlite3|/opt/_internal/sqlite3/include|g ; s|sqlite_extra_link_args = ()|sqlite_extra_link_args = ('-Wl,-rpath=/opt/_internal/sqlite3/lib',)|g" setup.py;;
5959
*) ;;
6060
esac
6161

6262
OPENSSL_PREFIX=$(find /opt/_internal -maxdepth 1 -name 'openssl*')
6363
if [ "${OPENSSL_PREFIX}" != "" ]; then
6464
CONFIGURE_ARGS+=("--with-openssl=${OPENSSL_PREFIX}")
6565
case "${CPYTHON_VERSION}" in
66-
3.8.*|3.9.*) export LD_RUN_PATH=${OPENSSL_PREFIX}/lib;;
66+
3.8.*|3.9.*) export LDFLAGS_EXTRA="-Wl,-rpath,${OPENSSL_PREFIX}/lib";;
6767
*) CONFIGURE_ARGS+=(--with-openssl-rpath=auto);;
6868
esac
6969
fi
7070

7171
unset _PYTHON_HOST_PLATFORM
7272

73-
if [ "${AUDITWHEEL_ARCH}" == "x86_64" ] && echo | gcc -S -x c -v - 2>&1 | grep 'march=x86-64-v' > /dev/null; then
74-
export EXTRA_CFLAGS="-mtune=generic -march=x86-64"
75-
fi
76-
7773
# configure with hardening options only for the interpreter & stdlib C extensions
7874
# do not change the default for user built extension (yet?)
7975
./configure \
80-
CFLAGS_NODIST="${MANYLINUX_CFLAGS} ${MANYLINUX_CPPFLAGS} ${CFLAGS_EXTRA}" \
81-
LDFLAGS_NODIST="${MANYLINUX_LDFLAGS}" \
76+
CFLAGS_NODIST="${MANYLINUX_CFLAGS} ${MANYLINUX_CPPFLAGS}" \
77+
LDFLAGS_NODIST="${MANYLINUX_LDFLAGS} ${LDFLAGS_EXTRA}" \
8278
"--prefix=${PREFIX}" "${CONFIGURE_ARGS[@]}" > /dev/null
8379
make > /dev/null
8480
make install > /dev/null

docker/build_scripts/build-openssl.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,16 @@ if [ "$(nproc)" -ge 2 ]; then
4545
PARALLEL_BUILDS=-j2
4646
fi
4747

48+
LIBATOMIC=
49+
if [ "${AUDITWHEEL_ARCH}" == "i686" ]; then
50+
LIBATOMIC=-latomic
51+
fi
52+
4853
fetch_source "${OPENSSL_ROOT}.tar.gz" "${OPENSSL_DOWNLOAD_URL}"
4954
check_sha256sum "${OPENSSL_ROOT}.tar.gz" "${OPENSSL_HASH}"
5055
tar -xzf "${OPENSSL_ROOT}.tar.gz"
5156
pushd "${OPENSSL_ROOT}"
52-
./Configure "--prefix=${PREFIX}" "--openssldir=${PREFIX}" --libdir=lib CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS}" CXXFLAGS="${MANYLINUX_CXXFLAGS}" LDFLAGS="${MANYLINUX_LDFLAGS} -Wl,-rpath,\$(LIBRPATH)" > /dev/null
57+
./Configure "--prefix=${PREFIX}" "--openssldir=${PREFIX}" --libdir=lib no-afalgeng CPPFLAGS="${MANYLINUX_CPPFLAGS}" CFLAGS="${MANYLINUX_CFLAGS}" CXXFLAGS="${MANYLINUX_CXXFLAGS}" LDFLAGS="${MANYLINUX_LDFLAGS} -Wl,-rpath,\$(LIBRPATH) ${LIBATOMIC}" > /dev/null
5358
make ${PARALLEL_BUILDS} > /dev/null
5459
make install_sw > /dev/null
5560
popd

0 commit comments

Comments
 (0)