From fb7ee2330bfe679037d6b4ac37622ab5b1a16fa5 Mon Sep 17 00:00:00 2001 From: Ella Stanforth <23418164+Ella-0@users.noreply.github.com> Date: Sun, 26 Dec 2021 14:30:09 +0000 Subject: [PATCH] add bootstrap packages --- bootstrap/README.md | 3 +++ bootstrap/rust/boot.sh | 49 +++++++++++++++++++++++++++++++++++++++++ bootstrap/rust/build.sh | 36 ++++++++++++++++++++++++++++++ 3 files changed, 88 insertions(+) create mode 100644 bootstrap/README.md create mode 100755 bootstrap/rust/boot.sh create mode 100644 bootstrap/rust/build.sh diff --git a/bootstrap/README.md b/bootstrap/README.md new file mode 100644 index 0000000..36853bf --- /dev/null +++ b/bootstrap/README.md @@ -0,0 +1,3 @@ +# Bootstrap +These packages are not meant to be used in a complete Iglunix system but are +ment as a stepping stone to build the full packages. diff --git a/bootstrap/rust/boot.sh b/bootstrap/rust/boot.sh new file mode 100755 index 0000000..3cc417e --- /dev/null +++ b/bootstrap/rust/boot.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +ARCH=aarch64 +CHAN=beta +LIBUNWIND=/usr/lib/libunwind.so.1 + +mkdir -p build + +echo 'Downloading rust tar' +stat build/rust.tar > /dev/null 2> /dev/null \ +|| curl "https://static.rust-lang.org/dist/rust-$CHAN-$ARCH-unknown-linux-musl.tar.gz" -o build/rust.tar + +echo 'Extracting rust tar' +stat build/rust-$CHAN-$ARCH-unknown-linux-musl > /dev/null 2> /dev/null \ +|| tar -xf build/rust.tar -C build + +echo 'Building libgcc_s.so' +stat build/libgcc_s.so > /dev/null 2> /dev/null \ +|| clang -shared -o build/libgcc_s.so \ +-Wl,--allow-multiple-definition -Wl,--whole-archive \ +$(clang -print-libgcc-file-name) + +mkdir -p build/rust-root + +echo 'Installing rust to rust-root' + +stat build/rust-root/lib/rustlib/uninstall.sh > /dev/null 2> /dev/null \ +|| ./build/rust-$CHAN-$ARCH-unknown-linux-musl/install.sh \ +--disable-ldconfig \ +--destdir=$(pwd)/build/rust-root \ +--prefix=/ + +# Can't just symlink here 'cause rustc needs __clear_cache which isn't exposed +# by libunwind +echo 'Copying libgcc_s shim' +stat $(pwd)/build/rust-root/lib/libgcc_s.so.1 > /dev/null 2> /dev/null \ +|| cp $(pwd)/build/libgcc_s.so $(pwd)/build/rust-root/lib/libgcc_s.so.1 + +# Symlink libunwind for dynamic builds to link to +echo 'Symlinking libunwind' +stat $(pwd)/build/rust-root/lib/rustlib/aarch64-unknown-linux-musl/lib/libgcc_s.so > /dev/null 2> /dev/null \ +|| ln -sr $LIBUNWIND $(pwd)/build/rust-root/lib/rustlib/aarch64-unknown-linux-musl/lib/libgcc_s.so + +export RUSTC=$(pwd)/build/rust-root/bin/rustc + +echo "Checking Sanity" + +$RUSTC sanity.rs -C target-feature=-crt-static -o build/sanity +./build/sanity diff --git a/bootstrap/rust/build.sh b/bootstrap/rust/build.sh new file mode 100644 index 0000000..ba67806 --- /dev/null +++ b/bootstrap/rust/build.sh @@ -0,0 +1,36 @@ +pkgname=rust +pkgver=beta + +fetch() { + stat rust.tar.gz > /dev/null 2> /dev/null \ + || curl "https://static.rust-lang.org/dist/rust-$pkgver-$ARCH-unknown-linux-musl.tar.gz" -o rust.tar.gz + + stat rust-$pkgver-$ARCH-unknown-linux-musl > /dev/null 2> /dev/null \ + || tar -xf rust.tar.gz +} + +build() { + stat libgcc_s.so > /dev/null 2> /dev/null \ + || clang -shared -o libgcc_s.so \ + -Wl,--allow-multiple-definition -Wl,--whole-archive \ + $(clang -print-libgcc-file-name) +} + +package() { + stat $pkgdir/opt/rust/lib/rustlib/uninstall.sh > /dev/null 2> /dev/null \ + || ./rust-$pkgver-$ARCH-unknown-linux-musl/install.sh \ + --disable-ldconfig \ + --destdir=$pkgdir \ + --prefix=/opt/rust + + stat $pkgdir/opt/rust/lib/libgcc_s.so \ + || cp ./libgcc_s.so $pkgdir/opt/rust/lib/libgcc_s.so +} + +backup() { + return +} + +license() { + return +}