summaryrefslogtreecommitdiffstats
path: root/waftools
diff options
context:
space:
mode:
authorStefano Pigozzi <stefano.pigozzi@gmail.com>2013-11-24 15:49:34 +0100
committerStefano Pigozzi <stefano.pigozzi@gmail.com>2013-11-24 15:57:49 +0100
commitd8f1a57876cbb5b363e739333576ca666f13ef20 (patch)
tree5c22f7174a9422e7b80b15a2f9fb70e86e825941 /waftools
parent2231d5e398265919e7812390ef356bbdc3c552ce (diff)
downloadmpv-d8f1a57876cbb5b363e739333576ca666f13ef20.tar.bz2
mpv-d8f1a57876cbb5b363e739333576ca666f13ef20.tar.xz
build: make waf append pkgconfig flags as-is
waf apparently only appends a pkgconfig flag if it doesn't already exist in the lib storage. Since our configure often checks for multiple libraries in one call we want to keep the flags as is. This is especially important to always keep stuff like -lm in the right place.
Diffstat (limited to 'waftools')
-rw-r--r--waftools/checks/generic.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/waftools/checks/generic.py b/waftools/checks/generic.py
index 46813aed01..5abc740bb7 100644
--- a/waftools/checks/generic.py
+++ b/waftools/checks/generic.py
@@ -1,5 +1,6 @@
import os
from inflectors import DependencyInflector
+from waflib.ConfigSet import ConfigSet
__all__ = [
"check_pkg_config", "check_cc", "check_statement", "check_libs",
@@ -66,12 +67,22 @@ def check_pkg_config(*args, **kw_ext):
'package': " ".join(packages),
'args': sargs + pkgc_args }
opts = __merge_options__(dependency_identifier, defaults, kw_ext, kw)
- if ctx.check_cfg(**opts):
- return True
- else:
+
+ # Warning! Megahack incoming: when parsing flags in `parse_flags` waf
+ # uses append_unique. This appends the flags only if they aren't
+ # already present in the list. This causes breakage if one checks for
+ # multiple pkg-config packages in a single call as stuff like -lm is
+ # added only at its first occurrence.
+ original_append_unique = ConfigSet.append_unique
+ ConfigSet.append_unique = ConfigSet.append_value
+ result = bool(ctx.check_cfg(**opts))
+ ConfigSet.append_unique = original_append_unique
+
+ if not result:
defkey = DependencyInflector(dependency_identifier).define_key()
ctx.undefine(defkey)
return False
+ return result
return fn
def check_headers(*headers):