Rework on scripts
Also we are now using a cross compiler to create the toolchain because I'm too lazy to do too much scripting lmao.
This commit is contained in:
parent
a9a3077633
commit
b041f9304f
8 changed files with 45 additions and 43 deletions
|
|
@ -1,15 +1,15 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
source ./scripts/config.sh
|
||||
. $PWD/scripts/config.sh
|
||||
|
||||
while IFS= read -r url; do \
|
||||
[ -z "$url" ] && continue; \
|
||||
fname="$(printf '%s' "$url" | sed -E 's/[?#].*$//' | sed -E 's!.*/!!')"; \
|
||||
if [ -e "./sources/$fname" ]; then \
|
||||
if [ -e "$PROOT/sources/$fname" ]; then \
|
||||
printf "SKIP: %s (already exists)\n" "$fname"; \
|
||||
else \
|
||||
printf "GET: %s -> %s\n" "$url" "$fname"; \
|
||||
curl -f -L -O -S --output-dir "./sources/" "$url" || { printf "ERROR: failed to download %s\n" "$url"; exit 1; }; \
|
||||
curl -f -L -O -S --output-dir "$PROOT/sources/" "$url" || { printf "ERROR: failed to download %s\n" "$url"; exit 1; }; \
|
||||
fi; \
|
||||
done < "$SOURCES_FILE"; \
|
||||
|
|
|
|||
|
|
@ -7,9 +7,10 @@
|
|||
# these are shared between the Makefile and scripts
|
||||
#
|
||||
ARCH=$(uname -m)
|
||||
SOURCES_FILE=./sources.list
|
||||
PROOT=${PWD}
|
||||
SOURCES_FILE=${PROOT}/sources.list
|
||||
FROOT="${ARCH}-musllvm"
|
||||
CROSS="./build/cross" # cross directory
|
||||
CROSS="${PROOT}/build/cross" # cross directory
|
||||
|
||||
# MAKEFLAGS to parse the amounto of cores used
|
||||
MAKEFLAGS="-j$(nproc) -l$(nproc)"
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
source ./scripts/config.sh
|
||||
. $PWD/scripts/config.sh
|
||||
|
||||
ELF_TAR=$(ls ./sources/elftoolchain-*.tar.* 2>/dev/null | head -n 1 | xargs basename)
|
||||
ELF_TAR=$(ls "$PROOT"/sources/elftoolchain-*.tar.* 2>/dev/null | head -n 1 | xargs basename)
|
||||
if [ -z "$ELF_TAR" ]; then
|
||||
echo "ERR: No Musl tarball found in sources directory"
|
||||
exit 1
|
||||
|
|
@ -16,15 +16,15 @@ else
|
|||
export CC="cc"
|
||||
fi
|
||||
|
||||
if [ ! -d ./build/"$ELF_SOURCE" ]; then
|
||||
if [ ! -d $PROOT/build/"$ELF_SOURCE" ]; then
|
||||
echo "Extracting Elftoolchain tarball to ./build/"
|
||||
tar -xpf ./sources/"$ELF_TAR" -C ./build
|
||||
tar -xpf $PROOT/sources/"$ELF_TAR" -C ./build
|
||||
else
|
||||
echo "Elftoolchain source already extracted."
|
||||
fi
|
||||
|
||||
echo "Buliding musl headers"
|
||||
if [ -f "./build/$ELF_SOURCE" ]; then
|
||||
if [ -f "$PROOT/build/$ELF_SOURCE" ]; then
|
||||
echo "ELFTOOLCHAIN already built, skipping..."
|
||||
exit
|
||||
fi
|
||||
|
|
@ -33,7 +33,7 @@ cd ./build/"$ELF_SOURCE"
|
|||
|
||||
echo "patching elftoolchain-cross..."
|
||||
|
||||
patch -Np1 < ../../patches/elftoolchain/*
|
||||
patch -Np1 < "$PROOT"/patches/elftoolchain/*
|
||||
|
||||
echo "Installing elftoolchain-cross..."
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
source ./scripts/config.sh
|
||||
. $PWD/scripts/config.sh
|
||||
|
||||
LINUX_TAR=$(ls ./sources/linux-*.tar.* 2>/dev/null | head -n 1 | xargs basename)
|
||||
LINUX_TAR=$(ls "$PROOT"/sources/linux-*.tar.* 2>/dev/null | head -n 1 | xargs basename)
|
||||
if [ -z "$LINUX_TAR" ]; then
|
||||
echo "ERR: No Linux tarball found in sources directory"
|
||||
exit 1
|
||||
|
|
@ -15,18 +15,18 @@ if command -v "clang" >/dev/null 2>&1 && command -v "lld" >/dev/null 2>&1; then
|
|||
export LLVM_IAS=1
|
||||
fi
|
||||
|
||||
if [ ! -d ./build/"$LINUX_SOURCE" ]; then
|
||||
if [ ! -d $PROOT/build/"$LINUX_SOURCE" ]; then
|
||||
echo "Extracting Linux tarball to ./build/"
|
||||
tar -xpf ./sources/"$LINUX_TAR" -C ./build
|
||||
tar -xpf $PROOT/sources/"$LINUX_TAR" -C $PROOT/build
|
||||
else
|
||||
echo "Linux source already extracted."
|
||||
fi
|
||||
|
||||
echo "Creating target include directory"
|
||||
mkdir -pv ./build/"$FROOT"/include
|
||||
mkdir -pv $PROOT/build/"$FROOT"/include
|
||||
|
||||
echo "Building Headers"
|
||||
if [ -d ./build/"$FROOT"/include/linux ]; then
|
||||
if [ -d $PROOT/build/"$FROOT"/include/linux ]; then
|
||||
echo "Headers already built, skipping..."
|
||||
exit
|
||||
fi
|
||||
|
|
@ -36,5 +36,5 @@ cd ./build/"$LINUX_SOURCE"
|
|||
make mrproper
|
||||
make headers
|
||||
find usr/include -type f ! -name '*.h' -delete
|
||||
cp -rv usr/include/* ../"$FROOT"/include/
|
||||
cp -rv usr/include/* $PROOT/build/"$FROOT"/include/
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
source ./scripts/config.sh
|
||||
. $PWD/scripts/config.sh
|
||||
|
||||
MUSL_TAR=$(ls ./sources/musl-*.tar.* 2>/dev/null | head -n 1 | xargs basename)
|
||||
MUSL_TAR=$(ls "$PROOT"/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
|
||||
|
|
@ -16,7 +16,7 @@ else
|
|||
export CC="cc"
|
||||
fi
|
||||
|
||||
if [ ! -d ./build/"MUSL_SOURCE" ]; then
|
||||
if [ ! -d $PROOT/build/"MUSL_SOURCE" ]; then
|
||||
echo "Extracting Musl tarball to ./build/"
|
||||
tar -xpf ./sources/"$MUSL_TAR" -C ./build
|
||||
else
|
||||
|
|
@ -24,15 +24,15 @@ else
|
|||
fi
|
||||
|
||||
echo "Buliding musl headers"
|
||||
if [ -f "./build/$MUSL_SOURCE" ]; then
|
||||
if [ -f "$PROOT/build/$MUSL_SOURCE" ]; then
|
||||
echo "Musl headers already built, skipping..."
|
||||
exit
|
||||
fi
|
||||
|
||||
cd ./build/"$MUSL_SOURCE"
|
||||
cd $PROOT/build/"$MUSL_SOURCE"
|
||||
|
||||
echo "Installing musl headers..."
|
||||
./configure \
|
||||
--prefix=/
|
||||
|
||||
DESTDIR=../../$CROSS make ARCH=$(uname -m) install-headers
|
||||
DESTDIR=$CROSS make ARCH=$(uname -m) install-headers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue