From ad1b487285b4b413f76b651e15a5f673f86c3868 Mon Sep 17 00:00:00 2001 From: Wade Berrier Date: Sun, 18 Jun 2017 19:33:31 -0600 Subject: [PATCH] dependency: boost: only consult environment at initial stage ... not when getting compiler and link arguments Would be nice to have some tests, but that requires boost in a non-standard location. --- mesonbuild/dependencies/misc.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index c24acf06a..99df587ed 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -35,7 +35,7 @@ class BoostDependency(ExternalDependency): def __init__(self, environment, kwargs): super().__init__('boost', environment, 'cpp', kwargs) - self.libdir = '' + self.libdir = None try: self.boost_root = os.environ['BOOST_ROOT'] if not os.path.isabs(self.boost_root): @@ -56,6 +56,9 @@ class BoostDependency(ExternalDependency): self.incdir = os.environ['BOOST_INCLUDEDIR'] else: self.incdir = '/usr/include' + + if 'BOOST_LIBRARYDIR' in os.environ: + self.libdir = os.environ['BOOST_LIBRARYDIR'] else: self.incdir = os.path.join(self.boost_root, 'include') self.boost_inc_subdir = os.path.join(self.incdir, 'boost') @@ -183,7 +186,9 @@ class BoostDependency(ExternalDependency): if not libdir: return libdir = libdir[0] - self.libdir = libdir + # Don't override what was set in the environment + if self.libdir: + self.libdir = libdir globber = 'libboost_*-gd-*.lib' if self.static else 'boost_*-gd-*.lib' # FIXME for entry in glob.glob(os.path.join(libdir, globber)): (_, fname) = os.path.split(entry) @@ -200,8 +205,8 @@ class BoostDependency(ExternalDependency): libsuffix = 'so' globber = 'libboost_*.{}'.format(libsuffix) - if 'BOOST_LIBRARYDIR' in os.environ: - libdirs = [os.environ['BOOST_LIBRARYDIR']] + if self.libdir: + libdirs = [self.libdir] elif self.boost_root is None: libdirs = mesonlib.get_library_dirs() else: @@ -219,6 +224,7 @@ class BoostDependency(ExternalDependency): def get_win_link_args(self): args = [] + # TODO: should this check self.libdir? if self.boost_root: args.append('-L' + self.libdir) for module in self.requested_modules: @@ -233,8 +239,8 @@ class BoostDependency(ExternalDependency): args = [] if self.boost_root: args.append('-L' + os.path.join(self.boost_root, 'lib')) - elif 'BOOST_LIBRARYDIR' in os.environ: - args.append('-L' + os.environ['BOOST_LIBRARYDIR']) + elif self.libdir: + args.append('-L' + self.libdir) for module in self.requested_modules: module = BoostDependency.name2lib.get(module, module) libname = 'boost_' + module