diff --git a/clang/Dockerfile b/clang/Dockerfile index 832cf24..5bbb88f 100644 --- a/clang/Dockerfile +++ b/clang/Dockerfile @@ -7,15 +7,12 @@ COPY test/test.cpp ./ RUN touch /etc/dockerinit -ARG LIBCXX -ARG BUILD_LIBCXX RUN apt-get update -qq && \ apt-get install -y --no-install-recommends \ binutils-dev \ ca-certificates \ gdb \ git \ - ${LIBCXX} \ libcurl4-openssl-dev \ libdw-dev \ libiberty-dev \ @@ -28,6 +25,15 @@ RUN apt-get update -qq && \ xz-utils \ zlib1g-dev \ wget + +COPY common/install-glibc.sh . +RUN stat ./install-glibc.sh +RUN ./install-glibc.sh +RUN rm install-glibc.sh + +ARG LIBCXX +RUN [ -z "${LIBCXX}" ] || apt-get install -y --no-install-recommends ${LIBCXX} + RUN apt-get install -y --no-install-recommends gpg gpg-agent || true COPY clang/install-clang.sh ./ diff --git a/clang/install-libcxx.sh b/clang/install-libcxx.sh index d95ad12..419e05a 100755 --- a/clang/install-libcxx.sh +++ b/clang/install-libcxx.sh @@ -62,7 +62,6 @@ if [[ $VERSION == "3."* ]]; then cp -r llvm-build/lib/* /usr/lib/x86_64-linux-gnu cp -r ${SOURCE}/projects/libcxx/include/* /usr/lib/llvm-$1/include/c++/v1 else - ln -s /usr/include/locale.h /usr/include/xlocale.h cmake -DCMAKE_C_COMPILER=clang-$1 -DCMAKE_CXX_COMPILER=clang++-$1 \ -DCMAKE_INSTALL_PREFIX=/usr \ -DCMAKE_BUILD_WITH_INSTALL_RPATH=1 \ diff --git a/common/install-glibc.sh b/common/install-glibc.sh new file mode 100755 index 0000000..be743a8 --- /dev/null +++ b/common/install-glibc.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +set -eou pipefail + +export CURRENT_VERSION="$(ldd --version | head -n 1 | sed 's/^.* \([0-9].*\)$/\1/')" +MIN_VERSION=2.28 + +function greater_version() { + echo -e "$1\n$2" | sort -Vr | head -n 1 +} +if [ "$(greater_version $MIN_VERSION $CURRENT_VERSION)" == "${CURRENT_VERSION}" ] +then + exit 0 +fi +apt install -y --no-install-recommends gawk bison texinfo gcc +git clone -b glibc-${MIN_VERSION} --depth=1 git://sourceware.org/git/glibc +mkdir glibc/build +pushd glibc/build +../configure --disable-sanity-checks +make +make install +popd +rm /usr/include/xlocale.h +ln -s /usr/include/locale.h /usr/include/xlocale.h +apt remove -y gawk bison texinfo gcc +apt autoremove -y +rm -rf glibc diff --git a/gcc/Dockerfile b/gcc/Dockerfile index 7bc402c..c6e5f5b 100644 --- a/gcc/Dockerfile +++ b/gcc/Dockerfile @@ -7,18 +7,17 @@ COPY test/test.cpp ./ RUN touch /etc/dockerinit -ARG GCC_VERSION RUN apt-get update -qq && \ apt-get install -y --no-install-recommends \ binutils-dev \ ca-certificates \ - g++-${GCC_VERSION} \ gdb \ git \ libcurl4-openssl-dev \ libdw-dev \ libiberty-dev \ libssl-dev \ + make \ ninja-build \ parallel \ python3 \ @@ -26,6 +25,13 @@ RUN apt-get update -qq && \ xz-utils \ zlib1g-dev \ wget + +COPY common/install-glibc.sh . +RUN ./install-glibc.sh; rm install-glibc.sh + +ARG GCC_VERSION +RUN apt-get install -y --no-install-recommends g++-${GCC_VERSION} + RUN apt-get install -y --no-install-recommends gpg gpg-agent || true ARG GCC_VERSION