Skip to content

Commit

Permalink
Move to 22.04; fix 1.1 build
Browse files Browse the repository at this point in the history
  • Loading branch information
mattgodbolt committed Jan 24, 2025
1 parent 6601a85 commit 07d4a57
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -7,6 +7,7 @@ RUN apt install -y -q \
gcc \
git \
make \
ncurses-dev \
patchelf \
xz-utils \
libgmp-dev
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
6 changes: 4 additions & 2 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 07d4a57

Please sign in to comment.