From 1e14742ed2b4c6728a6efa67cf444212e2eec8ac Mon Sep 17 00:00:00 2001 From: "rmcilroy@chromium.org" Date: Fri, 29 Aug 2014 15:04:59 +0000 Subject: [PATCH] Properly separate host and target builds when using external natives. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit R=rmcilroy@chromium.org, vogelheim@chromium.org Review URL: https://codereview.chromium.org/506983002 Patch from André Baixo . git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@23522 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- tools/gyp/v8.gyp | 87 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 73 insertions(+), 14 deletions(-) diff --git a/tools/gyp/v8.gyp b/tools/gyp/v8.gyp index d6b59de376..eeb1014fda 100644 --- a/tools/gyp/v8.gyp +++ b/tools/gyp/v8.gyp @@ -55,12 +55,23 @@ # to appear before libv8_snapshot.a so it's listed explicitly. 'dependencies': ['v8_base', 'v8_nosnapshot'], }], + ['v8_use_external_startup_data==1 and want_separate_host_toolset==1', { + 'dependencies': ['v8_base', 'v8_external_snapshot'], + 'target_conditions': [ + ['_toolset=="host"', { + 'inputs': [ + '<(PRODUCT_DIR)/snapshot_blob_host.bin', + ], + }, { + 'inputs': [ + '<(PRODUCT_DIR)/snapshot_blob.bin', + ], + }], + ], + }], ['v8_use_external_startup_data==1 and want_separate_host_toolset==0', { 'dependencies': ['v8_base', 'v8_external_snapshot'], - }], - ['v8_use_external_startup_data==1 and want_separate_host_toolset==1', { - 'dependencies': ['v8_base', 'v8_external_snapshot#host'], - }], + 'inputs': [ '<(PRODUCT_DIR)/snapshot_blob.bin', ], ['component=="shared_library"', { 'type': '<(component)', 'sources': [ @@ -218,11 +229,11 @@ 'type': 'static_library', 'conditions': [ ['want_separate_host_toolset==1', { - 'toolsets': ['host'], + 'toolsets': ['host', 'target'], 'dependencies': [ 'mksnapshot#host', 'js2c#host', - 'natives_blob#host', + 'natives_blob', ]}, { 'toolsets': ['target'], 'dependencies': [ @@ -260,9 +271,27 @@ 'inputs': [ '<(PRODUCT_DIR)/<(EXECUTABLE_PREFIX)mksnapshot<(EXECUTABLE_SUFFIX)', ], - 'outputs': [ - '<(INTERMEDIATE_DIR)/snapshot.cc', - '<(PRODUCT_DIR)/snapshot_blob.bin', + 'conditions': [ + ['want_separate_host_toolset==1', { + 'target_conditions': [ + ['_toolset=="host"', { + 'outputs': [ + '<(INTERMEDIATE_DIR)/snapshot.cc', + '<(PRODUCT_DIR)/snapshot_blob_host.bin', + ], + }, { + 'outputs': [ + '<(INTERMEDIATE_DIR)/snapshot.cc', + '<(PRODUCT_DIR)/snapshot_blob.bin', + ], + }], + ], + }, { + 'outputs': [ + '<(INTERMEDIATE_DIR)/snapshot.cc', + '<(PRODUCT_DIR)/snapshot_blob.bin', + ], + }], ], 'variables': { 'mksnapshot_flags': [ @@ -1398,7 +1427,13 @@ 'type': 'none', 'conditions': [ [ 'v8_use_external_startup_data==1', { - 'dependencies': ['js2c'], + 'conditions': [ + ['want_separate_host_toolset==1', { + 'dependencies': ['js2c#host'], + }, { + 'dependencies': ['js2c'], + }], + ], 'actions': [{ 'action_name': 'concatenate_natives_blob', 'inputs': [ @@ -1406,14 +1441,38 @@ '<(SHARED_INTERMEDIATE_DIR)/libraries.bin', '<(SHARED_INTERMEDIATE_DIR)/libraries-experimental.bin', ], - 'outputs': [ - '<(PRODUCT_DIR)/natives_blob.bin', + 'conditions': [ + ['want_separate_host_toolset==1', { + 'target_conditions': [ + ['_toolset=="host"', { + 'outputs': [ + '<(PRODUCT_DIR)/natives_blob_host.bin', + ], + 'action': [ + 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob_host.bin' + ], + }, { + 'outputs': [ + '<(PRODUCT_DIR)/natives_blob.bin', + ], + 'action': [ + 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob.bin' + ], + }], + ], + }, { + 'outputs': [ + '<(PRODUCT_DIR)/natives_blob.bin', + ], + 'action': [ + 'python', '<@(_inputs)', '<(PRODUCT_DIR)/natives_blob.bin' + ], + }], ], - 'action': ['python', '<@(_inputs)', '<@(_outputs)'], }], }], ['want_separate_host_toolset==1', { - 'toolsets': ['host'], + 'toolsets': ['host', 'target'], }, { 'toolsets': ['target'], }],