From 52756be36a2acf8635f9bf32c0c3448aebcc3997 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Mon, 2 Feb 2015 07:13:01 -0800 Subject: [PATCH] Turned CPU detection into a function --- libretro-config.sh | 53 +++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/libretro-config.sh b/libretro-config.sh index 8defba14..fe982e1a 100755 --- a/libretro-config.sh +++ b/libretro-config.sh @@ -2,30 +2,35 @@ # vi: ts=3 sw=3 et # Architecture Assignment -[ -z "${ARCH}" ] && ARCH="`uname -m`" -case "${ARCH}" in - x86_64) - X86=true - X86_64=true - ;; - i386|i686) - X86=true - ;; - armv*) - ARM=true - export FORMAT_COMPILER_TARGET=armv - export RARCHCFLAGS="${RARCHCFLAGS} -marm" - case "${ARCH}" in - armv5tel) ARMV5=true ;; - armv6l) ARMV6=true ;; - armv7l) ARMV7=true ;; - esac - ;; -esac -if [ -n "${PROCESSOR_ARCHITEW6432}" -a "${PROCESSOR_ARCHITEW6432}" = "AMD64" ]; then - ARCH=x86_64 - X86=true && X86_64=true -fi +config_cpu() { + [ -n "${2}" ] && ARCH=${1} + [ -z "${ARCH}" ] && ARCH="`uname -m`" + case "${ARCH}" in + x86_64) + X86=true + X86_64=true + ;; + i386|i686) + X86=true + ;; + armv*) + ARM=true + export FORMAT_COMPILER_TARGET=armv + export RARCHCFLAGS="${RARCHCFLAGS} -marm" + case "${ARCH}" in + armv5tel) ARMV5=true ;; + armv6l) ARMV6=true ;; + armv7l) ARMV7=true ;; + esac + ;; + esac + if [ -n "${PROCESSOR_ARCHITEW6432}" -a "${PROCESSOR_ARCHITEW6432}" = "AMD64" ]; then + ARCH=x86_64 + X86=true && X86_64=true + fi +} + +config_cpu if [ -z "$JOBS" ]; then if command -v nproc >/dev/null; then