Bug 1426558 - Make autospider builds not rely on system libnspr. r?sfink draft
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 21 Dec 2017 10:11:13 +0900
changeset 713844 91c2434a588982d0923b6b0c522ccd8649040801
parent 713838 9ff29239774b00d06bef02416ccb0067e7f39af7
child 713845 f7b26026edba64423a01976f0ce3b50661f17a84
child 713846 b793b7d9a5b79da21433fc8e4a2c22648077155d
child 713851 0ff43265dc14c089c0551419f0986d31979985ce
push id93776
push userbmo:mh+mozilla@glandium.org
push dateThu, 21 Dec 2017 02:04:47 +0000
reviewerssfink
bugs1426558
milestone59.0a1
Bug 1426558 - Make autospider builds not rely on system libnspr. r?sfink The only reason autospider builds succeed in running tests at the moment is that there is a libnspr4 library installed at the system level on Centos that is binary compatible with what the js shell requires. While on the long run we should just avoid depending on libnspr4 at all, in the short term, we should make the effort to make those tests use the libnspr4 present in dist/bin. For the tests executed from js/src/Makefile.in, it turns out there is already a level of wrapping that does that, relying on run-mozilla.sh, which is only installed on gecko builds. Installing it on standalone js builds solve half the problem. The other half is addressed by setting LD_LIBRARY_PATH before invoking the js shell in the various places it's invoked.
js/app.mozbuild
js/src/devtools/automation/autospider.py
js/src/devtools/rootAnalysis/analyze.py
--- a/js/app.mozbuild
+++ b/js/app.mozbuild
@@ -8,16 +8,21 @@ if CONFIG['COMPILE_ENVIRONMENT']:
     DIRS += [
         '/js/src',
     ]
 else:
     TEST_DIRS += [
         '/js/src/tests',
     ]
 
+if CONFIG['JS_STANDALONE'] and CONFIG['OS_ARCH'] != 'WINNT':
+    DIRS += [
+        '/build/unix',
+    ]
+
 DIRS += [
     '/config/external/fdlibm',
     '/config/external/nspr',
     '/config/external/zlib',
     '/memory',
     '/mozglue',
 ]
 
--- a/js/src/devtools/automation/autospider.py
+++ b/js/src/devtools/automation/autospider.py
@@ -225,16 +225,20 @@ if os.path.exists(os.path.join(compiler_
     env.setdefault('CC', os.path.join(compiler_dir, 'bin', compiler))
     env.setdefault('CXX', os.path.join(compiler_dir, 'bin', cxx))
     platlib = 'lib64' if word_bits == 64 else 'lib'
     env.setdefault('LD_LIBRARY_PATH', os.path.join(compiler_dir, platlib))
 else:
     env.setdefault('CC', compiler)
     env.setdefault('CXX', cxx)
 
+bindir = os.path.join(OBJDIR, 'dist', 'bin')
+env['LD_LIBRARY_PATH'] = ':'.join(
+    p for p in (bindir, env.get('LD_LIBRARY_PATH')) if p)
+
 rust_dir = os.path.join(DIR.tooltool, 'rustc')
 if os.path.exists(os.path.join(rust_dir, 'bin', 'rustc')):
     env.setdefault('RUSTC', os.path.join(rust_dir, 'bin', 'rustc'))
     env.setdefault('CARGO', os.path.join(rust_dir, 'bin', 'cargo'))
 else:
     env.setdefault('RUSTC', 'rustc')
     env.setdefault('CARGO', 'cargo')
 
--- a/js/src/devtools/rootAnalysis/analyze.py
+++ b/js/src/devtools/rootAnalysis/analyze.py
@@ -27,16 +27,18 @@ except:
         exec(compile(open(thefile).read(), filename=thefile, mode="exec"), globals)
 
 def env(config):
     e = dict(os.environ)
     e['PATH'] = ':'.join(p for p in (config.get('gcc_bin'), config.get('sixgill_bin'), e['PATH']) if p)
     e['XDB'] = '%(sixgill_bin)s/xdb.so' % config
     e['SOURCE'] = config['source']
     e['ANALYZED_OBJDIR'] = config['objdir']
+    bindir = os.path.dirname(config['js'])
+    e['LD_LIBRARY_PATH'] = ':'.join(p for p in (e.get('LD_LIBRARY_PATH'), bindir) if p)
     return e
 
 def fill(command, config):
     try:
         return tuple(s % config for s in command)
     except:
         print("Substitution failed:")
         problems = []