diff options
author | Konstantin Käfer <mail@kkaefer.com> | 2015-08-03 17:04:31 +0200 |
---|---|---|
committer | Konstantin Käfer <mail@kkaefer.com> | 2015-08-04 14:08:58 +0200 |
commit | e6053aa5475e03568f39e4967dc49ef4aba3c5fe (patch) | |
tree | 0b8fa3e3f5159f28210ff2c0611d8900d9577006 /scripts | |
parent | b44fe1c7af889089a640097583add8cd90e9330a (diff) | |
download | qtlocation-mapboxgl-e6053aa5475e03568f39e4967dc49ef4aba3c5fe.tar.gz |
Make build system architecture agnostic to remove Android special case
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/android/configure.sh | 14 | ||||
-rw-r--r-- | scripts/android/defaults.mk | 11 | ||||
-rw-r--r-- | scripts/ios/configure.sh | 6 | ||||
-rw-r--r-- | scripts/ios/defaults.mk | 12 | ||||
-rwxr-xr-x | scripts/ios/package.sh | 4 | ||||
-rw-r--r-- | scripts/linux/configure.sh | 18 | ||||
-rw-r--r-- | scripts/linux/defaults.mk | 5 | ||||
-rw-r--r-- | scripts/main.mk | 127 | ||||
-rw-r--r-- | scripts/osx/configure.sh | 13 | ||||
-rw-r--r-- | scripts/osx/defaults.mk | 5 |
10 files changed, 213 insertions, 2 deletions
diff --git a/scripts/android/configure.sh b/scripts/android/configure.sh new file mode 100644 index 0000000000..667ea68911 --- /dev/null +++ b/scripts/android/configure.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +BOOST_VERSION=1.57.0 +LIBCURL_VERSION=7.40.0 +OPENSSL_VERSION=1.0.1l +LIBPNG_VERSION=1.6.16 +JPEG_VERSION=v9a +SQLITE_VERSION=3.8.8.1 +LIBUV_VERSION=1.4.0 +ZLIB_VERSION=system +NUNICODE_VERSION=1.5.1 +LIBZIP_VERSION=0.11.2 + +export MASON_ANDROID_ABI=${MASON_PLATFORM_VERSION}
\ No newline at end of file diff --git a/scripts/android/defaults.mk b/scripts/android/defaults.mk new file mode 100644 index 0000000000..436f9db710 --- /dev/null +++ b/scripts/android/defaults.mk @@ -0,0 +1,11 @@ +HEADLESS ?= none +PLATFORM ?= android +ASSET ?= zip +HTTP ?= curl +CACHE ?= sqlite + +GYP_FLAVOR_SUFFIX=-android + +HOST_VERSION ?= arm-v7 + +ENV = $(shell MASON_ANDROID_ABI=$(HOST_VERSION) ./scripts/android/toolchain.sh) diff --git a/scripts/ios/configure.sh b/scripts/ios/configure.sh new file mode 100644 index 0000000000..0562e0e39a --- /dev/null +++ b/scripts/ios/configure.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +BOOST_VERSION=1.57.0 +SQLITE_VERSION=system +LIBUV_VERSION=0.10.28 +ZLIB_VERSION=system diff --git a/scripts/ios/defaults.mk b/scripts/ios/defaults.mk new file mode 100644 index 0000000000..fafc332133 --- /dev/null +++ b/scripts/ios/defaults.mk @@ -0,0 +1,12 @@ +HEADLESS = none +PLATFORM ?= ios +ASSET ?= fs +HTTP ?= nsurl +CACHE ?= sqlite + +HOST_VERSION = all + +PROVISIONING_PROFILE ?= 19324a54-7455-4f0b-8e1c-e6957c718ebc + +export MASON_PLATFORM=$(HOST) +export MASON_PLATFORM_VERSION=$(HOST_VERSION) diff --git a/scripts/ios/package.sh b/scripts/ios/package.sh index b499f4a108..449cf5c258 100755 --- a/scripts/ios/package.sh +++ b/scripts/ios/package.sh @@ -50,7 +50,7 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then ARCHS="arm64 armv7 armv7s" \ ONLY_ACTIVE_ARCH=NO \ GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ - -project ./build/ios/mbgl.xcodeproj \ + -project ./build/ios-all/mbgl.xcodeproj \ -configuration ${BUILDTYPE} \ -target everything \ -jobs ${JOBS} | xcpretty -c @@ -61,7 +61,7 @@ xcodebuild -sdk iphonesimulator${IOS_SDK_VERSION} \ ARCHS="x86_64 i386" \ ONLY_ACTIVE_ARCH=NO \ GCC_GENERATE_DEBUGGING_SYMBOLS=${GCC_GENERATE_DEBUGGING_SYMBOLS} \ - -project ./build/ios/mbgl.xcodeproj \ + -project ./build/ios-all/mbgl.xcodeproj \ -configuration ${BUILDTYPE} \ -target everything \ -jobs ${JOBS} | xcpretty -c diff --git a/scripts/linux/configure.sh b/scripts/linux/configure.sh new file mode 100644 index 0000000000..1099a65504 --- /dev/null +++ b/scripts/linux/configure.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +BOOST_VERSION=1.57.0 +BOOST_LIBPROGRAM_OPTIONS_VERSION=1.57.0 +LIBCURL_VERSION=system +GLFW_VERSION=3.1 +LIBPNG_VERSION=1.6.16 +JPEG_VERSION=v9a +SQLITE_VERSION=3.8.8.1 +LIBUV_VERSION=0.10.28 +ZLIB_VERSION=system +NUNICODE_VERSION=1.5.1 +LIBZIP_VERSION=0.11.2 + +function print_opengl_flags { + CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN + CONFIG+=" 'opengl_ldflags%': $(quote_flags $(pkg-config gl x11 --libs)),"$LN +} diff --git a/scripts/linux/defaults.mk b/scripts/linux/defaults.mk new file mode 100644 index 0000000000..126c8f99a4 --- /dev/null +++ b/scripts/linux/defaults.mk @@ -0,0 +1,5 @@ +HEADLESS ?= glx +PLATFORM ?= linux +ASSET ?= fs +HTTP ?= curl +CACHE ?= sqlite diff --git a/scripts/main.mk b/scripts/main.mk new file mode 100644 index 0000000000..b641a6ffe2 --- /dev/null +++ b/scripts/main.mk @@ -0,0 +1,127 @@ +ifeq (,$(V)) + QUIET = @ +endif + +# Determine host platform +HOST ?= $(BUILD) + +# Defines host defaults +include scripts/$(HOST)/defaults.mk + +HOST_VERSION ?= $(BUILD_VERSION) + +# Optionally include version-specific host defaults +-include scripts/$(HOST)/$(HOST_VERSION)/defaults.mk + +export MASON_PLATFORM=$(HOST) +export MASON_PLATFORM_VERSION=$(HOST_VERSION) + +HOST_SLUG = $(HOST)-$(HOST_VERSION) +CONFIGURE_FILES = scripts/$(HOST)/configure.sh +ifneq (,$(wildcard scripts/$(HOST)/$(HOST_VERSION)/configure.sh)) + CONFIGURE_FILES += scripts/$(HOST)/$(HOST_VERSION)/configure.sh +endif + + +# Text formatting +TEXT_BOLD = \033[1m +COLOR_GREEN = \033[32m +COLOR_CYAN = \033[36m +COLOR_PINK = \033[35m +FORMAT_END = \033[0m + +default: ; + +#### Dependencies ############################################################## + +SUBMODULES += .mason/mason.sh +.mason/mason.sh: + ./scripts/flock.py .git/Submodule.lock git submodule update --init .mason + +SUBMODULES += styles/styles +styles/styles: + ./scripts/flock.py .git/Submodule.lock git submodule update --init styles + +SUBMODULES += src/mbgl/util/geojsonvt/geojsonvt.hpp +src/mbgl/util/geojsonvt/geojsonvt.hpp: + ./scripts/flock.py .git/Submodule.lock git submodule update --init src/mbgl/util/geojsonvt + +SUBMODULES += test/suite/package.json +test/suite/package.json: + ./scripts/flock.py .git/Submodule.lock git submodule update --init test/suite + +ifeq ($(HOST),ios) +SUBMODULES += platform/ios/vendor/SMCalloutView/SMCalloutView.h +platform/ios/vendor/SMCalloutView/SMCalloutView.h: + ./scripts/flock.py .git/Submodule.lock git submodule update --init platform/ios/vendor/SMCalloutView + +SUBMODULES += test/ios/KIF/KIF.xcodeproj +test/ios/KIF/KIF.xcodeproj: + ./scripts/flock.py .git/Submodule.lock git submodule update --init test/ios/KIF +endif + +# Wildcard targets get removed after build by default, but we want to preserve the config. +.PRECIOUS: config/%.gypi +config/%.gypi: $(SUBMODULES) configure $(CONFIGURE_FILES) + @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" + $(QUIET)$(ENV) ./scripts/flock.py build/Configure.lock ./configure config/$*.gypi + + +#### Build files ############################################################### + +GYP_FLAGS += -Dhost=$(HOST) +GYP_FLAGS += -Iconfig/$(HOST_SLUG).gypi +GYP_FLAGS += -Dplatform_lib=$(PLATFORM) +GYP_FLAGS += -Dhttp_lib=$(HTTP) +GYP_FLAGS += -Dasset_lib=$(ASSET) +GYP_FLAGS += -Dcache_lib=$(CACHE) +GYP_FLAGS += -Dheadless_lib=$(HEADLESS) +GYP_FLAGS += -Dtest=$(BUILD_TEST) +GYP_FLAGS += -Drender=$(BUILD_RENDER) +GYP_FLAGS += --depth=. +GYP_FLAGS += -Goutput_dir=. +GYP_FLAGS += --generator-output=./build/$(HOST_SLUG) + +.PHONY: Makefile/__project__ +Makefile/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi + @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" + $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) -f make$(GYP_FLAVOR_SUFFIX) + +.PHONY: Xcode/__project__ +Xcode/__project__: print-env $(SUBMODULES) config/$(HOST_SLUG).gypi + @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Recreating project...$(FORMAT_END)\n" + $(QUIET)$(ENV) deps/run_gyp gyp/$(HOST).gyp $(GYP_FLAGS) -f xcode$(GYP_FLAVOR_SUFFIX) + +#### Build individual targets ################################################## + +Makefile/%: Makefile/__project__ + @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n" + $(QUIET)$(ENV) $(MAKE) -C build/$(HOST_SLUG) BUILDTYPE=$(BUILDTYPE) $* + +Xcode/%: Xcode/__project__ + @printf "$(TEXT_BOLD)$(COLOR_GREEN)* Building target $*...$(FORMAT_END)\n" + $(QUIET)$(ENV) xcodebuild \ + $(XCODEBUILD_ARGS) \ + -project ./build/$(HOST_SLUG)/gyp/$(HOST).xcodeproj \ + -configuration $(BUILDTYPE) \ + -target $* \ + -jobs $(JOBS) \ + $(XCPRETTY) + +#### Run tests ################################################################# + +test-%: Makefile/test + ./scripts/run_tests.sh "build/$(HOST_SLUG)/$(BUILDTYPE)/test" --gtest_filter=$* + +#### Helper targets ############################################################ + +.PHONY: print-env +print-env: $(SUBMODULES) + @printf "$(COLOR_PINK)build:$(FORMAT_END) $(BUILD)/$(BUILD_VERSION)\n" + @printf "$(COLOR_PINK)host:$(FORMAT_END) $(HOST)/$(HOST_VERSION)\n" + @printf "$(COLOR_PINK)libs:$(FORMAT_END) " + @printf "headless=$(COLOR_CYAN)%s$(FORMAT_END) " $(HEADLESS) + @printf "platform=$(COLOR_CYAN)%s$(FORMAT_END) " $(PLATFORM) + @printf "asset=$(COLOR_CYAN)%s$(FORMAT_END) " $(ASSET) + @printf "http=$(COLOR_CYAN)%s$(FORMAT_END) " $(HTTP) + @printf "cache=$(COLOR_CYAN)%s$(FORMAT_END)\n" $(CACHE) diff --git a/scripts/osx/configure.sh b/scripts/osx/configure.sh new file mode 100644 index 0000000000..fc3c5f464f --- /dev/null +++ b/scripts/osx/configure.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash + +BOOST_VERSION=1.57.0 +BOOST_LIBPROGRAM_OPTIONS_VERSION=1.57.0 +LIBCURL_VERSION=system +GLFW_VERSION=3.1 +LIBPNG_VERSION=1.6.16 +JPEG_VERSION=v9a +SQLITE_VERSION=3.8.8.1 +LIBUV_VERSION=0.10.28 +ZLIB_VERSION=system +NUNICODE_VERSION=1.5.1 +LIBZIP_VERSION=0.11.2 diff --git a/scripts/osx/defaults.mk b/scripts/osx/defaults.mk new file mode 100644 index 0000000000..f148f66d8a --- /dev/null +++ b/scripts/osx/defaults.mk @@ -0,0 +1,5 @@ +HEADLESS ?= cgl +PLATFORM ?= osx +ASSET ?= fs +HTTP ?= nsurl +CACHE ?= sqlite |