From 473a56c5adf2af1044666963d11f65b030d17f7b Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Sat, 25 Apr 2015 03:38:48 +0200 Subject: [PATCH 1/3] Revert "wafsamba: flags from enviroment are put before our own internal versions" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit b2bb6aeb8057ac725f6ad12378344b201c3a3ba2. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10877 Signed-off-by: Ralph Boehme Reviewed-by: Jelmer Vernooij Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Sun Apr 26 18:40:39 CEST 2015 on sn-devel-104 --- buildtools/wafsamba/samba_optimisation.py | 42 ------------------------------- 1 file changed, 42 deletions(-) diff --git a/buildtools/wafsamba/samba_optimisation.py b/buildtools/wafsamba/samba_optimisation.py index 5def580..51d514e 100644 --- a/buildtools/wafsamba/samba_optimisation.py +++ b/buildtools/wafsamba/samba_optimisation.py @@ -287,45 +287,3 @@ 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 = [] -- 2.1.0 From 84ba72c85595f95e9aee2731415da79d692aa106 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 21 May 2015 05:00:02 +0200 Subject: [PATCH 2/3] waf: put user LDFLAGS behind internal search paths but before LIBS Bug: https://bugzilla.samba.org/show_bug.cgi?id=10877 Signed-off-by: Ralph Boehme --- buildtools/wafadmin/Tools/ccroot.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/buildtools/wafadmin/Tools/ccroot.py b/buildtools/wafadmin/Tools/ccroot.py index 25c5179..64037c8 100644 --- a/buildtools/wafadmin/Tools/ccroot.py +++ b/buildtools/wafadmin/Tools/ccroot.py @@ -461,6 +461,7 @@ def apply_objdeps(self): def apply_obj_vars(self): """after apply_lib_vars for uselib""" v = self.env + v['LINKFLAGS_PATHS'] = [] lib_st = v['LIB_ST'] staticlib_st = v['STATICLIB_ST'] libpath_st = v['LIBPATH_ST'] @@ -469,16 +470,27 @@ def apply_obj_vars(self): app = v.append_unique + # The desired final order is LIBPATH/RPATH LINKFLAGS LIBS, so + # put library paths and marker in a temp variable if v['FULLSTATIC']: - v.append_value('LINKFLAGS', v['FULLSTATIC_MARKER']) + v.append_value('LINKFLAGS_PATHS', v['FULLSTATIC_MARKER']) for i in v['RPATH']: if i and rpath_st: - app('LINKFLAGS', rpath_st % i) + app('LINKFLAGS_PATHS', rpath_st % i) + for i in v['LIBPATH']: - app('LINKFLAGS', libpath_st % i) - app('LINKFLAGS', staticlibpath_st % i) + app('LINKFLAGS_PATHS', libpath_st % i) + app('LINKFLAGS_PATHS', staticlibpath_st % i) + + # LINKFLAGS_PATHS now contains the library paths. LINKFLAGS + # contains the user environment LDFLAGS as well as any flags + # added by waf at configuration time. + app('LINKFLAGS_PATHS', v['LINKFLAGS']) + + # Now assign LINKFLAGS, LIBS will be appended below + v['LINKFLAGS'] = v['LINKFLAGS_PATHS'] if v['STATICLIB']: v.append_value('LINKFLAGS', v['STATICLIB_MARKER']) -- 2.1.0 From 3a5bbae3af4f7baf816f6ca58cb2c20b60077deb Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Thu, 21 May 2015 05:12:56 +0200 Subject: [PATCH 3/3] waf: put user env CPPFLAGS behind internal flags Bug: https://bugzilla.samba.org/show_bug.cgi?id=10877 Signed-off-by: Ralph Boehme --- buildtools/wafadmin/Tools/cc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildtools/wafadmin/Tools/cc.py b/buildtools/wafadmin/Tools/cc.py index 903a1c5..bfbba27 100644 --- a/buildtools/wafadmin/Tools/cc.py +++ b/buildtools/wafadmin/Tools/cc.py @@ -88,7 +88,7 @@ def c_hook(self, node): raise Utils.WafError('Have you forgotten to set the feature "cc" on %s?' % str(self)) return task -cc_str = '${CC} ${CCFLAGS} ${CPPFLAGS} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' +cc_str = '${CC} ${_CCINCFLAGS} ${_CCDEFFLAGS} ${CCFLAGS} ${CPPFLAGS} ${CC_SRC_F}${SRC} ${CC_TGT_F}${TGT}' cls = Task.simple_task_type('cc', cc_str, 'GREEN', ext_out='.o', ext_in='.c', shell=False) cls.scan = ccroot.scan cls.vars.append('CCDEPS') -- 2.1.0