summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-02-04 18:07:32 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 18:07:32 +0100
commitda981e78253ab2b8715f4e10e175be4bea43c133 (patch)
tree20ecc711861fdaf6e3676b5110fd6ac9d589da73
parentb56b618abf0b15025b61ab96dcc873cf7af82450 (diff)
downloadqtlocation-mapboxgl-da981e78253ab2b8715f4e10e175be4bea43c133.tar.gz
move config files to config/ folder
-rw-r--r--.gitignore3
-rw-r--r--Makefile130
-rw-r--r--config/defaults.mk67
-rwxr-xr-xconfigure15
-rwxr-xr-xscripts/flock.py29
5 files changed, 136 insertions, 108 deletions
diff --git a/.gitignore b/.gitignore
index f0a0360782..4a61e999eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,9 +5,10 @@
*.diff.png
*.pyc
/mason_packages
-/config-*.gypi
+/config/*.gypi
/build
/macosx/build
+/linux/build
/test/build
/test/node_modules
/include/mbgl/shader/shaders.hpp
diff --git a/Makefile b/Makefile
index c8660f1625..d26aa2fbb7 100644
--- a/Makefile
+++ b/Makefile
@@ -11,87 +11,20 @@ HOST ?= linux
all: mbgl
-#### 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_env.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_env.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_env.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_env.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_env.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_env.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_env.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=.
+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
- @echo $(CMD)
- @$(ENV_$*) $(CMD)
- cat config-$*.gypi
+.PRECIOUS: config/%.gypi
+config/%.gypi: CMD = ./configure config/$*.gypi
+config/%.gypi: configure
+ @$(ENV_$*) ./scripts/flock.py build/Configure.lock ./configure config/$*.gypi
#### Library builds ############################################################
.PRECOIUS: Makefile/mbgl
-Makefile/mbgl: config-$(HOST).gypi
+Makefile/mbgl: config/$(HOST).gypi
deps/run_gyp mbgl.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make
mbgl: Makefile/mbgl
@@ -107,7 +40,7 @@ install: Makefile/mbgl
##### Test builds ##############################################################
.PRECIOUS: Makefile/test
-Makefile/test: test/test.gyp config-$(HOST).gypi
+Makefile/test: test/test.gyp config/$(HOST).gypi
deps/run_gyp test/test.gyp $(CONFIG_$(HOST)) $(LIBS_$(HOST)) --generator-output=./build/$(HOST) -f make
test: Makefile/test
@@ -118,7 +51,7 @@ test-%: test
.PRECIOUS: Xcode/test
-Xcode/test: test/test.gyp config-osx.gypi
+Xcode/test: test/test.gyp config/osx.gypi
deps/run_gyp test/test.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f xcode
.PHONY: lproj lbuild run-xlinux
@@ -135,7 +68,7 @@ xtest-%: xtest
#### Mac OS X application builds ###############################################
.PRECIOUS: Makefile/osx
-Makefile/osx: macosx/mapboxgl-app.gyp config-osx.gypi
+Makefile/osx: macosx/mapboxgl-app.gyp config/osx.gypi
deps/run_gyp macosx/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f make
.PHONY: osx run-osx
@@ -147,7 +80,7 @@ run-osx: osx
.PRECIOUS: Xcode/osx
-Xcode/osx: macosx/mapboxgl-app.gyp config-osx.gypi
+Xcode/osx: macosx/mapboxgl-app.gyp config/osx.gypi
deps/run_gyp macosx/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_osx) --generator-output=./build/osx -f xcode
.PHONY: xosx-proj xosx run-xosx
@@ -168,7 +101,7 @@ xproj: xosx-proj
#### iOS application builds ####################################################
.PRECIOUS: Xcode/ios
-Xcode/ios: ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp config-ios.gypi
+Xcode/ios: ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp config/ios.gypi
deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp $(CONFIG_ios) $(LIBS_ios) --generator-output=./build/ios -f xcode
.PHONY: ios-proj ios run-ios
@@ -185,7 +118,7 @@ iproj: ios-proj
#### Linux application builds ##################################################
.PRECIOUS: Makefile/linux
-Makefile/linux: linux/mapboxgl-app.gyp config-$(HOST).gypi
+Makefile/linux: linux/mapboxgl-app.gyp config/$(HOST).gypi
deps/run_gyp linux/mapboxgl-app.gyp $(CONFIG_$(HOST)) $(LIBS_linux) --generator-output=./build/$(HOST) -f make
.PHONY: linux run-linux
@@ -197,7 +130,7 @@ run-linux: linux
.PRECIOUS: Xcode/linux
-Xcode/linux: linux/mapboxgl-app.gyp config-osx.gypi
+Xcode/linux: linux/mapboxgl-app.gyp config/osx.gypi
deps/run_gyp linux/mapboxgl-app.gyp $(CONFIG_osx) $(LIBS_linux) --generator-output=./build/osx -f xcode
.PHONY: lproj lbuild run-xlinux
@@ -214,45 +147,25 @@ run-xlinux: xlinux
lproj: xlinux-proj
-##### Render application #######################################################
-# .PHONY: build/render/Makefile
-# build/render/Makefile: bin/render.gyp __$(HOST)__/render
-# __%__/render: config-%.gypi
-# deps/run_gyp bin/render.gyp -Iconfig-$*.gypi $(CONFIG_STRING) --generator-output=./build/render -f make
-
-# .PHONY: build/bin/render.xcodeproj
-# build/bin/render.xcodeproj: bin/render.gyp __osx__/render-xcode
-# __osx__/render-xcode:config-osx.gypi
-# deps/run_gyp bin/render.gyp -Iconfig-osx.gypi $(CONFIG_STRING) --generator-output=./build -f xcode
-
-# # Builds the CLI render app
-# render: build/render/Makefile
-# $(MAKE) -C build/render BUILDTYPE=$(BUILDTYPE) mbgl-render
-
#### Android libaries #########################################################
.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
+Makefile/android-%: config/android-%.gypi
@echo $(CMD)
@$(ENV_android-$*) $(CMD)
-# Builds all android architectures.
-android-all: $(ANDROID_ABIS)
-android-all: android
-
# Builds a particular android architecture.
-android-lib-%: CMD = $(MAKE) -C build/android-$* BUILDTYPE=$(BUILDTYPE) androidapp
android-lib-%: Makefile/android-%
- @echo $(CMD)
- @$(ENV_android-$*) $(CMD)
+ @$(ENV_android-$*) ./scripts/flock.py -v build/Android.lock $(MAKE) -C build/android-$* BUILDTYPE=$(BUILDTYPE) androidapp
# Builds the selected/default Android library
android: android-lib-$(ANDROID_ABI)
cd android/java && ./gradlew --parallel-threads=$(JOBS) build
-# rproj: build/bin/render.xcodeproj
-# open ./build/bin/render.xcodeproj
+# Builds all android architectures.
+android-all: $(ANDROID_ABIS)
+ cd android/java && ./gradlew --parallel-threads=$(JOBS) build
##### Maintenace operations ####################################################
@@ -282,7 +195,12 @@ endif
clean: clear_sqlite_cache clear_xcode_cache
-find ./deps/gyp -name "*.pyc" -exec rm {} \;
-rm -rf ./build/
- -rm -rf ./config-*.gypi
+ -rm -rf ./macosx/build
+ -rm -rf ./linux/build
+ -rm -rf ./ios/mapbox-gl-cocoa/build
+ -rm -rf ./ios/mapbox-gl-cocoa/app/build
+ -rm -rf ./test/build
+ -rm -rf ./config/*.gypi
-rm -rf ./android/java/build ./android/java/app/build ./android/java/lib/build
-rm -rf ./android/java/lib/src/main/jniLibs ./android/java/lib/src/main/assets
-rm -f ./android/test/features.zip
diff --git a/config/defaults.mk b/config/defaults.mk
new file mode 100644
index 0000000000..2aa11ccbe9
--- /dev/null
+++ b/config/defaults.mk
@@ -0,0 +1,67 @@
+
+#### 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_env.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_env.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_env.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_env.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_env.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_env.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_env.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=.
diff --git a/configure b/configure
index d00feda380..fec0bfd311 100755
--- a/configure
+++ b/configure
@@ -3,7 +3,7 @@
set -e
set -o pipefail
-CONFIG_FILE=${1:-config.gypi}
+CONFIG_FILE=$1
if [ `uname -s` = 'Darwin' ]; then
MASON_PLATFORM=${MASON_PLATFORM:-osx}
@@ -52,6 +52,18 @@ esac
function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; }
+if [ -z ${CONFIG_FILE} ]; then
+ abort 'You need to specify an output path for the configuration file'
+fi
+
+if [[ ${MASON_PLATFORM} = 'android' && -z ${MASON_ANDROID_ABI} ]]; then
+ abort 'You need to specify an ABI for android platforms'
+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 "
@@ -164,3 +176,4 @@ CONFIG+=" }
"
echo "${CONFIG}" > ${CONFIG_FILE}
+cat ${CONFIG_FILE}
diff --git a/scripts/flock.py b/scripts/flock.py
new file mode 100755
index 0000000000..6ceb585cdc
--- /dev/null
+++ b/scripts/flock.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+
+import fcntl, os, subprocess, sys, errno
+
+# from http://stackoverflow.com/a/600612
+def mkdir_p(path):
+ try:
+ os.makedirs(path)
+ except OSError as exc: # Python >2.5
+ if exc.errno == errno.EEXIST and os.path.isdir(path):
+ pass
+ else: raise
+
+def flock(lockfile, cmd_list, verbose = False):
+ mkdir_p(os.path.dirname(lockfile))
+ fd = os.open(lockfile, os.O_RDONLY | os.O_NOCTTY | os.O_CREAT, 0o666)
+ fcntl.flock(fd, fcntl.LOCK_EX)
+ if verbose:
+ print(' '.join(cmd_list))
+ return subprocess.call(cmd_list)
+
+if '__main__' == __name__:
+ try:
+ if sys.argv[1] == '-v':
+ sys.exit(flock(sys.argv[2], sys.argv[3:], True))
+ else:
+ sys.exit(flock(sys.argv[1], sys.argv[2:]))
+ except KeyboardInterrupt:
+ sys.exit(1)