Bug 1478499 - Move symbol version script generation for js shared library to moz.build. r=mshal
☠☠ backed out by 5de91845f8e7 ☠ ☠
authorChris Manchester <cmanchester@mozilla.com>
Tue, 31 Jul 2018 15:29:42 -0700
changeset 429606 6f6e562e2013c4d63a470bc43d5b24eb618445e9
parent 429605 03f68a47b89ea690a1695d4a4ecb575874d1457e
child 429607 3982c14a834eb62f3c473d8e68c6abb45e354ef8
push id34368
push userdvarga@mozilla.com
push dateWed, 01 Aug 2018 22:08:36 +0000
treeherdermozilla-central@210796a7e6b4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmshal
bugs1478499
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1478499 - Move symbol version script generation for js shared library to moz.build. r=mshal MozReview-Commit-ID: JF3dtk0ybw2
js/src/build/Makefile.in
js/src/build/moz.build
toolkit/library/gen_symverscript.py
toolkit/library/moz.build
--- a/js/src/build/Makefile.in
+++ b/js/src/build/Makefile.in
@@ -1,25 +1,14 @@
 # -*- Mode: makefile -*-
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-# Ensure symbol versions of shared library on Linux do not conflict
-# with those in libxul.
-ifeq (Linux,$(OS_TARGET))
-
-symverscript: symverscript.in
-	$(call py_action,preprocessor, \
-		-DVERSION='$(subst -,_,$(JS_LIBRARY_NAME))' $< -o $@)
-
-EXTRA_DEPS += symverscript
-endif
-
 include $(topsrcdir)/config/rules.mk
 
 # check_vanilla_allocations.py is tailored to Linux, so only run it there.
 # That should be enough to catch any problems.
 check-vanilla-allocations:
 	$(PYTHON) $(topsrcdir)/config/check_vanilla_allocations.py $(REAL_LIBRARY)
 
 # The "aggressive" variant will likely fail on some compiler/platform
--- a/js/src/build/moz.build
+++ b/js/src/build/moz.build
@@ -18,16 +18,27 @@ if not CONFIG['JS_STANDALONE']:
 # and then the static data cells used for locking no longer work.
 #
 # In fact, we now build both a static and a shared library, as the
 # JS shell would like to link to the static library.
 
 if CONFIG['JS_SHARED_LIBRARY']:
     GeckoSharedLibrary('js', linkage=None)
     SHARED_LIBRARY_NAME = CONFIG['JS_LIBRARY_NAME']
+
+    # Ensure symbol versions of shared library on Linux do not conflict
+    # with those in libxul.
+    if CONFIG['OS_TARGET'] == 'Linux':
+        GENERATED_FILES += ['symverscript']
+        GENERATED_FILES['symverscript'].script = '/toolkit/library/gen_symverscript.py'
+        GENERATED_FILES['symverscript'].inputs = ['symverscript.in']
+        GENERATED_FILES['symverscript'].flags = [
+            CONFIG['JS_LIBRARY_NAME'].replace('-', '_'),
+        ]
+        LDFLAGS += ['-Wl,-version-script,symverscript']
 else:
     Library('js')
 
 FORCE_STATIC_LIB = True
 STATIC_LIBRARY_NAME = 'js_static'
 
 if CONFIG['ENABLE_INTL_API']:
     USE_LIBS += [
@@ -71,21 +82,16 @@ if CONFIG['MOZ_NEEDS_LIBATOMIC']:
     OS_LIBS += ['atomic']
 
 OS_LIBS += CONFIG['REALTIME_LIBS']
 
 NO_EXPAND_LIBS = True
 
 DIST_INSTALL = True
 
-# Ensure symbol versions of shared library on Linux do not conflict
-# with those in libxul.
-if CONFIG['OS_TARGET'] == 'Linux':
-    LDFLAGS += ['-Wl,-version-script,symverscript']
-
 # Run SpiderMonkey style checker after linking the static library. This avoids
 # running the script for no-op builds.
 GENERATED_FILES += ['spidermonkey_checks']
 run_checks = GENERATED_FILES['spidermonkey_checks']
 run_checks.script = '/config/run_spidermonkey_checks.py'
 run_checks.inputs += [
     '!%sjs_static.%s' % (CONFIG['LIB_PREFIX'], CONFIG['LIB_SUFFIX']),
     '/config/check_spidermonkey_style.py',
--- a/toolkit/library/gen_symverscript.py
+++ b/toolkit/library/gen_symverscript.py
@@ -3,18 +3,18 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distibuted with this
 # file, You can obtain one at http://mozilla.og/MPL/2.0/.
 
 import sys
 import buildconfig
 from mozbuild.preprocessor import Preprocessor
 
-def main(output, input_file):
+def main(output, input_file, version=None):
     pp = Preprocessor()
     pp.context.update({
-        'VERSION': 'xul%s' % buildconfig.substs['MOZILLA_SYMBOLVERSION'],
+        'VERSION': version,
     })
     pp.out = output
     pp.do_include(input_file)
 
 if __name__ == '__main__':
     main(*sys.agv[1:])
--- a/toolkit/library/moz.build
+++ b/toolkit/library/moz.build
@@ -340,13 +340,16 @@ if CONFIG['COMPILE_ENVIRONMENT']:
         '!%s' % full_libname,
     ]
     FINAL_TARGET_FILES += ['!dependentlibs.list', '!dependentlibs.list.gtest']
 
     if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
         GENERATED_FILES += ['symverscript']
         GENERATED_FILES['symverscript'].script = 'gen_symverscript.py'
         GENERATED_FILES['symverscript'].inputs = ['symverscript.in']
+        GENERATED_FILES['symverscript'].flags = [
+            'xul%s' % CONFIG['MOZILLA_SYMBOLVERSION']
+        ]
         SYMBOLS_FILE = '!symverscript'
 
 # This library is entirely composed of Rust code, and needs to come after
 # all the C++ code so any possible C++ -> Rust calls can be resolved.
 USE_LIBS += ['gkrust']