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.
This commit is contained in:
Ray Speth 2011-12-14 19:36:36 +00:00
parent 605efec48d
commit 2f7fdd5066
2 changed files with 7 additions and 26 deletions

View file

@ -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

View file

@ -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'))