Bug 1305145 - Make libs and flags set by pkg_check_modules available to the caller.
MozReview-Commit-ID: 7uZheAOXKwE
--- 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: not bool(v is not 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',))