| 1 | FROM docker.io/debian:bookworm |
| 2 | |
| 3 | # |
| 4 | # Create the container: podman build -t gcc-5 -f gcc5.Containerfile . |
| 5 | # Build the cross compilers: |
| 6 | # mkdir -p ~/gcc-5 |
| 7 | # for i in aarch64-linux-gnu arm-linux-gnueabihf i686-linux-gnu powerpc64le-linux-gnu powerpc-linux-gnu riscv64-linux-gnu s390x-linux-gnu ; do podman run --rm -e "TARGET=$i" -e "SRC_DIR=/src/gcc-releases-gcc-5.5.0" -e "BIN_SUFFIX=5" -e "CSTD=gnu11" -e "CXXSTD=gnu++11" -v ~/gcc-5:/output localhost/gcc-5 ; done |
| 8 | # tar -czf ~/gcc-5.tgz -C ~/gcc-5 ./ |
| 9 | |
| 10 | RUN echo 'deb-src http://deb.debian.org/debian bookworm main contrib' >> /etc/apt/sources.list |
| 11 | RUN apt-get update |
| 12 | |
| 13 | RUN apt-get -y --force-yes build-dep gcc-12 |
| 14 | RUN apt-get -y --force-yes install wget |
| 15 | RUN apt-get -y --force-yes install gcc-12-aarch64-linux-gnu gcc-12-riscv64-linux-gnu gcc-12-i686-linux-gnu gcc-12-s390x-linux-gnu gcc-12-powerpc64le-linux-gnu gcc-12-powerpc-linux-gnu gcc-12-arm-linux-gnueabihf |
| 16 | # gcc-5.5.0 isn't compatible with libisl >= 0.21, as that version drops |
| 17 | # the deprecated isl_map_n_out function. |
| 18 | # See libisl commit aed01a35f1cd18ec6c9d3d151aee8d66afd67610 |
| 19 | # gcc-5.5.0 ins't compatible with libisl >= 0.19 as isl_band.h was removed in 0.19. |
| 20 | # See libisl commit 4eb5d8f7ea10bd5b47022334640f3c074f5a3d40 |
| 21 | # |
| 22 | # RUN wget -q http://snapshot.debian.org/archive/debian/20170106T032927Z/pool/main/i/isl/libisl-dev_0.18-1_amd64.deb |
| 23 | # RUN wget -q http://snapshot.debian.org/archive/debian/20170106T032927Z/pool/main/i/isl/libisl15_0.18-1_amd64.deb |
| 24 | # RUN apt install -y --allow-downgrades ./*.deb |
| 25 | |
| 26 | RUN mkdir -p /src/build /src/patches /output |
| 27 | WORKDIR /src |
| 28 | RUN wget -q -O - https://github.com/gcc-mirror/gcc/archive/refs/tags/releases/gcc-5.5.0.tar.gz | tar -xzf - |
| 29 | |
| 30 | WORKDIR /src/patches |
| 31 | # ustat.h was removed from glibc 2.28; the build of the compiler piggy backs on |
| 32 | # glibc shipped with the base OS, so a patch to address it's removal is |
| 33 | # necessary to allow the build to pass. |
| 34 | RUN wget -q https://aur.archlinux.org/cgit/aur.git/plain/glibc2.28-ustat.patch?h=gcc5 -O 01-ustat_removal.patch.0 |
| 35 | |
| 36 | # recent linux kernels removed support for cyclades |
| 37 | COPY gcc5-cyclades_removal.patch /src/patches/02-cyclades_removal.patch.1 |
| 38 | |
| 39 | # backport of https://github.com/gcc-mirror/gcc/commit/2701442d0cf6292f6624443c15813d6d1a3562fe |
| 40 | COPY gcc5-sanitizer_fs.patch /src/patches/03-sanitizer_fs.patch.1 |
| 41 | |
| 42 | WORKDIR /src/build |
| 43 | COPY script.sh /usr/bin/build-gcc.sh |
| 44 | CMD /usr/bin/build-gcc.sh |
| 45 | |
| 46 | # @TODO: missing crtbegin.o eg., libgcc-5-dev-arm64-cross |
| 47 | # This can be "worked around" by copying the system libc-cross |
| 48 | # eg. |
| 49 | # cp -r /usr/lib/gcc-cross/aarch64-linux-gnu/12/ /usr/lib/gcc-cross/aarch64-linux-gnu/5.5.0 |
| 50 | # make |
| 51 | # |