Bug 1547217 - Reshuffle how verifymar is linked. r=chmanchester
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 19 Jun 2019 23:26:40 +0000
changeset 479621 de9be674a6db6949aae3fa523a9999282c086055
parent 479620 85228e5172e3c45a2e4a7397e922d79dc2a94221
child 479622 80967042eb63d2c08f55b5fac14dbc3f8605a015
push id113474
push userrmaries@mozilla.com
push dateThu, 20 Jun 2019 11:21:48 +0000
treeherdermozilla-inbound@20956a783e08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester
bugs1547217
milestone69.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 1547217 - Reshuffle how verifymar is linked. r=chmanchester The conditions under which verifymar is built were not aligned with what kind of setups are actually doing something. For instance --disable-signmar --enable-verify-mar was building the verifymar library but not doing anything with it. OTOH, building with --enable-signmar --disable-verify-mar did build it but its code was eliminated at link time because it's unused. Finally, the conditions between modules/libmar/verify/moz.build and toolkit/mozapps/update/updater/updater-common.build weren't aligned and broke some non-Linux tier-3 platforms. We remedy the latter by moving the flags and libraries verifymar needs to verifymar, so that things that link verifymar inherit them. And while in the vicinity, replace a use of NSPR_LIBS with the pseudo-library `nspr` which has the same effect. Differential Revision: https://phabricator.services.mozilla.com/D34620
modules/libmar/moz.build
modules/libmar/tool/moz.build
modules/libmar/verify/moz.build
toolkit/mozapps/update/updater/updater-common.build
--- a/modules/libmar/moz.build
+++ b/modules/libmar/moz.build
@@ -5,16 +5,16 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'Application Update')
 
 DIRS += ['src']
 
 if CONFIG['MOZ_ENABLE_SIGNMAR']:
-    DIRS += ['sign', 'verify']
+    DIRS += ['sign']
     TEST_DIRS += ['tests']
-elif CONFIG['MOZ_VERIFY_MAR_SIGNATURE']:
-    DIRS += ['verify']
+    if CONFIG['MOZ_VERIFY_MAR_SIGNATURE']:
+        DIRS += ['verify']
 
 # If we are building ./sign and ./verify then ./tool must come after it
 DIRS += ['tool']
 
--- a/modules/libmar/tool/moz.build
+++ b/modules/libmar/tool/moz.build
@@ -18,19 +18,23 @@ HOST_USE_LIBS += [
 if CONFIG['MOZ_ENABLE_SIGNMAR']:
     Program('signmar')
 
     SOURCES += HOST_SOURCES
 
     USE_LIBS += [
         'mar',
         'signmar',
-        'verifymar',
     ]
 
+    if CONFIG['MOZ_VERIFY_MAR_SIGNATURE']:
+        USE_LIBS += [
+            'verifymar',
+        ]
+
 for var in ('MAR_CHANNEL_ID', 'MOZ_APP_VERSION'):
     DEFINES[var] = '"%s"' % CONFIG[var]
     HOST_DEFINES[var] = DEFINES[var]
 
 if CONFIG['MOZ_ENABLE_SIGNMAR']:
     USE_LIBS += [
         'nspr',
         'nss',
--- a/modules/libmar/verify/moz.build
+++ b/modules/libmar/verify/moz.build
@@ -20,12 +20,24 @@ elif CONFIG['OS_ARCH'] == 'Darwin':
       'MacVerifyCrypto.cpp',
     ]
     OS_LIBS += [
       '-framework Security',
     ]
 else:
     DEFINES['MAR_NSS'] = True
     LOCAL_INCLUDES += ['../sign']
+    USE_LIBS += [
+        'nspr',
+        'nss',
+        'signmar',
+    ]
+    # Ideally, this would be '-Wl,-rpath=$ORIGIN', but the build system
+    # doesn't do the right escaping yet. Even more ideally, this would
+    # be LDFLAGS, but the build system doesn't propagate those like USE_LIBS
+    # and OS_LIBS. Bug #1041943.
+    OS_LIBS += [
+        '-Wl,-rpath=\\$$ORIGIN',
+    ]
 
 LOCAL_INCLUDES += [
     '../src',
 ]
--- a/toolkit/mozapps/update/updater/updater-common.build
+++ b/toolkit/mozapps/update/updater/updater-common.build
@@ -34,23 +34,16 @@ if CONFIG['OS_ARCH'] == 'WINNT':
     OS_LIBS += [
         'comctl32',
         'ws2_32',
         'shell32',
         'shlwapi',
         'crypt32',
         'advapi32',
     ]
-elif CONFIG['OS_ARCH'] == 'Linux' and CONFIG['MOZ_VERIFY_MAR_SIGNATURE']:
-    USE_LIBS += [
-        'nss',
-        'signmar',
-    ]
-    OS_LIBS += CONFIG['NSPR_LIBS']
-    LDFLAGS += ['-Wl,-rpath=$ORIGIN']
 
 USE_LIBS += [
     'bspatch',
     'mar',
     'updatecommon',
     'xz-embedded',
 ]