2023-11-17 10:00:25 +00:00
|
|
|
FROM imgrep/musl:latest as musl
|
|
|
|
FROM imgrep/bootstrap:latest as build
|
2023-11-08 22:39:09 +00:00
|
|
|
|
2023-11-09 13:41:25 +00:00
|
|
|
ENV GCC_SITE https://mirrors.kernel.org/gnu/gcc
|
2023-12-02 18:37:45 +00:00
|
|
|
ENV GCC_VERSION 12.2.0
|
|
|
|
ENV GCC_HASH e549cf9cf3594a00e27b6589d4322d70e0720cdd213f39beb4181e06926230ff
|
2023-11-08 22:39:09 +00:00
|
|
|
|
2023-12-02 18:37:45 +00:00
|
|
|
RUN echo wget ${GCC_SITE}/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz
|
2023-11-09 13:41:25 +00:00
|
|
|
RUN wget ${GCC_SITE}/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz
|
|
|
|
RUN echo "${GCC_HASH} gcc-${GCC_VERSION}.tar.xz" | sha256sum -c
|
|
|
|
RUN tar -xf gcc-${GCC_VERSION}.tar.xz
|
|
|
|
WORKDIR gcc-${GCC_VERSION}
|
2023-11-08 22:39:09 +00:00
|
|
|
RUN set -ex; \
|
|
|
|
./contrib/download_prerequisites; \
|
2023-11-09 13:41:25 +00:00
|
|
|
{ rm *.tar.* || true; }
|
2023-11-13 06:09:30 +00:00
|
|
|
|
2023-11-09 13:41:25 +00:00
|
|
|
RUN set -ex; \
|
|
|
|
./configure \
|
2023-11-18 08:37:31 +00:00
|
|
|
--target=x86_64-linux-musl \
|
|
|
|
--build=x86_64-linux-musl \
|
|
|
|
--host=x86_64-linux-musl \
|
|
|
|
--prefix /usr \
|
|
|
|
--mandir=/usr/share/man \
|
|
|
|
--infodir=/usr/share/info \
|
2023-11-19 00:44:16 +00:00
|
|
|
--libdir=/usr/lib \
|
2023-11-18 08:37:31 +00:00
|
|
|
--disable-cet \
|
|
|
|
--disable-fixed-point \
|
|
|
|
--disable-libstdcxx-pch \
|
2023-11-08 22:39:09 +00:00
|
|
|
--disable-multilib \
|
2023-11-18 08:37:31 +00:00
|
|
|
--disable-nls \
|
|
|
|
--disable-werror \
|
|
|
|
--enable-__cxa_atexit \
|
|
|
|
--enable-default-pie \
|
|
|
|
--enable-default-ssp \
|
2023-11-09 13:41:25 +00:00
|
|
|
--enable-languages=c,c++ \
|
2023-11-18 08:37:31 +00:00
|
|
|
--enable-link-serialization=2 \
|
|
|
|
--enable-linker-build-id; \
|
|
|
|
make -j "$(nproc)"
|
2023-12-02 18:37:45 +00:00
|
|
|
RUN set -eux; \
|
|
|
|
make DESTDIR=/home/user/rootfs/ install-strip; \
|
|
|
|
ln -s gcc /home/user/rootfs/usr/bin/cc
|
2023-11-18 08:37:31 +00:00
|
|
|
COPY --from=musl /lib/* /home/user/rootfs/lib/
|
2023-11-08 22:39:09 +00:00
|
|
|
|
|
|
|
FROM scratch
|
2023-11-18 08:37:31 +00:00
|
|
|
COPY --from=build /home/user/rootfs /
|
|
|
|
ENTRYPOINT ["/usr/bin/gcc"]
|
2023-11-08 22:39:09 +00:00
|
|
|
CMD ["--version"]
|