Scons: fix typos and minor bugs

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@14070 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-06-11 04:48:22 +00:00
parent 48ecd44845
commit 9d229c3f24
3 changed files with 25 additions and 14 deletions

View File

@ -14,12 +14,16 @@ from scons_utils import globSource
Import('env')
def libExists(libname):
''' Check whether or not lib $LOCALLIBNAME/libname already exists'''
return os.path.isfile(File(env.subst('$LOCALLIBPATH/${LIBPREFIX}%s$LIBSUFFIX'%libname)).abspath)
targets = env['BUILD_TARGETS']
# msvc need to pass full target name, so I have to look for path/lyx etc
build_lyx = targets == [] or True in ['lyx' in x for x in targets] \
or 'install' in targets or 'all' in targets
build_boost = env['INCLUDED_BOOST'] or 'boost' in targets
build_intl = env['INCLUDED_GETTEXT'] or 'intl' in targets
build_boost = (env['INCLUDED_BOOST'] and not libExists('boost_regex')) or 'boost' in targets
build_intl = (env['INCLUDED_GETTEXT'] and not libExists('included_intl')) or 'intl' in targets
build_support = build_lyx or True in [x in targets for x in ['support', 'client', 'tex2lyx']]
build_mathed = build_lyx or 'mathed' in targets
build_insets = build_lyx or 'insets' in targets
@ -45,7 +49,7 @@ if rebuild_targets:
if name in rebuild_targets:
return True
# else if not rebuild, and if the library already exists
elif os.path.isfile(File(env.subst('$LOCALLIBPATH/${LIBPREFIX}%s$LIBSUFFIX'%libname)).abspath):
elif libExists(libname):
return False
# do not change the original value
else:

View File

@ -286,8 +286,8 @@ opts.AddOptions(
PathOption('exec_prefix', 'install architecture-independent executable files in PREFIX', None),
# log file
('logfile', 'save commands (not outputs) to logfile', default_log_file),
# Path to aikasurus
PathOption('aikasurus_path', 'Path to aikasurus library', None),
# Path to aiksaurus
PathOption('aiksaurus_path', 'Path to aiksaurus library', None),
# environment variable can be set as options. (DO NOT set defaults)
('CC', '$CC', None),
('LINK', '$LINK', None),
@ -523,8 +523,8 @@ if env.has_key('extra_bin_path') and env['extra_bin_path']:
# maybe only one of them is needed
os.environ['PATH'] += os.pathsep + env['extra_bin_path']
env['ENV']['PATH'] += os.pathsep + env['extra_bin_path']
if env.has_key('aikasurus_path') and env['aikasurus_path']:
env.AppendUnique(LIBPATH = [env['aikasurus_path']])
if env.has_key('aiksaurus_path') and env['aiksaurus_path']:
env.AppendUnique(LIBPATH = [env['aiksaurus_path']])
# under windows, scons is confused by .C/.c and uses gcc instead of
@ -654,12 +654,13 @@ if not fast_start:
boost_opt = ARGUMENTS.get('boost', default_boost_opt)
# check for system boost
succ = False
boost_libpath = None
if boost_opt in ['auto', 'system']:
pathes = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
sig = conf.CheckBoostLibraries('boost_signals', pathes)
reg = conf.CheckBoostLibraries('boost_regex', pathes)
fil = conf.CheckBoostLibraries('boost_filesystem', pathes)
ios = conf.CheckBoostLibraries('boost_iostreams', pathes)
paths = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
sig = conf.CheckBoostLibraries('boost_signals', paths)
reg = conf.CheckBoostLibraries('boost_regex', paths)
fil = conf.CheckBoostLibraries('boost_filesystem', paths)
ios = conf.CheckBoostLibraries('boost_iostreams', paths)
# if any of them is not found
if ('' in [sig[0], reg[0], fil[0], ios[0]]):
if boost_opt == 'system':
@ -670,6 +671,7 @@ if not fast_start:
else:
env['BOOST_LIBRARIES'] = [sig[1], reg[1], fil[1], ios[1]]
# assume all boost libraries are in the same path...
boost_libpath = sig[0]
env.AppendUnique(LIBPATH = [sig[0]])
env['INCLUDED_BOOST'] = False
succ = True
@ -681,8 +683,11 @@ if not fast_start:
env['INCLUDED_BOOST'] = True
env_cache['BOOST_LIBRARIES'] = env['BOOST_LIBRARIES']
env_cache['INCLUDED_BOOST'] = env['INCLUDED_BOOST']
env_cache['BOOST_LIBPATH'] = boost_libpath
else:
env['BOOST_LIBRARIES'] = env_cache['BOOST_LIBRARIES']
if env_cache['BOOST_LIBPATH'] is not None:
env.AppendUnique(LIBPATH = [env_cache['BOOST_LIBPATH']])
env['INCLUDED_BOOST'] = env_cache['INCLUDED_BOOST']
@ -1288,7 +1293,7 @@ env['VERSION_INFO'] = '''Configuration
Build info:
Builing directory: %s
Local library directory: %s
Libraries pathes: %s
Libraries paths: %s
Boost libraries: %s
Frontend libraries: %s
System libraries: %s

View File

@ -70,12 +70,14 @@ def env_subst(target, source, env):
#st = os.stat(str(source[0]))
#os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
#
# glob filenames
#
def globSource(dir, pattern, build_dir=None, exclude=[], include=[]):
''' glob files, in dir and use build_dir as returned path name '''
files = filter(lambda x: x not in exclude, glob.glob1(dir, pattern)) + include
# exclude 'exclude+include' to avoid duplicate items in files
files = filter(lambda x: x not in exclude + include, glob.glob1(dir, pattern)) + include
if build_dir is None:
return files
else: