Merge pull request #1086 from Keruspe/master

Allow specifying some toolchain executables using env
pull/1159/head
Jussi Pakkanen 8 years ago committed by GitHub
commit d1501e39d5
  1. 1
      authors.txt
  2. 13
      mesonbuild/dependencies.py
  3. 5
      mesonbuild/modules/gnome.py
  4. 16
      mesonbuild/scripts/symbolextractor.py

@ -57,3 +57,4 @@ Mark Schulte
Paulo Antonio Alvarez
Olexa Bilaniuk
Daniel Stone
Marc-Antoine Perennou

@ -122,6 +122,10 @@ class PkgConfigDependency(Dependency):
raise DependencyException('Pkg-config binary missing from cross file.')
pkgbin = environment.cross_info.config["binaries"]['pkgconfig']
self.type_string = 'Cross'
else:
evar = 'PKG_CONFIG'
if evar in os.environ:
pkgbin = os.environ[evar].strip()
else:
pkgbin = 'pkg-config'
self.type_string = 'Native'
@ -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

@ -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')

@ -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:

Loading…
Cancel
Save