From 160af4b457f77ff6d80e6a521c922169b284a6f9 Mon Sep 17 00:00:00 2001 From: "T. Joseph Carter" Date: Mon, 2 Feb 2015 23:05:57 -0800 Subject: [PATCH] Moved compiler selection so it's all in one place --- libretro-build-common.sh | 56 +++++++++++++++++++++++++++++++++++ libretro-build.sh | 64 ---------------------------------------- 2 files changed, 56 insertions(+), 64 deletions(-) diff --git a/libretro-build-common.sh b/libretro-build-common.sh index 8316d981..36449c84 100755 --- a/libretro-build-common.sh +++ b/libretro-build-common.sh @@ -5,6 +5,57 @@ die() { #exit 1 } +if [ -z "$JOBS" ]; then + JOBS=7 +fi + +if [ "$HOST_CC" ]; then + CC="${HOST_CC}-gcc" + CXX="${HOST_CC}-g++" + CXX11="${HOST_CC}-g++" + STRIP="${HOST_CC}-strip" +fi + +if [ -z "$MAKE" ]; then + if uname -s | grep -i MINGW32 > /dev/null 2>&1; then + MAKE=mingw32-make + else + if type gmake > /dev/null 2>&1; then + MAKE=gmake + else + MAKE=make + fi + fi +fi + + +if [ -z "$CC" ]; then + if [ $FORMAT_COMPILER_TARGET = "osx" ]; then + CC=cc + elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then + CC=mingw32-gcc + else + CC=gcc + fi +fi + +if [ -z "$CXX" ]; then + if [ $FORMAT_COMPILER_TARGET = "osx" ]; then + CXX=c++ + CXX11="clang++ -std=c++11 -stdlib=libc++" + elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then + CXX=mingw32-g++ + CXX11=mingw32-g++ + else + CXX=g++ + CXX11=g++ + fi +fi + +FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET +echo "CC = $CC" +echo "CXX = $CXX" +echo "STRIP = $STRIP" if [ "${CC}" ] && [ "${CXX}" ]; then COMPILER="CC=\"${CC}\" CXX=\"${CXX}\"" else @@ -27,6 +78,11 @@ echo "${FORMAT_COMPILER_TARGET_ALT}" RESET_FORMAT_COMPILER_TARGET=$FORMAT_COMPILER_TARGET RESET_FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET_ALT +if [ -z "$RARCH_DIST_DIR" ]; then + RARCH_DIR="${WORKDIR}/dist" + RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR" +fi + build_summary_log() { if [ -z "${NOBUILD_SUMMARY}" ]; then if [ "${1}" -eq "0" ]; then diff --git a/libretro-build.sh b/libretro-build.sh index 6e85ccf1..ce0b9c38 100755 --- a/libretro-build.sh +++ b/libretro-build.sh @@ -23,70 +23,6 @@ BASE_DIR="`dirname "${SCRIPT}"`" WORKDIR="`pwd`" . ${BASE_DIR}/libretro-config.sh - -if [ -z "$RARCH_DIST_DIR" ]; then - RARCH_DIR="${WORKDIR}/dist" - RARCH_DIST_DIR="$RARCH_DIR/$DIST_DIR" -fi - -if [ -z "$JOBS" ]; then - JOBS=7 -fi - -die() -{ - echo $1 - #exit 1 -} - -if [ "$HOST_CC" ]; then - CC="${HOST_CC}-gcc" - CXX="${HOST_CC}-g++" - CXX11="${HOST_CC}-g++" - STRIP="${HOST_CC}-strip" -fi - -if [ -z "$MAKE" ]; then - if uname -s | grep -i MINGW32 > /dev/null 2>&1; then - MAKE=mingw32-make - else - if type gmake > /dev/null 2>&1; then - MAKE=gmake - else - MAKE=make - fi - fi -fi - - -if [ -z "$CC" ]; then - if [ $FORMAT_COMPILER_TARGET = "osx" ]; then - CC=cc - elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then - CC=mingw32-gcc - else - CC=gcc - fi -fi - -if [ -z "$CXX" ]; then - if [ $FORMAT_COMPILER_TARGET = "osx" ]; then - CXX=c++ - CXX11="clang++ -std=c++11 -stdlib=libc++" - elif uname -s | grep -i MINGW32 > /dev/null 2>&1; then - CXX=mingw32-g++ - CXX11=mingw32-g++ - else - CXX=g++ - CXX11=g++ - fi -fi - -FORMAT_COMPILER_TARGET_ALT=$FORMAT_COMPILER_TARGET -echo "CC = $CC" -echo "CXX = $CXX" -echo "STRIP = $STRIP" - . ${BASE_DIR}/libretro-build-common.sh mkdir -p "$RARCH_DIST_DIR"