summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Marcos P. Santos <thiago@mapbox.com>2016-04-22 16:26:13 +0300
committerThiago Marcos P. Santos <thiago@mapbox.com>2016-04-25 16:44:28 +0300
commit8b9f84d815c3291915789d63ddf570cfed4f2fa2 (patch)
treef2ba52a7a9e0608cf8a53e8fd52704097135fc38
parent4c548fe0bb62b5bdd045013ad08288a0615a3489 (diff)
downloadqtlocation-mapboxgl-8b9f84d815c3291915789d63ddf570cfed4f2fa2.tar.gz
[Qt] Add toolchain support
Enables cross-compilation.
-rw-r--r--platform/qt/scripts/configure.sh6
-rwxr-xr-xplatform/qt/scripts/toolchain.sh21
-rw-r--r--scripts/main.mk55
3 files changed, 58 insertions, 24 deletions
diff --git a/platform/qt/scripts/configure.sh b/platform/qt/scripts/configure.sh
index 4c56409c8f..ec88247c94 100644
--- a/platform/qt/scripts/configure.sh
+++ b/platform/qt/scripts/configure.sh
@@ -46,3 +46,9 @@ function print_qt_flags {
CONFIG+=" 'qt_rcc%': '$(pkg-config QtCore --variable=rcc_location)',"$LN
fi
}
+
+CONFIGURE_SUPLATFORM=platform/qt/scripts/configure-${SUBPLATFORM}.sh
+
+if [ -f $CONFIGURE_SUPLATFORM ]; then
+ source $CONFIGURE_SUPLATFORM
+fi
diff --git a/platform/qt/scripts/toolchain.sh b/platform/qt/scripts/toolchain.sh
new file mode 100755
index 0000000000..bb08e0b010
--- /dev/null
+++ b/platform/qt/scripts/toolchain.sh
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+
+set -e
+set -o pipefail
+
+if [ -z ${MASON_SYSROOT:-} ]; then
+ exit 0
+fi
+
+export PATH="`pwd`/.mason:${PATH}"
+export MASON_DIR="`pwd`/.mason"
+
+export PATH=`mason env PATH`
+
+echo CXX=\"`which $(mason env CXX)`\"
+echo CC=\"`which $(mason env CC)`\"
+echo LD=\"`which $(mason env LD)`\"
+echo LINK=\"`which $(mason env CXX)`\"
+echo AR=\"`which $(mason env AR)`\"
+echo RANLIB=\"`which $(mason env RANLIB)`\"
+echo STRIP=\"`which $(mason env STRIP)`\"
diff --git a/scripts/main.mk b/scripts/main.mk
index d5d0d74ff1..466ffff219 100644
--- a/scripts/main.mk
+++ b/scripts/main.mk
@@ -16,38 +16,45 @@ else
export SUBPLATFORM ?= $(shell uname -m)
endif
-ifneq ($(PLATFORM),node)
- export MASON_PLATFORM = $(PLATFORM)
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = $(PLATFORM)-$(SUBPLATFORM)
-else ifeq ($(shell uname -s), Darwin)
- export MASON_PLATFORM = osx
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = node-osx-$(SUBPLATFORM)
-else ifeq ($(shell uname -s), Linux)
- export MASON_PLATFORM = linux
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = node-linux-$(SUBPLATFORM)
+ifeq ($(PLATFORM),node)
+ ifeq ($(shell uname -s), Darwin)
+ export MASON_PLATFORM ?= osx
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = node-osx-$(SUBPLATFORM)
+ else ifeq ($(shell uname -s), Linux)
+ export MASON_PLATFORM ?= linux
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = node-linux-$(SUBPLATFORM)
+ endif
endif
-export PLATFORM_OUTPUT = ./build/$(PLATFORM_SLUG)
-export PLATFORM_CONFIG_INPUT = platform/$(MASON_PLATFORM)/scripts/configure.sh
-export PLATFORM_CONFIG_OUTPUT = $(PLATFORM_OUTPUT)/config.gypi
-
ifeq ($(PLATFORM),qt)
ifeq ($(shell uname -s), Darwin)
- export MASON_PLATFORM = osx
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = qt-osx-$(SUBPLATFORM)
- export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
+ export MASON_PLATFORM ?= osx
+
+ ifneq ($(MASON_PLATFORM), osx)
+ export GYP_FLAVOR_SUFFIX = -$(MASON_PLATFORM)
+ endif
else ifeq ($(shell uname -s), Linux)
- export MASON_PLATFORM = linux
- export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
- export PLATFORM_SLUG = qt-linux-$(SUBPLATFORM)
- export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
+ export MASON_PLATFORM ?= linux
endif
+
+ export MASON_PLATFORM_VERSION = $(SUBPLATFORM)
+ export PLATFORM_SLUG = qt-$(MASON_PLATFORM)-$(SUBPLATFORM)
+ export PLATFORM_CONFIG_INPUT = platform/qt/scripts/configure.sh
+
+ # Cross compilation support
+ ENV = $(shell MASON_PLATFORM_VERSION=$(SUBPLATFORM) ./platform/qt/scripts/toolchain.sh)
endif
+# Defaults if not set
+export PLATFORM_OUTPUT ?= ./build/$(PLATFORM_SLUG)
+export PLATFORM_CONFIG_INPUT ?= platform/$(MASON_PLATFORM)/scripts/configure.sh
+export PLATFORM_CONFIG_OUTPUT ?= $(PLATFORM_OUTPUT)/config.gypi
+export MASON_PLATFORM ?= $(PLATFORM)
+export MASON_PLATFORM_VERSION ?= $(SUBPLATFORM)
+export PLATFORM_SLUG ?= $(PLATFORM)-$(SUBPLATFORM)
+
ifneq (,$(findstring clang,$(CXX)))
CXX_HOST = "clang"
else ifneq (,$(findstring g++,$(CXX)))