--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+#
+# file SConstruct
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+#
+#
+# This is a scons based building system for lyx, you can use it as follows:
+# (after of course installation of scons from www.scons.org)
+#
+# scons [frontend=qt3|gt4] [boost=included|auto] ...
+#
+# Where:
+# * use scons -h for details about parameters
+# * qt3 is used by default on linux, cygwin and mac
+# * qt4 is used by default on win32
+#
+# File layouts (Important):
+# * Unless you specify builddir=dir, building will happen
+# in $BUILDDIR = $mode/$platform-$frontend. E.g., something like
+# debug/linux-qt3/
+# * All shared libs will be put in $BUILDDIR/libs, e.g.
+# debug/linux-qt3/libs
+# * lyx executable will be in directories like debug/linux-qt3
+#
+# Hints:
+# * scons --config=force
+# force re-configuration (use scons -H for details)
+#
+# * check config.log to see why config has failed
+#
+# * use extra_inc_path, extra_lib_path, qt_dir, qt_inc_path
+# qt_lib_path to help locate qt and other libraries
+#
+# * (Important) use scons logfile=logfile.log to enable command line
+# logging. (default is no logging)
+#
+# Notes:
+# * Currently, all scons does is building lyx in
+# $LYXROOT/$mode/$build_dir/
+# where $mode is debug or release, $build_dir is the build_dir name
+# listed above
+#
+# * scons install etc may be added later. Interested contributors can follow
+# http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/AccumulateBuilder
+# or
+# http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/DistTarBuilder
+# Please also see the commented out code in scons_utils.py
+#
+# * NSIS support can be found here.
+# http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/NsisSconsTool
+#
+# * rpm support?
+# http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/RpmHonchoTemp
+#
+# However, I decide to wait since scons seems to be standardizing these
+# features.
+#
+
+import os, sys
+
+# scons_util defines a few utility function
+import scons_utils as utils
+
+#----------------------------------------------------------
+# Required runtime environment
+#----------------------------------------------------------
+
+# FIXME: I remember lyx requires higher version of python?
+EnsurePythonVersion(1, 5)
+# Please use at least 0.96.91 (not 0.96.1)
+EnsureSConsVersion(0, 96)
+
+#----------------------------------------------------------
+# Global definitions
+#----------------------------------------------------------
+
+# some global settings
+PACKAGE_VERSION = '1.5.0svn'
+DEVEL_VERSION = True
+default_build_mode = 'debug'
+
+PACKAGE = 'lyx'
+PACKAGE_BUGREPORT = 'lyx-devel@lists.lyx.org'
+PACKAGE_NAME = 'LyX'
+PACKAGE_TARNAME = 'lyx'
+PACKAGE_STRING = '%s %s' % (PACKAGE_NAME, PACKAGE_VERSION)
+PROGRAM_SUFFIX = ''
+config_h = os.path.join('src', 'config.h')
+default_log_file = 'scons_lyx.log'
+
+# FIXME: what is this? (They are used in src/support/package.C.in
+LOCALEDIR = "../locale/"
+LYX_DIR = "/usr/local/share/lyx"
+
+# platform dependent default build_dir and other settings
+#
+# I know, somebody would say:
+# This is TOTALLY wrong! Everything should be automatically
+# determined.
+#
+if os.name == 'nt':
+ platform_name = 'win32'
+ default_frontend = 'qt4'
+ # boost and gettext are unlikely to be installed already
+ default_boost_opt = 'included'
+ default_gettext_opt = 'included'
+ default_pch_opt = False
+ default_with_x = False
+ spell_checker = 'auto'
+ # FIXME: I need to know what exactly is boost_posix
+ boost_posix = False
+ packaging_method = 'windows'
+elif os.name == 'posix' and sys.platform != 'cygwin':
+ platform_name = 'linux'
+ default_frontend = 'qt3'
+ # try to use system boost/gettext libraries
+ default_boost_opt = 'auto'
+ default_gettext_opt = 'auto'
+ default_pch_opt = False
+ default_with_x = True
+ boost_posix = False
+ packaging_method = 'posix'
+elif os.name == 'posix' and sys.platform == 'cygwin':
+ platform_name = 'cygwin'
+ default_frontend = 'qt3'
+ # force the use of cygwin/boost/gettext
+ default_boost_opt = 'system'
+ default_gettext_opt = 'system'
+ default_pch_opt = False
+ default_with_x = True
+ boost_posix = True
+ packaging_method = 'posix'
+elif os.name == 'darwin':
+ platform_name = 'mac'
+ default_frontend = 'qt3'
+ # to be safe
+ default_boost_opt = 'included'
+ default_gettext_opt = 'included'
+ default_pch_opt = False
+ default_with_x = False
+ boost_posix = False
+ packaging_method = 'msc'
+else: # unsupported system
+ platform_name = 'others'
+ default_frontend = 'qt3'
+ # to be safe
+ default_boost_opt = 'included'
+ default_gettext_opt = 'included'
+ default_pch_opt = False
+ default_with_x = True
+ boost_posix = False
+ packaging_method = 'posix'
+
+#---------------------------------------------------------
+# Handling options
+#----------------------------------------------------------
+# Note that if you set the options via the command line,
+# they will be remembered in the file 'options.cache'
+#
+# NOTE: the scons people are trying to fix scons so that
+# options like --prefix will be accepted. Right now,
+# we have to use the KEY=VALUE style of scons
+#
+opts = Options(['options.cache', 'config.py'])
+opts.AddOptions(
+ # frontend,
+ EnumOption('frontend', 'Main GUI',
+ default_frontend,
+ allowed_values = ('xform', 'qt3', 'qt4', 'gtk') ),
+ # debug or release build
+ EnumOption('mode', 'Building method', default_build_mode,
+ allowed_values = ('debug', 'release') ),
+ # boost libraries
+ EnumOption('boost',
+ 'Use included, system boost library, or try sytem first.',
+ default_boost_opt,
+ allowed_values = (
+ 'auto', # detect boost, if not found, use included
+ 'included', # always use included boost
+ 'system', # always use system boost, fail if can not find
+ ) ),
+ EnumOption('gettext',
+ 'Use included, system gettext library, or try sytem first',
+ default_gettext_opt,
+ allowed_values = (
+ 'auto', # detect gettext, if not found, use included
+ 'included', # always use included gettext
+ 'system', # always use system gettext, fail if can not find
+ ) ),
+ # FIXME: I am not allowed to use '' as default, '.' is not good either.
+ PathOption('qt_dir', 'Path to qt directory', '.'),
+ PathOption('qt_include_path', 'Path to qt include directory', '.'),
+ PathOption('qt_lib_path', 'Path to qt library directory', '.'),
+ # FIXME: I do not know how pch is working. Ignore this option now.
+ BoolOption('pch', '(NA) Whether or not use pch', default_pch_opt),
+ # FIXME: Not implemented yet.
+ BoolOption('version_suffix', '(NA) Whether or not add version suffix', False),
+ # build directory, will replace build_dir if set
+ PathOption('build_dir', 'Build directory', '.'),
+ # extra include and libpath
+ PathOption('extra_inc_path', 'Extra include path', '.'),
+ PathOption('extra_lib_path', 'Extra library path', '.'),
+ # enable assertion, (config.h has ENABLE_ASSERTIOS
+ BoolOption('assertions', 'Use assertions', True),
+ # enable warning, (config.h has WITH_WARNINGS)
+ BoolOption('warnings', 'Use warnings', True),
+ # enable glib, (config.h has _GLIBCXX_CONCEPT_CHECKS)
+ BoolOption('concept_checks', 'Enable concept checks', True),
+ # FIXME: I do not know what is nls
+ BoolOption('nls', '(NA) Whether or not use native language support', False),
+ # FIXME: not implemented
+ BoolOption('profile', '(NA) Whether or not enable profiling', False),
+ # FIXME: not implemented
+ PathOption('prefix', '(NA) install architecture-independent files in PREFIX', '.'),
+ # FIXME: not implemented
+ PathOption('exec_prefix', '(NA) install architecture-independent executable files in PREFIX', '.'),
+ # FIXME: not implemented
+ BoolOption('std_debug', '(NA) Whether or not turn on stdlib debug', False),
+ # using x11?
+ BoolOption('X11', 'Use x11 windows system', default_with_x),
+ # FIXME: not implemented
+ BoolOption('libintl', '(NA) Use libintl library', False),
+ # FIXME: not implemented
+ PathOption('intl_prefix', '(NA) Path to intl library', '.'),
+ # log file
+ ('logfile', 'save commands (not outputs) to logfile', default_log_file),
+ # What is aiksaurus?
+ BoolOption('aikasurus', 'Whether or not use aikasurus library', False),
+ #
+ EnumOption('spell', 'Choose spell checker to use.', 'auto',
+ allowed_values = ('aspell', 'pspell', 'ispell', 'auto') )
+)
+
+# 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
+)
+
+# 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['ENV']['PKG_CONFIG_PATH'] = os.environ.get('PKG_CONFIG_PATH')
+env['TOP_SRC_DIR'] = Dir('.').abspath
+
+#
+# frontend, mode, BUILDDIR and LOCALLIBPATH=BUILDDIR/libs
+#
+env['frontend'] = frontend
+env['mode'] = ARGUMENTS.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 ARGUMENTS.has_key('build_dir'):
+ build_dir = ARGUMENTS['build_dir']
+ env['BUILDDIR'] = build_dir
+else:
+ # Determine the name of the build (platform+frontend
+ build_dir = '%s-%s' % (platform_name, frontend)
+ if use_X11 and platform_name == 'cygwin':
+ build_dir += '-X11'
+ env['BUILDDIR'] = os.path.join('$mode', build_dir)
+# all built libraries will go to build_dir/libs
+# (This is different from the make file approach)
+env['LOCALLIBPATH'] = '#$BUILDDIR/libs'
+env.Append(LIBPATH = ['$LOCALLIBPATH'])
+
+#
+# QTDIR, QT_LIB_PATH, QT_INC_PATH
+#
+if platform_name == 'win32':
+ env.Tool('mingw')
+
+if ARGUMENTS.has_key('qt_dir'):
+ env['QTDIR'] = ARGUMENTS['qt_dir']
+ # add path to the qt tools
+ env.Append(LIBPATH = [os.path.join(ARGUMENTS['qt_dir'], 'lib')])
+ env.Append(CPPPATH = [os.path.join(ARGUMENTS['qt_dir'], 'include')])
+ # set environment so that moc etc can be found even if its path is not set properly
+ env['ENV']['PATH'] = os.path.join(ARGUMENTS['qt_dir'], 'bin') + os.pathsep + env['ENV']['PATH']
+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']
+else:
+ env['QT_LIB_PATH'] = '$QTDIR/lib'
+env.Append(LIBPATH = ['$QT_LIB_PATH'])
+# qt4 seems to be using pkg_config
+env['ENV']['PKG_CONFIG_PATH'] = env.subst('$QT_LIB_PATH')
+
+if ARGUMENTS.has_key('qt_inc_path'):
+ env['QT_INC_PATH'] = ARGUMENTS['qt_inc_path']
+elif os.path.isdir(os.path.join(env.subst('$QTDIR'), 'include')):
+ env['QT_INC_PATH'] = '$QTDIR/include'
+else: # have to guess
+ env['QT_INC_PATH'] = '/usr/include/$frontend/'
+env.Append(CPPPATH = env['QT_INC_PATH'])
+
+#
+# extra_inc_path and extra_lib_path
+#
+if ARGUMENTS.has_key('extra_inc_path'):
+ env.Append(CPPPATH = [ARGUMENTS['extra_inc_path']])
+if ARGUMENTS.has_key('extra_lib_path'):
+ env.Append(LIBPATH = [ARGUMENTS['extra_lib_path']])
+
+#
+# this is a bit out of place (after auto-configration)
+# but it is required to do the tests.
+if platform_name == 'win32':
+ env.Append(CPPPATH = ['#c:/MinGW/include'])
+
+#----------------------------------------------------------
+# Autoconf business
+#----------------------------------------------------------
+
+conf = Configure(env,
+ custom_tests = {
+ 'CheckPkgConfig' : utils.checkPkgConfig,
+ 'CheckPackage' : utils.checkPackage,
+ 'CheckPutenv' : utils.checkPutenv,
+ 'CheckIstreambufIterator' : utils.checkIstreambufIterator,
+ 'CheckMkdirOneArg' : utils.checkMkdirOneArg,
+ 'CheckStdCount' : utils.checkStdCount,
+ 'CheckSelectArgType' : utils.checkSelectArgType,
+ 'CheckBoostLibraries' : utils.checkBoostLibraries,
+ }
+)
+
+# pkg-config? (if not, we use hard-coded options)
+if conf.CheckPkgConfig('0.15.0'):
+ env['HAS_PKG_CONFIG'] = True
+else:
+ print 'pkg-config >= 0.1.50 is not found'
+ env['HAS_PKG_CONFIG'] = False
+
+# zlib? This is required.
+if not conf.CheckLibWithHeader('z', 'zlib.h', 'C'):
+ print 'Did not find libz or zlib.h, exiting!'
+ Exit(1)
+
+# qt libraries?
+#
+# qt3 does not use pkg_config
+if env['frontend'] == 'qt3':
+ if not conf.CheckLibWithHeader('qt-mt', 'qapp.h', 'c++', 'QApplication qapp();'):
+ print 'Did not find qt libraries, exiting!'
+ Exit(1)
+elif env['frontend'] == 'qt4':
+ succ = False
+ # first: try pkg_config
+ if env['HAS_PKG_CONFIG']:
+ succ = conf.CheckPackage('QtCore')
+ env['QT4_PKG_CONFIG'] = succ
+ # second: try to link to it
+ if not succ:
+ # FIXME: under linux, I can test the following perfectly
+ # However, under windows, lib names need to passed as libXXX4.a ...
+ succ = conf.CheckLibWithHeader('QtCore', 'QtGui/QApplication', 'c++', 'QApplication qapp();')
+ # third: try to look up the path
+ if not succ:
+ succ = True
+ for lib in ['QtCore', 'QtGui', 'Qt3Support']:
+ # windows version has something like QtGui4 ...
+ if not (os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s.a' % lib)) or \
+ os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s4.a' % lib))):
+ succ = False
+ break
+ # still can not find it
+ if not succ:
+ print 'Did not find qt libraries, exiting!'
+ Exit(1)
+
+# check socket libs
+env['socket_libs'] = []
+if conf.CheckLib('socket'):
+ env.Append(socket_libs = ['socket'])
+
+# FIXME: What is nsl, is it related to socket?
+if conf.CheckLib('nsl'):
+ env.Append(socket_libs = ['nsl'])
+
+# check boost libraries
+boost_opt = ARGUMENTS.get('boost', default_boost_opt)
+# check for system boost
+succ = False
+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)
+ # if any them is not found
+ if ('' in [sig[0], reg[0], fil[0], ios[0]]):
+ if boost_opt == 'system':
+ print "Can not find system boost libraries"
+ print "Please supply a path through extra_lib_path"
+ print "and try again."
+ Exit(2)
+ else:
+ env['BOOST_LIBRARIES'] = [sig[1], reg[1], fil[1], ios[1]]
+ # assume all boost libraries are in the same path...
+ env.Append(LIBPATH = sig[0])
+ env['INCLUDED_BOOST'] = False
+ succ = True
+# now, auto and succ = false, or included
+if not succ:
+ # we do not need to set LIBPATH now.
+ env['BOOST_LIBRARIES'] = ['boost_signals', 'boost_regex',
+ 'boost_filesystem', 'boost_iostreams']
+ env['INCLUDED_BOOST'] = True
+
+#
+# Building config.h
+#
+
+print "Generating ", config_h, "..."
+
+# I do not handle all macros in src/config.h.in, rather I am following a list
+# of *used-by-lyx* macros compiled by Abdelrazak Younes <younes.a@free.fr>
+#
+# Note: addToConfig etc are defined in scons_util
+utils.startConfigH(config_h)
+
+# HAVE_IO_H
+# HAVE_LIMITS_H
+# HAVE_LOCALE_H
+# HAVE_LOCALE
+# HAVE_PROCESS_H
+# HAVE_STDLIB_H
+# HAVE_SYS_STAT_H
+# HAVE_SYS_TIME_H
+# HAVE_SYS_TYPES_H
+# HAVE_SYS_UTIME_H
+# HAVE_UNISTD_H
+# HAVE_UTIME_H
+# HAVE_ISTREAM
+# HAVE_OSTREAM
+# HAVE_IOS
+
+# Check header files
+headers = [
+ ('io.h', 'HAVE_IO_H', 'c'),
+ ('limits.h', 'HAVE_LIMITS_H', 'c'),
+ ('locale.h', 'HAVE_LOCALE_H', 'c'),
+ ('locale', 'HAVE_LOCALE', 'cxx'),
+ ('process.h', 'HAVE_PROCESS_H', 'c'),
+ ('stdlib.h', 'HAVE_STDLIB_H', 'c'),
+ ('sys/stat.h', 'HAVE_SYS_STAT_H', 'c'),
+ ('sys/time.h', 'HAVE_SYS_TIME_H', 'c'),
+ ('sys/types.h', 'HAVE_SYS_TYPES_H', 'c'),
+ ('sys/utime.h', 'HAVE_SYS_UTIME_H', 'c'),
+ ('sys/socket.h', 'HAVE_SYS_SOCKET_H', 'c'),
+ ('unistd.h', 'HAVE_UNISTD_H', 'c'),
+ ('utime.h', 'HAVE_UTIME_H', 'c'),
+ ('istream', 'HAVE_ISTREAM', 'cxx'),
+ ('ostream', 'HAVE_OSTREAM', 'cxx'),
+ ('ios', 'HAVE_IOS', 'cxx')
+]
+
+for header in headers:
+ if (header[2] == 'c' and conf.CheckCHeader(header[0])) or \
+ (header[2] == 'cxx' and conf.CheckCXXHeader(header[0])):
+ utils.addToConfig('#define %s 1' % header[1])
+ else:
+ utils.addToConfig('/* #undef %s */' % header[1])
+
+# HAVE_OPEN
+# HAVE_CLOSE
+# HAVE_POPEN
+# HAVE_PCLOSE
+# HAVE__OPEN
+# HAVE__CLOSE
+# HAVE__POPEN
+# HAVE__PCLOSE
+# HAVE_GETPID
+# HAVE__GETPID
+# HAVE_MKDIR
+# HAVE__MKDIR
+# HAVE_MKTEMP
+# HAVE_MKSTEMP
+# HAVE_STRERROR
+
+# Check functions
+functions = [
+ ('open', 'HAVE_OPEN'),
+ ('close', 'HAVE_CLOSE'),
+ ('popen', 'HAVE_POPEN'),
+ ('pclose', 'HAVE_PCLOSE'),
+ ('_open', 'HAVE__OPEN'),
+ ('_close', 'HAVE__CLOSE'),
+ ('_popen', 'HAVE__POPEN'),
+ ('_pclose', 'HAVE__PCLOSE'),
+ ('getpid', 'HAVE_GETPID'),
+ ('_getpid', 'HAVE__GETPID'),
+ ('mkdir', 'HAVE_MKDIR'),
+ ('_mkdir', 'HAVE__MKDIR'),
+ ('mktemp', 'HAVE_MKTEMP'),
+ ('mkstemp', 'HAVE_MKSTEMP'),
+ ('strerror', 'HAVE_STRERROR')
+]
+
+for func in functions:
+ if conf.CheckFunc(func[0]):
+ utils.addToConfig('#define %s 1' % func[1])
+ else:
+ utils.addToConfig('/* #undef %s */' % func[1])
+
+# PACKAGE
+# PACKAGE_VERSION
+# DEVEL_VERSION
+utils.addToConfig('#define PACKAGE "%s"' % PACKAGE)
+utils.addToConfig('#define PACKAGE_VERSION "%s"' % PACKAGE_VERSION)
+if DEVEL_VERSION:
+ utils.addToConfig('#define DEVEL_VERSION 1')
+
+# ENABLE_ASSERTIONS
+# ENABLE_NLS
+# WITH_WARNINGS
+# _GLIBCXX_CONCEPT_CHECKS
+
+# items are (ENV, ARGUMENTS)
+values = [
+ ('ENABLE_ASSERTIONS', 'assertions'),
+ ('ENABLE_NLS', 'nls'),
+ ('WITH_WARNINGS', 'warnings'),
+ ('_GLIBCXX_CONCEPT_CHECKS', 'concept_checks'),
+]
+
+for val in values:
+ if (env.has_key(val[0]) and env[val[0]]) or \
+ ARGUMENTS.get(val[1]):
+ utils.addToConfig('#define %s 1' % val[0])
+ else:
+ utils.addToConfig('/* #undef %s */' % val[0])
+
+# AIKSAURUS_H_LOCATION
+if ARGUMENTS.get('aiksaurus'):
+ if conf.CheckLib('Aiksaurus'):
+ utils.addToConfig("#define AIKSAURUS_H_LOCATION")
+ else:
+ print 'Library Aiksaurus not found'
+ Exit(2)
+
+# USE_ASPELL
+# USE_PSPELL
+# USE_ISPELL
+
+# determine headers to use
+spell_engine = ARGUMENTS.get('spell', 'auto')
+spell_detected = False
+if spell_engine in ['auto', 'aspell'] and \
+ conf.CheckLibWithHeader('aspell', 'aspell.h', 'C'):
+ utils.addToConfig('#define USE_ASPELL 1')
+ spell_detected = True
+elif spell_engine in ['auto', 'pspell'] and \
+ conf.CheckLibWithHeader('pspell', 'pspell.h', 'C'):
+ utils.addToConfig('#define USE_PSPELL 1')
+ spell_detected = True
+elif spell_engine in ['auto', 'ispell'] and \
+ conf.CheckLibWithHeader('ispell', 'ispell.h', 'C'):
+ utils.addToConfig('#define USE_ISPELL 1')
+ spell_detected = False
+
+if not spell_detected:
+ # FIXME: can lyx work without an spell engine
+ if spell_engine == 'auto':
+ print "Warning: Can not locate any spell checker"
+ else:
+ print "Warning: Can not locate specified spell checker:", spell_engine
+
+# USE_POSIX_PACKAGING
+# USE_MACOSX_PACKAGING
+# USE_WINDOWS_PACKAGING
+if packaging_method == 'windows':
+ utils.addToConfig('#define USE_WINDOWS_PACKAGING 1')
+elif packaging_method == 'posix':
+ utils.addToConfig('#define USE_POSIX_PACKAGING 1')
+elif packaging_method == 'mac':
+ utils.addToConfig('#define USE_MACOSX_PACKAGING 1')
+
+# BOOST_POSIX
+if boost_posix:
+ utils.addToConfig('#define BOOST_POSIX 1')
+else:
+ utils.addToConfig('/* #undef BOOST_POSIX */')
+
+# HAVE_PUTENV
+if conf.CheckPutenv():
+ utils.addToConfig('#define HAVE_PUTENV 1')
+else:
+ utils.addToConfig('/* #undef HAVE_PUTENV */')
+
+# HAVE_DECL_ISTREAMBUF_ITERATOR
+if conf.CheckIstreambufIterator():
+ utils.addToConfig('#define HAVE_DECL_ISTREAMBUF_ITERATOR 1')
+else:
+ utils.addToConfig('/* #undef HAVE_DECL_ISTREAMBUF_ITERATOR */')
+
+# MKDIR_TAKES_ONE_ARG
+if conf.CheckMkdirOneArg():
+ utils.addToConfig('#define MKDIR_TAKES_ONE_ARG 1')
+else:
+ utils.addToConfig('/* #undef MKDIR_TAKES_ONE_ARG */')
+
+# HAVE_STD_COUNT
+if conf.CheckStdCount():
+ utils.addToConfig('#define HAVE_STD_COUNT 1')
+else:
+ utils.addToConfig('/* #undef HAVE_STD_COUNT */')
+
+# SELECT_TYPE_ARG1
+# SELECT_TYPE_ARG234
+# SELECT_TYPE_ARG5
+(arg1, arg234, arg5) = conf.CheckSelectArgType()
+utils.addToConfig('#define SELECT_TYPE_ARG1 %s' % arg1)
+utils.addToConfig('#define SELECT_TYPE_ARG234 %s' % arg234)
+utils.addToConfig('#define SELECT_TYPE_ARG5 %s' % arg5)
+
+# mkstemp
+# USE_BOOST_FORMAT
+# WANT_GETFILEATTRIBUTESEX_WRAPPER
+utils.endConfigH(config_h)
+
+#
+# Finish auto-configuration
+env = conf.Finish()
+
+#----------------------------------------------------------
+# Now set up our build process accordingly
+#----------------------------------------------------------
+
+#
+# QT_LIB etc (EXTRA_LIBS holds lib for each frontend)
+#
+# NOTE: Tool('qt') or Tool('qt4') will be loaded later
+# in their respective directory and specialized env.
+try:
+ if frontend == 'qt3':
+ # note: env.Tool('qt') my set QT_LIB to qt
+ env['QT_LIB'] = 'qt-mt'
+ env['EXTRA_LIBS'] = ['qt-mt']
+ if platform_name == 'cygwin' and use_X11:
+ env['EXTRA_LIBS'] += ['GL', 'Xmu', 'Xi', 'Xrender', 'Xrandr', 'Xcursor',
+ 'Xft', 'freetype', 'fontconfig', 'Xext', 'X11', 'SM', 'ICE', 'resolv',
+ 'pthread']
+ env.Append(LIBPATH = ['/usr/X11R6/lib'])
+ elif frontend == 'qt4':
+ # local qt4 toolset from
+ # http://www.iua.upf.es/~dgarcia/Codders/sconstools.html
+ env['QT_LIB'] = ['QtCore', 'QtGui', 'Qt3Support']
+ env['EXTRA_LIBS'] = env['QT_LIB']
+except:
+ print "Can not locate qt tools"
+ print "What I get is "
+ print " QTDIR: ", env['QTDIR']
+
+#
+# Build parameters CPPPATH etc
+#
+# boost is always in
+env.Append(CPPPATH = ['#boost', '#src'])
+
+# TODO: add (more) appropriate compiling options (-DNDEBUG etc)
+# for debug/release mode
+if ARGUMENTS.get('mode', default_build_mode) == 'debug':
+ env.Append(CCFLAGS = [])
+else:
+ env.Append(CCFLAGS = [])
+
+#
+# Customized builders
+#
+# install customized builders
+env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
+# FIXME: there must be a better way.
+env['BUILDERS']['fileCopy'] = Builder(action = utils.env_filecopy)
+
+#
+# A Link script for cygwin see
+# http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
+# http://www.cygwin.com/ml/cygwin-apps/2004-09/msg00309.html
+# for details
+#
+if platform_name == 'cygwin' and env['frontend'] == 'qt3':
+ ld_script_path = '/usr/lib/qt3/mkspecs/cygwin-g++'
+ ld_script = utils.installCygwinLDScript(ld_script_path)
+ env.Append(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc -Wl,--script,%s -Wl,-s' % ld_script])
+
+
+#
+# Report results
+#
+# src/support/package.C.in needs the following to replace
+env['LYX_DIR'] = LYX_DIR
+env['LOCALEDIR'] = LOCALEDIR
+env['TOP_SRCDIR'] = str(Dir('#'))
+env['PROGRAM_SUFFIX'] = PROGRAM_SUFFIX
+# needed by src/version.C.in => src/version.C
+env['PACKAGE_VERSION'] = PACKAGE_VERSION
+# fill in the version info
+env['VERSION_INFO'] = '''Configuration
+ Host type: %s
+ Special build flags: %s
+ C Compiler: %s
+ C Compiler flags: %s %s
+ C++ Compiler: %s
+ C++ Compiler LyX flags: %s
+ C++ Compiler flags: %s %s
+ Linker flags: %s
+ Linker user flags: %s
+Build info:
+ Builing directory: %s
+ Local library directory: %s
+ Libraries pathes: %s
+ Boost libraries: %s
+Frontend:
+ Frontend: %s
+ Packaging: %s
+ LyX binary dir: FIXME
+ LyX files dir: FIXME
+''' % (platform_name,
+ env.subst('$CCFLAGS'), env.subst('$CC'),
+ env.subst('$CPPFLAGS'), env.subst('$CFLAGS'),
+ env.subst('$CXX'), env.subst('$CXXFLAGS'),
+ env.subst('$CPPFLAGS'), env.subst('$CXXFLAGS'),
+ env.subst('$LINKFLAGS'), env.subst('$LINKFLAGS'),
+ env.subst('$BUILDDIR'), env.subst('$LOCALLIBPATH'),
+ str(env['LIBPATH']), str(env['BOOST_LIBRARIES']),
+ env['frontend'], packaging_method)
+
+if env['frontend'] in ['qt3', 'qt4']:
+ env['VERSION_INFO'] += ''' include dir: %s
+ library dir: %s
+ X11: %s
+''' % (env.subst('$QT_INC_PATH'), env.subst('$QT_LIB_PATH'), use_X11)
+
+print env['VERSION_INFO']
+
+#
+# Mingw command line may be too short for our link usage,
+# Here we use a trick from scons wiki
+# http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/LongCmdLinesOnWin32
+#
+# I also would like to add logging (commands only) capacity to the
+# spawn system.
+logfile = ARGUMENTS.get('logfile', default_log_file)
+if logfile != '' or platform_name == 'win32':
+ import time
+ utils.setLoggedSpawn(env, logfile, longarg = (platform_name == 'win32'),
+ info = '''# This is a log of commands used by scons to build lyx
+# Time: %s
+# Command: %s
+# Info: %s
+''' % (time.asctime(), ' '.join(sys.argv),
+ env['VERSION_INFO'].replace('\n','\n# ')) )
+
+
+#
+# Cleanup stuff
+#
+# save options
+opts.Save('options.cache', env)
+# -h will print out help info
+Help(opts.GenerateHelpText(env))
+
+
+
+#----------------------------------------------------------
+# Start building
+#----------------------------------------------------------
+Export('env')
+env.BuildDir('$BUILDDIR', 'src')
+print "Building all targets recursively"
+
+client = env.SConscript('#$BUILDDIR/client/SConscript')
+lyx = env.SConscript('#$BUILDDIR/SConscript')
+tex2lyx = env.SConscript('#$BUILDDIR/tex2lyx/SConscript')
+
+# avoid using full path to build them
+Alias('client', client)
+Alias('tex2lyx', tex2lyx)
+Alias('lyx', lyx)
+
+Default('lyx', 'tex2lyx')
+
+print "Buinging lyx done with targets", map(str, BUILD_TARGETS)
+
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+# This will be used by all boost libraries
+boostenv = env.Copy()
+boostenv.Append(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"')
+# for config.h
+boostenv.Append(CPPPATH = ['#src'])
+Export('boostenv')
+
+print "Entering boost/libs..."
+
+boost = boostenv.SConscript(
+ dirs = [
+ 'filesystem/src',
+ 'iostreams/src',
+ 'regex/src',
+ 'signals/src'
+ ]
+)
+
+# Return boost libraries
+Return('boost')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('boostenv')
+
+print 'Entering boost/libs/filesystem/src...'
+
+filesystem = boostenv.StaticLibrary(
+ target = '$LOCALLIBPATH/boost_filesystem',
+ source = Split('''
+ convenience.cpp
+ exception.cpp
+ operations_posix_windows.cpp
+ path_posix_windows.cpp
+ ''')
+)
+
+# Return the library
+Return('filesystem')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('boostenv')
+
+print 'Entering boost/libs/iostreams/src...'
+
+iostreams = boostenv.StaticLibrary(
+ target = '$LOCALLIBPATH/boost_iostreams',
+ source = Split('''
+ file_descriptor.cpp
+ mapped_file.cpp
+ zlib.cpp
+ ''')
+)
+
+# Return the library
+Return('iostreams')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('boostenv')
+
+print 'Entering boost/libs/regex/src...'
+
+regex = boostenv.StaticLibrary(
+ target = '$LOCALLIBPATH/boost_regex',
+ source = Split('''
+ cpp_regex_traits.cpp
+ c_regex_traits.cpp
+ cregex.cpp
+ fileiter.cpp
+ instances.cpp
+ regex.cpp
+ regex_raw_buffer.cpp
+ regex_traits_defaults.cpp
+ w32_regex_traits.cpp
+ ''')
+)
+
+# Return the library
+Return('regex')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('boostenv')
+
+print 'Entering boost/libs/signals/src...'
+
+signals = boostenv.StaticLibrary(
+ target = '$LOCALLIBPATH/boost_signals',
+ source = Split('''
+ connection.cpp
+ named_slot_map.cpp
+ signal_base.cpp
+ slot.cpp
+ trackable.cpp
+ ''')
+)
+
+# Return the library
+Return('signals')
--- /dev/null
+import re
+import os.path
+
+import SCons.Defaults
+import SCons.Tool
+import SCons.Util
+
+
+class ToolQtWarning(SCons.Warnings.Warning):
+ pass
+class GeneratedMocFileNotIncluded(ToolQtWarning):
+ pass
+class QtdirNotFound(ToolQtWarning):
+ pass
+SCons.Warnings.enableWarningClass(ToolQtWarning)
+
+qrcinclude_re = re.compile(r'<file>([^<]*)</file>', re.M)
+
+
+header_extensions = [".h", ".hxx", ".hpp", ".hh"]
+if SCons.Util.case_sensitive_suffixes('.h', '.H'):
+ header_extensions.append('.H')
+#cplusplus = __import__('c++', globals(), locals(), ['Scons.Tools'])
+#cxx_suffixes = cplusplus.CXXSuffixes
+cxx_suffixes = [".c", ".cxx", ".cpp", ".cc", ".C"]
+
+def _checkMocIncluded(target, source, env):
+ moc = target[0]
+ cpp = source[0]
+ # looks like cpp.includes is cleared before the build stage :-(
+ # not really sure about the path transformations (moc.cwd? cpp.cwd?) :-/
+ path = SCons.Defaults.CScan.path_function(env, moc.cwd)
+ includes = SCons.Defaults.CScan(cpp, env, path)
+ if not moc in includes:
+ SCons.Warnings.warn(
+ GeneratedMocFileNotIncluded,
+ "Generated moc file '%s' is not included by '%s'" %
+ (str(moc), str(cpp)))
+
+def _find_file(filename, paths, node_factory):
+ retval = None
+ for dir in paths:
+ node = node_factory(filename, dir)
+ if node.rexists():
+ return node
+ return None
+
+class _Automoc:
+ """
+ Callable class, which works as an emitter for Programs, SharedLibraries and
+ StaticLibraries.
+ """
+
+ def __init__(self, objBuilderName):
+ self.objBuilderName = objBuilderName
+
+ def __call__(self, target, source, env):
+ """
+ Smart autoscan function. Gets the list of objects for the Program
+ or Lib. Adds objects and builders for the special qt files.
+ """
+ try:
+ if int(env.subst('$QT_AUTOSCAN')) == 0:
+ return target, source
+ except ValueError:
+ pass
+ try:
+ debug = int(env.subst('$QT_DEBUG'))
+ except ValueError:
+ debug = 0
+
+ # some shortcuts used in the scanner
+ FS = SCons.Node.FS.default_fs
+ splitext = SCons.Util.splitext
+ objBuilder = getattr(env, self.objBuilderName)
+
+ # some regular expressions:
+ # Q_OBJECT detection
+ q_object_search = re.compile(r'[^A-Za-z0-9]Q_OBJECT[^A-Za-z0-9]')
+ # cxx and c comment 'eater'
+ #comment = re.compile(r'(//.*)|(/\*(([^*])|(\*[^/]))*\*/)')
+ # CW: something must be wrong with the regexp. See also bug #998222
+ # CURRENTLY THERE IS NO TEST CASE FOR THAT
+
+ # The following is kind of hacky to get builders working properly (FIXME)
+ objBuilderEnv = objBuilder.env
+ objBuilder.env = env
+ mocBuilderEnv = env.Moc4.env
+ env.Moc4.env = env
+
+ # make a deep copy for the result; MocH objects will be appended
+ out_sources = source[:]
+
+ for obj in source:
+ if not obj.has_builder():
+ # binary obj file provided
+ if debug:
+ print "scons: qt: '%s' seems to be a binary. Discarded." % str(obj)
+ continue
+ cpp = obj.sources[0]
+ if not splitext(str(cpp))[1] in cxx_suffixes:
+ if debug:
+ print "scons: qt: '%s' is no cxx file. Discarded." % str(cpp)
+ # c or fortran source
+ continue
+ #cpp_contents = comment.sub('', cpp.get_contents())
+ cpp_contents = cpp.get_contents()
+ h=None
+ for h_ext in header_extensions:
+ # try to find the header file in the corresponding source
+ # directory
+ hname = splitext(cpp.name)[0] + h_ext
+ h = _find_file(hname,
+ (cpp.get_dir(),),
+ FS.File)
+ if h:
+ if debug:
+ print "scons: qt: Scanning '%s' (header of '%s')" % (str(h), str(cpp))
+ #h_contents = comment.sub('', h.get_contents())
+ h_contents = h.get_contents()
+ break
+ if not h and debug:
+ print "scons: qt: no header for '%s'." % (str(cpp))
+ if h and q_object_search.search(h_contents):
+ # h file with the Q_OBJECT macro found -> add moc_cpp
+ moc_cpp = env.Moc4(h)
+ moc_o = objBuilder(moc_cpp)
+ out_sources.append(moc_o)
+ #moc_cpp.target_scanner = SCons.Defaults.CScan
+ if debug:
+ print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(h), str(moc_cpp))
+ if cpp and q_object_search.search(cpp_contents):
+ # cpp file with Q_OBJECT macro found -> add moc
+ # (to be included in cpp)
+ moc = env.Moc4(cpp)
+ env.Ignore(moc, moc)
+ if debug:
+ print "scons: qt: found Q_OBJECT macro in '%s', moc'ing to '%s'" % (str(cpp), str(moc))
+ #moc.source_scanner = SCons.Defaults.CScan
+ # restore the original env attributes (FIXME)
+ objBuilder.env = objBuilderEnv
+ env.Moc4.env = mocBuilderEnv
+
+ return (target, out_sources)
+
+AutomocShared = _Automoc('SharedObject')
+AutomocStatic = _Automoc('StaticObject')
+
+def _detect(env):
+ """Not really safe, but fast method to detect the QT library"""
+
+ QTDIR = env.get('QTDIR',None)
+ if QTDIR!=None : return QTDIR
+
+ QTDIR = os.environ.get('QTDIR',None)
+ if QTDIR!=None : return QTDIR
+
+ moc = env.WhereIs('moc-qt4') or env.WhereIs('moc')
+ if moc:
+ SCons.Warnings.warn(
+ QtdirNotFound,
+ "QTDIR variable is not defined, using moc executable as a hint (QTDIR=%s)" % QTDIR)
+ return os.path.dirname(os.path.dirname(moc))
+
+ SCons.Warnings.warn(
+ QtdirNotFound,
+ "Could not detect qt, using empty QTDIR")
+ return None
+
+def generate(env):
+ """Add Builders and construction variables for qt to an Environment."""
+
+ print "Loading qt4 tool..."
+
+ def locateQt4Command(env, command, qtdir) :
+ fullpath = env.Detect([command+'-qt4', command])
+ if not (fullpath is None) : return fullpath
+ fullpath1 = os.path.join(qtdir,'bin',command +'-qt4')
+ if os.access(fullpath1, os.X_OK) or \
+ os.access(fullpath1+".exe", os.X_OK):
+ return fullpath1
+ fullpath2 = os.path.join(qtdir,'bin',command)
+ if os.access(fullpath2, os.X_OK) or \
+ os.access(fullpath2+".exe", os.X_OK):
+ return fullpath2
+ raise "Qt4 command '" + command + "' not found. Tried: " + fullpath1 + " and "+ fullpath2
+
+
+ CLVar = SCons.Util.CLVar
+ Action = SCons.Action.Action
+ Builder = SCons.Builder.Builder
+ splitext = SCons.Util.splitext
+
+ # the basics
+ env['QTDIR'] = _detect(env)
+ env['QT4_MOC'] = locateQt4Command(env,'moc', env['QTDIR'])
+ env['QT4_UIC'] = locateQt4Command(env,'uic', env['QTDIR'])
+ env['QT4_RCC'] = locateQt4Command(env,'rcc', env['QTDIR'])
+ env['QT4_LUPDATE'] = locateQt4Command(env,'lupdate', env['QTDIR'])
+ env['QT4_LRELEASE'] = locateQt4Command(env,'lrelease', env['QTDIR'])
+
+ # Should the qt tool try to figure out, which sources are to be moc'ed ?
+ env['QT4_AUTOSCAN'] = 1
+
+ # Some QT specific flags. I don't expect someone wants to
+ # manipulate those ...
+ env['QT4_UICDECLFLAGS'] = CLVar('')
+ env['QT4_MOCFROMHFLAGS'] = CLVar('')
+ env['QT4_MOCFROMCXXFLAGS'] = CLVar('-i')
+ env['QT4_QRCFLAGS'] = ''
+
+ # suffixes/prefixes for the headers / sources to generate
+ env['QT4_MOCHPREFIX'] = 'moc_'
+ env['QT4_MOCHSUFFIX'] = '$CXXFILESUFFIX'
+ env['QT4_MOCCXXPREFIX'] = 'moc_'
+ env['QT4_MOCCXXSUFFIX'] = '.moc'
+ env['QT4_UISUFFIX'] = '.ui'
+ env['QT4_UICDECLPREFIX'] = 'ui_'
+ env['QT4_UICDECLSUFFIX'] = '.h'
+ env['QT4_QRCSUFFIX'] = '.qrc',
+ env['QT4_QRCCXXSUFFIX'] = '$CXXFILESUFFIX'
+ env['QT4_QRCCXXPREFIX'] = 'qrc_'
+
+ env['QT4_LIB'] = '' # KLUDGE to avoid linking qt3 library
+
+ # Translation builder
+ tsbuilder = Builder(
+ action ='$QT4_LUPDATE $SOURCES -ts $TARGETS',
+ multi=1
+ )
+ env.Append( BUILDERS = { 'Ts': tsbuilder } )
+ qmbuilder = Builder(
+ action =[
+ '$QT4_LRELEASE $SOURCE',
+ ],
+ src_suffix = '.ts',
+ suffix = '.qm',
+ single_source = True
+ )
+ env.Append( BUILDERS = { 'Qm': qmbuilder } )
+
+ # Resource builder
+ def scanResources(node, env, path, arg):
+ contents = node.get_contents()
+ includes = qrcinclude_re.findall(contents)
+ return includes
+ qrcscanner = env.Scanner(name = 'qrcfile',
+ function = scanResources,
+ argument = None,
+ skeys = ['.qrc'])
+ qrcbuilder = Builder(
+ action ='$QT4_RCC $QT4_QRCFLAGS $SOURCE -o $TARGET',
+ source_scanner = qrcscanner,
+ src_suffix = '$QT4_QRCSUFFIX',
+ suffix = '$QT4_QRCCXXSUFFIX',
+ prefix = '$QT4_QRCCXXPREFIX',
+ single_source = True
+ )
+ env.Append( BUILDERS = { 'Qrc': qrcbuilder } )
+
+ # Interface builder
+ env['QT4_UIC4COM'] = [
+ CLVar('$QT4_UIC $QT4_UICDECLFLAGS -o ${TARGETS[0]} $SOURCE'),
+ ]
+ uic4builder = Builder(
+ action='$QT4_UIC4COM',
+ src_suffix='$QT4_UISUFFIX',
+ suffix='$QT4_UICDECLSUFFIX',
+ prefix='$QT4_UICDECLPREFIX',
+ single_source = True
+ )
+ env.Append( BUILDERS = { 'Uic4': uic4builder } )
+
+ # Metaobject builder
+ env['QT4_MOCFROMHCOM'] = (
+ '$QT4_MOC $QT4_MOCFROMHFLAGS -o ${TARGETS[0]} $SOURCE')
+ env['QT4_MOCFROMCXXCOM'] = [
+ CLVar('$QT4_MOC $QT4_MOCFROMCXXFLAGS -o ${TARGETS[0]} $SOURCE'),
+ Action(_checkMocIncluded,None)]
+ mocBld = Builder(action={}, prefix={}, suffix={})
+ for h in header_extensions:
+ mocBld.add_action(h, '$QT4_MOCFROMHCOM')
+ mocBld.prefix[h] = '$QT4_MOCHPREFIX'
+ mocBld.suffix[h] = '$QT4_MOCHSUFFIX'
+ for cxx in cxx_suffixes:
+ mocBld.add_action(cxx, '$QT4_MOCFROMCXXCOM')
+ mocBld.prefix[cxx] = '$QT4_MOCCXXPREFIX'
+ mocBld.suffix[cxx] = '$QT4_MOCCXXSUFFIX'
+ env.Append( BUILDERS = { 'Moc4': mocBld } )
+
+ # er... no idea what that was for
+ static_obj, shared_obj = SCons.Tool.createObjBuilders(env)
+ static_obj.src_builder.append('Uic4')
+ shared_obj.src_builder.append('Uic4')
+
+ # We use the emitters of Program / StaticLibrary / SharedLibrary
+ # to scan for moc'able files
+ # We can't refer to the builders directly, we have to fetch them
+ # as Environment attributes because that sets them up to be called
+ # correctly later by our emitter.
+ env.AppendUnique(PROGEMITTER =[AutomocStatic],
+ SHLIBEMITTER=[AutomocShared],
+ LIBEMITTER =[AutomocStatic],
+ # Of course, we need to link against the qt libraries
+ CPPPATH=[os.path.join('$QTDIR', 'include')],
+ LIBPATH=[os.path.join('$QTDIR', 'lib')],
+ LIBS=['$QT4_LIB'])
+
+ import new
+ method = new.instancemethod(enable_modules, env, SCons.Environment)
+ env.EnableQt4Modules=method
+
+def enable_modules(self, modules, debug=False) :
+ import sys
+
+ validModules = [
+ 'QtCore',
+ 'QtGui',
+ 'QtOpenGL',
+ 'Qt3Support',
+ # The next modules have not been tested yet so, please
+ # maybe they require additional work on non Linux platforms
+ 'QtSql',
+ 'QtNetwork',
+ 'QtSvg',
+ 'QtTest',
+ 'QtXml',
+ 'QtUiTools',
+ ]
+ pclessModules = [
+ 'QtUiTools',
+ 'QtUiTools_debug',
+ ]
+ invalidModules=[]
+ for module in modules:
+ if module not in validModules :
+ invalidModules.append(module)
+ if invalidModules :
+ raise "Modules %s are not Qt4 modules. Valid Qt4 modules are: %s"% \
+ (str(invalidModules),str(validModules))
+
+ # TODO: Check whether we should add QT_CORE_LIB, QT_XML_LIB, QT_NETWORK_LIB...
+ if 'QtGui' in modules:
+ self.AppendUnique(CPPFLAGS='-DQT_GUI_LIB')
+
+ if sys.platform == "linux2" :
+ if debug : modules = [module+"_debug" for module in modules]
+ for module in modules :
+ if module in pclessModules :
+ # self.AppendUnique(LIBS=[module])
+ self.AppendUnique(LIBPATH=[os.path.join(self["QTDIR"],"lib",module)])
+ self.AppendUnique(CPPPATH=[os.path.join(self["QTDIR"],"include","qt4",module)])
+ modules.remove(module)
+ self.ParseConfig('PKG_CONFIG_PATH=%s/lib/pkgconfig pkg-config %s --libs --cflags'%
+ (
+ self['QTDIR'],
+ ' '.join(modules)))
+ return
+ if sys.platform == "win32" :
+ if debug : debugSuffix = 'd'
+ else : debugSuffix = ''
+ self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules])
+ if 'QtOpenGL' in modules:
+ self.AppendUnique(LIBS=['opengl32'])
+ self.AppendUnique(CPPPATH=[ '$QTDIR/include/'+module
+ for module in modules])
+ self.AppendUnique(LIBPATH=['$QTDIR/lib'])
+
+
+def exists(env):
+ return _detect(env)
+
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+#
+# file scons_utils.py
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+#
+# This file defines all the utility functions for the
+# scons-based build system of lyx
+#
+
+import os, sys, re, shutil, glob
+
+def writeToFile(filename, lines, append = False):
+ " utility function: write or append lines to filename "
+ if append:
+ file = open(filename, 'a')
+ else:
+ file = open(filename, 'w')
+ file.write(lines)
+ file.close()
+
+
+def addToConfig(lines):
+ ''' utility function: shortcut for appending lines to outfile
+ add newline at the end of lines.
+ '''
+ if lines.strip() != '':
+ writeToFile(os.path.join('src', 'config.h'),
+ lines + '\n\n', append = True)
+
+
+def printEnvironment(env, keys=[]):
+ ''' used to check profile settings '''
+ dict = env.Dictionary()
+ if len(keys) == 0:
+ keys = dict.keys()
+ keys.sort()
+ for key in keys:
+ try:
+ # try to expand, but this is not always possible
+ print key, '=', env.subst('$'+key)
+ except:
+ print '<<UNEXPANDED>>:', key, '=', dict[key]
+
+
+def env_subst(target, source, env):
+ ''' subst variables in source by those in env, and output to target
+ source and target are scons File() objects
+
+ %key% (not key itself) is an indication of substitution
+ '''
+ assert len(target) == 1
+ assert len(source) == 1
+ target_file = file(str(target[0]), "w")
+ source_file = file(str(source[0]), "r")
+
+ contents = source_file.read()
+ for (k, v) in env.items():
+ try:
+ contents = re.sub('%'+k+'%', v, contents)
+ except:
+ pass
+ target_file.write(contents + "\n")
+ target_file.close()
+ #st = os.stat(str(source[0]))
+ #os.chmod(str(target[0]), stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
+
+
+def env_filecopy(target, source, env):
+ shutil.copy(str(source[0]), str(target[0]))
+
+
+#
+# autoconf tests
+#
+
+def checkPkgConfig(conf, version):
+ ''' Return false if pkg_config does not exist, or is too old '''
+ conf.Message('Checking for pkg-config...')
+ ret = conf.TryAction('pkg-config --atleast-pkgconfig-version=%s' % version)[0]
+ conf.Result(ret)
+ return ret
+
+
+def checkPackage(conf, pkg):
+ ''' check if pkg is under the control of conf '''
+ conf.Message('Checking for package %s...' % pkg)
+ print "pkg-config --exists %s" % pkg
+ ret = conf.TryAction("pkg-config --print-errors --exists %s" % pkg)[0]
+ conf.Result(ret)
+ return ret
+
+
+def startConfigH(config_h):
+ ''' Write the first part of config.h '''
+ writeToFile(config_h,
+'''/* src/config.h. Generated by scon. */
+
+/* -*- C++ -*- */
+/*
+ * \file config.h
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
+ *
+ * This is the compilation configuration file for LyX.
+ * It was generated by scon.
+ * You might want to change some of the defaults if something goes wrong
+ * during the compilation.
+ */
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+''')
+
+
+def endConfigH(config_h):
+ ''' Write the last part of config.h '''
+ writeToFile(config_h, '''
+/************************************************************
+ ** You should not need to change anything beyond this point */
+
+#ifndef HAVE_STRERROR
+#if defined(__cplusplus)
+extern "C"
+#endif
+char * strerror(int n);
+#endif
+
+#ifdef HAVE_MKSTEMP
+#ifndef HAVE_DECL_MKSTEMP
+#if defined(__cplusplus)
+extern "C"
+#endif
+int mkstemp(char*);
+#endif
+#endif
+
+#ifdef __EMX__
+# include "support/os2_defines.h"
+#endif
+
+#if defined(HAVE_OSTREAM) && defined(HAVE_LOCALE) && defined(HAVE_SSTREAM)
+# define USE_BOOST_FORMAT 1
+#else
+# define USE_BOOST_FORMAT 0
+#endif
+
+#define BOOST_USER_CONFIG <config.h>
+
+#if !defined(ENABLE_ASSERTIONS)
+# define BOOST_DISABLE_ASSERTS 1
+#endif
+#define BOOST_ENABLE_ASSERT_HANDLER 1
+
+#define BOOST_DISABLE_THREADS 1
+#define BOOST_NO_WREGEX 1
+#define BOOST_NO_WSTRING 1
+
+#ifdef __CYGWIN__
+# define BOOST_POSIX 1
+#endif
+
+#if defined(HAVE_NEWAPIS_H)
+# define WANT_GETFILEATTRIBUTESEX_WRAPPER 1
+#endif
+
+#endif
+''', append=True)
+
+
+#HAVE_PUTENV
+def checkPutenv(conf):
+ check_putenv_source = """
+#include <stdlib.h>
+int main()
+{
+ putenv("");
+ return(0);
+}
+"""
+ conf.Message('Checking for putenv... ')
+ ret = conf.TryLink(check_putenv_source, '.c')
+ conf.Result(ret)
+ return ret
+
+
+#HAVE_DECL_ISTREAMBUF_ITERATOR
+def checkIstreambufIterator(conf):
+ check_istreambuf_iterator_source = """
+#include <streambuf>
+#include <istream>
+int main()
+{
+ std::istreambuf_iterator<std::istream> iter;
+ return 0;
+}
+"""
+ conf.Message('Checking for iostreambuf::iterator... ')
+ ret = conf.TryLink(check_istreambuf_iterator_source, '.cpp')
+ conf.Result(ret)
+ return ret
+
+
+#MKDIR_TAKES_ONE_ARG
+def checkMkdirOneArg(conf):
+ check_mkdir_one_arg_source = """
+#include <sys/stat.h>
+int main()
+{
+ mkdir("somedir");
+}
+"""
+ conf.Message('Checking for the number of args for mkdir... ')
+ ret = conf.TryLink(check_mkdir_one_arg_source, '.c')
+ if ret:
+ conf.Result('one')
+ else:
+ conf.Result('two')
+ return ret
+
+
+#HAVE_STD_COUNT
+def checkStdCount(conf):
+ check_std_count_source = """
+#include <algorithm>
+using std::count;
+int countChar(char * b, char * e, char const c)
+{
+ return count(b, e, c);
+}
+
+int main()
+{
+ char a[] = "hello";
+ int i = countChar(a, a + 5, 'l');
+}
+"""
+ conf.Message('Checking for std::count... ')
+ ret = conf.TryLink(check_std_count_source, '.cpp')
+ conf.Result(ret)
+ return ret
+
+
+# SELECT_TYPE_ARG1
+# SELECT_TYPE_ARG234
+# SELECT_TYPE_ARG5
+def checkSelectArgType(conf):
+ ''' Adapted from autoconf '''
+ conf.Message('Checking for arg types for select... ')
+ for arg234 in ['fd_set *', 'int *', 'void *']:
+ for arg1 in ['int', 'size_t', 'unsigned long', 'unsigned']:
+ for arg5 in ['struct timeval *', 'const struct timeval *']:
+ check_select_source = '''
+#if HAVE_SYS_SELECT_H
+# include <sys/select.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif
+extern int select (%s, %s, %s, %s, %s);
+int main()
+{
+ return(0);
+}
+''' % (arg1, arg234, arg234, arg234, arg5)
+ ret = conf.TryLink(check_select_source, '.c')
+ if ret:
+ conf.Result(ret)
+ return (arg1, arg234, arg5)
+ conf.Result('no (use default)')
+ return ('int', 'int *', 'struct timeval *')
+
+
+def checkBoostLibraries(conf, lib, pathes):
+ ''' look for boost libraries '''
+ conf.Message('Checking for boost library %s... ' % lib)
+ for path in pathes:
+ # direct form: e.g. libboost_iostreams.a
+ if os.path.isfile(os.path.join(path, 'lib%s.a' % lib)):
+ conf.Result('yes')
+ return (path, lib)
+ # check things like libboost_iostreams-gcc.a
+ # I know, this does not look clever ...
+ files = glob.glob(os.path.join(path, 'lib%s-[a-z][a-z].a' % lib)) + \
+ glob.glob(os.path.join(path, 'lib%s-[a-z][a-z][a-z].a' % lib)) + \
+ glob.glob(os.path.join(path, 'lib%s-[a-z][a-z][a-z][a-z].a' % lib))
+ # and not clean
+ if len(files) >= 1:
+ # get xxx-gcc from /usr/local/lib/libboost_xxx-gcc.a
+ conf.Result('yes')
+ return (path, files[0].split(os.sep)[-1][3:-2])
+ conf.Result('n')
+ return ('','')
+
+
+import SCons.Node
+def processLang(env, folder):
+ """ Process translations (.po files) in a po/ dir
+ This is copied from KDE knetstats-1.5/admin/kde.py
+
+ FIXME: imcomplete
+ """
+ import glob
+ dir=SCons.Node.FS.default_fs.Dir(folder).srcnode()
+ fld=dir.srcnode()
+ tmptransfiles = glob.glob(str(fld)+'/*.po')
+
+ transfiles=[]
+ if env.has_key('_BUILDDIR_'):
+ bdir=env['_BUILDDIR_']
+ for dir in env.make_list(tmptransfiles):
+ transfiles.append( env.join(bdir, dir) )
+ else:
+ transfiles=tmptransfiles
+
+ env['MSGFMT'] = 'msgfmt'
+ env['BUILDERS']['Transfiles']=SCons.Builder.Builder(action='$MSGFMT $SOURCE -o $TARGET',suffix='.gmo',src_suffix='.po')
+ languages=None
+ # FIXME: KDE has this ARGS thing...
+ #if env['ARGS'] and env['ARGS'].has_key('languages'):
+ # languages=env.make_list(env['ARGS']['languages'])
+ mydir=SCons.Node.FS.default_fs.Dir('.')
+ for f in transfiles:
+ fname=f.replace(mydir.abspath, '')
+ file=SCons.Node.FS.default_fs.File(fname)
+ country = SCons.Util.splitext(file.name)[0]
+ if not languages or country in languages:
+ result = env.Transfiles(file)
+ # FIXME
+ # dir=env.join( getInstDirForResType(env, 'KDELOCALE'), country)
+ # env.bksys_install(env.join(dir, 'LC_MESSAGES'), result, destfile=appname+'.mo')
+
+
+def installCygwinLDScript(path):
+ ''' Install i386pe.x-no-rdata '''
+ ld_script = os.path.join(path, 'i386pe.x-no-rdata')
+ script = open(ld_script, 'w')
+ script.write('''/* specific linker script avoiding .rdata sections, for normal executables
+for a reference see
+http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
+http://www.cygwin.com/ml/cygwin-apps/2004-09/msg00309.html
+*/
+OUTPUT_FORMAT(pei-i386)
+SEARCH_DIR("/usr/i686-pc-cygwin/lib"); SEARCH_DIR("/usr/lib"); SEARCH_DIR("/usr/lib/w32api");
+ENTRY(_mainCRTStartup)
+SECTIONS
+{
+ .text __image_base__ + __section_alignment__ :
+ {
+ *(.init)
+ *(.text)
+ *(SORT(.text$*))
+ *(.glue_7t)
+ *(.glue_7)
+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
+ LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*)); LONG (0);
+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
+ LONG (-1); *(.dtors); *(.dtor); *(SORT(.dtors.*)); LONG (0);
+ *(.fini)
+ /* ??? Why is .gcc_exc here? */
+ *(.gcc_exc)
+ PROVIDE (etext = .);
+ *(.gcc_except_table)
+ }
+ /* The Cygwin32 library uses a section to avoid copying certain data
+ on fork. This used to be named ".data". The linker used
+ to include this between __data_start__ and __data_end__, but that
+ breaks building the cygwin32 dll. Instead, we name the section
+ ".data_cygwin_nocopy" and explictly include it after __data_end__. */
+ .data BLOCK(__section_alignment__) :
+ {
+ __data_start__ = . ;
+ *(.data)
+ *(.data2)
+ *(SORT(.data$*))
+ *(.rdata)
+ *(SORT(.rdata$*))
+ *(.eh_frame)
+ ___RUNTIME_PSEUDO_RELOC_LIST__ = .;
+ __RUNTIME_PSEUDO_RELOC_LIST__ = .;
+ *(.rdata_runtime_pseudo_reloc)
+ ___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
+ __RUNTIME_PSEUDO_RELOC_LIST_END__ = .;
+ __data_end__ = . ;
+ *(.data_cygwin_nocopy)
+ }
+ .rdata BLOCK(__section_alignment__) :
+ {
+ }
+ .pdata BLOCK(__section_alignment__) :
+ {
+ *(.pdata)
+ }
+ .bss BLOCK(__section_alignment__) :
+ {
+ __bss_start__ = . ;
+ *(.bss)
+ *(COMMON)
+ __bss_end__ = . ;
+ }
+ .edata BLOCK(__section_alignment__) :
+ {
+ *(.edata)
+ }
+ /DISCARD/ :
+ {
+ *(.debug$S)
+ *(.debug$T)
+ *(.debug$F)
+ *(.drectve)
+ }
+ .idata BLOCK(__section_alignment__) :
+ {
+ /* This cannot currently be handled with grouped sections.
+ See pe.em:sort_sections. */
+ SORT(*)(.idata$2)
+ SORT(*)(.idata$3)
+ /* These zeroes mark the end of the import list. */
+ LONG (0); LONG (0); LONG (0); LONG (0); LONG (0);
+ SORT(*)(.idata$4)
+ SORT(*)(.idata$5)
+ SORT(*)(.idata$6)
+ SORT(*)(.idata$7)
+ }
+ .CRT BLOCK(__section_alignment__) :
+ {
+ ___crt_xc_start__ = . ;
+ *(SORT(.CRT$XC*)) /* C initialization */
+ ___crt_xc_end__ = . ;
+ ___crt_xi_start__ = . ;
+ *(SORT(.CRT$XI*)) /* C++ initialization */
+ ___crt_xi_end__ = . ;
+ ___crt_xl_start__ = . ;
+ *(SORT(.CRT$XL*)) /* TLS callbacks */
+ /* ___crt_xl_end__ is defined in the TLS Directory support code */
+ ___crt_xp_start__ = . ;
+ *(SORT(.CRT$XP*)) /* Pre-termination */
+ ___crt_xp_end__ = . ;
+ ___crt_xt_start__ = . ;
+ *(SORT(.CRT$XT*)) /* Termination */
+ ___crt_xt_end__ = . ;
+ }
+ .tls BLOCK(__section_alignment__) :
+ {
+ ___tls_start__ = . ;
+ *(.tls)
+ *(.tls$)
+ *(SORT(.tls$*))
+ ___tls_end__ = . ;
+ }
+ .endjunk BLOCK(__section_alignment__) :
+ {
+ /* end is deprecated, don't use it */
+ PROVIDE (end = .);
+ PROVIDE ( _end = .);
+ __end__ = .;
+ }
+ .rsrc BLOCK(__section_alignment__) :
+ {
+ *(.rsrc)
+ *(SORT(.rsrc$*))
+ }
+ .reloc BLOCK(__section_alignment__) :
+ {
+ *(.reloc)
+ }
+ .stab BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.stab)
+ }
+ .stabstr BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.stabstr)
+ }
+ /* DWARF debug sections.
+ Symbols in the DWARF debugging sections are relative to the beginning
+ of the section. Unlike other targets that fake this by putting the
+ section VMA at 0, the PE format will not allow it. */
+ /* DWARF 1.1 and DWARF 2. */
+ .debug_aranges BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_aranges)
+ }
+ .debug_pubnames BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_pubnames)
+ }
+ /* DWARF 2. */
+ .debug_info BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_info) *(.gnu.linkonce.wi.*)
+ }
+ .debug_abbrev BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_abbrev)
+ }
+ .debug_line BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_line)
+ }
+ .debug_frame BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_frame)
+ }
+ .debug_str BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_str)
+ }
+ .debug_loc BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_loc)
+ }
+ .debug_macinfo BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_macinfo)
+ }
+ /* SGI/MIPS DWARF 2 extensions. */
+ .debug_weaknames BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_weaknames)
+ }
+ .debug_funcnames BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_funcnames)
+ }
+ .debug_typenames BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_typenames)
+ }
+ .debug_varnames BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_varnames)
+ }
+ /* DWARF 3. */
+ .debug_ranges BLOCK(__section_alignment__) (NOLOAD) :
+ {
+ *(.debug_ranges)
+ }
+}
+''')
+ script.close()
+ return(ld_script)
+
+
+class loggedSpawn:
+ def __init__(self, env, logfile, longarg, info):
+ # save the spawn system
+ self.env = env
+ self.logfile = logfile
+ # clear the logfile (it may not exist)
+ if logfile != '':
+ # this will overwrite existing content.
+ writeToFile(logfile, info, append=False)
+ #
+ self.longarg = longarg
+ # get hold of the old spawn? (necessary?)
+ self._spawn = env['SPAWN']
+
+ # define new SPAWN
+ def spawn(self, sh, escape, cmd, args, spawnenv):
+ # get command line
+ newargs = ' '.join(map(escape, args[1:]))
+ cmdline = cmd + " " + newargs
+ #
+ # if log is not empty, write to it
+ if self.logfile != '':
+ # this tend to be slow (?) but ensure correct output
+ # Note that cmdline may be long so I do not escape it
+ try:
+ # since this is not an essential operation, proceed if things go wrong here.
+ writeToFile(self.logfile, cmd + " " + ' '.join(args[1:]) + '\n', append=True)
+ except:
+ print "Warning: can not write to log file ", self.logfile
+ #
+ # if the command is not too long, use the old
+ if not self.longarg or len(cmdline) < 8000:
+ exit_code = self._spawn(sh, escape, cmd, args, spawnenv)
+ else:
+ sAttrs = win32security.SECURITY_ATTRIBUTES()
+ StartupInfo = win32process.STARTUPINFO()
+ for var in spawnenv:
+ spawnenv[var] = spawnenv[var].encode('ascii', 'replace')
+ # check for any special operating system commands
+ if cmd == 'del':
+ for arg in args[1:]:
+ win32file.DeleteFile(arg)
+ exit_code = 0
+ else:
+ # otherwise execute the command.
+ hProcess, hThread, dwPid, dwTid = win32process.CreateProcess(None, cmdline, None, None, 1, 0, spawnenv, None, StartupInfo)
+ win32event.WaitForSingleObject(hProcess, win32event.INFINITE)
+ exit_code = win32process.GetExitCodeProcess(hProcess)
+ win32file.CloseHandle(hProcess);
+ win32file.CloseHandle(hThread);
+ return exit_code
+
+
+def setLoggedSpawn(env, logfile = '', longarg=False, info=''):
+ ''' This function modify env and allow logging of
+ commands to a logfile. If the argument is too long
+ a win32 spawn will be used instead of the system one
+ '''
+ if longarg:
+ import win32file
+ import win32event
+ import win32process
+ import win32security
+ import string
+ #
+ # create a new spwn object
+ ls = loggedSpawn(env, logfile, longarg, info)
+ # replace the old SPAWN by the new function
+ env['SPAWN'] = ls.spawn
+
+
+## def CheckPython(context, minver):
+## context.Message('Checking for Python >= %s...' % '.'.join(str(x) for x in minver))
+## try:
+## python = context.env['PYTHON']
+## except KeyError:
+## try:
+## python = os.environ['PYTHON']
+## except KeyError:
+## python = WhereIs("python")
+## if not python:
+## python = python = WhereIs("python%i.%i" % (minver[0], minver[1]))
+## minverhex = 0
+## minver = list(minver) + [0, 0, 0, 0]
+## for i in xrange(0, 4):
+## minverhex = (minverhex << 8) + minver[i]
+## prog = "import sys; sys.exit(sys.hexversion >= %s)" % minverhex
+## if python is None:
+## python = 'python'
+## try:
+## result = Popen([python, "-c", prog]).wait()
+## except OSError:
+## context.Result(False)
+## return False
+## context.Result(result)
+## if result:
+## context.env.Replace(PYTHON=python)
+## proc = Popen([python, "-c", "import sys; print sys.version[:3]"], stdout=PIPE)
+## pyver = proc.communicate()[0].rstrip()
+## context.env.Replace(PYTHON_VERSION=pyver)
+## context.env.Replace(pythondir="$prefix/lib/python$PYTHON_VERSION/site-packages")
+## context.env.Replace(pyexecdir="${exec_prefix}/lib/python$PYTHON_VERSION/site-packages")
+## return result
+##
+## def DistSources(env, node):
+## env.DistFiles(_get_sources(env, node))
+##
+## def DistFiles(env, files):
+## assert isinstance(files, (list, tuple))
+## DISTFILES = [env.File(fname) for fname in files]
+## env.AppendUnique(DISTFILES=DISTFILES)
+##
+##
+## def make_distdir(target=None, source=None, env=None):
+## distdir = env.subst('$DISTDIR')
+## Execute(Delete(distdir))
+## Execute(Mkdir(distdir))
+## for fnode in env["DISTFILES"]:
+## dirname, fname = os.path.split(str(fnode))
+## if dirname:
+## distdirname = os.path.join(distdir, dirname)
+## if not os.path.exists(distdirname):
+## Execute(Mkdir(distdirname))
+## Execute(Copy(os.path.join(distdir, dirname, fname), str(fnode)))
+##
+## def make_dist(target=None, source=None, env=None):
+## return Popen([env['TAR'], "-zcf",
+## env.subst("${PACKAGE}-${VERSION}.tar.gz"),
+## env.subst('$DISTDIR')]).wait()
+##
+## def make_distcheck(target=None, source=None, env=None):
+## distdir = env.subst('$DISTDIR')
+## distcheckinstdir = tempfile.mkdtemp('', env.subst('${PACKAGE}-${VERSION}-instdir-'))
+## distcheckdestdir = tempfile.mkdtemp('', env.subst('${PACKAGE}-${VERSION}-destdir-'))
+## instdirs = [os.path.join(distcheckinstdir, d) for d in
+## 'lib', 'share', 'bin', 'include']
+## for dir_ in instdirs:
+## Execute(Mkdir(dir_))
+##
+## cmd = env.subst("cd $DISTDIR && scons DESTDIR=%s prefix=%s"
+## " && scons check && scons install") %\
+## (os.path.join(distcheckdestdir, ''), distcheckinstdir)
+## status = Popen(cmd, shell=True).wait()
+## if status:
+## return status
+## ## Check that inst dirs are empty (to catch cases of $DESTDIR not being honored
+## for dir_ in instdirs:
+## if os.listdir(dir_):
+## raise SCons.Errors.BuildError(target, "%s not empy" % dir_)
+## ## Check that something inside $DESTDIR was installed
+## dir_ = os.path.join(distcheckdestdir, distcheckinstdir)
+## if not os.path.exists(dir_):
+## raise SCons.Errors.BuildError(target, "%s does not exist" % dir_)
+## Execute(Delete(distcheckinstdir))
+## Execute(Delete(distcheckdestdir))
+## Execute(Delete(distdir))
+##
+## def InstallWithDestDir(self, dir_, source):
+## dir_ = '${DESTDIR}' + str(dir_)
+## return SConsEnvironment.Install(self, dir_, source)
+##
+##
+## def InstallAsWithDestDir(self, target, source):
+## target = '${DESTDIR}' + str(target)
+## return SConsEnvironment.InstallAs(self, target, source)
+##
+## def generate(env):
+## env.EnsureSConsVersion(0, 96, 91)
+##
+## opts = Options(['options.cache'], ARGUMENTS)
+## opts.Add(PathOption('prefix', 'Installation prefix', '/usr/local'))
+## opts.Add(PathOption('exec_prefix', 'Installation prefix blah blah',
+## '$prefix'))
+## opts.Add(PathOption('libdir',
+## 'Installation prefix for architecture dependent files', '$prefix/lib'))
+## opts.Add(PathOption('includedir',
+## 'Installation prefix for C header files', '$prefix/include'))
+## opts.Add(PathOption('datadir',
+## 'Installation prefix for architecture independent files', '$prefix/share'))
+## opts.Add(PathOption('bindir', 'Installation prefix for programs', '$prefix/bin'))
+## opts.Add(PathOption('DESTDIR', 'blah blah', None))
+## opts.Update(env)
+## opts.Save('options.cache', env)
+## SConsEnvironment.Help(env, opts.GenerateHelpText(env))
+##
+## env.Append(CPPFLAGS=r' -DVERSION=\"$VERSION\"')
+## env.Append(CCFLAGS=ARGUMENTS.get('CCFLAGS', '-g -O2'))
+##
+## env['GNOME_TESTS'] = dict(CheckPython=CheckPython,
+## CheckPythonHeaders=CheckPythonHeaders,
+## PkgCheckModules=PkgCheckModules)
+##
+## SConsEnvironment.DistSources = DistSources
+## SConsEnvironment.DistFiles = DistFiles
+## env['DISTDIR'] = "${PACKAGE}-${VERSION}"
+##
+## #env.Command(env.Dir("$DISTDIR"), None, make_distdir)
+##
+## distdir_alias = env.Alias("distdir", None, make_distdir)
+## dist_alias = env.Alias("dist", None, make_dist)
+## env.Depends(dist_alias, distdir_alias)
+## distcheck_alias = env.Alias("distcheck", None, make_distcheck)
+## env.Depends(distcheck_alias, distdir_alias)
+## env.AlwaysBuild(env.Alias('check'))
+##
+## #env['TARFLAGS'] ='-c -z'
+## #env['TARSUFFIX'] = '.tar.gz'
+## #tar = env.Tar('${PACKAGE}-${VERSION}.tar.gz', "${DISTDIR}")
+## #env.Depends(tar, distdir_alias)
+## #print env['DEFAULT_TARGETS']
+##
+## #env.Depends(distdir_alias, "${DISTFILES}")
+## #env.Alias('dist', tar)
+## env.AlwaysBuild('dist')
+## env.AlwaysBuild('distdir')
+## env.AlwaysBuild('distcheck')
+## env.DistFiles(['SConstruct', 'scons/gnome.py'])
+##
+## env['BUILDERS']['EnvSubstFile'] = SCons.Builder.Builder(action=env_subst)
+##
+## SConsEnvironment.PythonByteCompile = env.Action(byte_compile_python)
+##
+## env.Install = new.instancemethod(InstallWithDestDir, env, env.__class__)
+## env.InstallAs = new.instancemethod(InstallAsWithDestDir, env, env.__class__)
+##
+##
+##
+
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src"
+
+# building all the libraries
+env.SConscript(
+ dirs = [
+ 'mathed',
+ 'insets',
+ 'frontends',
+ 'frontends/controllers',
+ 'graphics',
+ 'support',
+ 'frontends/$frontend'
+ ]
+)
+
+if env['INCLUDED_BOOST']:
+ env.SConscript(dirs = ['#boost/libs'])
+
+#
+# Start in src directory
+#
+env.substFile('version.C', 'version.C.in')
+
+lyx_source = Split('''
+ main.C
+ Bidi.C
+ BufferView.C
+ BufferView_pimpl.C
+ Bullet.C
+ BranchList.C
+ Chktex.C
+ Color.C
+ CutAndPaste.C
+ DepTable.C
+ FloatList.C
+ Floating.C
+ FontIterator.C
+ FuncStatus.C
+ InsetList.C
+ LColor.C
+ LaTeX.C
+ LaTeXFeatures.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
+ bufferparams.C
+ bufferview_funcs.C
+ changes.C
+ chset.C
+ converter.C
+ counters.C
+ coordcache.C
+ cursor.C
+ cursor_slice.C
+ debug.C
+ dimension.C
+ dociterator.C
+ encoding.C
+ errorlist.C
+ exporter.C
+ gettext.C
+ factory.C
+ format.C
+ funcrequest.C
+ graph.C
+ importer.C
+ intl.C
+ insetiterator.C
+ kbmap.C
+ kbsequence.C
+ language.C
+ session.C
+ lengthcommon.C
+ lyx_cb.C
+ lyx_main.C
+ lyx_sty.C
+ lyxfont.C
+ lyxfind.C
+ lyxfunc.C
+ lyxgluelength.C
+ lyxlayout.C
+ lyxlength.C
+ lyxlex.C
+ lyxlex_pimpl.C
+ lyxrc.C
+ lyxrow.C
+ lyxrow_funcs.C
+ lyxserver.C
+ lyxsocket.C
+ lyxtextclass.C
+ lyxtextclasslist.C
+ lyxvc.C
+ messages.C
+ metricsinfo.C
+ mover.C
+ output.C
+ outputparams.C
+ output_docbook.C
+ output_latex.C
+ output_linuxdoc.C
+ output_plaintext.C
+ paragraph.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
+ text.C
+ text2.C
+ text3.C
+ TocBackend.C
+ toc.C
+ trans.C
+ trans_mgr.C
+ undo.C
+ vc-backend.C
+ version.C
+ vspace.C
+''')
+
+if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
+ lyx_source += ['aspell.C']
+elif env.has_key('USE_PSPELL') and env['USE_PSPELL']:
+ lyx_source += ['pspell.C']
+elif env.has_key('USE_ISPELL') and env['USE_ISPELL']:
+ lyx_source += ['ispell.C']
+
+#
+# Build lyx with given frontend
+#
+lyx = env.Program(
+ target = 'lyx',
+ source = lyx_source,
+ LIBS = [
+ 'mathed',
+ 'insets',
+ 'frontends',
+ env['frontend'],
+ 'controllers',
+ 'graphics',
+ 'supports',
+ 'z' ] +
+ env['EXTRA_LIBS'] +
+ env['BOOST_LIBRARIES']
+)
+
+# Return program
+Return('lyx')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/client"
+
+lyxclient = env.Program(
+ target = 'lyxclient',
+ LIBS = [ 'boost_regex', 'boost_filesystem',
+ 'supports' ] + env['socket_libs'],
+ source = Split('''
+ boost.C
+ client.C
+ debug.C
+ gettext.C
+ messages.C
+ ''')
+)
+
+Return('lyxclient')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/frontends"
+
+frontends = env.StaticLibrary(
+ target = '$LOCALLIBPATH/frontends',
+ source = Split('''
+ Alert.C
+ Dialogs.C
+ LyXView.C
+ Painter.C
+ Timeout.C
+ Toolbars.C
+ guiapi.C
+ nullpainter.C
+ screen.C
+ screen.h
+ ''')
+)
+
+# return the library
+Return('frontends')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/frontends/controllers"
+
+controllers = env.StaticLibrary(
+ target = '$LOCALLIBPATH/controllers',
+ source = Split('''
+ Dialog.C
+ Kernel.C
+ biblio.C
+ character.C
+ frnt_lang.C
+ tex_helpers.C
+ BCView.C
+ ButtonController.C
+ ButtonPolicies.C
+ ControlAboutlyx.C
+ ControlBibtex.C
+ ControlBox.C
+ ControlBranch.C
+ ControlCharacter.C
+ ControlChanges.C
+ ControlCitation.C
+ ControlCommand.C
+ ControlCommandBuffer.C
+ ControlDocument.C
+ ControlErrorList.C
+ ControlERT.C
+ ControlExternal.C
+ ControlFloat.C
+ ControlGraphics.C
+ ControlInclude.C
+ ControlLog.C
+ ControlViewSource.C
+ ControlMath.C
+ ControlNote.C
+ ControlParagraph.C
+ ControlPreamble.C
+ ControlPrefs.C
+ ControlPrint.C
+ ControlRef.C
+ ControlSearch.C
+ ControlSendto.C
+ ControlShowFile.C
+ ControlSpellchecker.C
+ ControlTabular.C
+ ControlTabularCreate.C
+ ControlTexinfo.C
+ ControlThesaurus.C
+ ControlToc.C
+ ControlVSpace.C
+ ControlWrap.C
+ helper_funcs.C
+ helper_funcs.h
+ ''')
+)
+
+#return the library
+Return('controllers')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/frontends/qt3"
+
+qtenv = env.Copy()
+
+# load qt3 tools
+qtenv.Tool('qt')
+
+qtenv.Append(CPPPATH = [
+ '#$BUILDDIR',
+ '#$BUILDDIR/frontends',
+ '#$BUILDDIR/images',
+ '#$BUILDDIR/frontends/controllers',
+ '$QT_INC_DIR',
+ '.']
+)
+
+ui_files = Split('''
+ BiblioModuleBase.ui
+ BranchesModuleBase.ui
+ BulletsModuleBase.ui
+ TextLayoutModuleBase.ui
+ LanguageModuleBase.ui
+ LaTeXModuleBase.ui
+ MarginsModuleBase.ui
+ NumberingModuleBase.ui
+ MathsModuleBase.ui
+ PageLayoutModuleBase.ui
+ PreambleModuleBase.ui
+ QAboutDialogBase.ui
+ QAskForTextDialog.ui
+ QBibitemDialogBase.ui
+ QBibtexDialogBase.ui
+ QBibtexAddDialogBase.ui
+ QBoxDialogBase.ui
+ QBranchDialogBase.ui
+ QChangesDialogBase.ui
+ QCharacterDialogBase.ui
+ QCitationDialogBase.ui
+ QCitationFindDialogBase.ui
+ QDelimiterDialogBase.ui
+ QDocumentDialogBase.ui
+ QErrorListDialogBase.ui
+ QERTDialogBase.ui
+ QExternalDialogBase.ui
+ QFloatDialogBase.ui
+ QGraphicsDialogBase.ui
+ QIncludeDialogBase.ui
+ QIndexDialogBase.ui
+ QLogDialogBase.ui
+ QViewSourceDialogBase.ui
+ QMathDialogBase.ui
+ QMathMatrixDialogBase.ui
+ QNoteDialogBase.ui
+ QParagraphDialogBase.ui
+ QPrefAsciiModule.ui
+ QPrefColorsModule.ui
+ QPrefConvertersModule.ui
+ QPrefCopiersModule.ui
+ QPrefCygwinPathModule.ui
+ QPrefDateModule.ui
+ QPrefDisplayModule.ui
+ QPrefFileformatsModule.ui
+ QPrefIdentityModule.ui
+ QPrefKeyboardModule.ui
+ QPrefLanguageModule.ui
+ QPrefLatexModule.ui
+ QPrefPathsModule.ui
+ QPrefPrinterModule.ui
+ QPrefScreenFontsModule.ui
+ QPrefsDialogBase.ui
+ QPrefSpellcheckerModule.ui
+ QPrefUIModule.ui
+ QPrintDialogBase.ui
+ QRefDialogBase.ui
+ QSearchDialogBase.ui
+ QSendtoDialogBase.ui
+ QShowFileDialogBase.ui
+ QSpellcheckerDialogBase.ui
+ QTabularCreateDialogBase.ui
+ QTabularDialogBase.ui
+ QTexinfoDialogBase.ui
+ QThesaurusDialogBase.ui
+ QTocDialogBase.ui
+ QURLDialogBase.ui
+ QVSpaceDialogBase.ui
+ QWrapDialogBase.ui
+''')
+
+moc_files = Split('''
+ BulletsModule.C
+ emptytable.C
+ FileDialog_private.C
+ floatplacement.C
+ iconpalette.C
+ lengthcombo.C
+ panelstack.C
+ QAboutDialog.C
+ QBibitemDialog.C
+ QBibtexDialog.C
+ QBoxDialog.C
+ QBranchDialog.C
+ QBrowseBox.C
+ QChangesDialog.C
+ QCharacterDialog.C
+ QCitationDialog.C
+ QCommandBuffer.C
+ QCommandEdit.C
+ QContentPane.C
+ QDelimiterDialog.C
+ QDocumentDialog.C
+ QErrorListDialog.C
+ QERTDialog.C
+ QExternalDialog.C
+ QFloatDialog.C
+ QGraphicsDialog.C
+ QIncludeDialog.C
+ QIndexDialog.C
+ QLogDialog.C
+ QViewSourceDialog.C
+ QLPopupMenu.C
+ QLPrintDialog.C
+ QMathDialog.C
+ QMathMatrixDialog.C
+ QNoteDialog.C
+ QParagraphDialog.C
+ QPrefsDialog.C
+ QRefDialog.C
+ QSearchDialog.C
+ QSendtoDialog.C
+ qsetborder.C
+ QShowFileDialog.C
+ QSpellcheckerDialog.C
+ QDialogView.C
+ QTabularCreateDialog.C
+ QTabularDialog.C
+ QTexinfoDialog.C
+ QThesaurusDialog.C
+ QTocDialog.C
+ qttableview.C
+ QtView.C
+ QURLDialog.C
+ QVSpaceDialog.C
+ QWrapDialog.C
+ QLToolbar.C
+ socket_callback.C
+ validators.C
+''')
+
+qt3 = qtenv.StaticLibrary(
+ target = '$LOCALLIBPATH/qt3',
+ source = Split('''
+ QDialogView.C
+ Alert_pimpl.C
+ Dialogs.C
+ FileDialog.C
+ LyXKeySymFactory.C
+ LyXScreenFactory.C
+ QLMenubar.C
+ qtTimeout.C
+ QAbout.C
+ QBibitem.C
+ QBibtex.C
+ QBox.C
+ QBranch.C
+ QChanges.C
+ QCharacter.C
+ QCitation.C
+ QDocument.C
+ QErrorList.C
+ QERT.C
+ QExternal.C
+ QFloat.C
+ QGraphics.C
+ QInclude.C
+ QIndex.C
+ QLImage.C
+ QLog.C
+ QViewSource.C
+ QLPainter.C
+ QLyXKeySym.C
+ QMath.C
+ QNote.C
+ QParagraph.C
+ QPrefs.C
+ QPrint.C
+ QRef.C
+ QSearch.C
+ QSendto.C
+ QShowFile.C
+ QSpellchecker.C
+ QTabular.C
+ QTabularCreate.C
+ QTexinfo.C
+ QThesaurus.C
+ QToc.C
+ QURL.C
+ QVSpace.C
+ QWorkArea.C
+ QWrap.C
+ Qt2BC.C
+ WorkAreaFactory.C
+ checkedwidgets.C
+ lyx_gui.C
+ lcolorcache.C
+ panelstack.C
+ qcoloritem.C
+ qfontexample.C
+ qfont_loader.C
+ qfont_metrics.C
+ qscreen.C
+ qt_helpers.C
+ ''') +
+ moc_files +
+ ['ui/' + x for x in ui_files]
+)
+
+# return the library
+Return('qt3')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+
+Import('env')
+
+print "Entering src/frontends/qt4"
+
+qtenv = env.Copy()
+
+# local qt4 toolset from
+# http://www.iua.upf.es/~dgarcia/Codders/sconstools.html
+#
+# NOTE: I have to patch qt4.py since it does not automatically
+# process .C file!!! (add to cxx_suffixes )
+#
+qtenv.Tool('qt4', ['$TOP_SRC_DIR'])
+qtenv.EnableQt4Modules(env['QT_LIB'], debug = False)
+
+qtenv.Append(CPPPATH = [
+ '#$BUILDDIR',
+ '#$BUILDDIR/frontends',
+ '#$BUILDDIR/images',
+ '#$BUILDDIR/frontends/controllers',
+ '$QT_INC_PATH',
+ '$QT_INC_PATH/Qt',
+ '$QT_INC_PATH/QtCore',
+ '$QT_INC_PATH/QtGui',
+ '$QT_INC_PATH/Qt3Support',
+ '.']
+)
+
+# FIXME: replace by something from pkg_config
+qtenv.Append(CCFLAGS = [
+ '-DHAVE_CONFIG_H',
+ '-DQT_CLEAN_NAMESPACE',
+ '-DQT_GENUINE_STR',
+ '-DQT_NO_STL',
+ '-DQT3_SUPPORT',
+ '-Winvalid-pch']
+)
+
+ui_files = Split('''
+ BiblioUi
+ BranchesUi
+ BulletsUi
+ TextLayoutUi
+ LanguageUi
+ LaTeXUi
+ MarginsUi
+ NumberingUi
+ MathsUi
+ PageLayoutUi
+ PreambleUi
+ QAboutUi
+ QAskForTextUi
+ QBibitemUi
+ QBibtexUi
+ QBibtexAddUi
+ QBoxUi
+ QBranchUi
+ QChangesUi
+ QCharacterUi
+ QCitationUi
+ QCitationFindUi
+ QDelimiterUi
+ QDocumentUi
+ QErrorListUi
+ QERTUi
+ QExternalUi
+ QFloatUi
+ QGraphicsUi
+ QIncludeUi
+ QIndexUi
+ QLogUi
+ QViewSourceUi
+ QMathUi
+ QMathMatrixUi
+ QNoteUi
+ QParagraphUi
+ QPrefAsciiUi
+ QPrefColorsUi
+ QPrefConvertersUi
+ QPrefCopiersUi
+ QPrefCygwinPathUi
+ QPrefDateUi
+ QPrefDisplayUi
+ QPrefFileformatsUi
+ QPrefIdentityUi
+ QPrefKeyboardUi
+ QPrefLanguageUi
+ QPrefLatexUi
+ QPrefPathsUi
+ QPrefPrinterUi
+ QPrefScreenFontsUi
+ QPrefsUi
+ QPrefSpellcheckerUi
+ QPrefUi
+ QPrintUi
+ QRefUi
+ QSearchUi
+ QSendtoUi
+ QShowFileUi
+ QSpellcheckerUi
+ QTabularCreateUi
+ QTabularUi
+ QTexinfoUi
+ QThesaurusUi
+ QTocUi
+ QURLUi
+ QVSpaceUi
+ QWrapUi
+''')
+
+moc_files = Split('''
+ BulletsModule.C
+ emptytable.C
+ FileDialog_private.C
+ floatplacement.C
+ iconpalette.C
+ lengthcombo.C
+ panelstack.C
+ QAboutDialog.C
+ QBibitemDialog.C
+ QBibtexDialog.C
+ QBoxDialog.C
+ QBranchDialog.C
+ QBranches.C
+ QBrowseBox.C
+ QChangesDialog.C
+ QCharacterDialog.C
+ QCitationDialog.C
+ QCommandBuffer.C
+ QCommandEdit.C
+ QDelimiterDialog.C
+ QDocumentDialog.C
+ QErrorListDialog.C
+ QERTDialog.C
+ QExternalDialog.C
+ QFloatDialog.C
+ QGraphicsDialog.C
+ QIncludeDialog.C
+ QIndexDialog.C
+ QLAction.C
+ QLogDialog.C
+ QViewSourceDialog.C
+ QViewSource.C
+ QLMenubar.C
+ QLPopupMenu.C
+ QLPrintDialog.C
+ QMathDialog.C
+ QMathMatrixDialog.C
+ QNoteDialog.C
+ QParagraphDialog.C
+ QPrefsDialog.C
+ QRefDialog.C
+ QSearchDialog.C
+ QSendtoDialog.C
+ qsetborder.C
+ QShowFileDialog.C
+ QSpellcheckerDialog.C
+ QDialogView.C
+ QTabularCreateDialog.C
+ QTabularDialog.C
+ QTexinfoDialog.C
+ QThesaurusDialog.C
+ TocModel.C
+ QTocDialog.C
+ QtView.C
+ QURLDialog.C
+ QVSpaceDialog.C
+ QWorkArea.C
+ QWrapDialog.C
+ QLToolbar.C
+ socket_callback.C
+ validators.C
+''')
+
+#
+# Compile resources
+#
+resources = [qtenv.Uic4('ui/' + x) for x in ui_files]
+
+source_files = Split('''
+ QDialogView.C
+ Alert_pimpl.C
+ Dialogs.C
+ FileDialog.C
+ LyXKeySymFactory.C
+ LyXScreenFactory.C
+ QLMenubar.C
+ qtTimeout.C
+ QAbout.C
+ QBibitem.C
+ QBibtex.C
+ QBox.C
+ QBranch.C
+ QBranches.C
+ QChanges.C
+ QCharacter.C
+ QCitation.C
+ QDocument.C
+ QErrorList.C
+ QERT.C
+ QExternal.C
+ QFloat.C
+ QGraphics.C
+ QInclude.C
+ QIndex.C
+ QLAction.C
+ QLImage.C
+ QLog.C
+ QViewSource.C
+ QLPainter.C
+ QLyXKeySym.C
+ QMath.C
+ QNote.C
+ QParagraph.C
+ QPrefs.C
+ QPrint.C
+ QRef.C
+ QSearch.C
+ QSendto.C
+ QShowFile.C
+ QSpellchecker.C
+ QTabular.C
+ QTabularCreate.C
+ QTexinfo.C
+ QThesaurus.C
+ QToc.C
+ QURL.C
+ QVSpace.C
+ QWorkArea.C
+ QWrap.C
+ Qt2BC.C
+ WorkAreaFactory.C
+ checkedwidgets.C
+ lyx_gui.C
+ lcolorcache.C
+ panelstack.h
+ panelstack.C
+ qcoloritem.C
+ qfontexample.C
+ qfont_loader.C
+ qfont_metrics.C
+ qscreen.C
+ qt_helpers.C
+''')
+
+qt4 = qtenv.StaticLibrary(
+ target = '$LOCALLIBPATH/qt4',
+ LIBS = qtenv['QT_LIB'],
+ source = source_files + moc_files
+)
+
+# return the library
+Return('qt4')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/graphics"
+
+graphics = env.StaticLibrary(
+ target = '$LOCALLIBPATH/graphics',
+ source = Split('''
+ GraphicsCache.C
+ GraphicsCacheItem.C
+ GraphicsConverter.C
+ GraphicsImage.C
+ GraphicsLoader.C
+ GraphicsParams.C
+ LoaderQueue.C
+ GraphicsTypes.C
+ PreviewImage.C
+ PreviewLoader.C
+ Previews.C
+ ''')
+)
+
+# return the library
+Return('graphics')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/insets"
+
+insets = env.StaticLibrary(
+ target = '$LOCALLIBPATH/insets',
+ source = Split('''
+ mailinset.C
+ ExternalSupport.C
+ ExternalTemplate.C
+ ExternalTransforms.C
+ render_button.C
+ render_graphic.C
+ render_preview.C
+ inset.C
+ insetbase.C
+ insetbibitem.C
+ insetbibtex.C
+ insetbox.C
+ insetbranch.C
+ insetcaption.C
+ insetcharstyle.C
+ insetcite.C
+ insetcollapsable.C
+ insetcommand.C
+ insetcommandparams.C
+ insetenv.C
+ insetert.C
+ insetexternal.C
+ insetfloat.C
+ insetfloatlist.C
+ insetfoot.C
+ insetfootlike.C
+ insetgraphicsParams.C
+ insetgraphics.C
+ insethfill.C
+ insetinclude.C
+ insetindex.C
+ insetlabel.C
+ insetlatexaccent.C
+ insetline.C
+ insetmarginal.C
+ insetnewline.C
+ insetnote.C
+ insetoptarg.C
+ insetpagebreak.C
+ insetquotes.C
+ insetref.C
+ insetspace.C
+ insetspecialchar.C
+ insettabular.C
+ insettext.C
+ insettoc.C
+ inseturl.C
+ insetvspace.C
+ insetwrap.C
+ ''')
+)
+
+# return the library
+Return('insets')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/mathed"
+
+mathed = env.StaticLibrary(
+ target = '$LOCALLIBPATH/mathed',
+ source = Split('''
+ textpainter.C
+ math_amsarrayinset.C
+ math_arrayinset.C
+ math_atom.C
+ math_autocorrect.C
+ math_biginset.C
+ math_binominset.C
+ math_boldsymbolinset.C
+ math_boxinset.C
+ math_boxedinset.C
+ math_braceinset.C
+ math_casesinset.C
+ math_charinset.C
+ math_colorinset.C
+ math_commentinset.C
+ math_data.C
+ math_decorationinset.C
+ math_deliminset.C
+ math_dfracinset.C
+ math_diffinset.C
+ math_diminset.C
+ math_dotsinset.C
+ math_envinset.C
+ math_extern.C
+ math_exfuncinset.C
+ math_exintinset.C
+ math_factory.C
+ math_fboxinset.C
+ math_frameboxinset.C
+ math_fontinset.C
+ math_fontoldinset.C
+ math_fracinset.C
+ math_fracbase.C
+ math_gridinset.C
+ math_hullinset.C
+ math_inset.C
+ math_kerninset.C
+ math_lefteqninset.C
+ math_liminset.C
+ math_macro.C
+ math_macroarg.C
+ math_macrotemplate.C
+ math_macrotable.C
+ math_makeboxinset.C
+ math_mathmlstream.C
+ math_matrixinset.C
+ math_nestinset.C
+ math_numberinset.C
+ math_oversetinset.C
+ math_parinset.C
+ math_parser.C
+ math_phantominset.C
+ math_rootinset.C
+ math_scriptinset.C
+ math_sizeinset.C
+ math_spaceinset.C
+ math_splitinset.C
+ math_sqrtinset.C
+ math_stackrelinset.C
+ math_streamstr.C
+ math_stringinset.C
+ math_substackinset.C
+ math_support.C
+ math_symbolinset.C
+ math_tabularinset.C
+ math_tfracinset.C
+ math_unknowninset.C
+ math_undersetinset.C
+ math_xarrowinset.C
+ math_xymatrixinset.C
+ command_inset.C
+ ref_inset.C
+ ''')
+)
+
+# return the library
+Return('mathed')
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/supports"
+
+env.Append(CPPPATH = ['.'])
+
+env.substFile('package.C', 'package.C.in')
+
+supports = env.StaticLibrary(
+ target = '$LOCALLIBPATH/supports',
+ source = Split('''
+ FileMonitor.C
+ abort.C
+ chdir.C
+ convert.C
+ copy.C
+ environment.C
+ filefilterlist.C
+ filename.C
+ filetools.C
+ forkedcall.C
+ forkedcallqueue.C
+ forkedcontr.C
+ fs_extras.C
+ getcwd.C
+ kill.C
+ lstrings.C
+ lyxtime.C
+ lyxsum.C
+ mkdir.C
+ os.C
+ path.C
+ package.C
+ rename.C
+ socktools.C
+ systemcall.C
+ tempname.C
+ userinfo.C
+ unlink.C
+ ''')
+)
+
+# return the library
+Return('supports')
+
--- /dev/null
+# vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
+
+# file SConscript
+#
+# This file is part of LyX, the document processor.
+# Licence details can be found in the file COPYING.
+#
+# \author Bo Peng
+# Full author contact details are available in file CREDITS.
+
+Import('env')
+
+print "Entering src/tex2lyx"
+
+tex2lyx_env = env.Copy()
+# the order is important here.
+#tex2lyx_env.Prepend(CPPPATH = ['.', '#$BUILDDIR'])
+tex2lyx_env.Append(LIBPATH = ['#$LOCALLIBPATH'])
+
+tex2lyx_env.fileCopy('FloatList.C', '#$BUILDDIR/FloatList.C')
+tex2lyx_env.fileCopy('Floating.C', '#$BUILDDIR/Floating.C')
+tex2lyx_env.fileCopy('counters.C', '#$BUILDDIR/counters.C')
+tex2lyx_env.fileCopy('lyxlex.C', '#$BUILDDIR/lyxlex.C')
+tex2lyx_env.fileCopy('lyxlex_pimpl.C', '#$BUILDDIR/lyxlex_pimpl.C')
+# for some reason I do not know, I have to copy the header files as well.
+tex2lyx_env.fileCopy('lyxlayout.h', '#$BUILDDIR/lyxlayout.h')
+tex2lyx_env.fileCopy('lyxlayout.C', '#$BUILDDIR/lyxlayout.C')
+tex2lyx_env.fileCopy('lyxtextclass.h', '#$BUILDDIR/lyxtextclass.h')
+tex2lyx_env.fileCopy('lyxtextclass.C', '#$BUILDDIR/lyxtextclass.C')
+
+tex2lyx = tex2lyx_env.Program(
+ target = 'tex2lyx',
+ LIBS = [
+ 'supports',
+ 'z',
+ ] + env['BOOST_LIBRARIES'],
+ source = Split('''
+ FloatList.C
+ Floating.C
+ counters.C
+ lyxlayout.C
+ lyxtextclass.C
+ lyxlex.C
+ lyxlex_pimpl.C
+ boost.C
+ context.C
+ gettext.C
+ lengthcommon.C
+ lyxfont.C
+ texparser.C
+ tex2lyx.C
+ preamble.C
+ math.C
+ table.C
+ text.C
+ ''')
+)
+
+# Return the program
+Return('tex2lyx')
+