add bootstrap packages

This commit is contained in:
Ella Stanforth 2021-12-26 14:30:09 +00:00
parent 4de0af80de
commit fb7ee2330b
3 changed files with 88 additions and 0 deletions

3
bootstrap/README.md Normal file
View file

@ -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.

49
bootstrap/rust/boot.sh Executable file
View file

@ -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

36
bootstrap/rust/build.sh Normal file
View file

@ -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
}