| 1 | FROM docker.io/debian:bookworm |
| 2 | |
| 3 | # |
| 4 | # Create the container: podman build -t . gcc-4.8 |
| 5 | # Build the cross compilers: |
| 6 | # mkdir -p ~/gcc-4.8 |
| 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" -v ~/gcc-4.8:/output localhost/gcc-4.8 ; done |
| 8 | # tar -czf ~/gcc-4.8.tgz -C ~/gcc-4.8 ./ |
| 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 -t jessie cross-gcc-dev |
| 16 | RUN mkdir -p /src/build /src/patches /output |
| 17 | WORKDIR /src |
| 18 | RUN wget -q -O - https://github.com/gcc-mirror/gcc/archive/refs/tags/releases/gcc-4.8.5.tar.gz | tar -xzf - |
| 19 | WORKDIR /src/patches |
| 20 | |
| 21 | # This patch fixes builds with more recent versions of texinfo |
| 22 | RUN wget -q https://aur.archlinux.org/cgit/aur.git/plain/gcc.texi.49.patch?h=gcc48 -O 01-texi.patch.0 |
| 23 | |
| 24 | # This patch updates the program search directions and installation directories |
| 25 | # to match those used by the Debian packages, so we can piggy-back on the modern |
| 26 | # toolchain binaries (eg. binutils--arch64-linux-gnu) |
| 27 | RUN wget -q https://salsa.debian.org/toolchain-team/gcc/-/raw/gcc-4.8-debian/debian/patches/cross-install-location.diff -O 02-cross_install_dir.patch.2 |
| 28 | |
| 29 | WORKDIR /src/build |
| 30 | COPY script.sh /usr/bin/build-gcc.sh |
| 31 | CMD /usr/bin/build-gcc.sh |
| 32 | |
| 33 | # @TODO: missing crtbegin.o eg., libgcc-4.8-dev-arm64-cross |
| 34 | # This can be "worked around" by copying the system libc-cross |
| 35 | # eg. |
| 36 | # cp -r /usr/lib/gcc-cross/aarch64-linux-gnu/12/ /usr/lib/gcc-cross/aarch64-linux-gnu/4.8.5 |
| 37 | # make |
| 38 | # |