From: Alexander Bokovoy Date: Tue, 3 Jul 2018 09:48:39 +0000 (+0300) Subject: buildtools/wafsamba: generate build options output with waf 2.0 X-Git-Tag: tdb-1.3.17~1788 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a3fcdf1ef16f2efc936bed61fe85e3bb9e7fba9;p=thirdparty%2Fsamba.git buildtools/wafsamba: generate build options output with waf 2.0 With WAF 2.0 we get all defines in environment at the same level. Fix build options source code generator to handle this. I felt uneasy at filtering out some defines so instead the code is mangling generic defines to be correct for C compiler by replacing '-', '.', and '()' with an underscore ('_'). Signed-off-by: Alexander Bokovoy Reviewed-by: Andrew Bartlett --- diff --git a/buildtools/wafsamba/samba_patterns.py b/buildtools/wafsamba/samba_patterns.py index 00bedcda9c3..dc59c38b492 100644 --- a/buildtools/wafsamba/samba_patterns.py +++ b/buildtools/wafsamba/samba_patterns.py @@ -1,5 +1,6 @@ # a waf tool to add extension based build patterns for Samba +import sys from waflib import Build from wafsamba import samba_version_file @@ -146,13 +147,19 @@ def write_build_options_section(fp, keys, section): fp.write("\n") def write_build_options(task): - tbl = task.env['defines'] + tbl = task.env keys_option_with = [] keys_option_utmp = [] keys_option_have = [] keys_header_sys = [] keys_header_other = [] keys_misc = [] + if sys.hexversion>0x300000f: + trans_table = bytes.maketrans('.-()', '____') + else: + import string + trans_table = string.maketrans('.-()', '____') + for key in tbl: if key.startswith("HAVE_UT_UT_") or key.find("UTMP") >= 0: keys_option_utmp.append(key) @@ -169,7 +176,7 @@ def write_build_options(task): l = key.split("(") keys_misc.append(l[0]) else: - keys_misc.append(key) + keys_misc.append(key.translate(trans_table)) tgt = task.outputs[0].bldpath(task.env) f = open(tgt, 'w')