2023-12-10 18:05:50 +00:00
|
|
|
ARG REGISTRY=local
|
|
|
|
FROM ${REGISTRY}/musl:latest as musl
|
2023-12-16 23:50:40 +00:00
|
|
|
FROM ${REGISTRY}/bootstrap:latest as bootstrap
|
2023-11-13 22:45:56 +00:00
|
|
|
|
2023-12-16 23:50:40 +00:00
|
|
|
FROM bootstrap as base
|
2023-11-13 22:45:56 +00:00
|
|
|
ENV SRC_SITE https://ftp.gnu.org/gnu/binutils
|
|
|
|
ENV SRC_VERSION 2.41
|
|
|
|
ENV SRC_HASH ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450
|
|
|
|
|
2023-12-16 23:50:40 +00:00
|
|
|
FROM base as fetch
|
2023-11-13 22:45:56 +00:00
|
|
|
RUN wget ${SRC_SITE}/binutils-${SRC_VERSION}.tar.xz
|
|
|
|
RUN echo "${SRC_HASH} binutils-${SRC_VERSION}.tar.xz" | sha256sum -c
|
2023-12-16 23:50:40 +00:00
|
|
|
|
|
|
|
FROM fetch as build
|
2023-11-13 22:45:56 +00:00
|
|
|
RUN tar -xf binutils-${SRC_VERSION}.tar.xz
|
|
|
|
WORKDIR binutils-${SRC_VERSION}
|
|
|
|
RUN set -ex; \
|
|
|
|
CFLAGS='-Os -Wformat -Werror=format-security -O2' \
|
|
|
|
CXXFLAGS='-Os -Wformat -Werror=format-security -O2' \
|
|
|
|
./configure \
|
|
|
|
--build=x86_64-linux-musl \
|
|
|
|
--host=x86_64-linux-musl \
|
|
|
|
--target=x86_64-linux-musl \
|
|
|
|
--with-build-sysroot= \
|
|
|
|
--with-sysroot=/ \
|
2023-11-21 23:57:26 +00:00
|
|
|
--prefix=/usr \
|
2023-11-13 22:45:56 +00:00
|
|
|
--mandir=/usr/share/man \
|
|
|
|
--infodir=/usr/share/info \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--enable-plugins \
|
|
|
|
--without-zstd \
|
|
|
|
--disable-shared \
|
|
|
|
--disable-jansson \
|
|
|
|
--disable-gdb \
|
|
|
|
--disable-gprofng \
|
|
|
|
--disable-multilib \
|
|
|
|
--disable-nls \
|
|
|
|
--disable-werror \
|
2023-11-21 23:57:26 +00:00
|
|
|
--enable-gold \
|
2023-11-13 22:45:56 +00:00
|
|
|
--enable-64-bit-bfd \
|
|
|
|
--enable-default-execstack=no \
|
|
|
|
--enable-default-hash-style=gnu \
|
|
|
|
--enable-deterministic-archives \
|
|
|
|
--enable-ld=default \
|
|
|
|
--enable-new-dtags \
|
|
|
|
--enable-relro \
|
|
|
|
--enable-threads \
|
|
|
|
--with-mmap \
|
|
|
|
--with-pic; \
|
2023-12-16 23:50:40 +00:00
|
|
|
make -j "$(nproc)"
|
|
|
|
|
|
|
|
FROM build as install
|
|
|
|
USER 0:0
|
|
|
|
RUN make DESTDIR="/rootfs" install;
|
2023-11-19 07:38:16 +00:00
|
|
|
COPY --from=musl /usr/lib/libc.so /rootfs/lib/ld-musl-x86_64.so.1
|
2023-12-16 23:50:40 +00:00
|
|
|
RUN find /rootfs -exec touch -hcd "@0" "{}" +
|
2023-11-13 22:45:56 +00:00
|
|
|
|
2023-12-12 17:45:39 +00:00
|
|
|
FROM scratch as package
|
2023-12-16 23:50:40 +00:00
|
|
|
COPY --from=install /rootfs /
|
2023-11-13 22:45:56 +00:00
|
|
|
ENTRYPOINT ["/bin/ld"]
|
|
|
|
CMD ["--version"]
|