summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKonstantin Käfer <mail@kkaefer.com>2015-01-26 18:24:36 +0100
committerKonstantin Käfer <mail@kkaefer.com>2015-02-04 10:49:08 +0100
commit3d51e116a84ee168975bcee8377e9156f77e2731 (patch)
tree5a9799423e496c8c77f3e2edd6ae334dbf823da4
parent46553ff00c15414f4087ba9195fed7eba340fc13 (diff)
downloadqtlocation-mapboxgl-3d51e116a84ee168975bcee8377e9156f77e2731.tar.gz
use fake linker for merging the standalone static library
-rw-r--r--.gitignore1
-rw-r--r--Makefile22
-rwxr-xr-xconfigure2
-rw-r--r--gyp/common.gypi2
-rwxr-xr-xgyp/link.py34
-rw-r--r--gyp/mbgl-core.gypi59
-rw-r--r--gyp/mbgl-standalone.gypi16
-rw-r--r--mbgl.gyp10
8 files changed, 73 insertions, 73 deletions
diff --git a/.gitignore b/.gitignore
index f004dcf30f..82ecac6840 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,7 @@
*.o
*.actual.png
*.diff.png
+*.pyc
/mason_packages
/config.gypi
/config-ios.gypi
diff --git a/Makefile b/Makefile
index 9f026b1c50..ee4f587ee7 100644
--- a/Makefile
+++ b/Makefile
@@ -10,7 +10,7 @@ endif
PLATFORM ?= linux
.PHONY: all
-all: mbgl-core mbgl-platform mbgl-headless
+all: mbgl
config.gypi: configure
./configure
@@ -20,27 +20,23 @@ config-ios.gypi: configure
#### Library builds ############################################################
-.PHONY: mbgl-core
-mbgl-core: build/mbgl/Makefile
- $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-core
-
-.PHONY: mbgl-platform
-mbgl-platform: build/mbgl/Makefile
- $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-$(PLATFORM)
-
-.PHONY: mbgl-headless
-mbgl-headless: build/mbgl/Makefile
- $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-headless
+.PHONY: mbgl
+mbgl: build/mbgl/Makefile
+ $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mbgl-core mbgl-$(PLATFORM) mbgl-headless
.PHONY: install
install: build/mbgl/Makefile
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) install
+.PHONY: standalone
+standalone: build/mbgl/Makefile
+ LINK=`pwd`/gyp/link.py $(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) standalone
+
#### Build scripts #############################################################
.PHONY: build/mbgl/Makefile
build/mbgl/Makefile: mbgl.gyp config.gypi
- deps/run_gyp mbgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) -Dinstall_prefix=$(PREFIX) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
+ deps/run_gyp mbgl.gyp -Iconfig.gypi -Dplatform=$(PLATFORM) --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
.PHONY: build/test/Makefile
build/test/Makefile: test/test.gyp config.gypi
diff --git a/configure b/configure
index 13c7b6266d..900c464d10 100755
--- a/configure
+++ b/configure
@@ -99,8 +99,6 @@ if [ ! -z ${LIBCURL_VERSION} ]; then
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
-else
- CONFIG+=" 'curl_static_libs%': [],"$LN
fi
if [ ! -z ${GLFW_VERSION} ]; then
diff --git a/gyp/common.gypi b/gyp/common.gypi
index f16bfb27d5..2e47dd2f60 100644
--- a/gyp/common.gypi
+++ b/gyp/common.gypi
@@ -98,7 +98,7 @@
'xcode_settings': {
'GCC_OPTIMIZATION_LEVEL': '3',
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'YES',
- 'DEAD_CODE_STRIPPING': 'YES',
+ 'DEAD_CODE_STRIPPING': 'NO',
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'NO'
}
},
diff --git a/gyp/link.py b/gyp/link.py
new file mode 100755
index 0000000000..cab61aa9e6
--- /dev/null
+++ b/gyp/link.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+import sys
+from merge_static_libs import MergeLibs
+
+args = sys.argv[1:]
+
+out_lib = ''
+in_libs = []
+flags = []
+
+i = 0
+l = len(args)
+while i < l:
+ arg = args[i]
+
+ if arg[0:2] == '-l':
+ flags.append(arg)
+ elif arg == '-arch':
+ i += 1
+ elif arg == '-framework':
+ i += 1
+ flags.append(arg + ' ' + args[i])
+ elif arg == '-o':
+ i += 1
+ out_lib = args[i]
+ elif arg[0] != '-':
+ in_libs.append(arg)
+ else:
+ print 'Ignored linker directive: ' + arg
+
+ i += 1
+
+MergeLibs(in_libs, out_lib)
diff --git a/gyp/mbgl-core.gypi b/gyp/mbgl-core.gypi
index 35a535dd5f..5e6344da1c 100644
--- a/gyp/mbgl-core.gypi
+++ b/gyp/mbgl-core.gypi
@@ -6,8 +6,8 @@
'standalone_static_library': 1,
'hard_dependency': 1,
'dependencies': [
- 'shaders',
- 'version',
+ 'shaders',
+ 'version',
],
'sources': [
@@ -21,6 +21,11 @@
'bin/style.json'
],
+ 'include_dirs': [
+ '../include',
+ '../src',
+ ],
+
'variables': {
'cflags_cc': [
'<@(uv_cflags)',
@@ -38,11 +43,6 @@
],
},
- 'include_dirs': [
- '../include',
- '../src',
- ],
-
'conditions': [
['OS == "mac"', {
'xcode_settings': {
@@ -72,50 +72,5 @@
],
},
},
-
- { 'target_name': 'mbgl-standalone',
- 'type': 'none',
- 'hard_dependency': 1,
- 'dependencies': [
- 'mbgl-core'
- ],
- 'variables': {
- 'core_lib':'<(PRODUCT_DIR)/libmbgl-core.a',
- 'standalone_lib':'<(standalone_product_dir)/libmbgl.a'
- },
- 'direct_dependent_settings': {
- 'include_dirs': [
- '../include',
- ],
- 'conditions': [
- ['OS == "mac"', {
- 'xcode_settings': {
- 'OTHER_LDFLAGS': [ '<(standalone_lib)' ],
- }
- }, {
- 'ldflags': [ '<(standalone_lib)' ],
- }]
- ],
- },
- 'actions': [
- {
- 'action_name': 'build standalone core lib',
- 'inputs': [
- '<(core_lib)'
- ],
- 'outputs': [
- '<(standalone_lib)'
- ],
- 'action': [
- './gyp/merge_static_libs.py',
- '<(standalone_lib)',
- '<@(uv_static_libs)',
- '<@(curl_static_libs)',
- '<@(sqlite3_static_libs)',
- '<(core_lib)'
- ],
- }
- ]
- }
]
}
diff --git a/gyp/mbgl-standalone.gypi b/gyp/mbgl-standalone.gypi
new file mode 100644
index 0000000000..eb38a3e8c8
--- /dev/null
+++ b/gyp/mbgl-standalone.gypi
@@ -0,0 +1,16 @@
+{
+ 'targets': [
+ { 'target_name': 'standalone',
+ 'product_name': 'libmbgl.a',
+ 'type': 'executable',
+ 'hard_dependency': 1,
+
+ 'dependencies': [
+ '<(core_library)',
+ '<(platform_library)',
+ '<(storage_library)',
+ '<(headless_library)',
+ ],
+ },
+ ],
+} \ No newline at end of file
diff --git a/mbgl.gyp b/mbgl.gyp
index 2f65caa442..8ad17e87d4 100644
--- a/mbgl.gyp
+++ b/mbgl.gyp
@@ -7,26 +7,26 @@
'./gyp/certificates.gypi',
'./gyp/mbgl-core.gypi',
'./gyp/mbgl-headless.gypi',
- './gyp/mbgl-storage-curl.gypi',
- './gyp/install.gypi',
+ './gyp/mbgl-standalone.gypi',
],
'conditions': [
['platform == "osx"', {
'includes': [
'./gyp/mbgl-osx.gypi',
- './gyp/mbgl-storage-cocoa.gypi'
+ './gyp/mbgl-storage-cocoa.gypi',
],
}],
['platform == "ios"', {
'includes': [
'./gyp/mbgl-ios.gypi',
- './gyp/mbgl-storage-cocoa.gypi'
+ './gyp/mbgl-storage-cocoa.gypi',
],
}],
['platform == "linux"', {
'includes': [
- './gyp/mbgl-linux.gypi'
+ './gyp/mbgl-linux.gypi',
+ './gyp/mbgl-storage-curl.gypi',
],
}],
['platform == "android"', {