From 0cde7e269440a98d2a19fa42266e27612f9bfae1 Mon Sep 17 00:00:00 2001 From: "sgk@google.com" Date: Wed, 8 Apr 2009 12:55:49 +0000 Subject: [PATCH] Basic underpinnings of the gyp equivalent of the Linux SHARED=1 build: parameterize the 'type' setting of the various library targets, with a default of 'static_library'. (Hat tip to Craig Schlenter.) Review URL: http://codereview.chromium.org/62127 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13345 0039d316-1c4b-4281-b951-d872f2087c98 --- base/base.gyp | 6 +++--- build/common.gypi | 8 ++++++++ build/temp_gyp/breakpad.gyp | 4 ++-- build/temp_gyp/googleurl.gyp | 2 +- build/temp_gyp/v8.gyp | 8 ++++---- chrome/chrome.gyp | 18 +++++++++--------- chrome/installer/util/util.gyp | 2 +- chrome/third_party/hunspell/hunspell.gyp | 2 +- google_update/google_update.gyp | 2 +- media/media.gyp | 2 +- net/net.gyp | 4 ++-- printing/printing.gyp | 2 +- sandbox/sandbox.gyp | 2 +- sdch/sdch.gyp | 2 +- skia/skia.gyp | 2 +- testing/gtest.gyp | 2 +- third_party/bzip2/bzip2.gyp | 2 +- third_party/harfbuzz/harfbuzz.gyp | 4 ++-- third_party/libevent/libevent.gyp | 2 +- third_party/libjpeg/libjpeg.gyp | 2 +- third_party/libpng/libpng.gyp | 2 +- third_party/libxml/libxml.gyp | 2 +- third_party/libxslt/libxslt.gyp | 2 +- third_party/modp_b64/modp_b64.gyp | 2 +- third_party/sqlite/sqlite.gyp | 2 +- third_party/zlib/zlib.gyp | 2 +- webkit/activex_shim/activex_shim.gyp | 2 +- webkit/default_plugin/default_plugin.gyp | 2 +- webkit/tools/test_shell/test_shell.gyp | 2 +- webkit/webkit.gyp | 10 +++++----- 30 files changed, 57 insertions(+), 49 deletions(-) diff --git a/base/base.gyp b/base/base.gyp index 325ab65628ec5..8ebad3e56d5c7 100644 --- a/base/base.gyp +++ b/base/base.gyp @@ -12,7 +12,7 @@ 'targets': [ { 'target_name': 'base', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../third_party/icu38/icu38.gyp:icui18n', '../third_party/icu38/icu38.gyp:icuuc', @@ -452,7 +452,7 @@ }, { 'target_name': 'base_gfx', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'A508ADD3-CECE-4E0F-8448-2F5E454DF551', 'sources': [ 'gfx/gdi_util.cc', @@ -646,7 +646,7 @@ }, { 'target_name': 'test_support_base', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'base', '../testing/gtest.gyp:gtest', diff --git a/build/common.gypi b/build/common.gypi index 8279489d15b5a..a2d9f2b5e7303 100644 --- a/build/common.gypi +++ b/build/common.gypi @@ -31,6 +31,14 @@ # project file called "coverage". # Currently ignored on Windows. 'coverage%': 0, + + # To do a shared build on linux we need to be able to choose between type + # static_library and shared_library. We default to doing a static build + # but you can override this with "gyp -Dlibrary=shared_library" or you + # can add the following line (without the #) to ~/.gyp/include.gypi + # {'variables': {'library': 'shared_library'}} + # to compile as shared by default + 'library%': 'static_library', }, 'target_defaults': { 'conditions': [ diff --git a/build/temp_gyp/breakpad.gyp b/build/temp_gyp/breakpad.gyp index f0324466da591..c4b41bb8b227f 100644 --- a/build/temp_gyp/breakpad.gyp +++ b/build/temp_gyp/breakpad.gyp @@ -11,7 +11,7 @@ 'targets': [ { 'target_name': 'breakpad_handler', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'B55CA863-B374-4BAF-95AC-539E4FA4C90C', 'sources': [ '../../breakpad/src/client/windows/crash_generation/client_info.cc', @@ -45,7 +45,7 @@ }, { 'target_name': 'breakpad_sender', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': '9946A048-043B-4F8F-9E07-9297B204714C', 'sources': [ '../../breakpad/src/client/windows/sender/crash_report_sender.cc', diff --git a/build/temp_gyp/googleurl.gyp b/build/temp_gyp/googleurl.gyp index a5e0038ef4739..b518e4ca0755a 100644 --- a/build/temp_gyp/googleurl.gyp +++ b/build/temp_gyp/googleurl.gyp @@ -13,7 +13,7 @@ 'targets': [ { 'target_name': 'googleurl', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'EF5E94AB-B646-4E5B-A058-52EF07B8351C', 'dependencies': [ '../../base/base.gyp:base', diff --git a/build/temp_gyp/v8.gyp b/build/temp_gyp/v8.gyp index a64a7ca49c260..2a92aebd862cd 100644 --- a/build/temp_gyp/v8.gyp +++ b/build/temp_gyp/v8.gyp @@ -368,7 +368,7 @@ # Targets to build v8 for the native architecture (ia32). { 'target_name': 'v8_base', - 'type': 'static_library', + 'type': '<(library)', 'include_dirs': [ '../../v8/src', ], @@ -422,7 +422,7 @@ }, { 'target_name': 'v8_nosnapshot', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'js2c', 'v8_base', @@ -451,7 +451,7 @@ }, { 'target_name': 'v8', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'js2c', 'mksnapshot', @@ -546,7 +546,7 @@ # (src/simulator-arm.cc). The ARM targets are not snapshot-enabled. { 'target_name': 'v8_arm', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'js2c', ], diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 8fe9522c23d3e..a77909f2ed6c7 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -77,7 +77,7 @@ }, { 'target_name': 'common', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'resources', '../base/base.gyp:base', @@ -357,7 +357,7 @@ }, { 'target_name': 'browser', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'common', 'resources', @@ -1382,7 +1382,7 @@ }, { 'target_name': 'renderer', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'common', 'resources', @@ -1736,7 +1736,7 @@ # This target contains mocks and test utilities that don't belong in # production libraries but are used by more than one test executable. 'target_name': 'test_support_common', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'browser', 'common', @@ -1799,7 +1799,7 @@ }, { 'target_name': 'test_support_ui', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'test_support_common', 'resources', @@ -1834,7 +1834,7 @@ }, { 'target_name': 'test_support_unit', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'test_support_common', 'resources', @@ -2468,7 +2468,7 @@ { 'targets': [ { 'target_name': 'views', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'common', 'resources', @@ -2736,7 +2736,7 @@ { 'targets': [ { 'target_name': 'plugin', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'common', 'resources', @@ -2792,7 +2792,7 @@ }, { 'target_name': 'worker', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../base/base.gyp:base', '../webkit/webkit.gyp:webkit', diff --git a/chrome/installer/util/util.gyp b/chrome/installer/util/util.gyp index 26b1418b9f24e..f8238877d23f9 100644 --- a/chrome/installer/util/util.gyp +++ b/chrome/installer/util/util.gyp @@ -5,7 +5,7 @@ 'targets': [ { 'target_name': 'installer_util', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'prebuild/util_prebuild.gyp:installer_util_prebuild', '../../chrome.gyp:common', diff --git a/chrome/third_party/hunspell/hunspell.gyp b/chrome/third_party/hunspell/hunspell.gyp index 1d86c763d128b..92203a828b024 100644 --- a/chrome/third_party/hunspell/hunspell.gyp +++ b/chrome/third_party/hunspell/hunspell.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'hunspell', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../../../base/base.gyp:base', '../../../third_party/icu38/icu38.gyp:icuuc', diff --git a/google_update/google_update.gyp b/google_update/google_update.gyp index cfe110236f600..3ad4d06baa204 100644 --- a/google_update/google_update.gyp +++ b/google_update/google_update.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'google_update', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': '4052059A-D72B-4183-B5C2-9D1B099E9E35', 'sources': [ 'google_update_idl.idl', diff --git a/media/media.gyp b/media/media.gyp index a4e9b9161b7ad..f3e59f97bfdae 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -19,7 +19,7 @@ 'targets': [ { 'target_name': 'media', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../base/base.gyp:base', '../third_party/ffmpeg/ffmpeg.gyp:ffmpeg', diff --git a/net/net.gyp b/net/net.gyp index cfd17f66629e9..f1a48050eb39c 100644 --- a/net/net.gyp +++ b/net/net.gyp @@ -12,7 +12,7 @@ 'targets': [ { 'target_name': 'net', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../base/base.gyp:base', '../build/temp_gyp/googleurl.gyp:googleurl', @@ -537,7 +537,7 @@ }, { 'target_name': 'net_test_support', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'net', '../base/base.gyp:base', diff --git a/printing/printing.gyp b/printing/printing.gyp index 11fea0c59a2d1..51768fd715f46 100644 --- a/printing/printing.gyp +++ b/printing/printing.gyp @@ -12,7 +12,7 @@ 'targets': [ { 'target_name': 'printing', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../base/base.gyp:base', ], diff --git a/sandbox/sandbox.gyp b/sandbox/sandbox.gyp index e1ce9e418c8b0..6add0c2b9e657 100644 --- a/sandbox/sandbox.gyp +++ b/sandbox/sandbox.gyp @@ -11,7 +11,7 @@ 'targets': [ { 'target_name': 'sandbox', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../testing/gtest.gyp:gtest', '../base/base.gyp:base', diff --git a/sdch/sdch.gyp b/sdch/sdch.gyp index d03e392240ec0..b8224a38525dd 100644 --- a/sdch/sdch.gyp +++ b/sdch/sdch.gyp @@ -12,7 +12,7 @@ 'targets': [ { 'target_name': 'sdch', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'F54ABC59-5C00-414A-A9BA-BAF26D1699F0', 'sources': [ 'open-vcdiff/src/addrcache.cc', diff --git a/skia/skia.gyp b/skia/skia.gyp index 2957cc18da592..55071c898798e 100644 --- a/skia/skia.gyp +++ b/skia/skia.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'skia', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'CD9CA56E-4E94-444C-87D4-58CA1E6F300D', 'sources': [ 'precompiled.cc', diff --git a/testing/gtest.gyp b/testing/gtest.gyp index 110fe140ab44f..078ca3cf78eb5 100644 --- a/testing/gtest.gyp +++ b/testing/gtest.gyp @@ -12,7 +12,7 @@ 'targets': [ { 'target_name': 'gtest', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'BFE8E2A7-3B3B-43B0-A994-3058B852DB8B', 'sources': [ 'gtest/include/gtest/internal/gtest-death-test-internal.h', diff --git a/third_party/bzip2/bzip2.gyp b/third_party/bzip2/bzip2.gyp index 2508bb5d08aa7..c9f59de90d3b3 100644 --- a/third_party/bzip2/bzip2.gyp +++ b/third_party/bzip2/bzip2.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'bzip2', - 'type': 'static_library', + 'type': '<(library)', 'defines': ['BZ_NO_STDIO'], 'msvs_guid': '2A70CBF0-847E-4E3A-B926-542A656DC7FE', 'sources': [ diff --git a/third_party/harfbuzz/harfbuzz.gyp b/third_party/harfbuzz/harfbuzz.gyp index 5e98ddb0c870f..9d5b4086c706f 100644 --- a/third_party/harfbuzz/harfbuzz.gyp +++ b/third_party/harfbuzz/harfbuzz.gyp @@ -12,7 +12,7 @@ 'targets': [ { 'target_name': 'harfbuzz', - 'type': 'static_library', + 'type': '<(library)', 'sources': [ 'src/harfbuzz-buffer.c', 'src/harfbuzz-stream.c', @@ -46,7 +46,7 @@ }, { 'target_name': 'harfbuzz_interface', - 'type': 'static_library', + 'type': '<(library)', 'sources': [ 'contrib/harfbuzz-freetype.c', 'contrib/harfbuzz-unicode.c', diff --git a/third_party/libevent/libevent.gyp b/third_party/libevent/libevent.gyp index 213009adad1b2..4230cb479f100 100644 --- a/third_party/libevent/libevent.gyp +++ b/third_party/libevent/libevent.gyp @@ -13,7 +13,7 @@ { 'target_name': 'libevent', 'product_name': 'event', - 'type': 'static_library', + 'type': '<(library)', 'sources': [ 'buffer.c', 'evbuffer.c', diff --git a/third_party/libjpeg/libjpeg.gyp b/third_party/libjpeg/libjpeg.gyp index e29bd41ee74da..87f993793ad63 100644 --- a/third_party/libjpeg/libjpeg.gyp +++ b/third_party/libjpeg/libjpeg.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'libjpeg', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': '238CE175-76CE-4A25-A676-69D115885601', 'sources': [ 'jcapimin.c', diff --git a/third_party/libpng/libpng.gyp b/third_party/libpng/libpng.gyp index 83bb9077a94f3..63bd9d7a7895d 100644 --- a/third_party/libpng/libpng.gyp +++ b/third_party/libpng/libpng.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'libpng', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../zlib/zlib.gyp:zlib', ], diff --git a/third_party/libxml/libxml.gyp b/third_party/libxml/libxml.gyp index 35140971917b2..b1b01172f09bb 100644 --- a/third_party/libxml/libxml.gyp +++ b/third_party/libxml/libxml.gyp @@ -31,7 +31,7 @@ ], }, }, { # else: OS != "linux" or ! use_system_libxml - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'F9810DE8-CBC3-4605-A7B1-ECA2D5292FD7', 'sources': [ 'include/libxml/c14n.h', diff --git a/third_party/libxslt/libxslt.gyp b/third_party/libxslt/libxslt.gyp index 9615e83a3e418..f775d4bd1aa2b 100644 --- a/third_party/libxslt/libxslt.gyp +++ b/third_party/libxslt/libxslt.gyp @@ -31,7 +31,7 @@ ], }, }, { # else: OS != "linux" or ! use_system_libxslt - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'FC0E1FD0-5DD7-4041-A1C9-CD3C376E4EED', 'sources': [ 'libxslt/attributes.c', diff --git a/third_party/modp_b64/modp_b64.gyp b/third_party/modp_b64/modp_b64.gyp index 6b4b75ca6fd96..18dadd832a925 100644 --- a/third_party/modp_b64/modp_b64.gyp +++ b/third_party/modp_b64/modp_b64.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'modp_b64', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': '7100F41F-868D-4E99-80A2-AF8E6574749D', 'sources': [ 'modp_b64.cc', diff --git a/third_party/sqlite/sqlite.gyp b/third_party/sqlite/sqlite.gyp index 800cc1860f893..a7257542218c8 100644 --- a/third_party/sqlite/sqlite.gyp +++ b/third_party/sqlite/sqlite.gyp @@ -37,7 +37,7 @@ }, }, { # else: OS != "linux" or ! use_system_sqlite 'product_name': 'sqlite3', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': '6EAD4A4B-2BBC-4974-8E45-BB5C16CC2AC9', 'sources': [ # This list contains all .h, .c, and .cc files in the directories diff --git a/third_party/zlib/zlib.gyp b/third_party/zlib/zlib.gyp index f59bd468dc70d..a2e592e2a4585 100644 --- a/third_party/zlib/zlib.gyp +++ b/third_party/zlib/zlib.gyp @@ -9,7 +9,7 @@ 'targets': [ { 'target_name': 'zlib', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': '8423AF0D-4B88-4EBF-94E1-E4D00D00E21C', 'sources': [ 'contrib/minizip/ioapi.c', diff --git a/webkit/activex_shim/activex_shim.gyp b/webkit/activex_shim/activex_shim.gyp index 8addf20624d7b..7f08aafd0139a 100644 --- a/webkit/activex_shim/activex_shim.gyp +++ b/webkit/activex_shim/activex_shim.gyp @@ -14,7 +14,7 @@ 'targets': [ { 'target_name': 'activex_shim', - 'type': 'static_library', + 'type': '<(library)', 'msvs_guid': 'F4F4BCAA-EA59-445C-A119-3E6C29647A51', 'dependencies': [ '../../base/base.gyp:base', diff --git a/webkit/default_plugin/default_plugin.gyp b/webkit/default_plugin/default_plugin.gyp index 926623ce3457b..55142b8607be9 100644 --- a/webkit/default_plugin/default_plugin.gyp +++ b/webkit/default_plugin/default_plugin.gyp @@ -13,7 +13,7 @@ 'targets': [ { 'target_name': 'default_plugin', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../../third_party/libxml/libxml.gyp:libxml', '../../third_party/icu38/icu38.gyp:icui18n', diff --git a/webkit/tools/test_shell/test_shell.gyp b/webkit/tools/test_shell/test_shell.gyp index 024512b9ec72e..a9197e8891502 100644 --- a/webkit/tools/test_shell/test_shell.gyp +++ b/webkit/tools/test_shell/test_shell.gyp @@ -12,7 +12,7 @@ 'targets': [ { 'target_name': 'test_shell_common', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ '../../../base/base.gyp:base', '../../../base/base.gyp:base_gfx', diff --git a/webkit/webkit.gyp b/webkit/webkit.gyp index 6727436661bcf..2f6f12b53a054 100644 --- a/webkit/webkit.gyp +++ b/webkit/webkit.gyp @@ -200,7 +200,7 @@ }, { 'target_name': 'wtf', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'config', '../third_party/icu38/icu38.gyp:icui18n', @@ -362,7 +362,7 @@ }, { 'target_name': 'pcre', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'config', 'wtf', @@ -404,7 +404,7 @@ }, { 'target_name': 'webcore', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'config', 'pcre', @@ -4090,7 +4090,7 @@ }, { 'target_name': 'webkit', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'webcore', ], @@ -4216,7 +4216,7 @@ }, { 'target_name': 'glue', - 'type': 'static_library', + 'type': '<(library)', 'dependencies': [ 'webcore', 'webkit',