Bug 1305145 - Make libs and flags set by pkg_check_modules available to the caller. r=glandium
authorChris Manchester <cmanchester@mozilla.com>
Fri, 14 Oct 2016 11:06:30 -0700
changeset 346158 a103e419f1eeb6ccbacbe3f32a0e05305c842420
parent 346157 55ba6df1445e1cdc695416bb234399ffae9699af
child 346159 32fe0c9940c3ce3152b6fe455a45775b49d3f9ef
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1305145
milestone52.0a1
Bug 1305145 - Make libs and flags set by pkg_check_modules available to the caller. r=glandium MozReview-Commit-ID: 7uZheAOXKwE
build/moz.configure/pkg.configure
js/ffi.configure
moz.configure
toolkit/moz.configure
--- a/build/moz.configure/pkg.configure
+++ b/build/moz.configure/pkg.configure
@@ -82,12 +82,16 @@ def pkg_check_modules(var, package_desc,
 
     @depends_when(pkg_config, package_desc, when=package)
     @checking('%s_LIBS' % var, callback=lambda t: ' '.join(t))
     def pkg_libs(pkg_config, package_desc):
         libs = check_cmd_output(pkg_config, '--libs', package_desc)
         # Remove evil flags like -Wl,--export-dynamic
         return tuple(libs.replace('-Wl,--export-dynamic', '').split())
 
+    @depends_when(pkg_cflags, pkg_libs, when=package)
+    def pkg_info(cflags, libs):
+        return namespace(cflags=cflags, libs=libs)
+
     set_config('%s_CFLAGS' % var, pkg_cflags)
     set_config('%s_LIBS' % var, pkg_libs)
 
-    return package
+    return pkg_info
--- a/js/ffi.configure
+++ b/js/ffi.configure
@@ -15,20 +15,20 @@ imply_option('--with-system-ffi', force_
 js_option('--with-system-ffi',
           help='Use system libffi (located with pkgconfig)')
 
 use_system_ffi = depends_if('--with-system-ffi')(lambda _: True)
 
 system_ffi = pkg_check_modules('MOZ_FFI', 'libffi > 3.0.9',
                                when=use_system_ffi)
 
-building_ffi = depends(system_ffi)(lambda v: not bool(v))
+building_ffi = depends(system_ffi)(lambda v: v is None)
 
-set_config('MOZ_SYSTEM_FFI', system_ffi)
-add_old_configure_assignment('MOZ_SYSTEM_FFI', system_ffi)
+set_config('MOZ_SYSTEM_FFI', depends_if(system_ffi)(lambda _: True))
+add_old_configure_assignment('MOZ_SYSTEM_FFI', depends_if(system_ffi)(lambda _: True))
 
 # Target selection, based on ffi/configure.ac.
 @depends_when(target, when=building_ffi)
 def ffi_target(target):
     if target.cpu not in ('x86', 'x86_64', 'arm', 'aarch64'):
         die('Building libffi from the tree is not supported on this platform. '
             'Use --with-system-ffi instead.')
 
--- a/moz.configure
+++ b/moz.configure
@@ -270,17 +270,17 @@ option('--enable-system-hunspell',
 
 @depends('--enable-system-hunspell', compile_environment)
 def check_for_hunspell(value, compile_env):
     return value and compile_env
 
 system_hunspell = pkg_check_modules('MOZ_HUNSPELL', 'hunspell',
                                     when=check_for_hunspell)
 
-set_config('MOZ_SYSTEM_HUNSPELL', system_hunspell)
+set_config('MOZ_SYSTEM_HUNSPELL', depends_if(system_hunspell)(lambda _: True))
 
 
 @depends(target)
 @imports('os')
 def makensis_progs(target):
     if target.kernel != 'WINNT':
         return
 
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -468,17 +468,17 @@ option('--enable-gpsd', env='MOZ_GPSD',
 
 @depends('--enable-gpsd')
 def gpsd(value):
     return bool(value)
 
 system_gpsd = pkg_check_modules('MOZ_GPSD', 'libgps >= 3.11',
                                 when=gpsd)
 
-set_config('MOZ_GPSD', system_gpsd)
+set_config('MOZ_GPSD', depends_if(system_gpsd)(lambda _: True))
 
 # Miscellaneous programs
 # ==============================================================
 
 check_prog('TAR', ('gnutar', 'gtar', 'tar'))
 check_prog('UNZIP', ('unzip',))
 check_prog('ZIP', ('zip',))