diff options
-rw-r--r-- | authors.txt | 1 | ||||
-rw-r--r-- | mesonbuild/dependencies.py | 15 | ||||
-rw-r--r-- | mesonbuild/modules/gnome.py | 5 | ||||
-rwxr-xr-x | mesonbuild/scripts/symbolextractor.py | 16 |
4 files changed, 29 insertions, 8 deletions
diff --git a/authors.txt b/authors.txt index 03e8478..12e944e 100644 --- a/authors.txt +++ b/authors.txt @@ -57,3 +57,4 @@ Mark Schulte Paulo Antonio Alvarez Olexa Bilaniuk Daniel Stone +Marc-Antoine Perennou diff --git a/mesonbuild/dependencies.py b/mesonbuild/dependencies.py index a092732..b76c3cb 100644 --- a/mesonbuild/dependencies.py +++ b/mesonbuild/dependencies.py @@ -123,7 +123,11 @@ class PkgConfigDependency(Dependency): pkgbin = environment.cross_info.config["binaries"]['pkgconfig'] self.type_string = 'Cross' else: - pkgbin = 'pkg-config' + evar = 'PKG_CONFIG' + if evar in os.environ: + pkgbin = os.environ[evar].strip() + else: + pkgbin = 'pkg-config' self.type_string = 'Native' mlog.debug('Determining dependency %s with pkg-config executable %s.' % (name, pkgbin)) @@ -229,12 +233,17 @@ class PkgConfigDependency(Dependency): def check_pkgconfig(self): try: - p = subprocess.Popen(['pkg-config', '--version'], stdout=subprocess.PIPE, + evar = 'PKG_CONFIG' + if evar in os.environ: + pkgbin = os.environ[evar].strip() + else: + pkgbin = 'pkg-config' + p = subprocess.Popen([pkgbin, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE) out = p.communicate()[0] if p.returncode == 0: if not self.silent: - mlog.log('Found pkg-config:', mlog.bold(shutil.which('pkg-config')), + mlog.log('Found pkg-config:', mlog.bold(shutil.which(pkgbin)), '(%s)' % out.decode().strip()) PkgConfigDependency.pkgconfig_found = True return diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index e32037a..b915e96 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -371,14 +371,15 @@ can not be used with the current version of glib-compiled-resources, due to if not isinstance(girtarget, (build.Executable, build.SharedLibrary)): raise MesonException('Gir target must be an executable or shared library') try: - pkgstr = subprocess.check_output(['pkg-config', '--cflags', 'gobject-introspection-1.0']) + gir_dep = dependencies.PkgConfigDependency( + 'gobject-introspection-1.0', state.environment, {'native': True}) + pkgargs = gir_dep.get_compile_args() except Exception: global girwarning_printed if not girwarning_printed: mlog.warning('gobject-introspection dependency was not found, disabling gir generation.') girwarning_printed = True return [] - pkgargs = pkgstr.decode().strip().split() ns = kwargs.pop('namespace') nsversion = kwargs.pop('nsversion') libsources = kwargs.pop('sources') diff --git a/mesonbuild/scripts/symbolextractor.py b/mesonbuild/scripts/symbolextractor.py index c117301..9d28028 100755 --- a/mesonbuild/scripts/symbolextractor.py +++ b/mesonbuild/scripts/symbolextractor.py @@ -22,7 +22,7 @@ # This file is basically a reimplementation of # http://cgit.freedesktop.org/libreoffice/core/commit/?id=3213cd54b76bc80a6f0516aac75a48ff3b2ad67c -import sys, subprocess +import os, sys, subprocess from mesonbuild import mesonlib import argparse @@ -49,13 +49,23 @@ def write_if_changed(text, outfilename): f.write(text) def linux_syms(libfilename, outfilename): - pe = subprocess.Popen(['readelf', '-d', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + evar = 'READELF' + if evar in os.environ: + readelfbin = os.environ[evar].strip() + else: + readelfbin = 'readelf' + evar = 'NM' + if evar in os.environ: + nmbin = os.environ[evar].strip() + else: + nmbin = 'nm' + pe = subprocess.Popen([readelfbin, '-d', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = pe.communicate()[0].decode() if pe.returncode != 0: raise RuntimeError('Readelf does not work') result = [x for x in output.split('\n') if 'SONAME' in x] assert(len(result) <= 1) - pnm = subprocess.Popen(['nm', '--dynamic', '--extern-only', '--defined-only', '--format=posix', libfilename], + pnm = subprocess.Popen([nmbin, '--dynamic', '--extern-only', '--defined-only', '--format=posix', libfilename], stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = pnm.communicate()[0].decode() if pnm.returncode != 0: |