Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: use stagex for bootstrapping #125

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft
14 changes: 12 additions & 2 deletions Pkgfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
format: v1alpha2

vars:
BOOTSTRAP: /bootstrap

# renovate: datasource=git-tags extractVersion=^binutils-(?<version>.*)$ depName=git://sourceware.org/git/binutils-gdb.git
binutils_version: 2_43_1
binutils_sha256: 13f74202a3c4c51118b797a39ea4200d3f6cfbe224da6d1d95bb938480132dfd
Expand Down Expand Up @@ -51,5 +49,17 @@ vars:
musl_sha256: a9a118bbe84d8764da0ea0d28b3ab3fae8477fc7e4085d90102b8596fc7c75e4
musl_sha512: 7bb7f7833923cd69c7a1a9b8a5f1784bfd5289663eb6061dcd43d583e45987df8a68a1be05d75cc1c88a3f5b610653d1a70f4a9cff4d8f7fd41ae73ee058c17c

# Stage(x) reproducibly built bootstrap toolchain. Please update when necessary to build newer toolchain
stagex_binutils_sha256: eff721a796fdfba8c34e21a487b0e376fb55ca2633524926998f1660fbb810de
stagex_busybox_sha256: 3d128909dbc8e7b6c4b8c3c31f4583f01a307907ea179934bb42c4ef056c7efd
stagex_diffutils_sha256: df935bd3df054427c559c5008f2e5de12419725c1331d1f863380a6015a1d0e2
stagex_file_sha256: f1053114ea2ef35dc04bd1d1f1572c3f1b86e3d57dffda99faac9e191bd7ab5d
stagex_gcc_sha256: 49ea63c81c65f8be25c242b7e64f2758b23effdaafb458b5862d0f23ec803075
stagex_go_sha256: 6bb49db5a2d23cddcd9327933a4fcb6136882e72ec2be35730c06b1a420d7b17
stagex_make_sha256: ad81793d21d9778421925085c52734fdcca443957ade4f9bb80e4032b88252db
stagex_musl_sha256: d7f6c365f5724c65cadb2b96d9f594e46132ceb366174c89dbf7554897f2bc53
stagex_perl_sha256: 5fd2b41b5541b1b5de887f1cd47c56f3c59a268fa08096661eeff111d147234c
stagex_texinfo_sha256: ddaf6c83f6577335813eafcd601c9d0ffb698ebb991e9203eeb95d0122b45116

labels:
org.opencontainers.image.source: https://github.com/siderolabs/toolchain
24 changes: 10 additions & 14 deletions binutils/pkg.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
name: binutils
install:
- make
- texinfo
variant: scratch
dependencies:
- stage: bootstrap
- stage: musl
- stage: c
- image: "stagex/perl@sha256:{{ .stagex_perl_sha256 }}"
- image: "stagex/texinfo@sha256:{{ .stagex_texinfo_sha256 }}"
steps:
- sources:
- url: https://ftp.gnu.org/gnu/binutils/binutils-{{ .binutils_version | replace "_" "." }}.tar.xz
destination: binutils.tar.xz
sha256: "{{ .binutils_sha256 }}"
sha512: "{{ .binutils_sha512 }}"
env:
PATH: "{{ .BOOTSTRAP }}/bin:{{ .PATH }}"
prepare:
- |
tar -xJf binutils.tar.xz --strip-components=1
Expand All @@ -23,8 +20,7 @@ steps:
../configure \
--build=${BUILD} \
--host=${HOST} \
--prefix=${TOOLCHAIN} \
--with-lib-path=${TOOLCHAIN}/lib \
--prefix=/usr \
--disable-nls \
--disable-gprofng \
--disable-werror \
Expand All @@ -37,11 +33,11 @@ steps:
install:
- |
cd build
make install
make DESTDIR=/rootfs install
make -C ld clean
make -C ld LIB_PATH=/usr/lib:/lib
cp -v ld/ld-new ${TOOLCHAIN}/bin
rm -rf ${TOOLCHAIN}/share/man
cp -v ld/ld-new /rootfs/bin
rm -rf /rootfs/share/man
finalize:
- from: "{{ .TOOLCHAIN }}"
to: "{{ .TOOLCHAIN }}"
- from: /rootfs
to: /
34 changes: 0 additions & 34 deletions bootstrap/binutils/pkg.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions bootstrap/bootstrap/pkg.yaml

