Skip to content

Commit 83be2f2

Browse files
authored
Split libxcrypt build in runtime_base image (#965)
1 parent 8fa9e37 commit 83be2f2

File tree

5 files changed

+49
-39
lines changed

5 files changed

+49
-39
lines changed

docker/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,17 @@ RUN bash /build_scripts/install-entrypoint.sh && rm -rf build_scripts
2727
COPY manylinux-entrypoint /usr/local/bin/manylinux-entrypoint
2828
ENTRYPOINT ["manylinux-entrypoint"]
2929

30-
3130
COPY build_scripts/install-runtime-packages.sh /build_scripts/
3231
COPY build_scripts/build_utils.sh /build_scripts/
3332
COPY build_scripts/build_env_runtime.sh /build_scripts/
34-
RUN manylinux-entrypoint /build_scripts/install-runtime-packages.sh && rm -rf /build_scripts
33+
RUN manylinux-entrypoint /build_scripts/install-runtime-packages.sh
34+
35+
COPY build_scripts/install-libxcrypt.sh /build_scripts/
36+
RUN export LIBXCRYPT_VERSION=4.4.17 && \
37+
export LIBXCRYPT_HASH=7665168d0409574a03f7b484682e68334764c29c21ca5df438955a381384ca07 && \
38+
export LIBXCRYPT_DOWNLOAD_URL=https://github.com/besser82/libxcrypt/archive && \
39+
manylinux-entrypoint /build_scripts/install-libxcrypt.sh
40+
3541

3642
FROM runtime_base AS build_base
3743
COPY build_scripts/*pubkey*.txt /build_scripts/

docker/build_scripts/build_env_runtime.sh

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,3 @@ AUTOMAKE_DOWNLOAD_URL=http://ftp.gnu.org/gnu/automake
1111
LIBTOOL_ROOT=libtool-2.4.6
1212
LIBTOOL_HASH=e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3
1313
LIBTOOL_DOWNLOAD_URL=http://ftp.gnu.org/gnu/libtool
14-
15-
LIBXCRYPT_VERSION=4.4.17
16-
LIBXCRYPT_HASH=7665168d0409574a03f7b484682e68334764c29c21ca5df438955a381384ca07
17-
LIBXCRYPT_DOWNLOAD_URL=https://github.com/besser82/libxcrypt/archive

docker/build_scripts/build_utils.sh

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -160,36 +160,6 @@ function build_libtool {
160160
rm -rf ${libtool_fname} ${libtool_fname}.tar.gz
161161
}
162162

163-
function build_libxcrypt {
164-
check_var ${LIBXCRYPT_VERSION}
165-
check_var ${LIBXCRYPT_HASH}
166-
check_var ${LIBXCRYPT_DOWNLOAD_URL}
167-
fetch_source v${LIBXCRYPT_VERSION}.tar.gz ${LIBXCRYPT_DOWNLOAD_URL}
168-
check_sha256sum "v${LIBXCRYPT_VERSION}.tar.gz" "$LIBXCRYPT_HASH"
169-
tar xfz "v${LIBXCRYPT_VERSION}.tar.gz"
170-
pushd "libxcrypt-$LIBXCRYPT_VERSION"
171-
./autogen.sh > /dev/null
172-
do_standard_install \
173-
--disable-obsolete-api \
174-
--enable-hashes=all \
175-
--disable-werror
176-
# we also need libcrypt.so.1 with glibc compatibility for system libraries
177-
# c.f https://github.com/pypa/manylinux/issues/305#issuecomment-625902928
178-
make clean > /dev/null
179-
sed -r -i 's/XCRYPT_([0-9.])+/-/g;s/(%chain OW_CRYPT_1.0).*/\1/g' lib/libcrypt.map.in
180-
DESTDIR=$(pwd)/so.1 do_standard_install \
181-
--disable-xcrypt-compat-files \
182-
--enable-obsolete-api=glibc \
183-
--enable-hashes=all \
184-
--disable-werror
185-
cp -P ./so.1/usr/local/lib/libcrypt.so.1* /usr/local/lib/
186-
popd
187-
rm -rf "v${LIBXCRYPT_VERSION}.tar.gz" "libxcrypt-$LIBXCRYPT_VERSION"
188-
189-
# Delete GLIBC version headers and libraries
190-
rm -rf /usr/include/crypt.h
191-
rm -rf /usr/lib*/libcrypt.a /usr/lib*/libcrypt.so /usr/lib*/libcrypt.so.1
192-
}
193163

194164
function build_patchelf {
195165
local patchelf_version=$1
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
# Top-level build script called from Dockerfile
3+
4+
# Stop at any error, show all commands
5+
set -exuo pipefail
6+
7+
# Get script directory
8+
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
9+
10+
# Get build utilities
11+
source $MY_DIR/build_utils.sh
12+
13+
# Install libcrypt.so.1 and libcrypt.so.2
14+
check_var ${LIBXCRYPT_VERSION}
15+
check_var ${LIBXCRYPT_HASH}
16+
check_var ${LIBXCRYPT_DOWNLOAD_URL}
17+
fetch_source v${LIBXCRYPT_VERSION}.tar.gz ${LIBXCRYPT_DOWNLOAD_URL}
18+
check_sha256sum "v${LIBXCRYPT_VERSION}.tar.gz" "${LIBXCRYPT_HASH}"
19+
tar xfz "v${LIBXCRYPT_VERSION}.tar.gz"
20+
pushd "libxcrypt-${LIBXCRYPT_VERSION}"
21+
./autogen.sh > /dev/null
22+
do_standard_install \
23+
--disable-obsolete-api \
24+
--enable-hashes=all \
25+
--disable-werror
26+
# we also need libcrypt.so.1 with glibc compatibility for system libraries
27+
# c.f https://github.com/pypa/manylinux/issues/305#issuecomment-625902928
28+
make clean > /dev/null
29+
sed -r -i 's/XCRYPT_([0-9.])+/-/g;s/(%chain OW_CRYPT_1.0).*/\1/g' lib/libcrypt.map.in
30+
DESTDIR=$(pwd)/so.1 do_standard_install \
31+
--disable-xcrypt-compat-files \
32+
--enable-obsolete-api=glibc \
33+
--enable-hashes=all \
34+
--disable-werror
35+
cp -P ./so.1/usr/local/lib/libcrypt.so.1* /usr/local/lib/
36+
popd
37+
rm -rf "v${LIBXCRYPT_VERSION}.tar.gz" "libxcrypt-${LIBXCRYPT_VERSION}"
38+
39+
# Delete GLIBC version headers and libraries
40+
rm -rf /usr/include/crypt.h
41+
rm -rf /usr/lib*/libcrypt.a /usr/lib*/libcrypt.so /usr/lib*/libcrypt.so.1

docker/build_scripts/install-runtime-packages.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,6 @@ libtool --version
133133
# Install patchelf (latest with unreleased bug fixes) and apply our patches
134134
build_patchelf $PATCHELF_VERSION $PATCHELF_HASH
135135

136-
# Install libcrypt.so.1 and libcrypt.so.2
137-
build_libxcrypt "$LIBXCRYPT_DOWNLOAD_URL" "$LIBXCRYPT_VERSION" "$LIBXCRYPT_HASH"
138-
139136
# Strip what we can -- and ignore errors, because this just attempts to strip
140137
# *everything*, including non-ELF files:
141138
find /usr/local -type f -print0 | xargs -0 -n1 strip --strip-unneeded 2>/dev/null || true

0 commit comments

Comments
 (0)