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
# 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 = ['.'])
# src/mathed
#
-if 'mathed' in targets:
+if build_lyx or 'mathed' in targets:
print "Processing files in src/mathed"
mathed = env.StaticLibrary(
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(
insetwrap.C
''')]
)
+ Alias('insets', insets)
+
-if 'frontends' in targets:
+if build_lyx or 'frontends' in targets:
#
# src/frontends
#
Alias('frontends', frontends)
-if 'graphics' in targets:
+if build_lyx or 'graphics' in targets:
#
# src/graphics
#
Alias('graphics', graphics)
-if 'controllers' in targets:
+if build_lyx or 'controllers' in targets:
#
# src/frontends/controllers
#
#
# 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:
frontend = 'qt4'
else:
frontend = None
-
+
+
if frontend == 'qt3':
print "Processing files in src/frontends/qt3"
Alias('qt4', qt4)
-if 'client' in targets:
+if 'client' in targets or 'install' in targets:
#
# src/client
#
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
#
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
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
cursor.C
cursor_slice.C
debug.C
- dimension.C
dociterator.C
encoding.C
errorlist.C
paragraph_funcs.C
paragraph_pimpl.C
pariterator.C
- SpellBase.C
rowpainter.C
sgml.C
- tabular.C
tex-accent.C
tex-strings.C
texrow.C
main.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.append('aspell.C')
+ lyx_source_pre.append('aspell.C')
elif env.has_key('USE_PSPELL') and env['USE_PSPELL']:
- lyx_source.append('pspell.C')
+ lyx_source_pre.append('pspell.C')
elif env.has_key('USE_ISPELL') and env['USE_ISPELL']:
- lyx_source.append('ispell.C')
+ 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')
+
('LDFLAGS', '$LDFLAGS', ''),
)
-# Determine the frontend to use
-frontend = ARGUMENTS.get('frontend', default_frontend)
-use_X11 = ARGUMENTS.get('X11', default_with_x)
#---------------------------------------------------------
# Setting up environment
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']
# 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
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
#
# 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)
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)
# HAVE_MKTEMP
# HAVE_MKSTEMP
# HAVE_STRERROR
+# HAVE_FCNTL
# Check functions
functions = [
('_mkdir', 'HAVE__MKDIR'),
('mktemp', 'HAVE_MKTEMP'),
('mkstemp', 'HAVE_MKSTEMP'),
- ('strerror', 'HAVE_STRERROR')
+ ('strerror', 'HAVE_STRERROR'),
+ ('fcntl', 'HAVE_FCNTL')
]
for func in functions:
print " QTDIR: ", env['QTDIR']
if platform_name in ['win32', 'cygwin']:\r
- env['SYSTEM_LIBS'] = ['shlwapi', 'z']
+ env['SYSTEM_LIBS'] += ['shlwapi', 'z']
else:
- env['SYSTEM_LIBS'] = ['z']
+ env['SYSTEM_LIBS'] += ['z']
#
# Build parameters CPPPATH etc
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