From 07d4a5744846065cfd334a8675a329a13f2895a8 Mon Sep 17 00:00:00 2001 From: Matt Godbolt Date: Fri, 24 Jan 2025 12:03:05 -0600 Subject: [PATCH] Move to 22.04; fix 1.1 build Closes compiler-explorer/compiler-explorer#5626 --- Dockerfile | 3 ++- README.md | 6 ++++++ build/build.sh | 6 ++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index a9ae51f..1d537af 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:20.04 +FROM ubuntu:22.04 ARG DEBIAN_FRONTEND=noninteractive RUN apt update -y -q && apt upgrade -y -q @@ -7,6 +7,7 @@ RUN apt install -y -q \ gcc \ git \ make \ + ncurses-dev \ patchelf \ xz-utils \ libgmp-dev diff --git a/README.md b/README.md index 7a6a33f..c2ce132 100644 --- a/README.md +++ b/README.md @@ -2,3 +2,9 @@ The repository is part of the [Compiler Explorer](https://godbolt.org/) project. It builds the docker images used to build the Cobol compilers used on the site. + +### Example test... + +``` +$ docker build -t builder -f Dockerfile .; and docker run --rm -it -v/tmp/out:/build builder ./build.sh 1.1 /build +``` diff --git a/build/build.sh b/build/build.sh index 94d22fe..e872dfe 100755 --- a/build/build.sh +++ b/build/build.sh @@ -4,9 +4,11 @@ set -ex VERSION=$1 TAR_EXTRACT=J +WITH_OR_WITHOUT_CURSES=--without-curses if [[ "${VERSION}" == "1.1" ]]; then TAR_EXTRACT=z URL=https://ftp.gnu.org/gnu/gnucobol/gnu-cobol-${VERSION}.tar.gz + WITH_OR_WITHOUT_CURSES=--with-curses elif [[ "${VERSION}" =~ "rc" ]] || [[ "${VERSION}" =~ "beta" ]]; then URL=https://alpha.gnu.org/gnu/gnucobol/gnucobol-${VERSION}.tar.xz else @@ -35,12 +37,12 @@ mkdir -p ${BUILD_DIR} pushd ${BUILD_DIR} curl -sL ${URL} | tar ${TAR_EXTRACT}xf - --strip-components=1 # https://stackoverflow.com/questions/37060747/escaping-origin-for-libtool-based-project -./configure LDFLAGS="-Wl,-rpath,'\$\$ORIGIN/../lib'" --with-math=gmp --without-db --without-curses --without-xml2 --without-json +./configure LDFLAGS="-Wl,-rpath,'\$\$ORIGIN/../lib'" --with-math=gmp --without-db ${WITH_OR_WITHOUT_CURSES} --without-xml2 --without-json make -j$(nproc) make prefix=${STAGING_DIR} install # Copy dependent libraries, but not libdl, libc or libpthread. This isn't ideal.. -cp $(ldd "${STAGING_DIR}/bin/cobc" | grep -E '=> (/usr/)?/lib' | grep -Ev 'lib(pthread|c|dl).so' | awk '{print $3}') ${STAGING_DIR}/lib/ +cp $(ldd "${STAGING_DIR}"/bin/* | grep -E '=> (/usr/)?/lib' | grep -Ev 'lib(pthread|c|dl).so' | awk '{print $3}') ${STAGING_DIR}/lib/ patchelf --set-rpath '$ORIGIN/../lib' $(find ${STAGING_DIR}/lib/ -name \*.so\*) popd