From f6cd289725f1616508aa82206c4f63c04dc1ad0d Mon Sep 17 00:00:00 2001 From: LoRd_MuldeR Date: Sat, 21 May 2022 17:21:09 +0200 Subject: [PATCH] Support for MIPS architecture + small improvement to Linux cross-build script. --- etc/utils/linux/mk-musl.sh | 8 +++++--- frontend/src/platform.h | 4 ++++ mk-release.sh | 7 +++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/etc/utils/linux/mk-musl.sh b/etc/utils/linux/mk-musl.sh index 8327438..3d36208 100755 --- a/etc/utils/linux/mk-musl.sh +++ b/etc/utils/linux/mk-musl.sh @@ -1,11 +1,10 @@ #!/bin/bash -# sudo apt install crossbuild-essential-i386 -# sudo apt install crossbuild-essential-arm64 +# sudo apt install crossbuild-essential-{i386,armel,arm64,mips,mips64} set -e cd -- "$(dirname -- "${BASH_SOURCE[0]}")" function mk_musl() { - local outdir="/usr/local/musl/${1}-linux-gnu" + local outdir="/usr/local/musl/${1}" local build="musl-build-${1}" rm -rf "${build}" && mkdir -p "${build}" tar -xvf "musl-latest.tar.gz" --strip-components=1 -C "${build}" @@ -31,4 +30,7 @@ curl -vkf -o "musl-latest.tar.gz" "https://musl.libc.org/releases/musl-latest.ta mk_musl x86_64 mk_musl i686 i686-linux-gnu +mk_musl arm arm-linux-gnueabi mk_musl aarch64 aarch64-linux-gnu +mk_musl mips mips-linux-gnu +mk_musl mips64 mips64-linux-gnuabi64 diff --git a/frontend/src/platform.h b/frontend/src/platform.h index af497ae..ec71af6 100644 --- a/frontend/src/platform.h +++ b/frontend/src/platform.h @@ -58,6 +58,10 @@ # define CPU_ARCH "arm64" #elif defined(__arm__) || defined(_M_ARM) # define CPU_ARCH "arm" +#elif defined(__mips__) && defined(__mips64) +# define CPU_ARCH "mips64" +#elif defined(__mips__) || defined(__mips) +# define CPU_ARCH "mips" #else # error Unknown CPU architecture! #endif diff --git a/mk-release.sh b/mk-release.sh index bd9cbc8..69b5fa4 100755 --- a/mk-release.sh +++ b/mk-release.sh @@ -4,7 +4,7 @@ set -e cd -- "$(dirname -- "${BASH_SOURCE[0]}")" function mk_slunk() { - local command="make -B CC=/usr/local/musl/${1}-linux-gnu/bin/musl-gcc STATIC=1 STRIP=1 FLTO=1" + local command="make -B CC=/usr/local/musl/${1}/bin/musl-gcc STATIC=1 STRIP=1 FLTO=1" if [ ! -z "${2}" ]; then command="${command} ${2}" fi @@ -16,8 +16,11 @@ rm -rf "out" && mkdir -p "out" $BASH -x -c "make clean" -mk_slunk "x86_64" "MARCH=x86-64 MTUNE=nocona" mk_slunk "i686" "MARCH=pentiumpro MTUNE=generic" +mk_slunk "x86_64" "MARCH=x86-64 MTUNE=nocona" +mk_slunk "arm" mk_slunk "aarch64" +mk_slunk "mips" +mk_slunk "mips64" printf "\033[1;32m\nBuild completed successfully.\033[0m\n\n"