Compare commits

...
This repository has been archived on 2024-08-04. You can view files and clone it, but cannot push or open issues or pull requests.

1 Commits

Author SHA1 Message Date
Lance Vick 54bc57d683
WIP wget in stage3 2024-01-22 18:38:29 -08:00
1 changed files with 226 additions and 28 deletions

View File

@ -2,24 +2,82 @@ ARG REGISTRY=local
FROM ${REGISTRY}/stage2 as stage2
FROM stage2 as base
ENV TARGET=x86_64-linux-musl
ENV ARCH=x86_64
ENV TARGET=${ARCH}-linux-musl
ENV BUILD=i386-unknown-linux-musl
ENV MUSL_VERSION 1.2.4
ENV MUSL_SITE http://musl.libc.org/releases
ENV MUSL_FILE musl-${MUSL_VERSION}.tar.gz
ENV MUSL_HASH 7a35eae33d5372a7c0da1188de798726f68825513b7ae3ebe97aaaa52114f039
ENV MUSL_DIR=${HOME}/build-musl
ENV BASH_SITE=https://ftp.gnu.org/gnu/bash
ENV BASH_VERSION_=5.2.21
ENV BASH_HASH c8e31bdc59b69aaffc5b36509905ba3e5cbb12747091d27b4b977f078560d5b8
ENV BASH_FILE bash-${BASH_VERSION_}.tar.gz
ENV BASH_DIR=${HOME}/build-bash
ENV COREUTILS_SITE=https://ftp.gnu.org/gnu/coreutils
ENV COREUTILS_VERSION=9.4
ENV COREUTILS_HASH 5f600d9093973b0afe25393d9bc18c44f2232657f4ca0d95ea31c702eb66b739
ENV COREUTILS_FILE coreutils-${COREUTILS_VERSION}.tar.gz
ENV COREUTILS_DIR=${HOME}/build-coreutils
ENV BINUTILS_VERSION 2.41
ENV BINUTILS_SITE https://ftp.gnu.org/gnu/binutils
ENV BINUTILS_FILE binutils-${BINUTILS_VERSION}.tar.xz
ENV BINUTILS_HASH ae9a5789e23459e59606e6714723f2d3ffc31c03174191ef0d015bdf06007450
ENV BINUTILS_DIR ${HOME}/build-binutils
ENV NETTLE_VERSION 3.9.1
ENV NETTLE_SITE https://ftp.gnu.org/gnu/nettle
ENV NETTLE_FILE nettle-${NETTLE_VERSION}.tar.gz
ENV NETTLE_HASH ccfeff981b0ca71bbd6fbcb054f407c60ffb644389a5be80d6716d5b550c6ce3
ENV NETTLE_DIR ${HOME}/build-nettle
ENV GNUTLS_SITE https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/
ENV GNUTLS_VERSION 3.7.10
ENV GNUTLS_HASH b6e4e8bac3a950a3a1b7bdb0904979d4ab420a81e74de8636dd50b467d36f5a9
ENV GNUTLS_FILE gnutls-${GNUTLS_VERSION}.tar.xz
ENV GNUTLS_DIR ${HOME}/build-gnutls
ENV WGET_VERSION 1.21
ENV WGET_SITE https://ftp.gnu.org/gnu/wget
ENV WGET_FILE wget-${WGET_VERSION}.tar.gz
ENV WGET_HASH b3bc1a9bd0c19836c9709c318d41c19c11215a07514f49f89b40b9d50ab49325
ENV WGET_DIR ${HOME}/build-wget
ENV GCC_VERSION 13.1.0
ENV GCC_FILE gcc-$GCC_VERSION.tar.xz
ENV GCC_SITE https://mirrors.kernel.org/gnu/gcc/gcc-${GCC_VERSION}
ENV GCC_HASH 61d684f0aa5e76ac6585ad8898a2427aade8979ed5e7f85492286c4dfc13ee86
ENV GCC_DIR ${HOME}/build-gcc
ENV GMP_VERSION 6.2.1
ENV GMP_FILE gmp-${GMP_VERSION}.tar.bz2
ENV GMP_SITE https://gcc.gnu.org/pub/gcc/infrastructure/
ENV GMP_HASH eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
ENV GMP_DIR ${HOME}/build-gmp
ENV MPFR_VERSION 4.1.0
ENV MPFR_FILE mpfr-${MPFR_VERSION}.tar.bz2
ENV MPFR_SITE https://gcc.gnu.org/pub/gcc/infrastructure/
ENV MPFR_HASH feced2d430dd5a97805fa289fed3fc8ff2b094c02d05287fd6133e7f1f0ec926
ENV MPFR_DIR ${HOME}/build-mpfr
ENV MPC_VERSION 1.2.1
ENV MPC_FILE mpc-${MPC_VERSION}.tar.gz
ENV MPC_SITE https://gcc.gnu.org/pub/gcc/infrastructure/
ENV MPC_HASH 17503d2c395dfcf106b622dc142683c1199431d095367c6aacba6eec30340459
ENV MPC_DIR ${HOME}/build-mpc
ENV ISL_VERSION 0.24
ENV ISL_FILE isl-${ISL_VERSION}.tar.bz2
ENV ISL_SITE https://gcc.gnu.org/pub/gcc/infrastructure/
ENV ISL_HASH fcf78dd9656c10eb8cf9fbd5f59a0b6b01386205fe1934b3b287a0a1898145c0
ENV ISL_DIR ${HOME}/build-isl
FROM base as fetch
WORKDIR /home/user
RUN set -eux; \
@ -28,13 +86,42 @@ RUN set -eux; \
curl --insecure -OJ ${BASH_SITE}/${BASH_FILE}; \
echo "${BASH_HASH} ${BASH_FILE}" | sha256sum -c; \
curl --insecure -OJ ${COREUTILS_SITE}/${COREUTILS_FILE}; \
echo "${COREUTILS_HASH} ${COREUTILS_FILE}" | sha256sum -c
echo "${COREUTILS_HASH} ${COREUTILS_FILE}" | sha256sum -c; \
curl --insecure -OJ ${BINUTILS_SITE}/${BINUTILS_FILE}; \
echo "${BINUTILS_HASH} ${BINUTILS_FILE}" | sha256sum -c; \
curl --insecure -OJ ${NETTLE_SITE}/${NETTLE_FILE}; \
echo "${NETTLE_HASH} ${NETTLE_FILE}" | sha256sum -c; \
curl --insecure -OJ ${GNUTLS_SITE}/${GNUTLS_FILE}; \
echo "${GNUTLS_HASH} ${GNUTLS_FILE}" | sha256sum -c; \
curl --insecure -OJ ${WGET_SITE}/${WGET_FILE}; \
echo "${WGET_HASH} ${WGET_FILE}" | sha256sum -c; \
curl --insecure -OJ ${GCC_SITE}/${GCC_FILE}; \
echo "${GCC_HASH} ${GCC_FILE}" | sha256sum -c; \
curl --insecure -OJ ${GMP_SITE}/${GMP_FILE}; \
echo "${GMP_HASH} ${GMP_FILE}" | sha256sum -c; \
curl --insecure -OJ ${MPFR_SITE}/${MPFR_FILE}; \
echo "${MPFR_HASH} ${MPFR_FILE}" | sha256sum -c; \
curl --insecure -OJ ${MPC_SITE}/${MPC_FILE}; \
echo "${MPC_HASH} ${MPC_FILE}" | sha256sum -c; \
curl --insecure -OJ ${ISL_SITE}/${ISL_FILE}; \
echo "${ISL_HASH} ${ISL_FILE}" | sha256sum -c
FROM fetch as build
FROM fetch as extract
RUN set -eux; \
tar -xzf ${MUSL_FILE}; \
tar -xzf ${BASH_FILE}; \
tar -xzf ${COREUTILS_FILE}
tar -kxzf ${MUSL_FILE}; \
tar -kxzf ${BASH_FILE}; \
tar -kxzf ${COREUTILS_FILE}; \
tar -kxf ${BINUTILS_FILE}; \
tar -kxzf ${NETTLE_FILE}; \
tar -kxjf ${GMP_FILE}; \
tar -kxjf ${MPFR_FILE}; \
tar -kxzf ${MPC_FILE}; \
tar -kxjf ${ISL_FILE}; \
tar -kxf ${GNUTLS_FILE}; \
tar -kxzf ${WGET_FILE}; \
tar -kxf ${GCC_FILE}
FROM extract as build
WORKDIR ${MUSL_DIR}
RUN set -eux; \
../musl-${MUSL_VERSION}/configure \
@ -44,7 +131,6 @@ RUN set -eux; \
make
WORKDIR ${BASH_DIR}
RUN set -eux; \
echo "${BASH_VERSION_}"; \
../bash-${BASH_VERSION_}/configure \
--build=${BUILD} \
--host=${TARGET} \
@ -57,10 +143,8 @@ RUN set -eux; \
--without-curses \
--without-bash-malloc; \
make
WORKDIR ${COREUTILS_DIR}
RUN set -eux; \
echo "${COREUTILS_VERSION}"; \
../coreutils-${COREUTILS_VERSION}/configure \
--build=${BUILD} \
--host=${TARGET} \
@ -68,27 +152,141 @@ RUN set -eux; \
--bindir=/bin \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--disable-nls \
--enable-single-binary=symlinks; \
make
FROM build as install
USER 0:0
WORKDIR ${BINUTILS_DIR}
RUN set -eux; \
env -C ${MUSL_DIR} make DESTDIR=/rootfs install; \
env -C ${BASH_DIR} make DESTDIR=/rootfs install; \
env -C ${COREUTILS_DIR} make DESTDIR=/rootfs install; \
find /rootfs -exec touch -hcd "@0" "{}" +
../binutils-${BINUTILS_VERSION}/configure \
--build=${BUILD} \
--host=${TARGET} \
--prefix=/usr \
--bindir=/bin \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--disable-nls \
--disable-werror \
--disable-gprofng \
--disable-multilib \
--disable-gdb \
--enable-deterministic-archives \
--enable-threads \
--with-mmap \
--with-pic; \
make
WORKDIR ${GMP_DIR}
RUN set -eux; \
../gmp-${GMP_VERSION}/configure \
--build=${BUILD} \
--host=${TARGET} \
--prefix=/usr \
--bindir=/bin \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--enable-cxx \
--with-pic; \
make
WORKDIR ${NETTLE_DIR}
RUN set -eux; \
CPPFLAGS="-I${GMP_DIR}" \
LDFLAGS="-L${GMP_DIR}/.libs" \
../nettle-${NETTLE_VERSION}/configure \
--build=${BUILD} \
--host=${TARGET} \
--prefix=/usr \
--bindir=/bin \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--localstatedir=/var \
--disable-openssl \
--enable-fat \
--enable-shared \
--enable-static; \
make
WORKDIR ${GNUTLS_DIR}
RUN set -eux; \
CPPFLAGS="-I${NETTLE_DIR}" \
LDFLAGS="-L${NETTLE_DIR}" \
PKG_CONFIG_PATH="${NETTLE_DIR}" \
../gnutls-${GNUTLS_VERSION}/configure \
GMP_LIBS="-L${GMP_DIR}" \
--build=${BUILD} \
--host=${TARGET} \
--prefix=/usr \
--bindir=/bin \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/etc \
--with-libidn \
--with-included-libtasn1 \
--with-included-unistring \
--disable-nls || :
#make || :
FROM scratch as package
COPY --from=install /rootfs /
USER 1000:1000
ENTRYPOINT ["/bin/bash"]
ENV PATH=/x86_64-linux-musl/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
ENV USER=user
ENV HOME=/home/user
ENV TZ=UTC
ENV LANG=C.UTF-8
ENV SOURCE_DATE_EPOCH=1
ENV KCONFIG_NOTIMESTAMP=1
ENV PS1="stage3 $ "
from build as package
#WORKDIR ${WGET_DIR}
#RUN set -eux; \
# ../wget-${WGET_VERSION}/configure \
# --build=${BUILD} \
# --host=${TARGET} \
# --prefix=/usr \
# --bindir=/bin \
# --mandir=/usr/share/man \
# --infodir=/usr/share/info \
# --sysconfdir=/etc \
# --with-libidn \
# --disable-nls; \
# make
#WORKDIR ${GCC_DIR}
#RUN set -eux; \
# echo "${GCC_VERSION}"; \
# ../gcc-${GCC_VERSION}/configure \
# --build=${BUILD} \
# --host=${TARGET} \
# --target=${TARGET} \
# --prefix=/usr \
# --mandir=/usr/share/man \
# --infodir=/usr/share/info \
# --libdir=/usr/lib \
# --disable-cet \
# --disable-fixed-point \
# --disable-libstdcxx-pch \
# --disable-multilib \
# --disable-nls \
# --disable-werror \
# --enable-__cxa_atexit \
# --enable-default-pie \
# --enable-default-ssp \
# --enable-languages=c,c++ \
# --enable-link-serialization=2 \
# --enable-linker-build-id; \
# make || :
#
#FROM build as install
#USER 0:0
#RUN set -eux; \
# env -C ${MUSL_DIR} make DESTDIR=/rootfs install; \
# env -C ${BASH_DIR} make DESTDIR=/rootfs install; \
# env -C ${COREUTILS_DIR} make DESTDIR=/rootfs install; \
# env -C ${BINUTILS_DIR} make DESTDIR=/rootfs install; \
# env -C ${WGET_DIR} make DESTDIR=/rootfs install; \
# env -C ${GCC_DIR} make DESTDIR=/rootfs install; \
# find /rootfs -exec touch -hcd "@0" "{}" +
#
#FROM scratch as package
#COPY --from=install /rootfs /
#USER 1000:1000
#ENTRYPOINT ["/bin/bash"]
#ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
#ENV USER=user
#ENV HOME=/home/user
#ENV TZ=UTC
#ENV LANG=C.UTF-8
#ENV SOURCE_DATE_EPOCH=1
#ENV KCONFIG_NOTIMESTAMP=1
#ENV PS1="stage3 $ "