From e2c03150310867874079a71e7ae2b3433d035096 Mon Sep 17 00:00:00 2001 From: Sam Stuewe Date: Sat, 20 Jul 2013 09:04:37 -0500 Subject: [PATCH] Clean up architecture detection As with the ``$platform`` assignment in ``libretro-install.sh``, this uses ``case`` statements to greatly simplify the detection and handling of the architecture. --- libretro-build.sh | 47 ++++++++++++++--------------------------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/libretro-build.sh b/libretro-build.sh index a3d6fd3d..18cfd60d 100755 --- a/libretro-build.sh +++ b/libretro-build.sh @@ -88,39 +88,20 @@ die() #exit 1 } -ARCH=$(uname -m) -X86=false -X86_64=false -ARM=false -ARMV5=false -ARMV6=false -ARMV7=false -if [ $ARCH = x86_64 ]; then - echo "x86_64 CPU detected" - X86=true - X86_64=true -elif [ $ARCH = i686 ]; then - echo "x86_32 CPU detected" - X86=true -elif [ $ARCH = armv5tel ]; then - echo "ARMv5 CPU detected" - ARM=true - ARMV5=true - export FORMAT_COMPILER_TARGET=armv - export FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET -elif [ $ARCH = armv6l ]; then - echo "ARMv6 CPU detected" - ARM=true - ARMV6=true - export FORMAT_COMPILER_TARGET=armv - export FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET -elif [ $ARCH = armv7l ]; then - echo "ARMv7 CPU detected" - ARM=true - ARMV7=true - export FORMAT_COMPILER_TARGET=armv - export FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET -fi +case "$(uname -m)" in + x86_64) X86=true && X86_64=true;; + i686) X86=true;; + armv*) + ARM=true && export FORMAT_COMPILER_TARGET=armv + case "$(uname -m)" in + armv5tel) ARMV5=true;; + armv6l) ARMV6=true;; + armv7l) ARMV7=true;; + esac;; +esac + +echo "$(uname -m) CPU detected" +export FORMAT_COMPILER_TARGET_ALT="$FORMAT_COMPILER_TARGET" if [ "$HOST_CC" ]; then CC="${HOST_CC}-gcc"