From 2f7fdd506630915cc3496594b61aace5665dc1e4 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Wed, 14 Dec 2011 19:36:36 +0000 Subject: [PATCH] Fix for building system-dependent headers in f2c_libs SCons couldn't resolve dependencies on files created by CopyNoPrefix, so now the paths to these headers are specified relative to the project root. --- buildutils.py | 22 ---------------------- ext/SConscript | 11 +++++++---- 2 files changed, 7 insertions(+), 26 deletions(-) diff --git a/buildutils.py b/buildutils.py index 5920810df..28b660392 100644 --- a/buildutils.py +++ b/buildutils.py @@ -256,28 +256,6 @@ def add_RegressionTest(env): action=env.Action(regression_test, regression_test_message)) -class CopyNoPrefix(object): - """ - Copy a file, ignoring leading directories that are part - of 'prefix' (e.g. the variant directory) - """ - def __init__(self, prefix): - self.prefix = prefix - - def __call__(self, source, target, env): - sourcepath = psplit(str(source[0])) - targetpath = psplit(str(target[0])) - - depth = 0 - for a,b in zip(targetpath, psplit(self.prefix)): - if a == b: - depth += 1 - else: - break - print str(source[0]), pjoin(*targetpath[depth:]) - shutil.copyfile(str(source[0]), pjoin(*targetpath[depth:])) - - def quoted(s): """ Returns the given string wrapped in double quotes.""" return '"%s"' % s diff --git a/ext/SConscript b/ext/SConscript index b7414990a..ec6fba39e 100644 --- a/ext/SConscript +++ b/ext/SConscript @@ -21,12 +21,15 @@ if env['build_with_f2c']: # TODO: make link flag more general arithenv.Append(LINKFLAGS='-lm', CPPFLAGS='-DNO_FPINIT') arithenv.Program('f2c_libs/arithchk/arithchk', source='f2c_libs/arithchk/arithchk.c') - arithenv.Command('arith.h', 'f2c_libs/arithchk/arithchk', '$SOURCE > $TARGET') - arithenv.Command('f2c_libs/arith.h', 'arith.h', CopyNoPrefix(buildDir)) + arithenv.Command('#ext/f2c_libs/arith.h', 'f2c_libs/arithchk/arithchk$PROGSUFFIX', + '$SOURCE > $TARGET') # Possibly system-depenent headers - localenv.Command('f2c_libs/signal1.h', 'f2c_libs/signal1.h0', CopyNoPrefix(buildDir)) - localenv.Command('f2c_libs/sysdep1.h', 'f2c_libs/sysdep1.h0', CopyNoPrefix(buildDir)) + localenv.Command('#ext/f2c_libs/signal1.h', 'f2c_libs/signal1.h0', + Copy('$TARGET', '$SOURCE')) + + localenv.Command('#ext/f2c_libs/sysdep1.h', 'f2c_libs/sysdep1.h0', + Copy('$TARGET', '$SOURCE')) libs.append(('f2c_libs', 'ctf2c', 'c'))