summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile26
-rwxr-xr-xbuild-test.sh7
-rwxr-xr-xcross-make-mingw.sh45
-rwxr-xr-xjenkins-ci-build.sh13
4 files changed, 30 insertions, 61 deletions
diff --git a/Makefile b/Makefile
index 6f41b6fb..6649887f 100644
--- a/Makefile
+++ b/Makefile
@@ -466,7 +466,7 @@ else # ifeq darwin
ifeq ($(PLATFORM),mingw32)
# Some MinGW installations define CC to cc, but don't actually provide cc,
- # so explicitly use gcc instead (which is the only option anyway)
+ # so check that CC points to a real binary and use gcc if it doesn't
ifeq ($(call bin_path, $(CC)),)
CC=gcc
endif
@@ -475,6 +475,30 @@ ifeq ($(PLATFORM),mingw32)
WINDRES=windres
endif
+ ifeq ($(CROSS_COMPILING),1)
+ # If CC is already set to something generic, we probably want to use
+ # something more specific
+ ifneq ($(findstring $(CC),cc gcc),)
+ CC=
+ endif
+
+ # We need to figure out the correct compiler
+ ifeq ($(CC),)
+ ifeq ($(ARCH),x86_64)
+ MINGW_PREFIXES=amd64-mingw32msvc x86_64-w64-mingw32
+ endif
+ ifeq ($(ARCH),x86)
+ MINGW_PREFIXES=i586-mingw32msvc i686-w64-mingw32
+ endif
+
+ CC=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
+ $(call bin_path, $(MINGW_PREFIX)-gcc)))
+
+ WINDRES=$(strip $(foreach MINGW_PREFIX, $(MINGW_PREFIXES), \
+ $(call bin_path, $(MINGW_PREFIX)-windres)))
+ endif
+ endif
+
BASE_CFLAGS = -Wall -fno-strict-aliasing -Wimplicit -Wstrict-prototypes \
-DUSE_ICON
diff --git a/build-test.sh b/build-test.sh
index d3b7f656..83d463b9 100755
--- a/build-test.sh
+++ b/build-test.sh
@@ -4,19 +4,18 @@ failed=0;
# check if testing mingw
if [ "$CC" = "i686-w64-mingw32-gcc" ]; then
- MAKE=./cross-make-mingw.sh
+ export PLATFORM=mingw32
haveExternalLibs=0
else
- MAKE=make
haveExternalLibs=1
fi
# Default Build
-($MAKE clean release) || failed=1;
+(make clean release) || failed=1;
# Test additional options
if [ $haveExternalLibs -eq 1 ]; then
- ($MAKE clean release USE_CODEC_VORBIS=1 USE_FREETYPE=1) || failed=1;
+ (make clean release USE_CODEC_VORBIS=1 USE_FREETYPE=1) || failed=1;
fi
if [ $failed -eq 1 ]; then
diff --git a/cross-make-mingw.sh b/cross-make-mingw.sh
deleted file mode 100755
index f78aa264..00000000
--- a/cross-make-mingw.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-# Note: This works in Linux and cygwin
-
-if [ "$ARCH" = "x86_64" ];
-then
- CMD_PREFIX="amd64-mingw32msvc x86_64-w64-mingw32"
-else
- CMD_PREFIX="i586-mingw32msvc i686-w64-mingw32"
- export ARCH=x86
-fi
-
-if [ "$CC" = "cc" ] || [ "$CC" = "gcc" ];
-then
- CC=
-fi
-
-if [ "X$CC" = "X" ]; then
- for check in $CMD_PREFIX; do
- full_check="${check}-gcc"
- which "$full_check" > /dev/null 2>&1
- if [ "$?" = "0" ]; then
- export CC="$full_check"
- fi
- done
-fi
-
-if [ "X$WINDRES" = "X" ]; then
- for check in $CMD_PREFIX; do
- full_check="${check}-windres"
- which "$full_check" > /dev/null 2>&1
- if [ "$?" = "0" ]; then
- export WINDRES="$full_check"
- fi
- done
-fi
-
-if [ "X$WINDRES" = "X" -o "X$CC" = "X" ]; then
- echo "Error: Must define or find WINDRES and CC"
- exit 1
-fi
-
-export PLATFORM=mingw32
-
-exec make $*
diff --git a/jenkins-ci-build.sh b/jenkins-ci-build.sh
index eb09a37a..33c17e95 100755
--- a/jenkins-ci-build.sh
+++ b/jenkins-ci-build.sh
@@ -9,17 +9,8 @@ then
export USE_FREETYPE=1
fi
-if [ "$PLATFORM" = "mingw32" ];
-then
- MAKE=./cross-make-mingw.sh
-else
- MAKE=make
-fi
-
CORES=`awk '/^processor/ { N++} END { print N }' /proc/cpuinfo`
-# Default Build
-($MAKE -j${CORES} clean ${BUILD_TYPE})
-SUCCESS=$?
+make -j${CORES} clean ${BUILD_TYPE}
-exit ${SUCCESS}
+exit $?