mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 00:20:43 +00:00
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:
parent
479abc6efd
commit
e94889a041
@ -13,18 +13,18 @@ import os, sys
|
||||
Import('env')
|
||||
|
||||
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:
|
||||
#
|
||||
# boost libraries
|
||||
#
|
||||
# special builddir
|
||||
env.BuildDir('$BUILDDIR/boost', '$TOP_SRC_DIR/boost/libs', duplicate = 0)
|
||||
|
||||
boostenv = env.Copy()
|
||||
boostenv.Append(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"')
|
||||
# for config.h
|
||||
boostenv.Append(CPPPATH = ['$TOP_SRC_DIR/src'])
|
||||
boostenv.AppendUnique(CCFLAGS = '-DBOOST_USER_CONFIG="<config.h>"')
|
||||
|
||||
print 'Processing files in boost/libs/filesystem/src...'
|
||||
|
||||
@ -83,21 +83,19 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
|
||||
Alias('boost', signals)
|
||||
Alias('boost', iostreams)
|
||||
|
||||
|
||||
#
|
||||
# Now, src code under src/
|
||||
#
|
||||
|
||||
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']]:
|
||||
#
|
||||
# src/support
|
||||
#
|
||||
print "Processing files in src/support"
|
||||
|
||||
env.Append(CPPPATH = ['.'])
|
||||
|
||||
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')
|
||||
|
||||
@ -136,11 +134,11 @@ if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']
|
||||
)
|
||||
Alias('supports', supports)
|
||||
|
||||
#
|
||||
# src/mathed
|
||||
#
|
||||
|
||||
if build_lyx or 'mathed' in targets:
|
||||
#
|
||||
# src/mathed
|
||||
#
|
||||
print "Processing files in src/mathed"
|
||||
|
||||
mathed = env.StaticLibrary(
|
||||
@ -290,7 +288,6 @@ if build_lyx or 'frontends' in targets:
|
||||
#
|
||||
# src/frontends
|
||||
#
|
||||
|
||||
print "Processing files in src/frontends"
|
||||
|
||||
frontends = env.StaticLibrary(
|
||||
@ -314,7 +311,6 @@ if build_lyx or 'graphics' in targets:
|
||||
#
|
||||
# src/graphics
|
||||
#
|
||||
|
||||
print "Processing files in src/graphics"
|
||||
|
||||
graphics = env.StaticLibrary(
|
||||
@ -340,7 +336,6 @@ if build_lyx or 'controllers' in targets:
|
||||
#
|
||||
# src/frontends/controllers
|
||||
#
|
||||
|
||||
print "Processing files in src/frontends/controllers"
|
||||
|
||||
controllers = env.StaticLibrary(
|
||||
@ -397,6 +392,7 @@ if build_lyx or 'controllers' in targets:
|
||||
)
|
||||
Alias('controllers', controllers)
|
||||
|
||||
|
||||
#
|
||||
# src/frontend/qt3/4
|
||||
#
|
||||
@ -417,18 +413,19 @@ if frontend == 'qt3':
|
||||
print "Processing files in src/frontends/qt3"
|
||||
|
||||
qt3env = env.Copy()
|
||||
# disable auto scan to speed up non build time
|
||||
qt3env['QT_AUTOSCAN'] = 0
|
||||
|
||||
# load qt3 tools
|
||||
qt3env.Tool('qt')
|
||||
|
||||
qt3env.Append(CPPPATH = [
|
||||
qt3env.AppendUnique(CPPPATH = [
|
||||
'$BUILDDIR/common',
|
||||
'$BUILDDIR/common/images',
|
||||
'$BUILDDIR/common/frontends',
|
||||
'$BUILDDIR/common/frontends/qt3',
|
||||
'$BUILDDIR/common/images',
|
||||
'$BUILDDIR/common/frontends/controllers',
|
||||
'$BUILDDIR/common/frontends/qt3',
|
||||
'$QT_INC_DIR']
|
||||
'$QT_INC_PATH']
|
||||
)
|
||||
|
||||
qt3_ui_files = Split('''
|
||||
@ -503,7 +500,6 @@ if frontend == 'qt3':
|
||||
QWrapDialogBase.ui
|
||||
''')
|
||||
|
||||
|
||||
qt3_moc_files = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split('''
|
||||
BulletsModule.C
|
||||
emptytable.C
|
||||
@ -564,14 +560,15 @@ if frontend == 'qt3':
|
||||
validators.C
|
||||
''')]
|
||||
|
||||
# under windows, because of the .C/.c confusion
|
||||
# moc_files are not moced automatically.
|
||||
# I am doing it manually here, until lyx changes
|
||||
# file extension from .C to .cpp
|
||||
qt3_moced_files = []
|
||||
if os.name == 'nt' or sys.platform == 'cygwin':
|
||||
# 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]
|
||||
|
||||
qt3_uiced_files = [qt3env.Uic('$BUILDDIR/common/frontends/qt3/ui/'+x) for x in qt3_ui_files]
|
||||
qt3_uiced_cc_files = []
|
||||
for x in qt3_uiced_files:
|
||||
qt3_uiced_cc_files.extend(x[1:])
|
||||
|
||||
qt3 = qt3env.StaticLibrary(
|
||||
target = '$LOCALLIBPATH/qt3',
|
||||
source = ["$BUILDDIR/common/frontends/qt3/%s" % x for x in Split('''
|
||||
@ -636,8 +633,7 @@ if frontend == 'qt3':
|
||||
qscreen.C
|
||||
qt_helpers.C
|
||||
''')] +
|
||||
qt3_moc_files + qt3_moced_files +
|
||||
['$BUILDDIR/common/frontends/qt3/ui/' + x for x in qt3_ui_files]
|
||||
qt3_moc_files + qt3_moced_files + qt3_uiced_cc_files
|
||||
)
|
||||
Alias('qt3', qt3)
|
||||
|
||||
@ -646,6 +642,7 @@ elif frontend == 'qt4':
|
||||
print "Processing files in src/frontends/qt4"
|
||||
|
||||
qt4env = env.Copy()
|
||||
qt4env['QT_AUTOSCAN'] = 0
|
||||
|
||||
# local qt4 toolset from
|
||||
# http://www.iua.upf.es/~dgarcia/Codders/sconstools.html
|
||||
@ -656,7 +653,7 @@ elif frontend == 'qt4':
|
||||
qt4env.Tool('qt4', [env['SCONS_DIR']])
|
||||
qt4env.EnableQt4Modules(env['QT_LIB'], debug = False)
|
||||
|
||||
qt4env.Append(CPPPATH = [
|
||||
qt4env.AppendUnique(CPPPATH = [
|
||||
'$BUILDDIR/common',
|
||||
'$BUILDDIR/common/images',
|
||||
'$BUILDDIR/common/frontends',
|
||||
@ -678,7 +675,7 @@ elif frontend == 'qt4':
|
||||
'-Winvalid-pch']
|
||||
)
|
||||
|
||||
qt4_ui_files = Split('''
|
||||
qt4_ui_files = ['$BUILDDIR/common/frontends/qt4/ui/%s' % x for x in Split('''
|
||||
BiblioUi
|
||||
BranchesUi
|
||||
BulletsUi
|
||||
@ -748,9 +745,9 @@ elif frontend == 'qt4':
|
||||
QURLUi
|
||||
QVSpaceUi
|
||||
QWrapUi
|
||||
''')
|
||||
''')]
|
||||
|
||||
qt4_moc_files = Split('''
|
||||
qt4_moc_files = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in Split('''
|
||||
BulletsModule.C
|
||||
emptytable.C
|
||||
FileDialog_private.C
|
||||
@ -811,15 +808,9 @@ elif frontend == 'qt4':
|
||||
QLToolbar.C
|
||||
socket_callback.C
|
||||
validators.C
|
||||
''')
|
||||
''') ]
|
||||
|
||||
#
|
||||
# Compile resources
|
||||
#
|
||||
for x in qt4_ui_files:
|
||||
qt4env.Uic4('$BUILDDIR/common/frontends/qt4/ui/' + x)
|
||||
|
||||
qt4_source_files = Split('''
|
||||
qt4_source_files = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in Split('''
|
||||
QDialogView.C
|
||||
Alert_pimpl.C
|
||||
Dialogs.C
|
||||
@ -881,18 +872,29 @@ elif frontend == 'qt4':
|
||||
qfont_metrics.C
|
||||
qscreen.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(
|
||||
target = '$LOCALLIBPATH/qt4',
|
||||
LIBS = qt4env['QT_LIB'],
|
||||
source = ["$BUILDDIR/common/frontends/qt4/%s" % x for x in qt4_source_files] + \
|
||||
["$BUILDDIR/common/frontends/qt4/%s" % x for x in qt4_moc_files]
|
||||
source = qt4_source_files + qt4_moc_files + Flatten(qt4_moced_files)
|
||||
)
|
||||
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
|
||||
#
|
||||
@ -900,6 +902,7 @@ if 'client' in targets or 'install' in targets:
|
||||
|
||||
print "Processing files in src/client"
|
||||
|
||||
try:
|
||||
client = env.Program(
|
||||
target = '$BUILDDIR/common/client/lyxclient',
|
||||
LIBS = env['BOOST_LIBRARIES'] + env['SOCKET_LIBS'] + ['supports'],
|
||||
@ -913,10 +916,13 @@ if 'client' in targets or 'install' in targets:
|
||||
)
|
||||
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)
|
||||
|
||||
|
||||
if 'tex2lyx' in targets or 'install' in targets:
|
||||
if 'tex2lyx' in targets or 'install' in targets or 'all' in targets:
|
||||
#
|
||||
# tex2lyx
|
||||
#
|
||||
@ -925,7 +931,7 @@ if 'tex2lyx' in targets or 'install' in targets:
|
||||
tex2lyx_env = env.Copy()
|
||||
# the order is important here.
|
||||
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/Floating.C', '$TOP_SRC_DIR/src/Floating.C')
|
||||
@ -938,6 +944,7 @@ if 'tex2lyx' in targets or 'install' in targets:
|
||||
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')
|
||||
|
||||
try:
|
||||
tex2lyx = tex2lyx_env.Program(
|
||||
target = '$BUILDDIR/common/tex2lyx/tex2lyx',
|
||||
LIBS = ['supports'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'],
|
||||
@ -964,6 +971,9 @@ if 'tex2lyx' in targets or 'install' in targets:
|
||||
)
|
||||
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)
|
||||
|
||||
|
||||
@ -1114,6 +1124,7 @@ if build_lyx or 'lyx' in targets:
|
||||
#
|
||||
# Build lyx with given frontend
|
||||
#
|
||||
try:
|
||||
lyx = env.Program(
|
||||
target = '$BUILDDIR/$frontend/lyx',
|
||||
source = [],
|
||||
@ -1137,17 +1148,59 @@ if build_lyx or 'lyx' in targets:
|
||||
target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s' % frontend)
|
||||
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)
|
||||
|
||||
|
||||
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
|
||||
# install builder of scons instead of fancier wiki solutions
|
||||
# with the hope that scons can finish standarding this soon.
|
||||
# po/
|
||||
#
|
||||
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
|
||||
|
||||
#
|
||||
# windows: $PREFIX/Resources
|
||||
# others: $PREDIX/share/lyx
|
||||
share_dir = env['SHARE_DIR']
|
||||
@ -1159,7 +1212,7 @@ if 'install' in targets:
|
||||
locale_dir = env['LOCALE_DIR']
|
||||
|
||||
def install(dest, src):
|
||||
''' recusive installation of src '''
|
||||
''' recusive installation of src to dest '''
|
||||
# separate file and directory
|
||||
files = filter(os.path.isfile, [x for x in src])
|
||||
dirs = filter(os.path.isdir, [x for x in src])
|
||||
@ -1172,17 +1225,16 @@ if 'install' in targets:
|
||||
glob.glob(os.path.join(dir, '*'))) )
|
||||
return ins_dir
|
||||
#
|
||||
# executables
|
||||
env.Install(env['BIN_DIR'], [lyx, tex2lyx, client])
|
||||
# executables (some of them may be none)
|
||||
env.Install(env['BIN_DIR'], filter(lambda x: x != None, [lyx, tex2lyx, client]))
|
||||
Alias('install', env['BIN_DIR'])
|
||||
#
|
||||
# share/lyx
|
||||
dirs = install(env['SHARE_DIR'],
|
||||
[env.subst('$TOP_SRC_DIR/lib/') + file for file in ['configure.py', 'encodings',
|
||||
'chkconfig.ltx', 'CREDITS', 'external_templates', 'symbols', 'languages',
|
||||
'lyxrc.example', 'syntax.default', \
|
||||
'images', 'layouts', 'scripts', 'templates', \
|
||||
'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc', 'ui']]
|
||||
'lyxrc.example', 'syntax.default', 'bind', 'images', 'layouts', 'scripts',
|
||||
'templates', 'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc', 'ui']]
|
||||
)
|
||||
Alias('install', dirs)
|
||||
# man
|
||||
@ -1194,7 +1246,14 @@ if 'install' in targets:
|
||||
env.subst('$TOP_SRC_DIR/src/client/lyxclient.man'))
|
||||
Alias('install', [os.path.join(env['MAN_DIR'], x) for
|
||||
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')
|
||||
|
||||
Alias('all', ['lyx', 'client', 'tex2lyx', 'po'])
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -292,40 +292,15 @@ def checkBoostLibraries(conf, lib, pathes):
|
||||
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) )
|
||||
def checkMsgFmt(conf):
|
||||
''' check the existence of command msgfmt '''
|
||||
conf.Message('Checking for gettext command msgfmt...')
|
||||
res = conf.TryAction('msgfmt --help')
|
||||
conf.Result(res[0])
|
||||
if res[0]:
|
||||
return 'msgfmt'
|
||||
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
|
||||
return None
|
||||
|
||||
|
||||
def installCygwinLDScript(path):
|
||||
|
Loading…
Reference in New Issue
Block a user