Bug 1519308 - Try toolchain-prefixed pkg-config. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 11 Jan 2019 23:56:19 +0000
changeset 513567 6685e8b9d8671c087c5190537aa22f17f32ee8bb
parent 513566 dcb9d90e54564613f54c2404d589ed1dc4f4070c
child 513568 14fee8b5f596471935ef50d75f56d882977185c3
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1519308
milestone66.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 1519308 - Try toolchain-prefixed pkg-config. r=froydnj When doing cross-compiles for Desktop, system pkg-config is going to be looking for .pc files for the host, but systems setup for cross-compiles come with a toolchain-prefixed pkg-config, which we should be looking for. Differential Revision: https://phabricator.services.mozilla.com/D16318
build/moz.configure/pkg.configure
moz.configure
python/mozbuild/mozbuild/test/configure/test_checks_configure.py
--- a/build/moz.configure/pkg.configure
+++ b/build/moz.configure/pkg.configure
@@ -1,19 +1,19 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 
-@depends('--enable-compile-environment')
-def pkg_config(compile_env):
-    if compile_env:
-        return ('pkg-config',)
+@depends(toolchain_prefix, when=compile_environment)
+def pkg_config(prefixes):
+    return tuple('{}pkg-config'.format(p)
+                 for p in (prefixes or ()) + ('',))
 
 
 pkg_config = check_prog('PKG_CONFIG', pkg_config, allow_missing=True)
 
 
 @depends_if(pkg_config)
 @checking('for pkg-config version')
 @imports('subprocess')
--- a/moz.configure
+++ b/moz.configure
@@ -118,23 +118,24 @@ def debug_rust():
 
 set_config('MOZ_DEBUG_RUST', debug_rust)
 set_define('MOZ_DEBUG_RUST', debug_rust)
 
 js_option(env='MOZ_PGO', help='Build with profile guided optimizations')
 
 set_config('MOZ_PGO', depends('MOZ_PGO')(lambda x: bool(x)))
 
+include('build/moz.configure/toolchain.configure',
+        when='--enable-compile-environment')
+
 include('build/moz.configure/pkg.configure')
 # Make this assignment here rather than in pkg.configure to avoid
 # requiring this file in unit tests.
 add_old_configure_assignment('PKG_CONFIG', pkg_config)
 
-include('build/moz.configure/toolchain.configure',
-        when='--enable-compile-environment')
 include('build/moz.configure/memory.configure',
         when='--enable-compile-environment')
 include('build/moz.configure/headers.configure',
         when='--enable-compile-environment')
 include('build/moz.configure/warnings.configure',
         when='--enable-compile-environment')
 include('build/moz.configure/flags.configure',
         when='--enable-compile-environment')
--- a/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
+++ b/python/mozbuild/mozbuild/test/configure/test_checks_configure.py
@@ -643,16 +643,18 @@ class TestChecksConfigure(unittest.TestC
                 return 0, '-l%s' % args[1], ''
             if args[0] == '--version':
                 return 0, mock_pkg_config_version, ''
             self.fail("Unexpected arguments to mock_pkg_config: %s" % args)
 
         def get_result(cmd, args=[], extra_paths=None):
             return self.get_result(textwrap.dedent('''\
                 option('--disable-compile-environment', help='compile env')
+                compile_environment = depends(when='--enable-compile-environment')(lambda: True)
+                toolchain_prefix = depends(when=True)(lambda: None)
                 include('%(topsrcdir)s/build/moz.configure/util.configure')
                 include('%(topsrcdir)s/build/moz.configure/checks.configure')
                 include('%(topsrcdir)s/build/moz.configure/pkg.configure')
             ''' % {'topsrcdir': topsrcdir}) + cmd, args=args, extra_paths=extra_paths,
                                                    includes=())
 
         extra_paths = {
             mock_pkg_config_path: mock_pkg_config,