File tree Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Expand file tree Collapse file tree 2 files changed +28
-5
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ RUN apt update -y -q && apt upgrade -y -q && apt update -y -q && \
1111 apt -q install -y \
1212 curl \
1313 git \
14- libssl-dev \
1514 unzip \
15+ patchelf \
1616 xz-utils
1717
1818RUN mkdir -p /root
Original file line number Diff line number Diff line change 1818REVISION=" python-${VERSION} "
1919initialise " ${REVISION} " " ${OUTPUT} " " ${LAST_REVISION} "
2020
21- DEST=/root/built
21+ SSL_PREFIX=/root/ssl
22+ SSL_VERSION=3.3.2
23+ curl -sL https://github.com/openssl/openssl/releases/download/openssl-${SSL_VERSION} /openssl-${SSL_VERSION} .tar.gz | tar zxf -
24+ pushd openssl-${SSL_VERSION}
25+ ./Configure --prefix=${SSL_PREFIX}
26+ make -j$( nproc)
27+ make install_sw
28+ popd
29+
30+ # Python seems to hardcode ssldir/lib and not ssldir/lib64
31+ ln -s lib64 ${SSL_PREFIX} /lib
32+
33+ # The rpath below seems to not quite "take"
34+ export LD_LIBRARY_PATH=${SSL_PREFIX} /lib64
35+
36+ DEST=/root/python
2237
2338curl -sL https://www.python.org/ftp/python/${VERSION} /Python-${VERSION} .tgz | tar zxf -
2439pushd Python-${VERSION}
2540./configure \
2641 --prefix=${DEST} \
27- --enable-optimizations \
28- --without-pymalloc
42+ --with-openssl=${SSL_PREFIX} \
43+ --with-openssl-rpath=${SSL_PREFIX} /lib64 \
44+ --without-pymalloc \
45+ --enable-optimizations
2946
3047make -j$( nproc)
3148make install
3249popd
3350
51+ # copy SSL SOs to the same directory as the native python modules
52+ cp ${SSL_PREFIX} /lib64/* .so* /root/python/lib/python* /lib-dynload/
53+
54+ # then patch the ssl to look at $ORIGIN to find the crypto libs
55+ patchelf --set-rpath \$ ORIGIN /root/python/lib/python* /lib-dynload/_ssl* .so
56+
3457# strip executables
3558find ${DEST} -type f -perm /u+x -exec strip -d {} \;
3659
3760# delete tests and static libraries to save disk space
3861find ${DEST} -type d -name test -exec rm -rf {} +
39- find ${DEST} -type f -name * .a -delete
62+ find ${DEST} -type f -name ' *.a' -delete
4063
4164complete " ${DEST} " " ${FULLNAME} " " ${OUTPUT} "
You can’t perform that action at this time.
0 commit comments