[PATCHEs] wafsamba: fix ordering problems with lib-provided and internal RPATHs
Stefan (metze) Metzmacher
metze at samba.org
Thu Dec 18 14:16:13 MST 2014
Am 18.12.2014 um 22:13 schrieb Michael Adam:
> Hi Metze,
>
> this is nice, but the patch you want to revert from wafadmin is
> upstream, so it would be wrong to revert it. It was also fixed
> in newer waf versions. I'd also argue that your fix is not
> necessarily a better fix, since the bug in question is a proper
> bug in wafadmin. But it is nice that you found a way to do it in
> wafsamba that is not too complicated! We can add that
> additionally if you want.
>
> And I can see whether I can use the ideas for modifying our
> "wellknown libpaths" to not touch wafadmin.
Ah, ok then we just should not push the revert patch, but keep
the otherone to handle '-Wl,-R,' too.
The wellknown libpath patch is attached:-)
metze
-------------- next part --------------
From d304b6ca1d2fc0c8f18ce1fe6cfa8aeea2890e6f Mon Sep 17 00:00:00 2001
From: Stefan Metzmacher <metze at samba.org>
Date: Thu, 18 Dec 2014 21:36:07 +0100
Subject: [PATCH] wafsamba: STANDARD_LIBPATH...
---
buildtools/wafsamba/samba_conftests.py | 29 +++++++++++++++++++++++++++++
buildtools/wafsamba/samba_optimisation.py | 25 ++++++++++++++++++++++++-
buildtools/wafsamba/wscript | 2 ++
3 files changed, 55 insertions(+), 1 deletion(-)
diff --git a/buildtools/wafsamba/samba_conftests.py b/buildtools/wafsamba/samba_conftests.py
index f94b0b7..841b612 100644
--- a/buildtools/wafsamba/samba_conftests.py
+++ b/buildtools/wafsamba/samba_conftests.py
@@ -508,6 +508,35 @@ def CHECK_XSLTPROC_MANPAGES(conf):
print "A local copy of the docbook.xsl wasn't found on your system" \
" consider installing package like docbook-xsl"
+#
+# Determine the standard libpath for the used compiler,
+# so we can later use that to filter out these standard
+# library paths when some tools like cups-config or
+# python-config report standard lib paths with their
+# ldflags (-L...)
+#
+ at conf
+def CHECK_STANDARD_LIBPATH(conf):
+ # at least gcc and clang support this:
+ try:
+ cmd = conf.env.CC + ['-print-search-dirs']
+ out = Utils.cmd_output(cmd).split('\n')
+ except ValueError:
+ # option not supported by compiler - use a standard list of directories
+ dirlist = [ '/usr/lib', '/usr/lib64' ]
+ except:
+ raise Utils.WafError('Unexpected error running "%s"' % (cmd))
+ else:
+ dirlist = []
+ for line in out:
+ line = line.strip()
+ if line.startswith("libraries: ="):
+ dirliststr = line[len("libraries: ="):]
+ dirlist = [ os.path.normpath(x) for x in dirliststr.split(':') ]
+ break
+
+ conf.env.STANDARD_LIBPATH = dirlist
+
waf_config_c_parse_flags = config_c.parse_flags;
def samba_config_c_parse_flags(line, uselib, env):
diff --git a/buildtools/wafsamba/samba_optimisation.py b/buildtools/wafsamba/samba_optimisation.py
index 1333f8b..583a651 100644
--- a/buildtools/wafsamba/samba_optimisation.py
+++ b/buildtools/wafsamba/samba_optimisation.py
@@ -6,8 +6,9 @@
# overall this makes some build tasks quite a bit faster
+import os
import Build, Utils, Node
-from TaskGen import feature, after
+from TaskGen import feature, after, before
import preproc, Task
@feature('cc', 'cxx')
@@ -308,3 +309,25 @@ def apply_lib_vars(self):
val = self.env[v + '_' + x]
if val:
self.env.append_value(v, val)
+
+ at feature('cprogram', 'cshlib', 'cstaticlib')
+ at after('apply_lib_vars')
+ at before('apply_obj_vars')
+def samba_before_apply_obj_vars(self):
+ """before apply_obj_vars for uselib, this removes the standard pathes"""
+
+ def is_standard_libpath(env, path):
+ for _path in env.STANDARD_LIBPATH:
+ if _path == os.path.normpath(path):
+ return True
+ return False
+
+ v = self.env
+
+ for i in v['RPATH']:
+ if is_standard_libpath(v, i):
+ v['RPATH'].remove(i)
+
+ for i in v['LIBPATH']:
+ if is_standard_libpath(v, i):
+ v['LIBPATH'].remove(i)
diff --git a/buildtools/wafsamba/wscript b/buildtools/wafsamba/wscript
index 1a30d2f..03b591c 100755
--- a/buildtools/wafsamba/wscript
+++ b/buildtools/wafsamba/wscript
@@ -211,6 +211,8 @@ def configure(conf):
conf.check_tool('compiler_cc')
+ conf.CHECK_STANDARD_LIBPATH()
+
# we need git for 'waf dist'
conf.find_program('git', var='GIT')
--
1.9.1
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20141218/bc8961b9/attachment.pgp>
More information about the samba-technical
mailing list