This file was deleted.

88 changes: 0 additions & 88 deletions bootstrap/gcc/pkg.yaml

This file was deleted.

39 changes: 0 additions & 39 deletions bootstrap/libstdcxx/pkg.yaml

This file was deleted.

41 changes: 0 additions & 41 deletions bootstrap/musl/pkg.yaml

This file was deleted.

11 changes: 11 additions & 0 deletions c/pkg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: c
variant: scratch
dependencies:
- image: "stagex/binutils@sha256:{{ .stagex_binutils_sha256 }}"
- image: "stagex/busybox@sha256:{{ .stagex_busybox_sha256 }}"
- image: "stagex/gcc@sha256:{{ .stagex_gcc_sha256 }}"
- image: "stagex/make@sha256:{{ .stagex_make_sha256 }}"
- image: "stagex/musl@sha256:{{ .stagex_musl_sha256 }}"
finalize:
- from: /
to: /
Binary file modified deps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 7 additions & 29 deletions gcc/pkg.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: gcc
install:
- make
variant: scratch
dependencies:
- stage: bootstrap
- stage: musl
- stage: c
steps:
- sources:
- url: https://ftp.gnu.org/gnu/gcc/gcc-{{ .gcc_version }}/gcc-{{ .gcc_version }}.tar.xz
Expand All @@ -22,8 +20,6 @@ steps:
destination: mpc.tar.gz
sha256: "{{ .mpc_sha256 }}"
sha512: "{{ .mpc_sha512 }}"
env:
PATH: "{{ .BOOTSTRAP }}/bin:{{ .PATH }}"
prepare:
- |
mkdir mpfr
Expand All @@ -41,28 +37,10 @@ steps:

cat ../gcc/limitx.h ../gcc/glimits.h ../gcc/limity.h > `dirname $(gcc -print-libgcc-file-name)`/include-fixed/limits.h

for file in ../gcc/config/{aarch64/aarch64-linux,arm/{linux-eabi,linux-elf},linux,i386/linux{,64}}.h; do
cp -uv $file{,.orig}
sed -e "s@/lib\(64\)\?\(32\)\?/ld@${TOOLCHAIN}&@g" \
-e "s@/usr@${TOOLCHAIN}@g" $file.orig > $file
cat >> $file <<EOF
#undef STANDARD_STARTFILE_PREFIX_1
#undef STANDARD_STARTFILE_PREFIX_2
#define STANDARD_STARTFILE_PREFIX_1 "${TOOLCHAIN}/lib/"
#define STANDARD_STARTFILE_PREFIX_2 ""
EOF
touch $file.orig
done

sed -e '/m64=/s/lib64/lib/' -i.orig ../gcc/config/i386/t-linux64
sed -e '/mabi.lp64=/s/lib64/lib/' -i.orig ../gcc/config/aarch64/t-aarch64-linux

../configure \
--build=${BUILD} \
--host=${HOST} \
--prefix=${TOOLCHAIN} \
--with-local-prefix=${TOOLCHAIN} \
--with-native-system-header-dir=${TOOLCHAIN}/include \
--prefix=/usr \
--disable-multilib \
--disable-nls \
--enable-shared \
Expand Down Expand Up @@ -92,8 +70,8 @@ steps:
install:
- |
cd build
make install-strip
ln -sv gcc ${TOOLCHAIN}/bin/cc
make DESTDIR=/rootfs install-strip
ln -sv gcc /rootfs/usr/bin/cc
finalize:
- from: "{{ .TOOLCHAIN }}"
to: "{{ .TOOLCHAIN }}"
- from: /rootfs
to: /
Loading
Loading