Reworking the toolchain

We need to make a cross compiler first before then targeting the actual
toolchain
This commit is contained in:
cowmonk 2025-11-15 10:15:15 -07:00
parent e12419d686
commit 58d098dfae
3 changed files with 7 additions and 13 deletions

35
scripts/musl-cross.sh Executable file
View file

@ -0,0 +1,35 @@
#!/bin/sh
set -eu
ARCH=$(uname -m)
FROOT="../$ARCH-musllvm" # make install in source dir
MUSL_TAR=$(ls ./sources/musl-*.tar.* 2>/dev/null | head -n 1 | xargs basename)
if [ -z "$MUSL_TAR" ]; then
echo "ERR: No Musl tarball found in sources directory"
exit 1
fi
MUSL_SOURCE="${MUSL_TAR%%.tar.*}"
if command -v "clang" >/dev/null 2>&1 && command -v "lld" >/dev/null 2>&1; then
export CC="clang"
else
export CC="cc"
fi
if [ ! -d ./build/"MUSL_SOURCE" ]; then
echo "Extracting Musl tarball to ./build/"
tar -xpf ./sources/"$MUSL_TAR" -C ./build
else
echo "Musl source already extracted."
fi
echo "Buliding musl headers"
if [ -f "./build/$MUSL_SOURCE" ]; then
echo "Musl headers already built, skipping..."
exit
fi
cd ./build/"$MUSL_SOURCE"
echo "Installing musl headers..."
DESTDIR=$FROOT make ARCH=$(uname -m) install-headers