From 73ddd0b0c52ad7676ef22436a2c804916fdc91d4 Mon Sep 17 00:00:00 2001 From: apio Date: Wed, 11 Jan 2023 19:14:35 +0100 Subject: [PATCH] tools: Be more arch-agnostic --- CMakeLists.txt | 2 +- tools/env.sh | 2 +- tools/setup-binutils.sh | 6 +++--- tools/setup-env.sh | 4 ++-- tools/setup-gcc.sh | 8 ++++---- tools/test-binutils.sh | 6 +++--- tools/test-gcc.sh | 6 +++--- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78c72f8f..1777b63e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ set(CMAKE_ASM_NASM_OBJECT_FORMAT elf64) set(CMAKE_ASM_NASM_LINK_EXECUTABLE "${ARCH}-luna-ld -o ") -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}") diff --git a/tools/env.sh b/tools/env.sh index 72d65835..7d4cd8d8 100755 --- a/tools/env.sh +++ b/tools/env.sh @@ -1,11 +1,11 @@ #!/usr/bin/env bash export LUNA_ROOT=${LUNA_ROOT:-$(realpath $(dirname $0)/..)} 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 export ARCH=${ARCH:-x86_64} +export PATH=$LUNA_ROOT/toolchain/$ARCH-luna/bin:$LUNA_ROOT/toolchain/dist:$PATH if [ "$USE_MAKE" = "1" ] then diff --git a/tools/setup-binutils.sh b/tools/setup-binutils.sh index 8360520a..9877adc9 100755 --- a/tools/setup-binutils.sh +++ b/tools/setup-binutils.sh @@ -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 fi -rm -rf toolchain/build/binutils +rm -rf toolchain/build/binutils-$ARCH rm -rf toolchain/build/binutils-$LUNA_BINUTILS_VERSION_REQUIRED echo Extracting Binutils... @@ -30,9 +30,9 @@ cd - 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 CXX diff --git a/tools/setup-env.sh b/tools/setup-env.sh index 13885c62..d0c9957a 100755 --- a/tools/setup-env.sh +++ b/tools/setup-env.sh @@ -4,6 +4,6 @@ source $(dirname $0)/env.sh export LUNA_GCC_VERSION_REQUIRED=12.2.0 export LUNA_BINUTILS_VERSION_REQUIRED=2.39 -export BUILD_PREFIX=$LUNA_ROOT/toolchain/x86_64-luna -export BUILD_TARGET=x86_64-luna +export BUILD_PREFIX=$LUNA_ROOT/toolchain/$ARCH-luna +export BUILD_TARGET=$ARCH-luna export BUILD_SYSROOT=$LUNA_ROOT/base diff --git a/tools/setup-gcc.sh b/tools/setup-gcc.sh index 94500386..eabde2d8 100755 --- a/tools/setup-gcc.sh +++ b/tools/setup-gcc.sh @@ -4,7 +4,7 @@ source $(dirname $0)/setup-env.sh cd $LUNA_ROOT -if [ ! -x $(command -v x86_64-luna-as) ] +if [ ! -x $(command -v $ARCH-luna-as) ] then echo Binutils should be cross-built before GCC. 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 fi -rm -rf toolchain/build/gcc +rm -rf toolchain/build/gcc-$ARCH rm -rf toolchain/build/gcc-$LUNA_GCC_VERSION_REQUIRED echo Extracting GCC... @@ -38,9 +38,9 @@ cd - 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 CXX diff --git a/tools/test-binutils.sh b/tools/test-binutils.sh index 4ba6fb3d..c0d99acb 100755 --- a/tools/test-binutils.sh +++ b/tools/test-binutils.sh @@ -2,9 +2,9 @@ set -e source $(dirname $0)/setup-env.sh -if [ -x "$(command -v x86_64-luna-ar)" ] +if [ -x "$(command -v $ARCH-luna-ar)" ] 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 exit 0 else @@ -12,4 +12,4 @@ then fi else exit 1 -fi \ No newline at end of file +fi diff --git a/tools/test-gcc.sh b/tools/test-gcc.sh index c5be191f..2a6211ab 100755 --- a/tools/test-gcc.sh +++ b/tools/test-gcc.sh @@ -2,9 +2,9 @@ set -e source $(dirname $0)/setup-env.sh -if [ -x "$(command -v x86_64-luna-gcc)" ] +if [ -x "$(command -v $ARCH-luna-gcc)" ] 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 exit 0 else @@ -12,4 +12,4 @@ then fi else exit 1 -fi \ No newline at end of file +fi