diff options
author | Ralph Boehme <slow@samba.org> | 2014-12-19 09:05:33 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2015-01-08 23:38:07 +0100 |
commit | a6bda1f2bc85779feb9680bc74821da5ccd401c5 (patch) | |
tree | 915dc2f48e22ef068362c9a5a2ac08c82b6fe37a /buildtools/wafsamba | |
parent | 707dc16987c982b75c83cd5b06d4373c23e777e0 (diff) | |
download | samba-a6bda1f2bc85779feb9680bc74821da5ccd401c5.tar.gz |
wafsamba: flags from enviroment are put before our own internal versions
Ensure user provided CPPFLAGS and LDFLAGS are put *behind* our
internally computed compiler and linker flags.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10877
Pair-Programmed-With: Michael Adam <obnox@samba.org>
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Ralph Boehme <slow@samba.org>
Signed-off-by: Michael Adam <obnox@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Diffstat (limited to 'buildtools/wafsamba')
-rw-r--r-- | buildtools/wafsamba/samba_optimisation.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/buildtools/wafsamba/samba_optimisation.py b/buildtools/wafsamba/samba_optimisation.py index 583a6514d78..1e7a57fb0b5 100644 --- a/buildtools/wafsamba/samba_optimisation.py +++ b/buildtools/wafsamba/samba_optimisation.py @@ -331,3 +331,45 @@ def samba_before_apply_obj_vars(self): for i in v['LIBPATH']: if is_standard_libpath(v, i): v['LIBPATH'].remove(i) + +@feature('cc') +@before('apply_incpaths', 'apply_obj_vars_cc') +def samba_stash_cppflags(self): + """Fix broken waf ordering of CPPFLAGS""" + + self.env.SAVED_CPPFLAGS = self.env.CPPFLAGS + self.env.CPPFLAGS = [] + +@feature('cc') +@after('apply_incpaths', 'apply_obj_vars_cc') +def samba_pop_cppflags(self): + """append stashed user CPPFLAGS after our internally computed flags""" + + # + # Note that we don't restore the values to 'CPPFLAGS', + # but to _CCINCFLAGS instead. + # + # buildtools/wafadmin/Tools/cc.py defines the 'cc' task generator as + # '${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' + # + # Our goal is to effectively invert the order of ${CPPFLAGS} and + # ${_CCINCFLAGS}. + self.env.append_value('_CCINCFLAGS', self.env.SAVED_CPPFLAGS) + self.env.SAVED_CPPFLAGS = [] + +@feature('cprogram', 'cshlib', 'cstaticlib') +@before('apply_obj_vars', 'add_extra_flags') +def samba_stash_linkflags(self): + """stash away LINKFLAGS in order to fix waf's broken ordering wrt or + user LDFLAGS""" + + self.env.SAVE_LINKFLAGS = self.env.LINKFLAGS + self.env.LINKFLAGS = [] + +@feature('cprogram', 'cshlib', 'cstaticlib') +@after('apply_obj_vars', 'add_extra_flags') +def samba_pop_linkflags(self): + """after apply_obj_vars append saved LDFLAGS""" + + self.env.append_value('LINKFLAGS', self.env.SAVE_LINKFLAGS) + self.env.SAVE_LINKFLAGS = [] |