summaryrefslogtreecommitdiff
path: root/scons
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2012-08-15 19:24:58 +0100
committerJosé Fonseca <jfonseca@vmware.com>2012-08-16 17:21:52 +0100
commit50dec637909cfe8fa53582f2f64ab261b123f092 (patch)
treebd7b78912ffd7b2a5376c54d8e8d95336178d04f /scons
parent5f82d1924831da7467bfe8025ca18e98b9548ca4 (diff)
scons: Fix MinGW cross compilation.
Compensate for the recent changes and assumptions added to Makefiles.sources
Diffstat (limited to 'scons')
-rw-r--r--scons/custom.py25
1 files changed, 22 insertions, 3 deletions
diff --git a/scons/custom.py b/scons/custom.py
index 43e7727aa4..277c05b679 100644
--- a/scons/custom.py
+++ b/scons/custom.py
@@ -236,8 +236,13 @@ def parse_source_list(env, filename, names=None):
parser = source_list.SourceListParser()
src = env.File(filename).srcnode()
- parser.add_symbol('top_srcdir', env.Dir('#').abspath)
- parser.add_symbol('top_builddir', env['build_dir'])
+ cur_srcdir = env.Dir('.').srcnode().abspath
+ top_srcdir = env.Dir('#').abspath
+ top_builddir = os.path.join(top_srcdir, env['build_dir'])
+
+ # Populate the symbol table of the Makefile parser.
+ parser.add_symbol('top_srcdir', top_srcdir)
+ parser.add_symbol('top_builddir', top_builddir)
sym_table = parser.parse(src.abspath)
@@ -253,7 +258,21 @@ def parse_source_list(env, filename, names=None):
src_lists = {}
for sym in symbols:
val = sym_table[sym]
- src_lists[sym] = [f for f in val.split(' ') if f]
+ srcs = []
+ for f in val.split():
+ if f:
+ # Process source paths
+ if f.startswith(top_builddir + '/src'):
+ # Automake puts build output on a `src` subdirectory, bue
+ # SCons does no, so strip it here.
+ f = top_builddir + f[len(top_builddir + '/src'):]
+ if f.startswith(cur_srcdir + '/'):
+ # Prefer relative source paths, as absolute files tend to
+ # cause duplicate actions.
+ f = f[len(cur_srcdir + '/'):]
+ srcs.append(f)
+
+ src_lists[sym] = srcs
# if names are given, concatenate the lists
if names: