diff --git a/.gitmodules b/.gitmodules index d5d62523..dfab11ac 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,3 +7,6 @@ [submodule "siginfo"] path = siginfo url = ../siginfo +[submodule "waftoolchainflags"] + path = waftoolchainflags + url = ../waf-toolchain-flags diff --git a/waftoolchainflags b/waftoolchainflags new file mode 160000 index 00000000..c71e0256 --- /dev/null +++ b/waftoolchainflags @@ -0,0 +1 @@ +Subproject commit c71e02562fdd089c930412166412b5473f19e1da diff --git a/wscript b/wscript index cbf4f5ec..41d60ab1 100644 --- a/wscript +++ b/wscript @@ -27,6 +27,7 @@ import sys from waflib import Logs, Options, TaskGen from waflib import Context from waflib.Build import BuildContext, CleanContext, InstallContext, UninstallContext +from waftoolchainflags import WafToolchainFlags VERSION = "2.22.1" APPNAME = 'jackdbus' @@ -110,86 +111,6 @@ def detect_platform(conf): conf.end_msg(name, color='CYAN') break -class WafToolchainFlags: - """ - Waf helper class for handling set of CFLAGS - and related. The flush() method will - prepend so to allow supplied by (downstream/distro/builder) waf caller flags - to override the upstream flags in wscript. - TODO: upstream this or find alternative easy way of doing the same - """ - def __init__(self, conf): - """ - :param conf: Waf configuration object - """ - self.conf = conf - self.flags = {} - for x in ('CPPFLAGS', 'CFLAGS', 'CXXFLAGS', 'LINKFLAGS'): - self.flags[x] = [] - - def flush(self): - """ - Flush flags to the configuration object - Prepend is used so to allow supplied by - (downstream/distro/builder) waf caller flags - to override the upstream flags in wscript. - """ - for key, val in self.flags.items(): - self.conf.env.prepend_value(key, val) - - def add(self, key, val): - """ - :param key: Set to add flags to. 'CPPFLAGS', 'CFLAGS', 'CXXFLAGS' or 'LINKFLAGS' - :param val: string or list of strings - """ - flags = self.flags[key] - if isinstance(val, list): - #flags.extend(val) - for x in val: - if not isinstance(x, str): - raise Exception("value must be string or list of strings. ", type(x)) - flags.append(x) - elif isinstance(val, str): - flags.append(val) - else: - raise Exception("value must be string or list of strings") - - def add_cpp(self, value): - """ - Add flag or list of flags to CPPFLAGS - :param value: string or list of strings - """ - self.add('CPPFLAGS', value) - - def add_c(self, value): - """ - Add flag or list of flags to CFLAGS - :param value: string or list of strings - """ - self.add('CFLAGS', value) - - def add_cxx(self, value): - """ - Add flag or list of flags to CXXFLAGS - :param value: string or list of strings - """ - self.add('CXXFLAGS', value) - - def add_candcxx(self, value): - """ - Add flag or list of flags to CFLAGS and CXXFLAGS - :param value: string or list of strings - """ - self.add_c(value) - self.add_cxx(value) - - def add_link(self, value): - """ - Add flag or list of flags to LINKFLAGS - :param value: string or list of strings - """ - self.add('LINKFLAGS', value) - def configure(conf): conf.load('compiler_cxx') conf.load('compiler_c')