From c75a8976f070ef86cfced71b3df5cbce0e32e01a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuli=20Sepp=C3=A4nen?= Date: Sat, 19 Feb 2011 10:15:12 +0200 Subject: Changes to buildsystem patchset MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implemented changes to the buildsystem patchset suggested by jamesyonan in IRC meeting on 17th Feb 2010: 1) Remove variables added to version.m4 and use win/settings.in instead 2) Add ENABLE_ configuration to win/settings.in instead of parsing config-win32.h for them This patch applies on top of the previous 13 patches. Signed-off-by: Samuli Seppänen Acked-by: James Yonan Signed-off-by: David Sommerseth --- win/wb.py | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'win/wb.py') diff --git a/win/wb.py b/win/wb.py index 2875e59..d1b0b3e 100644 --- a/win/wb.py +++ b/win/wb.py @@ -21,7 +21,7 @@ def get_config(): def get_build_params(): kv = {} - parse_config_win32_h(kv,home_fn('config-win32.h')) + parse_build_params(kv,mod_fn('settings.in')) return kv @@ -80,34 +80,18 @@ def parse_settings_in(kv, settings_in): kv[g[0]] = g[1] or '' f.close() -def parse_config_win32_h(kv, config_win32_h): - r = re.compile(r'^#define\s+(ENABLE_\w+)\s+(\w+)') - s = re.compile(r'^#ifdef|^#ifndef') - e = re.compile(r'^#endif') +def parse_build_params(kv, settings_in): + r = re.compile(r'^!define\s+(ENABLE_\w+)\s+(\w+)') - # How "deep" in nested conditional statements are we? - depth=0 - - f = open(config_win32_h) + f = open(settings_in) for line in f: line = line.rstrip() - # Check if this is a #define line starting with ENABLE_ + # Check if this is a #define line starts with ENABLE_ m = re.match(r, line) - # Calculate how deep we're in (nested) conditional statements. A simple - # #ifdef/#endif state switcher would get confused by an #endif followed - # by a #define. - if re.match(s, line): - depth=depth+1 - if re.match(e, line): - depth=depth-1 - if m: - # Only add this #define if it's not inside a conditional statement - # block - if depth == 0: g = m.groups() kv[g[0]] = g[1] or '' f.close() @@ -129,20 +113,33 @@ def build_autodefs(kv, autodefs_in, autodefs_out): def build_configure_h(kv, configure_h_out, head_comment): """Generate a configure.h dynamically""" fout = open(configure_h_out, 'w') + + # These two variables are required to view build parameters during runtime configure_defines='#define CONFIGURE_DEFINES \"' configure_call='#define CONFIGURE_CALL \" config_all.py \"' + # Initialize the list of enabled features + features = '' + + # Write the header fout.write(head_comment) dict = get_build_params() for key, value in dict.iteritems(): + # Add enabled features + features = features + "#define " + key + " " + value + "\n" + + # Add each enabled feature to CONFIGURE_DEFINES list configure_defines = configure_defines + " " + key + "=" + value + "," configure_defines = configure_defines + "\"" + "\n" + fout.write(features) fout.write(configure_defines) fout.write(configure_call) + + fout.close() def build_version_m4_vars(version_m4_vars_out, head_comment): -- cgit v1.2.3