mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
add 'scons lyxbase', 'scons install', nsl support, and a few other scons improvement.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13835 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
e1a132eda7
commit
df9bd2cc6d
@ -13,23 +13,7 @@ import os, sys
|
||||
Import('env')
|
||||
|
||||
targets = env['BUILD_TARGETS']
|
||||
|
||||
if targets == [] or 'lyx' in targets:
|
||||
targets += ['supports', 'mathed', 'insets', 'frontends', \
|
||||
'graphics', 'controllers', env['frontend'], 'lyx']
|
||||
if env['INCLUDED_BOOST']:
|
||||
targets.append('boost')
|
||||
elif 'client' in targets:
|
||||
targets.append('supports')
|
||||
if env['INCLUDED_BOOST']:
|
||||
targets.append('boost')
|
||||
elif 'tex2lyx' in targets:
|
||||
targets.append('supports')
|
||||
if env['INCLUDED_BOOST']:
|
||||
targets.append('boost')
|
||||
|
||||
# unique target in the set (then I will need python 2.4)
|
||||
#targets = set(targets)
|
||||
build_lyx = (targets == [] or 'lyx' in targets or 'install' in targets)
|
||||
|
||||
#
|
||||
# boost libraries
|
||||
@ -109,7 +93,7 @@ env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
|
||||
# src/support
|
||||
#
|
||||
|
||||
if 'supports' in targets:
|
||||
if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']]:
|
||||
print "Processing files in src/support"
|
||||
|
||||
env.Append(CPPPATH = ['.'])
|
||||
@ -156,7 +140,7 @@ if 'supports' in targets:
|
||||
# src/mathed
|
||||
#
|
||||
|
||||
if 'mathed' in targets:
|
||||
if build_lyx or 'mathed' in targets:
|
||||
print "Processing files in src/mathed"
|
||||
|
||||
mathed = env.StaticLibrary(
|
||||
@ -239,11 +223,10 @@ if 'mathed' in targets:
|
||||
Alias('mathed', mathed)
|
||||
|
||||
|
||||
if 'insets' in targets:
|
||||
if build_lyx or 'insets' in targets:
|
||||
#
|
||||
# src/insets
|
||||
#
|
||||
|
||||
print "Processing files in src/insets"
|
||||
|
||||
insets = env.StaticLibrary(
|
||||
@ -300,8 +283,10 @@ if 'insets' in targets:
|
||||
insetwrap.C
|
||||
''')]
|
||||
)
|
||||
Alias('insets', insets)
|
||||
|
||||
|
||||
if 'frontends' in targets:
|
||||
if build_lyx or 'frontends' in targets:
|
||||
#
|
||||
# src/frontends
|
||||
#
|
||||
@ -325,7 +310,7 @@ if 'frontends' in targets:
|
||||
Alias('frontends', frontends)
|
||||
|
||||
|
||||
if 'graphics' in targets:
|
||||
if build_lyx or 'graphics' in targets:
|
||||
#
|
||||
# src/graphics
|
||||
#
|
||||
@ -351,7 +336,7 @@ if 'graphics' in targets:
|
||||
Alias('graphics', graphics)
|
||||
|
||||
|
||||
if 'controllers' in targets:
|
||||
if build_lyx or 'controllers' in targets:
|
||||
#
|
||||
# src/frontends/controllers
|
||||
#
|
||||
@ -415,7 +400,7 @@ if 'controllers' in targets:
|
||||
#
|
||||
# src/frontend/qt3/4
|
||||
#
|
||||
if env['frontend'] in targets:
|
||||
if build_lyx or env['frontend'] in targets:
|
||||
frontend = env['frontend']
|
||||
env.BuildDir('$BUILDDIR/$frontend', '$TOP_SRC_DIR/src/frontend/$frontend', duplicate = 0)
|
||||
else:
|
||||
@ -426,7 +411,8 @@ else:
|
||||
frontend = 'qt4'
|
||||
else:
|
||||
frontend = None
|
||||
|
||||
|
||||
|
||||
if frontend == 'qt3':
|
||||
print "Processing files in src/frontends/qt3"
|
||||
|
||||
@ -906,7 +892,7 @@ elif frontend == 'qt4':
|
||||
Alias('qt4', qt4)
|
||||
|
||||
|
||||
if 'client' in targets:
|
||||
if 'client' in targets or 'install' in targets:
|
||||
#
|
||||
# src/client
|
||||
#
|
||||
@ -925,11 +911,11 @@ if 'client' in targets:
|
||||
messages.C
|
||||
''')]
|
||||
)
|
||||
env.fileCopy('$BUILDDIR/lyxclient', '$BUILDDIR/common/client/lyxclient')
|
||||
Alias('client', env.fileCopy('$BUILDDIR/lyxclient', '$BUILDDIR/common/client/lyxclient'))
|
||||
Alias('client', client)
|
||||
|
||||
|
||||
if 'tex2lyx' in targets:
|
||||
if 'tex2lyx' in targets or 'install' in targets:
|
||||
#
|
||||
# tex2lyx
|
||||
#
|
||||
@ -975,19 +961,19 @@ if 'tex2lyx' in targets:
|
||||
text.C
|
||||
''')]
|
||||
)
|
||||
env.fileCopy('$BUILDDIR/tex2lyx', '$BUILDDIR/common/tex2lyx/tex2lyx')
|
||||
Alias('tex2lyx', env.fileCopy('$BUILDDIR/tex2lyx', '$BUILDDIR/common/tex2lyx/tex2lyx'))
|
||||
Alias('tex2lyx', tex2lyx)
|
||||
#
|
||||
# src/
|
||||
#
|
||||
|
||||
if 'lyx' in targets:
|
||||
if build_lyx or 'lyxbase' in targets:
|
||||
print "Processing files in src"
|
||||
|
||||
env['SUBST_KEYS'] = ['PACKAGE_VERSION', 'VERSION_INFO']
|
||||
env.substFile('$BUILDDIR/common/version.C', '$TOP_SRC_DIR/src/version.C.in')
|
||||
|
||||
lyx_source = Split('''
|
||||
lyx_source_pre = Split('''
|
||||
Bidi.C
|
||||
BufferView.C
|
||||
BufferView_pimpl.C
|
||||
@ -1008,13 +994,10 @@ if 'lyx' in targets:
|
||||
LyXAction.C
|
||||
MenuBackend.C
|
||||
ParagraphParameters.C
|
||||
PrinterParams.C
|
||||
Spacing.C
|
||||
Thesaurus.C
|
||||
ToolbarBackend.C
|
||||
author.C
|
||||
boost.C
|
||||
box.C
|
||||
buffer.C
|
||||
buffer_funcs.C
|
||||
bufferlist.C
|
||||
@ -1028,7 +1011,6 @@ if 'lyx' in targets:
|
||||
cursor.C
|
||||
cursor_slice.C
|
||||
debug.C
|
||||
dimension.C
|
||||
dociterator.C
|
||||
encoding.C
|
||||
errorlist.C
|
||||
@ -1078,10 +1060,8 @@ if 'lyx' in targets:
|
||||
paragraph_funcs.C
|
||||
paragraph_pimpl.C
|
||||
pariterator.C
|
||||
SpellBase.C
|
||||
rowpainter.C
|
||||
sgml.C
|
||||
tabular.C
|
||||
tex-accent.C
|
||||
tex-strings.C
|
||||
texrow.C
|
||||
@ -1099,43 +1079,95 @@ if 'lyx' in targets:
|
||||
main.C
|
||||
''')
|
||||
|
||||
if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
|
||||
lyx_source.append('aspell.C')
|
||||
elif env.has_key('USE_PSPELL') and env['USE_PSPELL']:
|
||||
lyx_source.append('pspell.C')
|
||||
elif env.has_key('USE_ISPELL') and env['USE_ISPELL']:
|
||||
lyx_source.append('ispell.C')
|
||||
lyx_source_post = Split('''
|
||||
tabular.C
|
||||
dimension.C
|
||||
PrinterParams.C
|
||||
box.C
|
||||
Thesaurus.C
|
||||
SpellBase.C
|
||||
''')
|
||||
|
||||
if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
|
||||
lyx_source_pre.append('aspell.C')
|
||||
elif env.has_key('USE_PSPELL') and env['USE_PSPELL']:
|
||||
lyx_source_pre.append('pspell.C')
|
||||
elif env.has_key('USE_ISPELL') and env['USE_ISPELL']:
|
||||
lyx_source_pre.append('ispell.C')
|
||||
|
||||
lyxbase_pre = env.StaticLibrary(
|
||||
target = '$LOCALLIBPATH/lyxbase_pre',
|
||||
source = ["$BUILDDIR/common/%s" % x for x in lyx_source_pre]
|
||||
)
|
||||
lyxbase_post = env.StaticLibrary(
|
||||
target = '$LOCALLIBPATH/lyxbase_post',
|
||||
source = ["$BUILDDIR/common/%s" % x for x in lyx_source_post]
|
||||
)
|
||||
Alias('lyxbase', lyxbase_pre)
|
||||
Alias('lyxbase', lyxbase_post)
|
||||
|
||||
|
||||
if build_lyx or 'lyx' in targets:
|
||||
#
|
||||
# Build lyx with given frontend
|
||||
#
|
||||
lyx = env.Program(
|
||||
target = '$BUILDDIR/$frontend/lyx',
|
||||
source = ["$BUILDDIR/common/%s" % x for x in lyx_source],
|
||||
source = [],
|
||||
LIBS = [
|
||||
'lyxbase_pre',
|
||||
'mathed',
|
||||
'insets',
|
||||
'frontends',
|
||||
env['frontend'],
|
||||
'controllers',
|
||||
'graphics',
|
||||
'supports'] +
|
||||
'supports',
|
||||
'lyxbase_post',
|
||||
] +
|
||||
env['BOOST_LIBRARIES'] +
|
||||
env['EXTRA_LIBS'] +
|
||||
env['SYSTEM_LIBS']
|
||||
)
|
||||
Alias('lyx', env.fileCopy('$BUILDDIR/lyx-$frontend', '$BUILDDIR/$frontend/lyx'))
|
||||
Alias('lyx', lyx)
|
||||
|
||||
|
||||
|
||||
if 'install' in targets:
|
||||
env.fileCopy('$BUILDDIR/lyx$frontend', '$BUILDDIR/$frontend/lyx')
|
||||
|
||||
#
|
||||
# This does not look clever right now. I am using the basic
|
||||
# install builder of scons instead of fancier wiki solutions
|
||||
# with the hope that scons can finish standarding this soon.
|
||||
#
|
||||
import glob
|
||||
|
||||
def install(dest, src):
|
||||
''' recusive installation of src '''
|
||||
# separate file and directory
|
||||
files = filter(os.path.isfile, [x for x in src])
|
||||
dirs = filter(os.path.isdir, [x for x in src])
|
||||
# install file
|
||||
env.Install(dest, files)
|
||||
# install directory
|
||||
ins_dir = [dest]
|
||||
for dir in dirs:
|
||||
ins_dir.extend(install(os.path.join(dest, os.path.basename(dir)),
|
||||
glob.glob(os.path.join(dir, '*'))) )
|
||||
return ins_dir
|
||||
#
|
||||
# other targets include client, tex2lyx
|
||||
Default('lyx')
|
||||
|
||||
Alias('install', env.installProg(Dir(env['BIN_DIR']),
|
||||
[lyx, tex2lyx, lyxclient]))
|
||||
## Alias('install', env.installProg(Dir(os.path.join(env['PREFIX'], 'share/lyx/')),
|
||||
## [Dir(env.subst('$TOP_SRC_DIR/lib/') + dir) for dir in ['images', 'layouts', 'scripts', 'templates', \
|
||||
## 'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc', 'ui'] ] + \
|
||||
## [File(env.subst('$TOP_SRC_DIR/lib/') + file) for file in ['configure.py', 'encodings', 'chkconfig.ltx', 'CREDITS', \
|
||||
## 'external_templates', 'symbols', 'languages', 'lyxrc.example', 'syntax.default']]))
|
||||
env.Install(env['BIN_DIR'], [lyx, tex2lyx, client])
|
||||
Alias('install', env['BIN_DIR'])
|
||||
#
|
||||
# copy files
|
||||
dirs = install(os.path.join(env['PREFIX'], 'share/lyx/'),
|
||||
[env.subst('$TOP_SRC_DIR/lib/') + file for file in ['configure.py', 'encodings',
|
||||
'chkconfig.ltx', 'CREDITS', 'external_templates', 'symbols', 'languages',
|
||||
'lyxrc.example', 'syntax.default', \
|
||||
'images', 'layouts', 'scripts', 'templates', \
|
||||
'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc', 'ui']]
|
||||
)
|
||||
Alias('install', dirs)
|
||||
|
||||
Default('lyx')
|
||||
|
||||
|
@ -279,9 +279,6 @@ opts.AddOptions(
|
||||
('LDFLAGS', '$LDFLAGS', ''),
|
||||
)
|
||||
|
||||
# Determine the frontend to use
|
||||
frontend = ARGUMENTS.get('frontend', default_frontend)
|
||||
use_X11 = ARGUMENTS.get('X11', default_with_x)
|
||||
|
||||
#---------------------------------------------------------
|
||||
# Setting up environment
|
||||
@ -289,15 +286,22 @@ use_X11 = ARGUMENTS.get('X11', default_with_x)
|
||||
|
||||
env = Environment(options = opts)
|
||||
|
||||
# Determine the frontend to use, which may be loaded
|
||||
# from option cache
|
||||
frontend = env.get('frontend', default_frontend)
|
||||
use_X11 = env.get('X11', default_with_x)
|
||||
|
||||
# set environment since I do not really like ENV = os.environ
|
||||
env['ENV']['PATH'] = os.environ.get('PATH')
|
||||
env['ENV']['HOME'] = os.environ.get('HOME')
|
||||
env['TOP_SRC_DIR'] = TOP_SRC_DIR
|
||||
env['SCONS_DIR'] = SCONS_DIR
|
||||
# install to current directory by default
|
||||
env['PREFIX'] = ARGUMENTS.get('prefix', '.')
|
||||
env['BIN_DIR'] = ARGUMENTS.get('exec_prefix',
|
||||
os.path.join(env['PREFIX'], 'bin'))
|
||||
env['PREFIX'] = env.get('prefix', '.')
|
||||
if env.has_key('exec_prefix') and env['exec_prefix'] != '.':
|
||||
env['BIN_DIR'] = env['exec_prefix']
|
||||
else:
|
||||
env['BIN_DIR'] = os.path.join(env['PREFIX'], 'bin')
|
||||
|
||||
# speed up source file processing
|
||||
#env['CPPSUFFIXES'] = ['.C', '.cc', '.cpp']
|
||||
@ -333,7 +337,7 @@ if platform_name == 'cygwin':
|
||||
# frontend, mode, BUILDDIR and LOCALLIBPATH=BUILDDIR/libs
|
||||
#
|
||||
env['frontend'] = frontend
|
||||
env['mode'] = ARGUMENTS.get('mode', default_build_mode)
|
||||
env['mode'] = env.get('mode', default_build_mode)
|
||||
# lyx will be built to $build/build_dir so it is possible
|
||||
# to build multiple build_dirs using the same source
|
||||
# $mode can be debug or release
|
||||
@ -354,26 +358,26 @@ env.AppendUnique(LIBPATH = ['$LOCALLIBPATH'])
|
||||
if platform_name == 'win32':
|
||||
env.Tool('mingw')
|
||||
|
||||
if ARGUMENTS.has_key('qt_dir'):
|
||||
env['QTDIR'] = ARGUMENTS['qt_dir']
|
||||
if env.has_key('qt_dir') and env['qt_dir'] != '.':
|
||||
env['QTDIR'] = env['qt_dir']
|
||||
# add path to the qt tools
|
||||
env.AppendUnique(LIBPATH = [os.path.join(ARGUMENTS['qt_dir'], 'lib')])
|
||||
env.AppendUnique(CPPPATH = [os.path.join(ARGUMENTS['qt_dir'], 'include')])
|
||||
env.AppendUnique(LIBPATH = [os.path.join(env['qt_dir'], 'lib')])
|
||||
env.AppendUnique(CPPPATH = [os.path.join(env['qt_dir'], 'include')])
|
||||
# set environment so that moc etc can be found even if its path is not set properly
|
||||
env.PrependENVPath('PATH', os.path.join(ARGUMENTS['qt_dir'], 'bin'))
|
||||
env.PrependENVPath('PATH', os.path.join(env['qt_dir'], 'bin'))
|
||||
else:
|
||||
env['QTDIR'] = os.environ.get('QTDIR', '/usr/lib/qt-3.3')
|
||||
|
||||
if ARGUMENTS.has_key('qt_lib_path'):
|
||||
env['QT_LIB_PATH'] = ARGUMENTS['qt_lib_path']
|
||||
if env.has_key('qt_lib_path') and env['qt_lib_path'] != '.':
|
||||
env['QT_LIB_PATH'] = env['qt_lib_path']
|
||||
else:
|
||||
env['QT_LIB_PATH'] = '$QTDIR/lib'
|
||||
env.AppendUnique(LIBPATH = ['$QT_LIB_PATH'])
|
||||
# qt4 seems to be using pkg_config
|
||||
env.PrependENVPath('PKG_CONFIG_PATH', env.subst('$QT_LIB_PATH'))
|
||||
|
||||
if ARGUMENTS.has_key('qt_inc_path'):
|
||||
env['QT_INC_PATH'] = ARGUMENTS['qt_inc_path']
|
||||
if env.has_key('qt_inc_path') and env['qt_inc_path'] != '.':
|
||||
env['QT_INC_PATH'] = env['qt_inc_path']
|
||||
elif os.path.isdir(os.path.join(env.subst('$QTDIR'), 'include')):
|
||||
env['QT_INC_PATH'] = '$QTDIR/include'
|
||||
else: # have to guess
|
||||
@ -383,16 +387,16 @@ env.AppendUnique(CPPPATH = env['QT_INC_PATH'])
|
||||
#
|
||||
# extra_inc_path and extra_lib_path
|
||||
#
|
||||
if ARGUMENTS.has_key('extra_inc_path'):
|
||||
env.AppendUnique(CPPPATH = [ARGUMENTS['extra_inc_path']])
|
||||
if ARGUMENTS.has_key('extra_lib_path'):
|
||||
env.AppendUnique(LIBPATH = [ARGUMENTS['extra_lib_path']])
|
||||
if ARGUMENTS.has_key('extra_inc_path1'):
|
||||
env.AppendUnique(CPPPATH = [ARGUMENTS['extra_inc_path1']])
|
||||
if ARGUMENTS.has_key('extra_lib_path1'):
|
||||
env.AppendUnique(LIBPATH = [ARGUMENTS['extra_lib_path1']])
|
||||
if ARGUMENTS.has_key('aikasurus_path'):
|
||||
env.AppendUnique(LIBPATH = [ARGUMENTS['aikasurus_path']])
|
||||
if env.has_key('extra_inc_path'):
|
||||
env.AppendUnique(CPPPATH = [env['extra_inc_path']])
|
||||
if env.has_key('extra_lib_path'):
|
||||
env.AppendUnique(LIBPATH = [env['extra_lib_path']])
|
||||
if env.has_key('extra_inc_path1'):
|
||||
env.AppendUnique(CPPPATH = [env['extra_inc_path1']])
|
||||
if env.has_key('extra_lib_path1'):
|
||||
env.AppendUnique(LIBPATH = [env['extra_lib_path1']])
|
||||
if env.has_key('aikasurus_path'):
|
||||
env.AppendUnique(LIBPATH = [env['aikasurus_path']])
|
||||
|
||||
#
|
||||
# this is a bit out of place (after auto-configration)
|
||||
@ -465,13 +469,14 @@ elif env['frontend'] == 'qt4':
|
||||
Exit(1)
|
||||
|
||||
# check socket libs
|
||||
env['socket_libs'] = []
|
||||
env['SYSTEM_LIBS'] = []
|
||||
if conf.CheckLib('socket'):
|
||||
env.AppendUnique(socket_libs = ['socket'])
|
||||
env['SYSTEM_LIBS'].append('socket')
|
||||
|
||||
# FIXME: What is nsl, is it related to socket?
|
||||
# EF: This is the network services library and provides a
|
||||
# transport-level interface to networking services.
|
||||
if conf.CheckLib('nsl'):
|
||||
env.AppendUnique(socket_libs = ['nsl'])
|
||||
env['SYSTEM_LIBS'].append('nsl')
|
||||
|
||||
# check boost libraries
|
||||
boost_opt = ARGUMENTS.get('boost', default_boost_opt)
|
||||
@ -574,6 +579,7 @@ for header in headers:
|
||||
# HAVE_MKTEMP
|
||||
# HAVE_MKSTEMP
|
||||
# HAVE_STRERROR
|
||||
# HAVE_FCNTL
|
||||
|
||||
# Check functions
|
||||
functions = [
|
||||
@ -591,7 +597,8 @@ functions = [
|
||||
('_mkdir', 'HAVE__MKDIR'),
|
||||
('mktemp', 'HAVE_MKTEMP'),
|
||||
('mkstemp', 'HAVE_MKSTEMP'),
|
||||
('strerror', 'HAVE_STRERROR')
|
||||
('strerror', 'HAVE_STRERROR'),
|
||||
('fcntl', 'HAVE_FCNTL')
|
||||
]
|
||||
|
||||
for func in functions:
|
||||
@ -765,9 +772,9 @@ except:
|
||||
print " QTDIR: ", env['QTDIR']
|
||||
|
||||
if platform_name in ['win32', 'cygwin']:
|
||||
env['SYSTEM_LIBS'] = ['shlwapi', 'z']
|
||||
env['SYSTEM_LIBS'] += ['shlwapi', 'z']
|
||||
else:
|
||||
env['SYSTEM_LIBS'] = ['z']
|
||||
env['SYSTEM_LIBS'] += ['z']
|
||||
|
||||
#
|
||||
# Build parameters CPPPATH etc
|
||||
@ -789,9 +796,6 @@ else:
|
||||
env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
|
||||
# FIXME: there must be a better way.
|
||||
env['BUILDERS']['fileCopy'] = Builder(action = utils.env_filecopy)
|
||||
# install
|
||||
env['BUILDERS']['installProg'] = Builder(action = utils.env_installProg)
|
||||
env['BUILDERS']['installFile'] = Builder(action = utils.env_installFile)
|
||||
|
||||
#
|
||||
# A Link script for cygwin see
|
||||
|
Loading…
Reference in New Issue
Block a user