Skip to content

Commit f2b0400

Browse files
authored
Split automake build in runtime_base image (#968)
1 parent bf04c6a commit f2b0400

File tree

5 files changed

+46
-49
lines changed

5 files changed

+46
-49
lines changed

docker/Dockerfile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ COPY manylinux-entrypoint /usr/local/bin/manylinux-entrypoint
2828
ENTRYPOINT ["manylinux-entrypoint"]
2929

3030
COPY build_scripts/install-runtime-packages.sh /build_scripts/
31+
RUN manylinux-entrypoint /build_scripts/install-runtime-packages.sh && rm /build_scripts/install-runtime-packages.sh
32+
3133
COPY build_scripts/build_utils.sh /build_scripts/
32-
COPY build_scripts/build_env_runtime.sh /build_scripts/
33-
RUN manylinux-entrypoint /build_scripts/install-runtime-packages.sh
34+
35+
COPY build_scripts/install-automake.sh /build_scripts/
36+
RUN export AUTOMAKE_ROOT=automake-1.16.2 && \
37+
export AUTOMAKE_HASH=b2f361094b410b4acbf4efba7337bdb786335ca09eb2518635a09fb7319ca5c1 && \
38+
export AUTOMAKE_DOWNLOAD_URL=http://ftp.gnu.org/gnu/automake && \
39+
manylinux-entrypoint /build_scripts/install-automake.sh
3440

3541
COPY build_scripts/install-libtool.sh /build_scripts/
3642
RUN export LIBTOOL_ROOT=libtool-2.4.6 && \

docker/build_scripts/build_env_runtime.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

docker/build_scripts/build_utils.sh

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -117,31 +117,3 @@ function do_standard_install {
117117
make -j$(nproc) > /dev/null
118118
make -j$(nproc) install > /dev/null
119119
}
120-
121-
122-
function build_autoconf {
123-
local autoconf_fname=$1
124-
check_var ${autoconf_fname}
125-
local autoconf_sha256=$2
126-
check_var ${autoconf_sha256}
127-
check_var ${AUTOCONF_DOWNLOAD_URL}
128-
fetch_source ${autoconf_fname}.tar.gz ${AUTOCONF_DOWNLOAD_URL}
129-
check_sha256sum ${autoconf_fname}.tar.gz ${autoconf_sha256}
130-
tar -zxf ${autoconf_fname}.tar.gz
131-
(cd ${autoconf_fname} && do_standard_install)
132-
rm -rf ${autoconf_fname} ${autoconf_fname}.tar.gz
133-
}
134-
135-
136-
function build_automake {
137-
local automake_fname=$1
138-
check_var ${automake_fname}
139-
local automake_sha256=$2
140-
check_var ${automake_sha256}
141-
check_var ${AUTOMAKE_DOWNLOAD_URL}
142-
fetch_source ${automake_fname}.tar.gz ${AUTOMAKE_DOWNLOAD_URL}
143-
check_sha256sum ${automake_fname}.tar.gz ${automake_sha256}
144-
tar -zxf ${automake_fname}.tar.gz
145-
(cd ${automake_fname} && do_standard_install)
146-
rm -rf ${automake_fname} ${automake_fname}.tar.gz
147-
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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 newest automake
14+
check_var ${AUTOMAKE_ROOT}
15+
check_var ${AUTOMAKE_HASH}
16+
check_var ${AUTOMAKE_DOWNLOAD_URL}
17+
18+
AUTOMAKE_VERSION=${AUTOMAKE_ROOT#*-}
19+
if automake --version > /dev/null 2>&1; then
20+
INSTALLED=$(automake --version | head -1 | awk '{ print $NF }')
21+
SMALLEST=$(echo -e "${INSTALLED}\n${AUTOMAKE_VERSION}" | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n | head -1)
22+
if [ "${SMALLEST}" == "${AUTOMAKE_VERSION}" ]; then
23+
echo "skipping installation of automake ${AUTOMAKE_VERSION}, system provides automake ${INSTALLED}"
24+
exit 0
25+
fi
26+
fi
27+
28+
fetch_source ${AUTOMAKE_ROOT}.tar.gz ${AUTOMAKE_DOWNLOAD_URL}
29+
check_sha256sum ${AUTOMAKE_ROOT}.tar.gz ${AUTOMAKE_HASH}
30+
tar -zxf ${AUTOMAKE_ROOT}.tar.gz
31+
pushd ${AUTOMAKE_ROOT}
32+
do_standard_install
33+
popd
34+
rm -rf ${AUTOMAKE_ROOT} ${AUTOMAKE_ROOT}.tar.gz
35+
36+
37+
hash -r
38+
automake --version

docker/build_scripts/install-runtime-packages.sh

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@ set -exuo pipefail
66

77
# Set build environment variables
88
MY_DIR=$(dirname "${BASH_SOURCE[0]}")
9-
source $MY_DIR/build_env_runtime.sh
10-
11-
# Get build utilities
12-
source $MY_DIR/build_utils.sh
139

1410
# Libraries that are allowed as part of the manylinux2014 profile
1511
# Extract from PEP: https://www.python.org/dev/peps/pep-0599/#the-manylinux2014-policy
@@ -120,12 +116,3 @@ fi
120116
if [ -d /usr/local/share/man ]; then
121117
rm -rf /usr/local/share/man
122118
fi
123-
124-
125-
# Install newest automake
126-
build_automake $AUTOMAKE_ROOT $AUTOMAKE_HASH
127-
automake --version
128-
129-
# Strip what we can -- and ignore errors, because this just attempts to strip
130-
# *everything*, including non-ELF files:
131-
find /usr/local -type f -print0 | xargs -0 -n1 strip --strip-unneeded 2>/dev/null || true

0 commit comments

Comments
 (0)