gettext support, fast_start option, scons all, mingw bug fix and some cleanup for the scons build system

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13849 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Bo Peng 2006-05-15 20:35:01 +00:00
parent 479abc6efd
commit e94889a041
3 changed files with 783 additions and 670 deletions

View File

@ -4,7 +4,7 @@
# #
# This file is part of LyX, the document processor. # This file is part of LyX, the document processor.
# Licence details can be found in the file COPYING. # Licence details can be found in the file COPYING.
# #
# \author Bo Peng # \author Bo Peng
# Full author contact details are available in file CREDITS. # Full author contact details are available in file CREDITS.
@ -13,21 +13,21 @@ import os, sys
Import('env') Import('env')
targets = env['BUILD_TARGETS'] targets = env['BUILD_TARGETS']
build_lyx = (targets == [] or 'lyx' in targets or 'install' in targets) build_lyx = (targets == [] or 'lyx' in targets or 'install' in targets or 'all' in targets)
#
# boost libraries
#
if env['INCLUDED_BOOST'] or 'boost' in targets: if env['INCLUDED_BOOST'] or 'boost' in targets:
#
# boost libraries
#
# special builddir
env.BuildDir('$BUILDDIR/boost', '$TOP_SRC_DIR/boost/libs', duplicate = 0) env.BuildDir('$BUILDDIR/boost', '$TOP_SRC_DIR/boost/libs', duplicate = 0)
boostenv = env.Copy() boostenv = env.Copy()
boostenv.Append(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"') boostenv.AppendUnique(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"')
# for config.h
boostenv.Append(CPPPATH = ['$TOP_SRC_DIR/src'])
print 'Processing files in boost/libs/filesystem/src...' print 'Processing files in boost/libs/filesystem/src...'
filesystem = boostenv.StaticLibrary( filesystem = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/boost_filesystem', target = '$LOCALLIBPATH/boost_filesystem',
source = ["$BUILDDIR/boost/filesystem/src/%s" % x for x in Split(''' source = ["$BUILDDIR/boost/filesystem/src/%s" % x for x in Split('''
@ -37,9 +37,9 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
path_posix_windows.cpp path_posix_windows.cpp
''')] ''')]
) )
print 'Processing files in boost/libs/regex/src...' print 'Processing files in boost/libs/regex/src...'
regex = boostenv.StaticLibrary( regex = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/boost_regex', target = '$LOCALLIBPATH/boost_regex',
source = ["$BUILDDIR/boost/regex/src/%s" % x for x in Split(''' source = ["$BUILDDIR/boost/regex/src/%s" % x for x in Split('''
@ -54,9 +54,9 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
w32_regex_traits.cpp w32_regex_traits.cpp
''')] ''')]
) )
print 'Processing files in boost/libs/signals/src...' print 'Processing files in boost/libs/signals/src...'
signals = boostenv.StaticLibrary( signals = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/boost_signals', target = '$LOCALLIBPATH/boost_signals',
source = ["$BUILDDIR/boost/signals/src/%s" % x for x in Split(''' source = ["$BUILDDIR/boost/signals/src/%s" % x for x in Split('''
@ -67,9 +67,9 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
trackable.cpp trackable.cpp
''')] ''')]
) )
print 'Processing files in boost/libs/iostreams/src...' print 'Processing files in boost/libs/iostreams/src...'
iostreams = boostenv.StaticLibrary( iostreams = boostenv.StaticLibrary(
target = '$LOCALLIBPATH/boost_iostreams', target = '$LOCALLIBPATH/boost_iostreams',
source = ["$BUILDDIR/boost/iostreams/src/%s" % x for x in Split(''' source = ["$BUILDDIR/boost/iostreams/src/%s" % x for x in Split('''
@ -82,25 +82,23 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
Alias('boost', regex) Alias('boost', regex)
Alias('boost', signals) Alias('boost', signals)
Alias('boost', iostreams) Alias('boost', iostreams)
# #
# Now, src code under src/ # Now, src code under src/
# #
env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0) env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
#
# src/support
#
if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']]: if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']]:
#
# src/support
#
print "Processing files in src/support" print "Processing files in src/support"
env.Append(CPPPATH = ['.'])
env['SUBST_KEYS'] = ['LYX_DIR', 'LOCALEDIR', 'TOP_SRCDIR', 'PROGRAM_SUFFIX'] env['SUBST_KEYS'] = ['LYX_DIR', 'LOCALEDIR', 'TOP_SRCDIR', 'PROGRAM_SUFFIX']
env.substFile('$BUILDDIR/common/support/package.C', '$TOP_SRC_DIR/src/support/package.C.in') env.substFile('$BUILDDIR/common/support/package.C', '$TOP_SRC_DIR/src/support/package.C.in')
supports = env.StaticLibrary( supports = env.StaticLibrary(
target = '$LOCALLIBPATH/supports', target = '$LOCALLIBPATH/supports',
source = ['$BUILDDIR/common/support/%s' % x for x in Split(''' source = ['$BUILDDIR/common/support/%s' % x for x in Split('''
@ -136,13 +134,13 @@ if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']
) )
Alias('supports', supports) Alias('supports', supports)
#
# src/mathed
#
if build_lyx or 'mathed' in targets: if build_lyx or 'mathed' in targets:
#
# src/mathed
#
print "Processing files in src/mathed" print "Processing files in src/mathed"
mathed = env.StaticLibrary( mathed = env.StaticLibrary(
target = '$LOCALLIBPATH/mathed', target = '$LOCALLIBPATH/mathed',
source = ["$BUILDDIR/common/mathed/%s" % x for x in Split(''' source = ["$BUILDDIR/common/mathed/%s" % x for x in Split('''
@ -228,7 +226,7 @@ if build_lyx or 'insets' in targets:
# src/insets # src/insets
# #
print "Processing files in src/insets" print "Processing files in src/insets"
insets = env.StaticLibrary( insets = env.StaticLibrary(
target = '$LOCALLIBPATH/insets', target = '$LOCALLIBPATH/insets',
source = ["$BUILDDIR/common/insets/%s" % x for x in Split(''' source = ["$BUILDDIR/common/insets/%s" % x for x in Split('''
@ -285,14 +283,13 @@ if build_lyx or 'insets' in targets:
) )
Alias('insets', insets) Alias('insets', insets)
if build_lyx or 'frontends' in targets: if build_lyx or 'frontends' in targets:
# #
# src/frontends # src/frontends
# #
print "Processing files in src/frontends" print "Processing files in src/frontends"
frontends = env.StaticLibrary( frontends = env.StaticLibrary(
target = '$LOCALLIBPATH/frontends', target = '$LOCALLIBPATH/frontends',
source = ["$BUILDDIR/common/frontends/%s" % x for x in Split(''' source = ["$BUILDDIR/common/frontends/%s" % x for x in Split('''
@ -310,13 +307,12 @@ if build_lyx or 'frontends' in targets:
Alias('frontends', frontends) Alias('frontends', frontends)
if build_lyx or 'graphics' in targets: if build_lyx or 'graphics' in targets:
# #
# src/graphics # src/graphics
# #
print "Processing files in src/graphics" print "Processing files in src/graphics"
graphics = env.StaticLibrary( graphics = env.StaticLibrary(
target = '$LOCALLIBPATH/graphics', target = '$LOCALLIBPATH/graphics',
source = ["$BUILDDIR/common/graphics/%s" % x for x in Split(''' source = ["$BUILDDIR/common/graphics/%s" % x for x in Split('''
@ -340,9 +336,8 @@ if build_lyx or 'controllers' in targets:
# #
# src/frontends/controllers # src/frontends/controllers
# #
print "Processing files in src/frontends/controllers" print "Processing files in src/frontends/controllers"
controllers = env.StaticLibrary( controllers = env.StaticLibrary(
target = '$LOCALLIBPATH/controllers', target = '$LOCALLIBPATH/controllers',
source = ["$BUILDDIR/common/frontends/controllers/%s" % x for x in Split(''' source = ["$BUILDDIR/common/frontends/controllers/%s" % x for x in Split('''
@ -397,6 +392,7 @@ if build_lyx or 'controllers' in targets:
) )
Alias('controllers', controllers) Alias('controllers', controllers)
# #
# src/frontend/qt3/4 # src/frontend/qt3/4
# #
@ -417,20 +413,21 @@ if frontend == 'qt3':
print "Processing files in src/frontends/qt3" print "Processing files in src/frontends/qt3"
qt3env = env.Copy() qt3env = env.Copy()
# disable auto scan to speed up non build time
qt3env['QT_AUTOSCAN'] = 0
# load qt3 tools # load qt3 tools
qt3env.Tool('qt') qt3env.Tool('qt')
qt3env.Append(CPPPATH = [ qt3env.AppendUnique(CPPPATH = [
'$BUILDDIR/common', '$BUILDDIR/common',
'$BUILDDIR/common/images',
'$BUILDDIR/common/frontends', '$BUILDDIR/common/frontends',
'$BUILDDIR/common/frontends/qt3', '$BUILDDIR/common/frontends/qt3',
'$BUILDDIR/common/images',
'$BUILDDIR/common/frontends/controllers', '$BUILDDIR/common/frontends/controllers',
'$BUILDDIR/common/frontends/qt3', '$QT_INC_PATH']
'$QT_INC_DIR']
) )
qt3_ui_files = Split(''' qt3_ui_files = Split('''
BiblioModuleBase.ui BiblioModuleBase.ui
BranchesModuleBase.ui BranchesModuleBase.ui
@ -502,8 +499,7 @@ if frontend == 'qt3':
QVSpaceDialogBase.ui QVSpaceDialogBase.ui
QWrapDialogBase.ui QWrapDialogBase.ui
''') ''')
qt3_moc_files = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split(''' qt3_moc_files = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split('''
BulletsModule.C BulletsModule.C
emptytable.C emptytable.C
@ -563,15 +559,16 @@ if frontend == 'qt3':
socket_callback.C socket_callback.C
validators.C validators.C
''')] ''')]
# manually moc and uic files for better performance
# (stop autoscan, 13:20s->12:50s :-)
qt3_moced_files = [qt3env.Moc(x.replace('.C', '.h')) for x in qt3_moc_files]
# under windows, because of the .C/.c confusion qt3_uiced_files = [qt3env.Uic('$BUILDDIR/common/frontends/qt3/ui/'+x) for x in qt3_ui_files]
# moc_files are not moced automatically. qt3_uiced_cc_files = []
# I am doing it manually here, until lyx changes for x in qt3_uiced_files:
# file extension from .C to .cpp qt3_uiced_cc_files.extend(x[1:])
qt3_moced_files = []
if os.name == 'nt' or sys.platform == 'cygwin':
qt3_moced_files = [qt3env.Moc(x.replace('.C', '.h')) for x in qt3_moc_files]
qt3 = qt3env.StaticLibrary( qt3 = qt3env.StaticLibrary(
target = '$LOCALLIBPATH/qt3', target = '$LOCALLIBPATH/qt3',
source = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split(''' source = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split('''
@ -636,8 +633,7 @@ if frontend == 'qt3':
qscreen.C qscreen.C
qt_helpers.C qt_helpers.C
''')] + ''')] +
qt3_moc_files + qt3_moced_files + qt3_moc_files + qt3_moced_files + qt3_uiced_cc_files
['$BUILDDIR/common/frontends/qt3/ui/' + x for x in qt3_ui_files]
) )
Alias('qt3', qt3) Alias('qt3', qt3)
@ -646,7 +642,8 @@ elif frontend == 'qt4':
print "Processing files in src/frontends/qt4" print "Processing files in src/frontends/qt4"
qt4env = env.Copy() qt4env = env.Copy()
qt4env['QT_AUTOSCAN'] = 0
# local qt4 toolset from # local qt4 toolset from
# http://www.iua.upf.es/~dgarcia/Codders/sconstools.html # http://www.iua.upf.es/~dgarcia/Codders/sconstools.html
# #
@ -655,8 +652,8 @@ elif frontend == 'qt4':
# #
qt4env.Tool('qt4', [env['SCONS_DIR']]) qt4env.Tool('qt4', [env['SCONS_DIR']])
qt4env.EnableQt4Modules(env['QT_LIB'], debug = False) qt4env.EnableQt4Modules(env['QT_LIB'], debug = False)
qt4env.Append(CPPPATH = [ qt4env.AppendUnique(CPPPATH = [
'$BUILDDIR/common', '$BUILDDIR/common',
'$BUILDDIR/common/images', '$BUILDDIR/common/images',
'$BUILDDIR/common/frontends', '$BUILDDIR/common/frontends',
@ -667,7 +664,7 @@ elif frontend == 'qt4':
'$QT_INC_PATH/QtCore', '$QT_INC_PATH/QtCore',
'$QT_INC_PATH/QtGui'] '$QT_INC_PATH/QtGui']
) )
# FIXME: replace by something from pkg_config # FIXME: replace by something from pkg_config
qt4env.Append(CCFLAGS = [ qt4env.Append(CCFLAGS = [
'-DHAVE_CONFIG_H', '-DHAVE_CONFIG_H',
@ -677,8 +674,8 @@ elif frontend == 'qt4':
'-DQT3_SUPPORT', '-DQT3_SUPPORT',
'-Winvalid-pch'] '-Winvalid-pch']
) )
qt4_ui_files = Split(''' qt4_ui_files = ['$BUILDDIR/common/frontends/qt4/ui/%s' % x for x in Split('''
BiblioUi BiblioUi
BranchesUi BranchesUi
BulletsUi BulletsUi
@ -748,9 +745,9 @@ elif frontend == 'qt4':
QURLUi QURLUi
QVSpaceUi QVSpaceUi
QWrapUi QWrapUi
''') ''')]
qt4_moc_files = Split(''' qt4_moc_files = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in Split('''
BulletsModule.C BulletsModule.C
emptytable.C emptytable.C
FileDialog_private.C FileDialog_private.C
@ -811,15 +808,9 @@ elif frontend == 'qt4':
QLToolbar.C QLToolbar.C
socket_callback.C socket_callback.C
validators.C validators.C
''') ''') ]
# qt4_source_files = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in Split('''
# Compile resources
#
for x in qt4_ui_files:
qt4env.Uic4('$BUILDDIR/common/frontends/qt4/ui/' + x)
qt4_source_files = Split('''
QDialogView.C QDialogView.C
Alert_pimpl.C Alert_pimpl.C
Dialogs.C Dialogs.C
@ -881,52 +872,67 @@ elif frontend == 'qt4':
qfont_metrics.C qfont_metrics.C
qscreen.C qscreen.C
qt_helpers.C qt_helpers.C
''') ''')]
#
# Compile resources
#
resources = [qt4env.Uic4(x) for x in qt4_ui_files]
#
# moc qt4_moc_files
#
qt4_moced_files = [qt4env.Moc4(x.replace('.C', '_moc.cpp'), x.replace('.C', '.h')) for x in qt4_moc_files]
# if the moced files are included in the .C file
# the Flatten(...) part will not be needed
qt4 = qt4env.StaticLibrary( qt4 = qt4env.StaticLibrary(
target = '$LOCALLIBPATH/qt4', target = '$LOCALLIBPATH/qt4',
LIBS = qt4env['QT_LIB'], LIBS = qt4env['QT_LIB'],
source = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in qt4_source_files] + \ source = qt4_source_files + qt4_moc_files + Flatten(qt4_moced_files)
["$BUILDDIR/common/frontends/qt4/%s" % x for x in qt4_moc_files] )
)
Alias('qt4', qt4) Alias('qt4', qt4)
if 'client' in targets or 'install' in targets: if 'client' in targets or 'install' in targets or 'all' in targets:
# #
# src/client # src/client
# #
env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0) env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
print "Processing files in src/client" print "Processing files in src/client"
client = env.Program( try:
target = '$BUILDDIR/common/client/lyxclient', client = env.Program(
LIBS = env['BOOST_LIBRARIES'] + env['SOCKET_LIBS'] + ['supports'], target = '$BUILDDIR/common/client/lyxclient',
source = ["$BUILDDIR/common/client/%s" % x for x in Split(''' LIBS = env['BOOST_LIBRARIES'] + env['SOCKET_LIBS'] + ['supports'],
boost.C source = ["$BUILDDIR/common/client/%s" % x for x in Split('''
client.C boost.C
debug.C client.C
gettext.C debug.C
messages.C gettext.C
''')] messages.C
) ''')]
Alias('client', env.Command(os.path.join('$BUILDDIR', os.path.split(str(client[0]))[1]), )
client, [Copy('$TARGET', '$SOURCE')])) Alias('client', env.Command(os.path.join('$BUILDDIR', os.path.split(str(client[0]))[1]),
client, [Copy('$TARGET', '$SOURCE')]))
except:
print "Building of program lyxclient failed"
client = None
Alias('client', client) Alias('client', client)
if 'tex2lyx' in targets or 'install' in targets: if 'tex2lyx' in targets or 'install' in targets or 'all' in targets:
# #
# tex2lyx # tex2lyx
# #
print "Processing files in src/tex2lyx" print "Processing files in src/tex2lyx"
tex2lyx_env = env.Copy() tex2lyx_env = env.Copy()
# the order is important here. # the order is important here.
tex2lyx_env.Prepend(CPPPATH = ['$BUILDDIR/common/tex2lyx']) tex2lyx_env.Prepend(CPPPATH = ['$BUILDDIR/common/tex2lyx'])
tex2lyx_env.Append(LIBPATH = ['#$LOCALLIBPATH']) tex2lyx_env.AppendUnique(LIBPATH = ['#$LOCALLIBPATH'])
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/FloatList.C', '$TOP_SRC_DIR/src/FloatList.C') tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/FloatList.C', '$TOP_SRC_DIR/src/FloatList.C')
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/Floating.C', '$TOP_SRC_DIR/src/Floating.C') tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/Floating.C', '$TOP_SRC_DIR/src/Floating.C')
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/counters.C', '$TOP_SRC_DIR/src/counters.C') tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/counters.C', '$TOP_SRC_DIR/src/counters.C')
@ -937,33 +943,37 @@ if 'tex2lyx' in targets or 'install' in targets:
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxtextclass.C', '$TOP_SRC_DIR/src/lyxtextclass.C') tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxtextclass.C', '$TOP_SRC_DIR/src/lyxtextclass.C')
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlex.C', '$TOP_SRC_DIR/src/lyxlex.C') tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlex.C', '$TOP_SRC_DIR/src/lyxlex.C')
tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlex_pimpl.C', '$TOP_SRC_DIR/src/lyxlex_pimpl.C') tex2lyx_env.fileCopy('$BUILDDIR/common/tex2lyx/lyxlex_pimpl.C', '$TOP_SRC_DIR/src/lyxlex_pimpl.C')
tex2lyx = tex2lyx_env.Program( try:
target = '$BUILDDIR/common/tex2lyx/tex2lyx', tex2lyx = tex2lyx_env.Program(
LIBS = ['supports'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'], target = '$BUILDDIR/common/tex2lyx/tex2lyx',
source = ["$BUILDDIR/common/tex2lyx/%s" % x for x in Split(''' LIBS = ['supports'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'],
FloatList.C source = ["$BUILDDIR/common/tex2lyx/%s" % x for x in Split('''
Floating.C FloatList.C
counters.C Floating.C
lyxlayout.C counters.C
lyxtextclass.C lyxlayout.C
lyxlex.C lyxtextclass.C
lyxlex_pimpl.C lyxlex.C
boost.C lyxlex_pimpl.C
context.C boost.C
gettext.C context.C
lengthcommon.C gettext.C
lyxfont.C lengthcommon.C
texparser.C lyxfont.C
tex2lyx.C texparser.C
preamble.C tex2lyx.C
math.C preamble.C
table.C math.C
text.C table.C
''')] text.C
) ''')]
Alias('tex2lyx', env.Command(os.path.join('$BUILDDIR', os.path.split(str(tex2lyx[0]))[1]), )
tex2lyx, [Copy('$TARGET', '$SOURCE')])) Alias('tex2lyx', env.Command(os.path.join('$BUILDDIR', os.path.split(str(tex2lyx[0]))[1]),
tex2lyx, [Copy('$TARGET', '$SOURCE')]))
except:
print "Building of program tex2lyx failed"
tex2lyx = None
Alias('tex2lyx', tex2lyx) Alias('tex2lyx', tex2lyx)
@ -972,10 +982,10 @@ if build_lyx or 'lyxbase' in targets:
# src/ # src/
# #
print "Processing files in src" print "Processing files in src"
env['SUBST_KEYS'] = ['PACKAGE_VERSION', 'VERSION_INFO'] env['SUBST_KEYS'] = ['PACKAGE_VERSION', 'VERSION_INFO']
env.substFile('$BUILDDIR/common/version.C', '$TOP_SRC_DIR/src/version.C.in') env.substFile('$BUILDDIR/common/version.C', '$TOP_SRC_DIR/src/version.C.in')
lyx_source_pre = Split(''' lyx_source_pre = Split('''
Bidi.C Bidi.C
BufferView.C BufferView.C
@ -1081,7 +1091,7 @@ if build_lyx or 'lyxbase' in targets:
vspace.C vspace.C
main.C main.C
''') ''')
lyx_source_post = Split(''' lyx_source_post = Split('''
tabular.C tabular.C
dimension.C dimension.C
@ -1090,14 +1100,14 @@ if build_lyx or 'lyxbase' in targets:
Thesaurus.C Thesaurus.C
SpellBase.C SpellBase.C
''') ''')
if env.has_key('USE_ASPELL') and env['USE_ASPELL']: if env.has_key('USE_ASPELL') and env['USE_ASPELL']:
lyx_source_post.append('aspell.C') lyx_source_post.append('aspell.C')
elif env.has_key('USE_PSPELL') and env['USE_PSPELL']: elif env.has_key('USE_PSPELL') and env['USE_PSPELL']:
lyx_source_post.append('pspell.C') lyx_source_post.append('pspell.C')
elif env.has_key('USE_ISPELL') and env['USE_ISPELL']: elif env.has_key('USE_ISPELL') and env['USE_ISPELL']:
lyx_source_post.append('ispell.C') lyx_source_post.append('ispell.C')
lyxbase_pre = env.StaticLibrary( lyxbase_pre = env.StaticLibrary(
target = '$LOCALLIBPATH/lyxbase_pre', target = '$LOCALLIBPATH/lyxbase_pre',
source = ["$BUILDDIR/common/%s" % x for x in lyx_source_pre] source = ["$BUILDDIR/common/%s" % x for x in lyx_source_pre]
@ -1114,40 +1124,83 @@ if build_lyx or 'lyx' in targets:
# #
# Build lyx with given frontend # Build lyx with given frontend
# #
lyx = env.Program( try:
target = '$BUILDDIR/$frontend/lyx', lyx = env.Program(
source = [], target = '$BUILDDIR/$frontend/lyx',
LIBS = [ source = [],
'lyxbase_pre', LIBS = [
'mathed', 'lyxbase_pre',
'insets', 'mathed',
'frontends', 'insets',
env['frontend'], 'frontends',
'controllers', env['frontend'],
'graphics', 'controllers',
'supports', 'graphics',
'lyxbase_post', 'supports',
] + 'lyxbase_post',
env['BOOST_LIBRARIES'] + ] +
env['EXTRA_LIBS'] + env['BOOST_LIBRARIES'] +
env['SOCKET_LIBS'] + env['EXTRA_LIBS'] +
env['SYSTEM_LIBS'] env['SOCKET_LIBS'] +
) env['SYSTEM_LIBS']
# [/path/to/lyx.ext] => lyx-qt3.ext )
target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s' % frontend) # [/path/to/lyx.ext] => lyx-qt3.ext
Alias('lyx', env.Command(os.path.join('$BUILDDIR', target_name), lyx, target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s' % frontend)
[Copy('$TARGET', '$SOURCE')])) Alias('lyx', env.Command(os.path.join('$BUILDDIR', target_name), lyx,
[Copy('$TARGET', '$SOURCE')]))
except:
print "Building of program lyx failed"
lyx = None
raise
Alias('lyx', lyx) Alias('lyx', lyx)
if 'install' in targets: if 'po' in targets or 'install' in targets or 'all' in targets:
# #
# This does not look clever right now. I am using the basic # po/
# install builder of scons instead of fancier wiki solutions #
# with the hope that scons can finish standarding this soon. print 'Processing files in po...'
import glob
# handle po files
#
# files to translate
transfiles = glob.glob(os.path.join(env.subst('$TOP_SRC_DIR'), 'po', '*.po'))
# possibly *only* handle these languages
languages = None
if env.has_key('languages'):
languages = env.make_list(env['lanauges'])
# use defulat msgfmt
if not env['MSGFMT']:
print 'msgfmt does not exist. Can not process po files'
else:
# create a builder
env['BUILDERS']['Transfiles'] = Builder(action='$MSGFMT $SOURCE -o $TARGET',suffix='.gmo',src_suffix='.po')
#
gmo_files = []
for f in transfiles:
# get filename
fname = os.path.split(f)[1]
# country code
country = fname.split('.')[0]
#
if not languages or country in languages:
gmo_files.extend(env.Transfiles(f))
if 'install' in targets:
# create the directory if needed
if not os.path.isdir(env['PREFIX']):
try:
os.makedirs(env['PREFIX'])
except:
pass
if not os.path.isdir(env['PREFIX']):
print 'Can not create directory', env['PREFIX']
Exit(3)
# #
import glob import glob
#
# windows: $PREFIX/Resources # windows: $PREFIX/Resources
# others: $PREDIX/share/lyx # others: $PREDIX/share/lyx
share_dir = env['SHARE_DIR'] share_dir = env['SHARE_DIR']
@ -1157,9 +1210,9 @@ if 'install' in targets:
# windows: $PREFIX/Resources/locale # windows: $PREFIX/Resources/locale
# others: $PREFIX/share/locale # others: $PREFIX/share/locale
locale_dir = env['LOCALE_DIR'] locale_dir = env['LOCALE_DIR']
def install(dest, src): def install(dest, src):
''' recusive installation of src ''' ''' recusive installation of src to dest '''
# separate file and directory # separate file and directory
files = filter(os.path.isfile, [x for x in src]) files = filter(os.path.isfile, [x for x in src])
dirs = filter(os.path.isdir, [x for x in src]) dirs = filter(os.path.isdir, [x for x in src])
@ -1168,21 +1221,20 @@ if 'install' in targets:
# install directory # install directory
ins_dir = [dest] ins_dir = [dest]
for dir in dirs: for dir in dirs:
ins_dir.extend(install(os.path.join(dest, os.path.basename(dir)), ins_dir.extend(install(os.path.join(dest, os.path.basename(dir)),
glob.glob(os.path.join(dir, '*'))) ) glob.glob(os.path.join(dir, '*'))) )
return ins_dir return ins_dir
# #
# executables # executables (some of them may be none)
env.Install(env['BIN_DIR'], [lyx, tex2lyx, client]) env.Install(env['BIN_DIR'], filter(lambda x: x != None, [lyx, tex2lyx, client]))
Alias('install', env['BIN_DIR']) Alias('install', env['BIN_DIR'])
# #
# share/lyx # share/lyx
dirs = install(env['SHARE_DIR'], dirs = install(env['SHARE_DIR'],
[env.subst('$TOP_SRC_DIR/lib/') + file for file in ['configure.py', 'encodings', [env.subst('$TOP_SRC_DIR/lib/') + file for file in ['configure.py', 'encodings',
'chkconfig.ltx', 'CREDITS', 'external_templates', 'symbols', 'languages', 'chkconfig.ltx', 'CREDITS', 'external_templates', 'symbols', 'languages',
'lyxrc.example', 'syntax.default', \ 'lyxrc.example', 'syntax.default', 'bind', 'images', 'layouts', 'scripts',
'images', 'layouts', 'scripts', 'templates', \ 'templates', 'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc', 'ui']]
'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc', 'ui']]
) )
Alias('install', dirs) Alias('install', dirs)
# man # man
@ -1194,7 +1246,14 @@ if 'install' in targets:
env.subst('$TOP_SRC_DIR/src/client/lyxclient.man')) env.subst('$TOP_SRC_DIR/src/client/lyxclient.man'))
Alias('install', [os.path.join(env['MAN_DIR'], x) for Alias('install', [os.path.join(env['MAN_DIR'], x) for
x in ['lyx.1', 'tex2lyx.1', 'lyxclient.1']]) x in ['lyx.1', 'tex2lyx.1', 'lyxclient.1']])
# locale files?
# ru.gmo ==> ru/LC_MESSAGES/lyx.mo
for gmo in gmo_files:
lan = os.path.split(str(gmo))[1].split('.')[0]
dest_file = os.path.join(env['LOCALE_DIR'], lan, 'LC_MESSAGES', 'lyx.mo')
env.InstallAs(dest_file, gmo)
Alias('install', dest_file)
Default('lyx') Default('lyx')
Alias('all', ['lyx', 'client', 'tex2lyx', 'po'])

File diff suppressed because it is too large Load Diff

View File

@ -292,40 +292,15 @@ def checkBoostLibraries(conf, lib, pathes):
return ('','') return ('','')
import SCons.Node def checkMsgFmt(conf):
def processLang(env, folder): ''' check the existence of command msgfmt '''
""" Process translations (.po files) in a po/ dir conf.Message('Checking for gettext command msgfmt...')
This is copied from KDE knetstats-1.5/admin/kde.py res = conf.TryAction('msgfmt --help')
conf.Result(res[0])
FIXME: imcomplete if res[0]:
""" return 'msgfmt'
import glob else:
dir=SCons.Node.FS.default_fs.Dir(folder).srcnode() return None
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
def installCygwinLDScript(path): def installCygwinLDScript(path):