Bug 1312718 - Fix -Dtest_build=1 on mac/xcode r=franziskus
authorTim Taubert <ttaubert@mozilla.com>
Tue, 25 Oct 2016 14:28:22 +0200
changeset 12756 69427d521cb1ea58fcd33f3d50390fce057bc3cd
parent 12755 ff79a65eb4abb4281bb6c7aecd86ef2bfeb919ba
child 12757 3e7b53b181128ee0b6700c666e6db788624d893c
push id1698
push userttaubert@mozilla.com
push dateTue, 25 Oct 2016 12:34:50 +0000
reviewersfranziskus
bugs1312718
Bug 1312718 - Fix -Dtest_build=1 on mac/xcode r=franziskus Differential Revision: https://nss-dev.phacility.com/D116
coreconf/config.gypi
--- a/coreconf/config.gypi
+++ b/coreconf/config.gypi
@@ -113,75 +113,78 @@
     'conditions': [
       [ 'OS=="linux"', {
         'libraries': [
           '-lpthread',
           '-ldl',
           '-lc',
         ],
       }],
-      [ 'test_build!=1', {
-        # skip the maps for test builds
-        'target_conditions': [
-          # mapfile handling
-          [ 'mapfile!=""', {
-            # Work around a gyp bug. Fixed upstream but not in Ubuntu packages:
-            # https://chromium.googlesource.com/external/gyp/+/b85ad3e578da830377dbc1843aa4fbc5af17a192%5E%21/
-            'sources': [
-              '<(DEPTH)/coreconf/empty.c',
-            ] ,
-            'xcode_settings': {
-              'OTHER_LDFLAGS': [
-                '-exported_symbols_list',
-                '<(INTERMEDIATE_DIR)/out.>(mapfile)',
-              ],
-            },
-              'conditions': [
-                [ 'OS=="linux" or OS=="android"', {
-                  'ldflags': [
-                    '-Wl,--version-script,<(INTERMEDIATE_DIR)/out.>(mapfile)',
-                  ],
-                }],
-                [ 'OS=="win"', {
-                  # On Windows, .def files are used directly as sources.
-                  'sources': [
-                    '>(mapfile)',
-                  ],
-                }, {
-                  # On other platforms, .def files need processing.
-                  'sources': [
-                    '<(INTERMEDIATE_DIR)/out.>(mapfile)',
-                  ],
-                  'actions': [{
-                    'action_name': 'generate_mapfile',
-                    'inputs': [
-                      '>(mapfile)',
-                    ],
-                    'outputs': [
-                      '<(INTERMEDIATE_DIR)/out.>(mapfile)',
-                    ],
-                    'action': ['<@(process_map_file)'],
-                  }],
-                }]
-              ],
-          }],
-        ],
-      }]
     ],
     'target_conditions': [
       # If we want to properly export a static library, and copy it to lib,
       # we need to mark it as a 'standalone_static_library'. Otherwise,
       # the relative paths in the thin archive will break linking.
       [ '_type=="shared_library"', {
         'product_dir': '<(nss_dist_obj_dir)/lib'
       }, '_type=="executable"', {
         'product_dir': '<(nss_dist_obj_dir)/bin'
       }, '_standalone_static_library==1', {
         'product_dir': '<(nss_dist_obj_dir)/lib'
       }],
+      # mapfile handling
+      [ 'test_build==0 and mapfile!=""', {
+        # Work around a gyp bug. Fixed upstream but not in Ubuntu packages:
+        # https://chromium.googlesource.com/external/gyp/+/b85ad3e578da830377dbc1843aa4fbc5af17a192%5E%21/
+        'sources': [
+          '<(DEPTH)/coreconf/empty.c',
+        ],
+        'xcode_settings': {
+          'OTHER_LDFLAGS': [
+            '-exported_symbols_list',
+            '<(INTERMEDIATE_DIR)/out.>(mapfile)',
+          ],
+        },
+        'conditions': [
+          [ 'OS=="linux" or OS=="android"', {
+            'ldflags': [
+              '-Wl,--version-script,<(INTERMEDIATE_DIR)/out.>(mapfile)',
+            ],
+          }],
+          [ 'OS=="win"', {
+            # On Windows, .def files are used directly as sources.
+            'sources': [
+              '>(mapfile)',
+            ],
+          }, {
+            # On other platforms, .def files need processing.
+            'sources': [
+              '<(INTERMEDIATE_DIR)/out.>(mapfile)',
+            ],
+            'actions': [{
+              'action_name': 'generate_mapfile',
+              'inputs': [
+                '>(mapfile)',
+              ],
+              'outputs': [
+                '<(INTERMEDIATE_DIR)/out.>(mapfile)',
+              ],
+              'action': ['<@(process_map_file)'],
+            }],
+          }]
+        ],
+      }, 'test_build==1 and _type=="shared_library"', {
+        # When linking a shared lib against a static one, XCode doesn't
+        # export the latter's symbols by default. -all_load fixes that.
+        'xcode_settings': {
+          'OTHER_LDFLAGS': [
+            '-all_load',
+          ],
+        },
+      }],
       [ '_type=="shared_library" or _type=="executable"', {
         'libraries': [
           '<@(nspr_libs)',
         ],
         'library_dirs': [
           '<(nspr_lib_dir)',
         ],
       }],