From 4b312378e9e7084a0699ca6d4b895bdadb7540db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Tue, 15 Mar 2011 16:37:41 +0200 Subject: Replaced config-win32.h with win/config.h.in MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The original config-win32.h - a static header file - has been superceded by both "domake-win" script and the new Python-based buildsystem. Transformed it into a template file, win/config.h.in, which obtains the most commonly used build parameters from win/settings.in. Added support code to win/config.py and win/wb.py to preprocess win/config.h.in and copy it to config.h, from where source and header files can find it. Removed all references to config-win32.h. Also removed obsolete PACKAGE_BUGREPORT and USE_PTHREAD variables from the win/config.h.in file. Signed-off-by: Samuli Seppänen Acked-by: James Yonan Signed-off-by: David Sommerseth --- win/wb.py | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'win/wb.py') diff --git a/win/wb.py b/win/wb.py index 33eefbd..1dacc9b 100644 --- a/win/wb.py +++ b/win/wb.py @@ -101,20 +101,28 @@ def parse_build_params(kv, settings_in): kv[g[0]] = g[1] or '' f.close() +def dict_def(dict, newdefs): + ret = dict.copy() + ret.update(newdefs) + return ret -def dict_def(dict, newdefs): - ret = dict.copy() - ret.update(newdefs) - return ret - -def build_autodefs(kv, autodefs_in, autodefs_out): +def build_autodefs(kv, autodefs_in, autodefs_out): preprocess(kv, - in_fn=autodefs_in, - out_fn=autodefs_out, - quote_begin='@', - quote_end='@', - head_comment='/* %s */\n\n' % autogen) - + in_fn=autodefs_in, + out_fn=autodefs_out, + quote_begin='@', + quote_end='@', + head_comment='/* %s */\n\n' % autogen) + +def build_config_h(kv): + """Generate static win/config.h to config.h to mimic autotools behavior""" + preprocess(kv, + in_fn=mod_fn('config.h.in'), + out_fn=home_fn('config.h'), + quote_begin='@', + quote_end='@', + head_comment='/* %s */\n\n' % autogen) + def build_configure_h(kv, configure_h_out, head_comment): """Generate a configure.h dynamically""" fout = open(configure_h_out, 'w') @@ -163,14 +171,12 @@ win/settings.in format. This done to allow importing them in win/openvpn.nsi""" fout.close() +def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=None, head_comment=None): + def repfn(m): + var, = m.groups() + return kv.get(var, '') - -def preprocess(kv, in_fn, out_fn, quote_begin=None, quote_end=None, if_prefix=None, head_comment=None): - def repfn(m): - var, = m.groups() - return kv.get(var, '') - - re_macro = re_ifdef = None + re_macro = re_ifdef = None if quote_begin and quote_end: re_macro = re.compile(r'%s(\w+)%s' % (re.escape(quote_begin), re.escape(quote_end))) -- cgit v1.2.3