aboutsummaryrefslogtreecommitdiff
path: root/win/wb.py
diff options
context:
space:
mode:
authorSamuli Seppänen <samuli@openvpn.net>2011-03-15 16:37:41 +0200
committerDavid Sommerseth <davids@redhat.com>2011-03-21 15:15:19 +0100
commit4b312378e9e7084a0699ca6d4b895bdadb7540db (patch)
tree369450938e4c7fed61829ea4c82516a690a4229f /win/wb.py
parentFixes to win/openvpn.nsi (diff)
downloadopenvpn-4b312378e9e7084a0699ca6d4b895bdadb7540db.tar.xz
Replaced config-win32.h with win/config.h.in
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 <samuli@openvpn.net> Acked-by: James Yonan <james@openvpn.net> Signed-off-by: David Sommerseth <davids@redhat.com>
Diffstat (limited to '')
-rw-r--r--win/wb.py44
1 files changed, 25 insertions, 19 deletions
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)))