Bug 1547217 - Reshuffle how verifymar is linked. r=chmanchester, a=jcristau
authorMike Hommey <mh+mozilla@glandium.org>
Wed, 19 Jun 2019 23:26:40 +0000
changeset 533988 b632ea1ae36e49a6ab60ed2b34ee2e967dcb26d9
parent 533987 2a84ae0921d1b955b2f229b16ec84ca0937ceb0e
child 533989 60c41ec534fae84b9eb1df13f5a242e68b20fb64
push id11484
push userjcristau@mozilla.com
push dateFri, 21 Jun 2019 06:08:09 +0000
treeherdermozilla-beta@b632ea1ae36e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerschmanchester, jcristau
bugs1547217
milestone68.0
Bug 1547217 - Reshuffle how verifymar is linked. r=chmanchester, a=jcristau 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',
 ]