diff options
32 files changed, 430 insertions, 495 deletions
diff --git a/.gitignore b/.gitignore index b253752e5d..3e46c0a0a3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ /ios/build /ios/app/build /test/build +/gyp/build +/gyp/java /test/node_modules /test/fixtures/*/*_actual.* /test/fixtures/api/1.png diff --git a/.mason b/.mason -Subproject abdc131273c3e50e42f245b1166c27de4c34c58 +Subproject 1d5789dfadeffa5df8e58770e3326840d1e6d9c @@ -1,225 +1,101 @@ -BUILDTYPE ?= Release -PYTHON ?= python -PREFIX ?= /usr/local -ANDROID_ABI ?= arm-v7 +export BUILDTYPE ?= Release +export BUILD_TEST ?= 1 +export BUILD_RENDER ?= 1 +# Determine build platform ifeq ($(shell uname -s), Darwin) -HOST = osx -HEADLESS = cgl -JOBS ?= $(shell sysctl -n hw.ncpu) -endif - -ifeq ($(shell uname -s), Linux) -HOST = linux -JOBS ?= $(shell grep --count processor /proc/cpuinfo) -BUILD_ROOT = $(shell pwd) -endif - -JOBS ?= 1 - -all: mbgl - -include config/defaults.mk - -#### Dependencies ############################################################## - -# Wildcard targets get removed after build by default, but we want to preserve the config. -.PRECIOUS: config/%.gypi -config/%.gypi: CMD = ./configure config/$*.gypi -config/%.gypi: configure - @$(ENV_$*) ./scripts/flock.py build/Configure.lock ./configure config/$*.gypi - -styles/styles: - git submodule update --init styles - -ifeq ($(shell uname -s), Darwin) -SMCalloutView: - git submodule update --init platform/ios/vendor/SMCalloutView +export BUILD = osx +export JOBS ?= $(shell sysctl -n hw.ncpu) +export XCPRETTY := $(shell ./scripts/xcpretty.sh) +else ifeq ($(shell uname -s), Linux) +export BUILD = linux +export JOBS ?= $(shell grep --count processor /proc/cpuinfo) else -SMCalloutView: +$(error Cannot determine build platform) endif +export BUILD_VERSION = $(shell uname -m) -geojsonvt: - git submodule update --init src/mbgl/util/geojsonvt - -KIF: - git submodule update --init test/ios/KIF - - -#### Build files ############################################################### - -.PRECIOUS: Makefile/project -Makefile/project: config/$(HOST).gypi styles/styles SMCalloutView geojsonvt - deps/run_gyp gyp/$(HOST).gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make - -.PRECIOUS: Xcode/project -Xcode/project: config/$(HOST).gypi styles/styles SMCalloutView geojsonvt - deps/run_gyp gyp/$(HOST).gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f xcode - - -#### Library builds ############################################################ - -mbgl: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) everything - -standalone: Makefile/project - LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) standalone - -install: Makefile/project - LINK=`pwd`/gyp/link.py $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) install - - -##### Test builds ############################################################## - -.PHONY: test -test: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) test - -test-%: test - ./scripts/run_tests.sh "build/$(HOST)/$(BUILDTYPE)/test" --gtest_filter=$* - -.PHONY: xtest -xtest: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xtest: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target test -jobs $(JOBS) $(XCPRETTY) - -xtest-%: xtest - ./scripts/run_tests.sh "build/osx/Build/Products/$(BUILDTYPE)/test" --gtest_filter=$* - +RUN = @$(MAKE) -f scripts/main.mk -#### Mac OS X application builds ############################################### +default: ; @printf "You must specify a valid target\n" -.PHONY: osx run-osx -osx: Makefile/project - $(MAKE) -C build/osx BUILDTYPE=$(BUILDTYPE) osxapp +#### OS X targets ############################################################## -run-osx: osx - "build/osx/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" +ifeq ($(BUILD),osx) +.PHONY: osx xosx run-osx run-xosx +osx: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Makefile/osxapp +xosx: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/osxapp +run-osx: osx ; @"build/osx-x86_64/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" +run-xosx: xosx ; @"gyp/build/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" -run-valgrind-osx: osx - (valgrind --leak-check=full --suppressions=scripts/valgrind.sup build/osx/$(BUILDTYPE)/Mapbox\ GL.app/Contents/MacOS/Mapbox\ GL) +.PHONY: Xcode/osx Xcode/ios +Xcode/ios: ; $(RUN) HOST=ios Xcode/__project__ +Xcode/osx: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/__project__ -.PHONY: xosx-proj xosx run-xosx -xosx-proj: Xcode/project - open ./build/osx/gyp/osx.xcodeproj +.PHONY: xproj iproj +xproj: Xcode/osx ; @open ./build/osx-x86_64/gyp/osx.xcodeproj +iproj: Xcode/ios ; @open ./build/ios-all/gyp/ios.xcodeproj -xosx: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xosx: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target osxapp -jobs $(JOBS) $(XCPRETTY) +.PHONY: ios ibench isim +ios ibench isim: export XCODEBUILD_ARGS += PROVISIONING_PROFILE="$$(PROVISIONING_PROFILE)" -run-xosx: xosx - "gyp/build/$(BUILDTYPE)/Mapbox GL.app/Contents/MacOS/Mapbox GL" +ios: export XCODEBUILD_ARGS += -sdk iphoneos ARCHS="arm64 armv7 armv7s" +ios: ; $(RUN) HOST=ios Xcode/iosapp -# Legacy name -xproj: xosx-proj +isim: export XCODEBUILD_ARGS += -sdk iphonesimulator ARCHS="x86_64 i386" +isim: ; $(RUN) HOST=ios Xcode/iosapp +ibench: export XCODEBUILD_ARGS += -sdk iphoneos ARCHS="arm64" +ibench: ; $(RUN) HOST=ios Xcode/ios-bench +.PHONY: ipackage ipackage-strip ipackage-sim itest +ipackage: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh +ipackage-strip: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh strip +ipackage-sim: Xcode/ios ; @JOBS=$(JOBS) ./scripts/ios/package.sh sim +itest: ipackage-sim ; ./scripts/ios/test.sh +endif -#### iOS application builds #################################################### - -.PRECIOUS: Xcode/ios -Xcode/ios: gyp/ios.gyp config/ios.gypi styles/styles SMCalloutView geojsonvt - deps/run_gyp gyp/ios.gyp $(CONFIG_ios) $(LIBS_ios) --generator-output=./build/ios -f xcode - -.PHONY: ios-proj ios isim ipackage -ios-proj: Xcode/ios - open ./build/ios/gyp/ios.xcodeproj - -ios: XCPRETTY := $(shell ./scripts/xcpretty.sh) -ios: Xcode/ios - xcodebuild -sdk iphoneos ARCHS="arm64 armv7 armv7s" PROVISIONING_PROFILE="19324a54-7455-4f0b-8e1c-e6957c718ebc" -project ./build/ios/gyp/ios.xcodeproj -configuration Release -target iosapp -jobs $(JOBS) $(XCPRETTY) - -ibench: XCPRETTY := $(shell ./scripts/xcpretty.sh) -ibench: Xcode/ios - xcodebuild -sdk iphoneos ARCHS="arm64" PROVISIONING_PROFILE="19324a54-7455-4f0b-8e1c-e6957c718ebc" -project ./build/ios/gyp/ios.xcodeproj -configuration Release -target ios-bench -jobs $(JOBS) $(XCPRETTY) - -isim: XCPRETTY := $(shell ./scripts/xcpretty.sh) -isim: Xcode/ios - xcodebuild -sdk iphonesimulator ARCHS="x86_64 i386" -project ./build/ios/gyp/ios.xcodeproj -configuration Debug -target iosapp -jobs $(JOBS) $(XCPRETTY) - -ipackage: Xcode/ios - JOBS=$(JOBS) ./scripts/ios/package.sh - -ipackage-strip: Xcode/ios - JOBS=$(JOBS) ./scripts/ios/package.sh strip - -ipackage-sim: Xcode/ios - JOBS=$(JOBS) ./scripts/ios/package.sh sim - -itest: ipackage-sim KIF - ./scripts/ios/test.sh - -# Legacy name -iproj: ios-proj - - -#### Linux application builds ################################################## - -.PHONY: linux run-linux -linux: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) linuxapp - -run-linux: linux - (cd build/$(HOST)/$(BUILDTYPE) && ./mapbox-gl) - -run-valgrind-linux: linux - (cd build/$(HOST)/$(BUILDTYPE) && valgrind --leak-check=full --suppressions=$(BUILD_ROOT)/scripts/valgrind.sup ./mapbox-gl) - -.PHONY: xlinux run-xlinux -xlinux: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xlinux: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target linuxapp -jobs $(JOBS) $(XCPRETTY) - -run-xlinux: xlinux - "gyp/build/$(BUILDTYPE)/mapbox-gl" - - -#### Android libaries ######################################################### +#### All platforms targets ##################################################### -.PRECIOUS: Makefile/android-% -Makefile/android-%: CMD = deps/run_gyp android/mapboxgl-app.gyp $(CONFIG_android-$*) $(LIBS_android) --generator-output=./build/android-$* -f make-android -Makefile/android-%: config/android-%.gypi styles/styles geojsonvt - @echo $(CMD) - @$(ENV_android-$*) $(CMD) +.PHONY: linux xlinux run-linux run-xlinux +linux: ; $(RUN) Makefile/linuxapp +.PHONY: android android-lib # Builds a particular android architecture. -android-lib-%: Makefile/android-% - @$(ENV_android-$*) ./scripts/flock.py -v build/Android.lock $(MAKE) -C build/android-$* BUILDTYPE=$(BUILDTYPE) androidapp +android-lib-%: ; $(RUN) HOST=android HOST_VERSION=$* Makefile/androidapp -# Builds the selected/default Android library -android-lib: android-lib-$(ANDROID_ABI) +# Builds the default Android library +android-lib: ; $(RUN) HOST=android Makefile/androidapp # Builds the selected/default Android library -android: android-lib-$(ANDROID_ABI) +android: android-lib cd android/java && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) # Builds all android architectures. -android-all: $(ANDROID_ABIS) +android-all: android-lib-arm-v5 android-lib-arm-v7 android-lib-arm-v8 +android-all: android-lib-x86 android-lib-x86-64 +android-all: android-lib-mips android-lib-mips-64 cd android/java && ./gradlew --parallel-threads=$(JOBS) assemble$(BUILDTYPE) -# Full build of GL Core for each architecture, build the Android Library, publish to Maven Central -android-deploy: $(ANDROID_ABIS) - cd android/java/MapboxGLAndroidSDK && chmod ugo+x deploy.sh && ./deploy.sh - -android-project: android-lib - - -##### Render builds ############################################################ - -render: Makefile/project - $(MAKE) -C build/$(HOST) BUILDTYPE=$(BUILDTYPE) mbgl-render +.PHONY: test +test: ; $(RUN) Makefile/test +test-%: ; $(RUN) test-$* +ifeq ($(BUILD),osx) +xtest: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/test +endif -.PHONY: xrender -xrender: XCPRETTY := $(shell ./scripts/xcpretty.sh) -xrender: Xcode/project - xcodebuild -project ./build/osx/gyp/osx.xcodeproj -configuration $(BUILDTYPE) -target mbgl-render -jobs $(JOBS) $(XCPRETTY) +.PHONY: render xrender +render: ; $(RUN) Makefile/mbgl-render +ifeq ($(BUILD),osx) +xrender: ; $(RUN) HOST=osx HOST_VERSION=x86_64 Xcode/mbgl-render +endif ##### Maintenace operations #################################################### .PHONY: clear_xcode_cache clear_xcode_cache: -ifeq ($(PLATFORM), osx) +ifeq ($(BUILD), osx) @CUSTOM_DD=`defaults read com.apple.dt.Xcode IDECustomDerivedDataLocation 2>/dev/null`; \ if [ $$CUSTOM_DD ]; then \ echo clearing files in $$CUSTOM_DD older than one day; \ @@ -233,7 +109,7 @@ endif .PHONY: clear_sqlite_cache clear_sqlite_cache: -ifeq ($(PLATFORM), osx) +ifeq ($(BUILD), osx) rm -f ~/Library/Application\ Support/Mapbox\ GL/cache.db else rm -f /tmp/mbgl-cache.db diff --git a/android/mapboxgl-app.gyp b/android/mapboxgl-app.gypi index d16d1dd4a2..107bbcbd50 100644 --- a/android/mapboxgl-app.gyp +++ b/android/mapboxgl-app.gypi @@ -26,13 +26,13 @@ ], 'libraries': [ '<@(openssl_static_libs)', - '<@(curl_static_libs)', - '<@(png_static_libs)', + '<@(libcurl_static_libs)', + '<@(libpng_static_libs)', '<@(jpeg_static_libs)', - '<@(sqlite3_static_libs)', - '<@(uv_static_libs)', - '<@(nu_static_libs)', - '<@(zip_static_libs)', + '<@(sqlite_static_libs)', + '<@(libuv_static_libs)', + '<@(nunicode_static_libs)', + '<@(libzip_static_libs)', ], 'variables': { 'ldflags': [ @@ -42,13 +42,13 @@ '-lGLESv2', '-lstdc++', '-latomic', - '<@(png_ldflags)', + '<@(libpng_ldflags)', '<@(jpeg_ldflags)', - '<@(sqlite3_ldflags)', + '<@(sqlite_ldflags)', '<@(openssl_ldflags)', - '<@(curl_ldflags)', + '<@(libcurl_ldflags)', '<@(zlib_ldflags)', - '<@(zip_ldflags)', + '<@(libzip_ldflags)', ], }, 'conditions': [ diff --git a/bin/render.gypi b/bin/render.gypi index 2e1dbd8f73..45c9ebb0e1 100644 --- a/bin/render.gypi +++ b/bin/render.gypi @@ -27,18 +27,18 @@ 'variables' : { 'cflags_cc': [ - '<@(glfw3_cflags)', - '<@(uv_cflags)', + '<@(glfw_cflags)', + '<@(libuv_cflags)', '<@(boost_cflags)', ], 'ldflags': [ - '<@(glfw3_ldflags)', - '<@(uv_ldflags)', + '<@(glfw_ldflags)', + '<@(libuv_ldflags)', ], 'libraries': [ - '<@(glfw3_static_libs)', - '<@(uv_static_libs)', - '<@(boost_program_options_static_libs)' + '<@(glfw_static_libs)', + '<@(libuv_static_libs)', + '<@(boost_libprogram_options_static_libs)' ], }, diff --git a/config/defaults.mk b/config/defaults.mk deleted file mode 100644 index 1449bf8e1b..0000000000 --- a/config/defaults.mk +++ /dev/null @@ -1,67 +0,0 @@ - -#### Configuration defaults #################################################### - -ENV_osx = MASON_PLATFORM=osx -CONFIG_osx = -Dhost=osx -Iconfig/osx.gypi -Dinstall_prefix=$(PREFIX) -LIBS_osx = -Dheadless_lib=$(word 1,$(HEADLESS) cgl) -LIBS_osx += -Dplatform_lib=$(word 1,$(PLATFORM) osx) -LIBS_osx += -Dasset_lib=$(word 1,$(ASSET) fs) -LIBS_osx += -Dhttp_lib=$(word 1,$(HTTP) nsurl) -LIBS_osx += -Dcache_lib=$(word 1,$(CACHE) sqlite) -LIBS_osx += --depth=. -Goutput_dir=. - - -ENV_ios = MASON_PLATFORM=ios -CONFIG_ios = -Dhost=ios -Iconfig/ios.gypi -Dinstall_prefix=$(PREFIX) -LIBS_ios = -Dheadless_lib=none -LIBS_ios += -Dplatform_lib=$(word 1,$(PLATFORM) ios) -LIBS_ios += -Dasset_lib=$(word 1,$(ASSET) fs) -LIBS_ios += -Dhttp_lib=$(word 1,$(HTTP) nsurl) -LIBS_ios += -Dcache_lib=$(word 1,$(CACHE) sqlite) -LIBS_ios += --depth=. -Goutput_dir=. - - -ENV_linux = MASON_PLATFORM=linux -CONFIG_linux = -Dhost=linux -Iconfig/linux.gypi -Dinstall_prefix=$(PREFIX) -LIBS_linux = -Dheadless_lib=$(word 1,$(HEADLESS) glx) -LIBS_linux += -Dplatform_lib=$(word 1,$(PLATFORM) linux) -LIBS_linux += -Dasset_lib=$(word 1,$(ASSET) fs) -LIBS_linux += -Dhttp_lib=$(word 1,$(HTTP) curl) -LIBS_linux += -Dcache_lib=$(word 1,$(CACHE) sqlite) -LIBS_linux += --depth=. -Goutput_dir=. - -ANDROID_ABIS += android-lib-arm-v8 -ENV_android-arm-v8 = $(shell MASON_ANDROID_ABI=arm-v8 ./scripts/android/toolchain.sh) -CONFIG_android-arm-v8 = -Dhost=android -Iconfig/android-arm-v8.gypi - -ANDROID_ABIS += android-lib-arm-v7 -ENV_android-arm-v7 = $(shell MASON_ANDROID_ABI=arm-v7 ./scripts/android/toolchain.sh) -CONFIG_android-arm-v7 = -Dhost=android -Iconfig/android-arm-v7.gypi - -ANDROID_ABIS += android-lib-arm-v5 -ENV_android-arm-v5 = $(shell MASON_ANDROID_ABI=arm-v5 ./scripts/android/toolchain.sh) -CONFIG_android-arm-v5 = -Dhost=android -Iconfig/android-arm-v5.gypi - -ANDROID_ABIS += android-lib-x86 -ENV_android-x86 = $(shell MASON_ANDROID_ABI=x86 ./scripts/android/toolchain.sh) -CONFIG_android-x86 = -Dhost=android -Iconfig/android-x86.gypi - -# OpenSSL build is incomplete. -# ANDROID_ABIS += android-lib-x86-64 -# ENV_android-x86-64 = $(shell MASON_ANDROID_ABI=x86-64 ./scripts/android/toolchain.sh) -# CONFIG_android-x86-64 = -Dhost=android -Iconfig/android-x86-64.gypi - -ANDROID_ABIS += android-lib-mips -ENV_android-mips = $(shell MASON_ANDROID_ABI=mips ./scripts/android/toolchain.sh) -CONFIG_android-mips = -Dhost=android -Iconfig/android-mips.gypi - -ANDROID_ABIS += android-lib-mips-64 -ENV_android-mips-64 = $(shell MASON_ANDROID_ABI=mips-64 ./scripts/android/toolchain.sh) -CONFIG_android-mips-64 = -Dhost=android -Iconfig/android-mips-64.gypi - -LIBS_android = -Dheadless_lib=none -LIBS_android += -Dplatform_lib=$(word 1,$(PLATFORM) android) -LIBS_android += -Dasset_lib=$(word 1,$(ASSET) zip) -LIBS_android += -Dhttp_lib=$(word 1,$(HTTP) curl) -LIBS_android += -Dcache_lib=$(word 1,$(CACHE) sqlite) -LIBS_android += --depth=. -Goutput_dir=. @@ -1,89 +1,63 @@ #!/usr/bin/env bash -set -e -set -o pipefail +set -euo pipefail CONFIG_FILE=$1 -if [ `uname -s` = 'Darwin' ]; then - MASON_PLATFORM=${MASON_PLATFORM:-osx} +if [ -z ${CONFIG_FILE} ]; then + abort 'You need to specify an output path for the configuration file' fi -function finish { - >&2 echo -en "\033[0m"; -} -trap finish EXIT +# Make sure we clear all colors +trap '>&2 echo -en "\033[0m"' TERM INT + +function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } +function info { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } +function warn { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } # Install mason -git submodule update --init .mason export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" -case ${MASON_PLATFORM} in - 'ios') - SQLITE_VERSION=system - LIBUV_VERSION=0.10.28 - ZLIB_VERSION=system - BOOST_VERSION=system - ;; - 'android') - SQLITE_VERSION=3.8.8.1 - LIBPNG_VERSION=1.6.16 - LIBJPEG_VERSION=v9a - OPENSSL_VERSION=1.0.1l - LIBCURL_VERSION=7.40.0 - LIBUV_VERSION=1.4.0 - ZLIB_VERSION=system - BOOST_VERSION=1.57.0 - NUNICODE_VERSION=1.5.1 - LIBZIP_VERSION=0.11.2 - ;; - *) - GLFW_VERSION=3.1 - SQLITE_VERSION=3.8.8.1 - LIBPNG_VERSION=1.6.16 - LIBJPEG_VERSION=v9a - LIBCURL_VERSION=system - LIBUV_VERSION=0.10.28 - ZLIB_VERSION=system - BOOST_VERSION=1.57.0 - BOOST_PROGRAM_OPTIONS_VERSION=1.57.0 - NUNICODE_VERSION=1.5.1 - LIBZIP_VERSION=0.11.2 - ;; -esac - -if [ ${MASON_PLATFORM} == 'linux' ] ; then - MESA_VERSION=10.4.3 - mason install mesa ${MESA_VERSION} - export PKG_CONFIG_PATH=`mason prefix mesa ${MESA_VERSION}`/lib/pkgconfig -fi +# You can override the function for a particular set of flags by defining a +# print_XXX_flags function in your dependencies.sh file +function print_flags { + local NAME=$1; shift + if [ "$(type -t print_${NAME}_flags)" = 'function' ]; then + print_${NAME}_flags + else + local VERSION=`echo "${NAME}_VERSION" | tr "[:lower:]" "[:upper:]"` + if [ ! -z ${!VERSION:-} ] ; then + mason install ${NAME} ${!VERSION} + for FLAGS in "$@" ; do + CONFIG+=" '${NAME}_${FLAGS}%': $(quote_flags $(mason ${FLAGS} ${NAME} ${!VERSION})),"$LN + done + else + warn "* Not using ${NAME}" + fi + fi +} -function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } +function print_default_flags { + : +} -if [ -z ${CONFIG_FILE} ]; then - abort 'You need to specify an output path for the configuration file' -fi +function print_opengl_flags { + CONFIG+=" 'opengl_cflags%': [],"$LN + CONFIG+=" 'opengl_ldflags%': [],"$LN +} -if [[ ${MASON_PLATFORM} = 'android' && -z ${MASON_ANDROID_ABI} ]]; then - abort 'You need to specify an ABI for android platforms' +# Load dependencies +source scripts/${MASON_PLATFORM}/configure.sh +if [ -e scripts/${MASON_PLATFORM}/${MASON_PLATFORM_VERSION}/configure.sh ]; then + source scripts/${MASON_PLATFORM}/${MASON_PLATFORM_VERSION}/configure.sh fi -echo -n "MASON_PLATFORM=${MASON_PLATFORM} " -if [ ${MASON_PLATFORM} = 'android' ]; then echo -n "MASON_ANDROID_ABI=${MASON_ANDROID_ABI} " ; fi -echo $0 $@ - PYTHON=`which python || abort 'Cannot find python'` >&2 echo -en "\033[1m\033[32m* Using " >&2 ${PYTHON} --version >&2 echo -en "\033[0m"; -PKG_CONFIG=`which pkg-config || abort 'Cannot find pkg-config'` - ->&2 echo -en "\033[1m\033[32m* Using pkg-config " ->&2 ${PKG_CONFIG} --version ->&2 echo -en "\033[0m"; - function quote_flags { ${PYTHON} -c "import sys, re; print filter(None, re.split('(?<!-framework)\s+', ' '.join(sys.argv[1:])))" "$@" } @@ -97,102 +71,33 @@ CONFIG="# Do not edit. Generated by the configure script. 'default_configuration': 'Release', 'defines': [], 'include_dirs': [], - 'libraries': [] - }, - 'variables': { + 'libraries': [], " -if [ ! -z ${BOOST_VERSION} ]; then - mason install boost ${BOOST_VERSION} - CONFIG+=" 'boost_cflags%': $(quote_flags $(mason cflags boost ${BOOST_VERSION})),"$LN -fi +print_default_flags -if [ ! -z ${BOOST_PROGRAM_OPTIONS_VERSION} ]; then - mason install boost_libprogram_options ${BOOST_PROGRAM_OPTIONS_VERSION} - CONFIG+=" 'boost_program_options_static_libs%': $(quote_flags $(mason static_libs boost_libprogram_options ${BOOST_VERSION})),"$LN -fi +CONFIG+=" },"$LN +CONFIG+=" 'variables': {"$LN -if [ ! -z ${OPENSSL_VERSION} ]; then - mason install openssl ${OPENSSL_VERSION} - CONFIG+=" 'openssl_static_libs%': $(quote_flags $(mason static_libs openssl ${OPENSSL_VERSION})),"$LN - CONFIG+=" 'openssl_cflags%': $(quote_flags $(mason cflags openssl ${OPENSSL_VERSION})),"$LN - CONFIG+=" 'openssl_ldflags%': $(quote_flags $(mason ldflags openssl ${OPENSSL_VERSION})),"$LN -fi +print_opengl_flags -if [ ! -z ${LIBCURL_VERSION} ]; then - mason install libcurl ${LIBCURL_VERSION} - CONFIG+=" 'curl_static_libs%': $(quote_flags $(mason static_libs libcurl ${LIBCURL_VERSION})),"$LN - CONFIG+=" 'curl_cflags%': $(quote_flags $(mason cflags libcurl ${LIBCURL_VERSION})),"$LN - CONFIG+=" 'curl_ldflags%': $(quote_flags $(mason ldflags libcurl ${LIBCURL_VERSION})),"$LN -fi - -if [ ! -z ${GLFW_VERSION} ]; then - mason install glfw ${GLFW_VERSION} - CONFIG+=" 'glfw3_static_libs%': $(quote_flags $(mason static_libs glfw ${GLFW_VERSION})),"$LN - CONFIG+=" 'glfw3_cflags%': $(quote_flags $(mason cflags glfw ${GLFW_VERSION})),"$LN - CONFIG+=" 'glfw3_ldflags%': $(quote_flags $(mason ldflags glfw ${GLFW_VERSION})),"$LN -fi - -if [ ${MASON_PLATFORM} == 'linux' ]; then - CONFIG+=" 'opengl_cflags%': $(quote_flags $(pkg-config gl x11 --cflags)),"$LN - CONFIG+=" 'opengl_ldflags%': $(quote_flags $(pkg-config gl x11 --libs)),"$LN -else - CONFIG+=" 'opengl_cflags%': $(quote_flags),"$LN - CONFIG+=" 'opengl_ldflags%': $(quote_flags),"$LN -fi - -if [ ! -z ${LIBPNG_VERSION} ]; then - mason install libpng ${LIBPNG_VERSION} - CONFIG+=" 'png_static_libs%': $(quote_flags $(mason static_libs libpng ${LIBPNG_VERSION})),"$LN - CONFIG+=" 'png_cflags%': $(quote_flags $(mason cflags libpng ${LIBPNG_VERSION})),"$LN - CONFIG+=" 'png_ldflags%': $(quote_flags $(mason ldflags libpng ${LIBPNG_VERSION})),"$LN -fi - -if [ ! -z ${LIBJPEG_VERSION} ]; then - mason install jpeg ${LIBJPEG_VERSION} - CONFIG+=" 'jpeg_static_libs%': $(quote_flags $(mason static_libs jpeg ${LIBJPEG_VERSION})),"$LN - CONFIG+=" 'jpeg_cflags%': $(quote_flags $(mason cflags jpeg ${LIBJPEG_VERSION})),"$LN - CONFIG+=" 'jpeg_ldflags%': $(quote_flags $(mason ldflags jpeg ${LIBJPEG_VERSION})),"$LN -fi - -if [ ! -z ${SQLITE_VERSION} ]; then - mason install sqlite ${SQLITE_VERSION} - CONFIG+=" 'sqlite3_static_libs%': $(quote_flags $(mason static_libs sqlite ${SQLITE_VERSION})),"$LN - CONFIG+=" 'sqlite3_cflags%': $(quote_flags $(mason cflags sqlite ${SQLITE_VERSION})),"$LN - CONFIG+=" 'sqlite3_ldflags%': $(quote_flags $(mason ldflags sqlite ${SQLITE_VERSION})),"$LN -fi - -if [ ! -z ${LIBUV_VERSION} ]; then - mason install libuv ${LIBUV_VERSION} - CONFIG+=" 'uv_static_libs%': $(quote_flags $(mason static_libs libuv ${LIBUV_VERSION})),"$LN - CONFIG+=" 'uv_cflags%': $(quote_flags $(mason cflags libuv ${LIBUV_VERSION})),"$LN - CONFIG+=" 'uv_ldflags%': $(quote_flags $(mason ldflags libuv ${LIBUV_VERSION})),"$LN -fi - -if [ ! -z ${ZLIB_VERSION} ]; then - mason install zlib ${ZLIB_VERSION} - CONFIG+=" 'zlib_static_libs%': $(quote_flags $(mason static_libs zlib ${ZLIB_VERSION})),"$LN - CONFIG+=" 'zlib_cflags%': $(quote_flags $(mason cflags zlib ${ZLIB_VERSION})),"$LN - CONFIG+=" 'zlib_ldflags%': $(quote_flags $(mason ldflags zlib ${ZLIB_VERSION})),"$LN -fi - -if [ ! -z ${NUNICODE_VERSION} ]; then - mason install nunicode ${NUNICODE_VERSION} - CONFIG+=" 'nu_static_libs%': $(quote_flags $(mason static_libs nunicode ${NUNICODE_VERSION})),"$LN - CONFIG+=" 'nu_cflags%': $(quote_flags $(mason cflags nunicode ${NUNICODE_VERSION})),"$LN - CONFIG+=" 'nu_ldflags%': $(quote_flags $(mason ldflags nunicode ${NUNICODE_VERSION})),"$LN -fi - -if [ ! -z ${LIBZIP_VERSION} ]; then - mason install libzip ${LIBZIP_VERSION} - CONFIG+=" 'zip_static_libs%': $(quote_flags $(mason static_libs libzip ${LIBZIP_VERSION})),"$LN - CONFIG+=" 'zip_cflags%': $(quote_flags $(mason cflags libzip ${LIBZIP_VERSION})),"$LN - CONFIG+=" 'zip_ldflags%': $(quote_flags $(mason ldflags libzip ${LIBZIP_VERSION})),"$LN -fi +print_flags boost cflags +print_flags boost_libprogram_options static_libs +print_flags openssl static_libs cflags ldflags +print_flags libcurl static_libs cflags ldflags +print_flags glfw static_libs cflags ldflags +print_flags libpng static_libs cflags ldflags +print_flags jpeg static_libs cflags ldflags +print_flags sqlite static_libs cflags ldflags +print_flags libuv static_libs cflags ldflags +print_flags zlib static_libs cflags ldflags +print_flags nunicode static_libs cflags ldflags +print_flags libzip static_libs cflags ldflags CONFIG+=" } } " +mkdir -p $(dirname "${CONFIG_FILE}") echo "${CONFIG}" > ${CONFIG_FILE} cat ${CONFIG_FILE} diff --git a/gyp/android.gyp b/gyp/android.gyp new file mode 100644 index 0000000000..0a09edb6cd --- /dev/null +++ b/gyp/android.gyp @@ -0,0 +1,5 @@ +{ + 'includes': [ + '../android/mapboxgl-app.gypi', + ], +} diff --git a/gyp/asset-fs.gypi b/gyp/asset-fs.gypi index f7fbea1c78..e84fabb629 100644 --- a/gyp/asset-fs.gypi +++ b/gyp/asset-fs.gypi @@ -17,14 +17,14 @@ 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', + '<@(libuv_cflags)', '<@(boost_cflags)', ], 'ldflags': [ - '<@(uv_ldflags)', + '<@(libuv_ldflags)', ], 'libraries': [ - '<@(uv_static_libs)', + '<@(libuv_static_libs)', ], 'defines': [ '-DMBGL_ASSET_FS' diff --git a/gyp/asset-zip.gypi b/gyp/asset-zip.gypi index 8a195649f3..e8854734e1 100644 --- a/gyp/asset-zip.gypi +++ b/gyp/asset-zip.gypi @@ -18,21 +18,21 @@ 'variables': { 'cflags': [ - '<@(uv_cflags)', - '<@(zip_cflags)', + '<@(libuv_cflags)', + '<@(libzip_cflags)', ], 'cflags_cc': [ - '<@(uv_cflags)', - '<@(zip_cflags)', + '<@(libuv_cflags)', + '<@(libzip_cflags)', '<@(boost_cflags)', ], 'ldflags': [ - '<@(uv_ldflags)', - '<@(zip_ldflags)', + '<@(libuv_ldflags)', + '<@(libzip_ldflags)', ], 'libraries': [ - '<@(uv_static_libs)', - '<@(zip_static_libs)', + '<@(libuv_static_libs)', + '<@(libzip_static_libs)', ], 'defines': [ '-DMBGL_ASSET_ZIP' diff --git a/gyp/cache-sqlite.gypi b/gyp/cache-sqlite.gypi index a9d21924c2..704dc490ea 100644 --- a/gyp/cache-sqlite.gypi +++ b/gyp/cache-sqlite.gypi @@ -19,17 +19,17 @@ 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', - '<@(sqlite3_cflags)', + '<@(libuv_cflags)', + '<@(sqlite_cflags)', ], 'ldflags': [ - '<@(uv_ldflags)', - '<@(sqlite3_ldflags)', + '<@(libuv_ldflags)', + '<@(sqlite_ldflags)', '<@(zlib_ldflags)', ], 'libraries': [ - '<@(uv_static_libs)', - '<@(sqlite3_static_libs)', + '<@(libuv_static_libs)', + '<@(sqlite_static_libs)', '<@(zlib_static_libs)', ], }, diff --git a/gyp/core.gypi b/gyp/core.gypi index 246419371c..f9b361032e 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -28,21 +28,21 @@ 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', + '<@(libuv_cflags)', '<@(opengl_cflags)', '<@(boost_cflags)', ], 'cflags': [ - '<@(uv_cflags)', + '<@(libuv_cflags)', '<@(opengl_cflags)', '-fPIC' ], 'ldflags': [ - '<@(uv_ldflags)', + '<@(libuv_ldflags)', '<@(opengl_ldflags)', ], 'libraries': [ - '<@(uv_static_libs)', + '<@(libuv_static_libs)', ], }, diff --git a/gyp/http-curl.gypi b/gyp/http-curl.gypi index b7c5832359..7ae5b1b75f 100644 --- a/gyp/http-curl.gypi +++ b/gyp/http-curl.gypi @@ -17,17 +17,17 @@ 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', - '<@(curl_cflags)', + '<@(libuv_cflags)', + '<@(libcurl_cflags)', '<@(boost_cflags)', ], 'ldflags': [ - '<@(uv_ldflags)', - '<@(curl_ldflags)', + '<@(libuv_ldflags)', + '<@(libcurl_ldflags)', ], 'libraries': [ - '<@(uv_static_libs)', - '<@(curl_static_libs)', + '<@(libuv_static_libs)', + '<@(libcurl_static_libs)', ], 'defines': [ '-DMBGL_HTTP_CURL' @@ -38,9 +38,9 @@ ['host == "android"', { 'variables': { # Android uses libzip and openssl to set CURL's CA bundle. - 'cflags_cc': [ '<@(zip_cflags)', '<@(openssl_cflags)' ], - 'ldflags': [ '<@(zip_ldflags)', ], - 'libraries': [ '<@(zip_static_libs)', ], + 'cflags_cc': [ '<@(libzip_cflags)', '<@(openssl_cflags)' ], + 'ldflags': [ '<@(libzip_ldflags)', ], + 'libraries': [ '<@(libzip_static_libs)', ], }, }], ['OS == "mac"', { diff --git a/gyp/http-nsurl.gypi b/gyp/http-nsurl.gypi index a64c8508e8..efd2c18a7d 100644 --- a/gyp/http-nsurl.gypi +++ b/gyp/http-nsurl.gypi @@ -17,14 +17,14 @@ 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', + '<@(libuv_cflags)', ], 'ldflags': [ '-framework Foundation', # For NSURLRequest - '<@(uv_ldflags)', + '<@(libuv_ldflags)', ], 'libraries': [ - '<@(uv_static_libs)', + '<@(libuv_static_libs)', ], 'defines': [ '-DMBGL_HTTP_NSURL' diff --git a/gyp/linux.gyp b/gyp/linux.gyp index 0f7126934f..6cc168ba8d 100644 --- a/gyp/linux.gyp +++ b/gyp/linux.gyp @@ -1,7 +1,10 @@ { 'includes': [ '../linux/mapboxgl-app.gypi', - '../test/test.gypi', - '../bin/render.gypi', + ], + + 'conditions': [ + ['test', { 'includes': [ '../test/test.gypi' ] } ], + ['render', { 'includes': [ '../bin/render.gypi' ] } ], ], } diff --git a/gyp/platform-android.gypi b/gyp/platform-android.gypi index 7701393bb9..41a5733acb 100644 --- a/gyp/platform-android.gypi +++ b/gyp/platform-android.gypi @@ -22,23 +22,23 @@ 'variables': { 'cflags_cc': [ - '<@(png_cflags)', + '<@(libpng_cflags)', '<@(jpeg_cflags)', - '<@(uv_cflags)', - '<@(nu_cflags)', + '<@(libuv_cflags)', + '<@(nunicode_cflags)', '<@(boost_cflags)', ], 'ldflags': [ - '<@(png_ldflags)', + '<@(libpng_ldflags)', '<@(jpeg_ldflags)', - '<@(uv_ldflags)', - '<@(nu_ldflags)', + '<@(libuv_ldflags)', + '<@(nunicode_ldflags)', ], 'libraries': [ - '<@(png_static_libs)', + '<@(libpng_static_libs)', '<@(jpeg_static_libs)', - '<@(uv_static_libs)', - '<@(nu_static_libs)', + '<@(libuv_static_libs)', + '<@(nunicode_static_libs)', ], }, diff --git a/gyp/platform-ios.gypi b/gyp/platform-ios.gypi index 7baba06e5c..481e0b2bbd 100644 --- a/gyp/platform-ios.gypi +++ b/gyp/platform-ios.gypi @@ -65,11 +65,11 @@ 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', + '<@(libuv_cflags)', '<@(boost_cflags)', ], 'libraries': [ - '<@(uv_static_libs)', + '<@(libuv_static_libs)', ], 'ldflags': [ '-framework CoreLocation', diff --git a/gyp/platform-linux.gypi b/gyp/platform-linux.gypi index 394433870d..f614b831e5 100644 --- a/gyp/platform-linux.gypi +++ b/gyp/platform-linux.gypi @@ -23,23 +23,23 @@ 'variables': { 'cflags_cc': [ - '<@(png_cflags)', + '<@(libpng_cflags)', '<@(jpeg_cflags)', - '<@(uv_cflags)', - '<@(nu_cflags)', + '<@(libuv_cflags)', + '<@(nunicode_cflags)', '<@(boost_cflags)', ], 'ldflags': [ - '<@(png_ldflags)', + '<@(libpng_ldflags)', '<@(jpeg_ldflags)', - '<@(uv_ldflags)', - '<@(nu_ldflags)', + '<@(libuv_ldflags)', + '<@(nunicode_ldflags)', ], 'libraries': [ - '<@(png_static_libs)', + '<@(libpng_static_libs)', '<@(jpeg_static_libs)', - '<@(uv_static_libs)', - '<@(nu_static_libs)', + '<@(libuv_static_libs)', + '<@(nunicode_static_libs)', ], }, diff --git a/gyp/platform-osx.gypi b/gyp/platform-osx.gypi index ae5194761c..af30019ee5 100644 --- a/gyp/platform-osx.gypi +++ b/gyp/platform-osx.gypi @@ -20,11 +20,11 @@ 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', + '<@(libuv_cflags)', '<@(boost_cflags)', ], 'libraries': [ - '<@(uv_static_libs)', + '<@(libuv_static_libs)', ], 'ldflags': [ '-framework Foundation', diff --git a/linux/mapboxgl-app.gypi b/linux/mapboxgl-app.gypi index 379bd4ad59..8457c2ce78 100644 --- a/linux/mapboxgl-app.gypi +++ b/linux/mapboxgl-app.gypi @@ -31,13 +31,13 @@ 'cflags_cc': [ '<@(opengl_cflags)', '<@(boost_cflags)', - '<@(glfw3_cflags)', + '<@(glfw_cflags)', ], 'ldflags': [ - '<@(glfw3_ldflags)', + '<@(glfw_ldflags)', ], 'libraries': [ - '<@(glfw3_static_libs)', + '<@(glfw_static_libs)', ], }, diff --git a/macosx/mapboxgl-app.gypi b/macosx/mapboxgl-app.gypi index 3b7d904a7d..589ae29bd5 100644 --- a/macosx/mapboxgl-app.gypi +++ b/macosx/mapboxgl-app.gypi @@ -35,14 +35,14 @@ 'variables' : { 'cflags_cc': [ '<@(boost_cflags)', - '<@(glfw3_cflags)', + '<@(glfw_cflags)', ], 'ldflags': [ '-framework SystemConfiguration', # For NSUserDefaults and Reachability - '<@(glfw3_ldflags)', + '<@(glfw_ldflags)', ], 'libraries': [ - '<@(glfw3_static_libs)', + '<@(glfw_static_libs)', ], }, 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 diff --git a/test/test.gypi b/test/test.gypi index 142445d984..4e669aee1d 100644 --- a/test/test.gypi +++ b/test/test.gypi @@ -94,19 +94,19 @@ 'style/sprite.cpp', ], 'libraries': [ - '<@(uv_static_libs)', - '<@(sqlite3_static_libs)', + '<@(libuv_static_libs)', + '<@(sqlite_static_libs)', ], 'variables': { 'cflags_cc': [ - '<@(uv_cflags)', + '<@(libuv_cflags)', '<@(opengl_cflags)', '<@(boost_cflags)', - '<@(sqlite3_cflags)', + '<@(sqlite_cflags)', ], 'ldflags': [ - '<@(uv_ldflags)', - '<@(sqlite3_ldflags)', + '<@(libuv_ldflags)', + '<@(sqlite_ldflags)', ], }, 'conditions': [ |