wesnoth/scons/pkgconfig.py
Chris Beck 9f93831a23 scons: don't ignore PKG_CONFIG_LIBDIR environment variable
This is an attempt to fixup our scons pkg-config code, following
issue raised here:

https://github.com/Homebrew/homebrew-games/pull/165#issuecomment-61391362
2014-11-01 22:35:15 -04:00

28 lines
854 B
Python
Executable File

# vi: syntax=python:et:ts=4
import os
def run_pkg_config(context, name):
env = context.env
try:
env["ENV"]["PKG_CONFIG_PATH"] = os.environ.get("PKG_CONFIG_PATH")
env["ENV"]["PKG_CONFIG_LIBDIR"] = os.environ.get("PKG_CONFIG_LIBDIR")
env.ParseConfig("pkg-config --libs --cflags --silence-errors $PKGCONFIG_FLAGS \"" + name + "\"")
context.Log("Found '" + name + "' with pkg-config.\n")
return True
except OSError:
context.Log("Failed to find '" + name + "' with pkg-config.\n")
return False
def CheckPKG(context, name):
env = context.env
context.Message( 'Checking for %s... ' % name )
if run_pkg_config(context, name):
context.Result("yes")
return True
else:
context.Result("no")
return False
config_checks = { "CheckPKG" : CheckPKG }