tools: Be more arch-agnostic
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
apio 2023-01-11 19:14:35 +01:00
parent d150c55143
commit 73ddd0b0c5
Signed by: apio
GPG Key ID: B8A7D06E42258954
7 changed files with 17 additions and 17 deletions

View File

@ -24,7 +24,7 @@ set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64)
set(CMAKE_ASM_NASM_LINK_EXECUTABLE "${ARCH}-luna-ld <FLAGS> <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>") set(CMAKE_ASM_NASM_LINK_EXECUTABLE "${ARCH}-luna-ld <FLAGS> <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_FIND_ROOT_PATH ${LUNA_ROOT}/toolchain/x86_64-luna) set(CMAKE_FIND_ROOT_PATH ${LUNA_ROOT}/toolchain/${ARCH}-luna)
message(STATUS "Configuring Luna for ${ARCH}") message(STATUS "Configuring Luna for ${ARCH}")

View File

@ -1,11 +1,11 @@
#!/usr/bin/env bash #!/usr/bin/env bash
export LUNA_ROOT=${LUNA_ROOT:-$(realpath $(dirname $0)/..)} export LUNA_ROOT=${LUNA_ROOT:-$(realpath $(dirname $0)/..)}
export LUNA_BASE=${LUNA_BASE:-$LUNA_ROOT/base} export LUNA_BASE=${LUNA_BASE:-$LUNA_ROOT/base}
export PATH=$LUNA_ROOT/toolchain/x86_64-luna/bin:$LUNA_ROOT/toolchain/dist:$PATH
[ -f "$LUNA_ROOT/env-local.sh" ] && source $LUNA_ROOT/env-local.sh [ -f "$LUNA_ROOT/env-local.sh" ] && source $LUNA_ROOT/env-local.sh
export ARCH=${ARCH:-x86_64} export ARCH=${ARCH:-x86_64}
export PATH=$LUNA_ROOT/toolchain/$ARCH-luna/bin:$LUNA_ROOT/toolchain/dist:$PATH
if [ "$USE_MAKE" = "1" ] if [ "$USE_MAKE" = "1" ]
then then

View File

@ -13,7 +13,7 @@ if [ ! -f toolchain/tarballs/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz ];
wget -Otoolchain/tarballs/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz https://ftp.gnu.org/gnu/binutils/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz wget -Otoolchain/tarballs/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz https://ftp.gnu.org/gnu/binutils/binutils-$LUNA_BINUTILS_VERSION_REQUIRED.tar.xz
fi fi
rm -rf toolchain/build/binutils rm -rf toolchain/build/binutils-$ARCH
rm -rf toolchain/build/binutils-$LUNA_BINUTILS_VERSION_REQUIRED rm -rf toolchain/build/binutils-$LUNA_BINUTILS_VERSION_REQUIRED
echo Extracting Binutils... echo Extracting Binutils...
@ -30,9 +30,9 @@ cd -
echo Configuring Binutils... echo Configuring Binutils...
mkdir -p toolchain/build/binutils mkdir -p toolchain/build/binutils-$ARCH
cd toolchain/build/binutils cd toolchain/build/binutils-$ARCH
unset CC unset CC
unset CXX unset CXX

View File

@ -4,6 +4,6 @@ source $(dirname $0)/env.sh
export LUNA_GCC_VERSION_REQUIRED=12.2.0 export LUNA_GCC_VERSION_REQUIRED=12.2.0
export LUNA_BINUTILS_VERSION_REQUIRED=2.39 export LUNA_BINUTILS_VERSION_REQUIRED=2.39
export BUILD_PREFIX=$LUNA_ROOT/toolchain/x86_64-luna export BUILD_PREFIX=$LUNA_ROOT/toolchain/$ARCH-luna
export BUILD_TARGET=x86_64-luna export BUILD_TARGET=$ARCH-luna
export BUILD_SYSROOT=$LUNA_ROOT/base export BUILD_SYSROOT=$LUNA_ROOT/base

View File

@ -4,7 +4,7 @@ source $(dirname $0)/setup-env.sh
cd $LUNA_ROOT cd $LUNA_ROOT
if [ ! -x $(command -v x86_64-luna-as) ] if [ ! -x $(command -v $ARCH-luna-as) ]
then then
echo Binutils should be cross-built before GCC. echo Binutils should be cross-built before GCC.
exit 1 exit 1
@ -21,7 +21,7 @@ if [ ! -f toolchain/tarballs/gcc-$LUNA_GCC_VERSION_REQUIRED.tar.xz ]; then
wget -Otoolchain/tarballs/gcc-$LUNA_GCC_VERSION_REQUIRED.tar.xz https://ftp.gnu.org/gnu/gcc/gcc-$LUNA_GCC_VERSION_REQUIRED/gcc-$LUNA_GCC_VERSION_REQUIRED.tar.xz wget -Otoolchain/tarballs/gcc-$LUNA_GCC_VERSION_REQUIRED.tar.xz https://ftp.gnu.org/gnu/gcc/gcc-$LUNA_GCC_VERSION_REQUIRED/gcc-$LUNA_GCC_VERSION_REQUIRED.tar.xz
fi fi
rm -rf toolchain/build/gcc rm -rf toolchain/build/gcc-$ARCH
rm -rf toolchain/build/gcc-$LUNA_GCC_VERSION_REQUIRED rm -rf toolchain/build/gcc-$LUNA_GCC_VERSION_REQUIRED
echo Extracting GCC... echo Extracting GCC...
@ -38,9 +38,9 @@ cd -
echo Configuring GCC... echo Configuring GCC...
mkdir -p toolchain/build/gcc mkdir -p toolchain/build/gcc-$ARCH
cd toolchain/build/gcc cd toolchain/build/gcc-$ARCH
unset CC unset CC
unset CXX unset CXX

View File

@ -2,9 +2,9 @@
set -e set -e
source $(dirname $0)/setup-env.sh source $(dirname $0)/setup-env.sh
if [ -x "$(command -v x86_64-luna-ar)" ] if [ -x "$(command -v $ARCH-luna-ar)" ]
then then
if [ "$(x86_64-luna-ar --version | head -n 1 | awk '{ print $5 }')" == "$LUNA_BINUTILS_VERSION_REQUIRED" ] if [ "$($ARCH-luna-ar --version | head -n 1 | awk '{ print $5 }')" == "$LUNA_BINUTILS_VERSION_REQUIRED" ]
then then
exit 0 exit 0
else else
@ -12,4 +12,4 @@ then
fi fi
else else
exit 1 exit 1
fi fi

View File

@ -2,9 +2,9 @@
set -e set -e
source $(dirname $0)/setup-env.sh source $(dirname $0)/setup-env.sh
if [ -x "$(command -v x86_64-luna-gcc)" ] if [ -x "$(command -v $ARCH-luna-gcc)" ]
then then
if [ "$(x86_64-luna-gcc --version | head -n 1 | awk '{ print $3 }')" == "$LUNA_GCC_VERSION_REQUIRED" ] if [ "$($ARCH-luna-gcc --version | head -n 1 | awk '{ print $3 }')" == "$LUNA_GCC_VERSION_REQUIRED" ]
then then
exit 0 exit 0
else else
@ -12,4 +12,4 @@ then
fi fi
else else
exit 1 exit 1
fi fi