1 # vi:filetype=python:expandtab:tabstop=2:shiftwidth=2
5 # This file is part of LyX, the document processor.
6 # Licence details can be found in the file COPYING.
9 # Full author contact details are available in file CREDITS.
12 # This is a scons based building system for lyx, you can use it as follows:
13 # (after of course installation of scons from www.scons.org)
15 # scons [frontend=qt3|gt4] [boost=included|auto] ...
18 # * use scons -h for details about parameters
19 # * qt3 is used by default on linux, cygwin and mac
20 # * qt4 is used by default on win32
22 # File layouts (Important):
23 # * Unless you specify builddir=dir, building will happen
24 # in $BUILDDIR = $mode/$platform-$frontend. E.g., something like
26 # * All shared libs will be put in $BUILDDIR/libs, e.g.
27 # debug/linux-qt3/libs
28 # * lyx executable will be in directories like debug/linux-qt3
31 # * scons --config=force
32 # force re-configuration (use scons -H for details)
34 # * check config.log to see why config has failed
36 # * use extra_inc_path, extra_lib_path, qt_dir, qt_inc_path
37 # qt_lib_path to help locate qt and other libraries
38 # (there are extra_inc_path1, extra_lib_path1 for now)
40 # * (Important) use scons logfile=logfile.log to enable command line
41 # logging. (default is no logging)
44 # * Currently, all scons does is building lyx in
45 # $LYXROOT/$mode/$build_dir/
46 # where $mode is debug or release, $build_dir is the build_dir name
49 # * scons install etc may be added later. Interested contributors can follow
50 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/AccumulateBuilder
52 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/DistTarBuilder
53 # Please also see the commented out code in scons_utils.py
55 # * NSIS support can be found here.
56 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/NsisSconsTool
59 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/RpmHonchoTemp
61 # However, I decide to wait since scons seems to be standardizing these
67 # config/scons_utils.py defines a few utility function
68 sys.path.append('config')
69 import scons_utils as utils
71 #----------------------------------------------------------
72 # Required runtime environment
73 #----------------------------------------------------------
75 # FIXME: I remember lyx requires higher version of python?
76 EnsurePythonVersion(1, 5)
77 # Please use at least 0.96.91 (not 0.96.1)
78 EnsureSConsVersion(0, 96)
80 #----------------------------------------------------------
82 #----------------------------------------------------------
84 # some global settings
85 PACKAGE_VERSION = '1.5.0svn'
87 default_build_mode = 'debug'
90 PACKAGE_BUGREPORT = 'lyx-devel@lists.lyx.org'
92 PACKAGE_TARNAME = 'lyx'
93 PACKAGE_STRING = '%s %s' % (PACKAGE_NAME, PACKAGE_VERSION)
95 config_h = os.path.join('src', 'config.h')
96 default_log_file = 'scons_lyx.log'
98 # FIXME: what is this? (They are used in src/support/package.C.in
99 LOCALEDIR = "../locale/"
100 LYX_DIR = "/usr/local/share/lyx"
102 # platform dependent default build_dir and other settings
104 # I know, somebody would say:
105 # This is TOTALLY wrong! Everything should be automatically
109 platform_name = 'win32'
110 default_frontend = 'qt4'
111 # boost and gettext are unlikely to be installed already
112 default_boost_opt = 'included'
113 default_gettext_opt = 'included'
114 default_pch_opt = False
115 default_with_x = False
116 spell_checker = 'auto'
117 # FIXME: I need to know what exactly is boost_posix
119 packaging_method = 'windows'
120 elif os.name == 'posix' and sys.platform != 'cygwin':
121 platform_name = 'linux'
122 default_frontend = 'qt3'
123 # try to use system boost/gettext libraries
124 default_boost_opt = 'auto'
125 default_gettext_opt = 'auto'
126 default_pch_opt = False
127 default_with_x = True
129 packaging_method = 'posix'
130 elif os.name == 'posix' and sys.platform == 'cygwin':
131 platform_name = 'cygwin'
132 default_frontend = 'qt3'
133 # force the use of cygwin/boost/gettext
134 default_boost_opt = 'system'
135 default_gettext_opt = 'system'
136 default_pch_opt = False
137 default_with_x = True
139 packaging_method = 'posix'
140 elif os.name == 'darwin':
141 platform_name = 'mac'
142 default_frontend = 'qt3'
144 default_boost_opt = 'included'
145 default_gettext_opt = 'included'
146 default_pch_opt = False
147 default_with_x = False
149 packaging_method = 'msc'
150 else: # unsupported system
151 platform_name = 'others'
152 default_frontend = 'qt3'
154 default_boost_opt = 'included'
155 default_gettext_opt = 'included'
156 default_pch_opt = False
157 default_with_x = True
159 packaging_method = 'posix'
161 #---------------------------------------------------------
163 #----------------------------------------------------------
164 # Note that if you set the options via the command line,
165 # they will be remembered in the file 'options.cache'
167 # NOTE: the scons people are trying to fix scons so that
168 # options like --prefix will be accepted. Right now,
169 # we have to use the KEY=VALUE style of scons
171 opts = Options(['options.cache', 'config.py'])
174 EnumOption('frontend', 'Main GUI',
176 allowed_values = ('xform', 'qt3', 'qt4', 'gtk') ),
177 # debug or release build
178 EnumOption('mode', 'Building method', default_build_mode,
179 allowed_values = ('debug', 'release') ),
182 'Use included, system boost library, or try sytem first.',
185 'auto', # detect boost, if not found, use included
186 'included', # always use included boost
187 'system', # always use system boost, fail if can not find
189 EnumOption('gettext',
190 'Use included, system gettext library, or try sytem first',
193 'auto', # detect gettext, if not found, use included
194 'included', # always use included gettext
195 'system', # always use system gettext, fail if can not find
197 # FIXME: I am not allowed to use '' as default, '.' is not good either.
198 PathOption('qt_dir', 'Path to qt directory', '.'),
199 PathOption('qt_include_path', 'Path to qt include directory', '.'),
200 PathOption('qt_lib_path', 'Path to qt library directory', '.'),
201 # FIXME: I do not know how pch is working. Ignore this option now.
202 BoolOption('pch', '(NA) Whether or not use pch', default_pch_opt),
203 # FIXME: Not implemented yet.
204 BoolOption('version_suffix', '(NA) Whether or not add version suffix', False),
205 # build directory, will replace build_dir if set
206 PathOption('build_dir', 'Build directory', '.'),
207 # extra include and libpath
208 PathOption('extra_inc_path', 'Extra include path', '.'),
209 PathOption('extra_lib_path', 'Extra library path', '.'),
210 PathOption('extra_inc_path1', 'Extra include path', '.'),
211 PathOption('extra_lib_path1', 'Extra library path', '.'),
212 # enable assertion, (config.h has ENABLE_ASSERTIOS
213 BoolOption('assertions', 'Use assertions', True),
214 # enable warning, (config.h has WITH_WARNINGS)
215 BoolOption('warnings', 'Use warnings', True),
216 # enable glib, (config.h has _GLIBCXX_CONCEPT_CHECKS)
217 BoolOption('concept_checks', 'Enable concept checks', True),
218 # FIXME: I do not know what is nls
219 BoolOption('nls', '(NA) Whether or not use native language support', False),
220 # FIXME: not implemented
221 BoolOption('profile', '(NA) Whether or not enable profiling', False),
222 # FIXME: not implemented
223 PathOption('prefix', '(NA) install architecture-independent files in PREFIX', '.'),
224 # FIXME: not implemented
225 PathOption('exec_prefix', '(NA) install architecture-independent executable files in PREFIX', '.'),
226 # FIXME: not implemented
227 BoolOption('std_debug', '(NA) Whether or not turn on stdlib debug', False),
229 BoolOption('X11', 'Use x11 windows system', default_with_x),
230 # FIXME: not implemented
231 BoolOption('libintl', '(NA) Use libintl library', False),
232 # FIXME: not implemented
233 PathOption('intl_prefix', '(NA) Path to intl library', '.'),
235 ('logfile', 'save commands (not outputs) to logfile', default_log_file),
237 BoolOption('aikasurus', 'Whether or not use aikasurus library', False),
239 EnumOption('spell', 'Choose spell checker to use.', 'auto',
240 allowed_values = ('aspell', 'pspell', 'ispell', 'auto') )
243 # Determine the frontend to use
244 frontend = ARGUMENTS.get('frontend', default_frontend)
245 use_X11 = ARGUMENTS.get('X11', default_with_x)
247 #---------------------------------------------------------
248 # Setting up environment
249 #---------------------------------------------------------
255 # set environment since I do not really like ENV = os.environ
256 env['ENV']['PATH'] = os.environ.get('PATH')
257 env['ENV']['HOME'] = os.environ.get('HOME')
258 env['ENV']['PKG_CONFIG_PATH'] = os.environ.get('PKG_CONFIG_PATH')
259 env['TOP_SRC_DIR'] = Dir('.').abspath
262 # frontend, mode, BUILDDIR and LOCALLIBPATH=BUILDDIR/libs
264 env['frontend'] = frontend
265 env['mode'] = ARGUMENTS.get('mode', default_build_mode)
266 # lyx will be built to $build/build_dir so it is possible
267 # to build multiple build_dirs using the same source
268 # $mode can be debug or release
269 if ARGUMENTS.has_key('build_dir'):
270 build_dir = ARGUMENTS['build_dir']
271 env['BUILDDIR'] = build_dir
273 # Determine the name of the build (platform+frontend
274 build_dir = '%s-%s' % (platform_name, frontend)
275 if use_X11 and platform_name == 'cygwin':
277 env['BUILDDIR'] = os.path.join('$mode', build_dir)
278 # all built libraries will go to build_dir/libs
279 # (This is different from the make file approach)
280 env['LOCALLIBPATH'] = '#$BUILDDIR/libs'
281 env.Append(LIBPATH = ['$LOCALLIBPATH'])
284 # QTDIR, QT_LIB_PATH, QT_INC_PATH
286 if platform_name == 'win32':
289 if ARGUMENTS.has_key('qt_dir'):
290 env['QTDIR'] = ARGUMENTS['qt_dir']
291 # add path to the qt tools
292 env.Append(LIBPATH = [os.path.join(ARGUMENTS['qt_dir'], 'lib')])
293 env.Append(CPPPATH = [os.path.join(ARGUMENTS['qt_dir'], 'include')])
294 # set environment so that moc etc can be found even if its path is not set properly
295 env['ENV']['PATH'] = os.path.join(ARGUMENTS['qt_dir'], 'bin') + os.pathsep + env['ENV']['PATH']
297 env['QTDIR'] = os.environ.get('QTDIR', '/usr/lib/qt-3.3')
299 if ARGUMENTS.has_key('qt_lib_path'):
300 env['QT_LIB_PATH'] = ARGUMENTS['qt_lib_path']
302 env['QT_LIB_PATH'] = '$QTDIR/lib'
303 env.Append(LIBPATH = ['$QT_LIB_PATH'])
304 # qt4 seems to be using pkg_config
305 env['ENV']['PKG_CONFIG_PATH'] = env.subst('$QT_LIB_PATH')
307 if ARGUMENTS.has_key('qt_inc_path'):
308 env['QT_INC_PATH'] = ARGUMENTS['qt_inc_path']
309 elif os.path.isdir(os.path.join(env.subst('$QTDIR'), 'include')):
310 env['QT_INC_PATH'] = '$QTDIR/include'
311 else: # have to guess
312 env['QT_INC_PATH'] = '/usr/include/$frontend/'
313 env.Append(CPPPATH = env['QT_INC_PATH'])
316 # extra_inc_path and extra_lib_path
318 if ARGUMENTS.has_key('extra_inc_path'):
319 env.Append(CPPPATH = [ARGUMENTS['extra_inc_path']])
320 if ARGUMENTS.has_key('extra_lib_path'):
321 env.Append(LIBPATH = [ARGUMENTS['extra_lib_path']])
322 if ARGUMENTS.has_key('extra_inc_path1'):
323 env.Append(CPPPATH = [ARGUMENTS['extra_inc_path1']])
324 if ARGUMENTS.has_key('extra_lib_path1'):
325 env.Append(LIBPATH = [ARGUMENTS['extra_lib_path1']])
328 # this is a bit out of place (after auto-configration)
329 # but it is required to do the tests.
330 if platform_name == 'win32':
331 env.Append(CPPPATH = ['#c:/MinGW/include'])
333 #----------------------------------------------------------
335 #----------------------------------------------------------
337 conf = Configure(env,
339 'CheckPkgConfig' : utils.checkPkgConfig,
340 'CheckPackage' : utils.checkPackage,
341 'CheckPutenv' : utils.checkPutenv,
342 'CheckIstreambufIterator' : utils.checkIstreambufIterator,
343 'CheckMkdirOneArg' : utils.checkMkdirOneArg,
344 'CheckStdCount' : utils.checkStdCount,
345 'CheckSelectArgType' : utils.checkSelectArgType,
346 'CheckBoostLibraries' : utils.checkBoostLibraries,
350 # pkg-config? (if not, we use hard-coded options)
351 if conf.CheckPkgConfig('0.15.0'):
352 env['HAS_PKG_CONFIG'] = True
354 print 'pkg-config >= 0.1.50 is not found'
355 env['HAS_PKG_CONFIG'] = False
357 # zlib? This is required.
358 if not conf.CheckLibWithHeader('z', 'zlib.h', 'C'):
359 print 'Did not find libz or zlib.h, exiting!'
364 # qt3 does not use pkg_config
365 if env['frontend'] == 'qt3':
366 if not conf.CheckLibWithHeader('qt-mt', 'qapp.h', 'c++', 'QApplication qapp();'):
367 print 'Did not find qt libraries, exiting!'
369 elif env['frontend'] == 'qt4':
371 # first: try pkg_config
372 if env['HAS_PKG_CONFIG']:
373 succ = conf.CheckPackage('QtCore') or conf.CheckPackage('QtCore4')
374 env['QT4_PKG_CONFIG'] = succ
375 # second: try to link to it
377 # FIXME: under linux, I can test the following perfectly
378 # However, under windows, lib names need to passed as libXXX4.a ...
379 succ = conf.CheckLibWithHeader('QtCore', 'QtGui/QApplication', 'c++', 'QApplication qapp();') or \
380 conf.CheckLibWithHeader('QtCore4', 'QtGui/QApplication', 'c++', 'QApplication qapp();')
381 # third: try to look up the path
384 for lib in ['QtCore', 'QtGui', 'Qt3Support']:
385 # windows version has something like QtGui4 ...
386 if not (os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s.a' % lib)) or \
387 os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s4.a' % lib))):
390 # still can not find it
392 print "Qt4 libraries are found."
394 print 'Did not find qt libraries, exiting!'
398 env['socket_libs'] = []
399 if conf.CheckLib('socket'):
400 env.Append(socket_libs = ['socket'])
402 # FIXME: What is nsl, is it related to socket?
403 if conf.CheckLib('nsl'):
404 env.Append(socket_libs = ['nsl'])
406 # check boost libraries
407 boost_opt = ARGUMENTS.get('boost', default_boost_opt)
408 # check for system boost
410 if boost_opt in ['auto', 'system']:
411 pathes = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
412 sig = conf.CheckBoostLibraries('boost_signals', pathes)
413 reg = conf.CheckBoostLibraries('boost_regex', pathes)
414 fil = conf.CheckBoostLibraries('boost_filesystem', pathes)
415 ios = conf.CheckBoostLibraries('boost_iostreams', pathes)
416 # if any them is not found
417 if ('' in [sig[0], reg[0], fil[0], ios[0]]):
418 if boost_opt == 'system':
419 print "Can not find system boost libraries"
420 print "Please supply a path through extra_lib_path"
421 print "and try again."
424 env['BOOST_LIBRARIES'] = [sig[1], reg[1], fil[1], ios[1]]
425 # assume all boost libraries are in the same path...
426 env.Append(LIBPATH = sig[0])
427 env['INCLUDED_BOOST'] = False
429 # now, auto and succ = false, or included
431 # we do not need to set LIBPATH now.
432 env['BOOST_LIBRARIES'] = ['boost_signals', 'boost_regex',
433 'boost_filesystem', 'boost_iostreams']
434 env['INCLUDED_BOOST'] = True
440 print "Generating ", config_h, "..."
442 # I do not handle all macros in src/config.h.in, rather I am following a list
443 # of *used-by-lyx* macros compiled by Abdelrazak Younes <younes.a@free.fr>
445 # Note: addToConfig etc are defined in scons_util
446 utils.startConfigH(config_h)
466 ('io.h', 'HAVE_IO_H', 'c'),
467 ('limits.h', 'HAVE_LIMITS_H', 'c'),
468 ('locale.h', 'HAVE_LOCALE_H', 'c'),
469 ('locale', 'HAVE_LOCALE', 'cxx'),
470 ('process.h', 'HAVE_PROCESS_H', 'c'),
471 ('stdlib.h', 'HAVE_STDLIB_H', 'c'),
472 ('sys/stat.h', 'HAVE_SYS_STAT_H', 'c'),
473 ('sys/time.h', 'HAVE_SYS_TIME_H', 'c'),
474 ('sys/types.h', 'HAVE_SYS_TYPES_H', 'c'),
475 ('sys/utime.h', 'HAVE_SYS_UTIME_H', 'c'),
476 ('sys/socket.h', 'HAVE_SYS_SOCKET_H', 'c'),
477 ('unistd.h', 'HAVE_UNISTD_H', 'c'),
478 ('utime.h', 'HAVE_UTIME_H', 'c'),
479 ('istream', 'HAVE_ISTREAM', 'cxx'),
480 ('ostream', 'HAVE_OSTREAM', 'cxx'),
481 ('ios', 'HAVE_IOS', 'cxx')
484 for header in headers:
485 if (header[2] == 'c' and conf.CheckCHeader(header[0])) or \
486 (header[2] == 'cxx' and conf.CheckCXXHeader(header[0])):
487 utils.addToConfig('#define %s 1' % header[1])
489 utils.addToConfig('/* #undef %s */' % header[1])
509 ('open', 'HAVE_OPEN'),
510 ('close', 'HAVE_CLOSE'),
511 ('popen', 'HAVE_POPEN'),
512 ('pclose', 'HAVE_PCLOSE'),
513 ('_open', 'HAVE__OPEN'),
514 ('_close', 'HAVE__CLOSE'),
515 ('_popen', 'HAVE__POPEN'),
516 ('_pclose', 'HAVE__PCLOSE'),
517 ('getpid', 'HAVE_GETPID'),
518 ('_getpid', 'HAVE__GETPID'),
519 ('mkdir', 'HAVE_MKDIR'),
520 ('_mkdir', 'HAVE__MKDIR'),
521 ('mktemp', 'HAVE_MKTEMP'),
522 ('mkstemp', 'HAVE_MKSTEMP'),
523 ('strerror', 'HAVE_STRERROR')
526 for func in functions:
527 if conf.CheckFunc(func[0]):
528 utils.addToConfig('#define %s 1' % func[1])
530 utils.addToConfig('/* #undef %s */' % func[1])
535 utils.addToConfig('#define PACKAGE "%s"' % PACKAGE)
536 utils.addToConfig('#define PACKAGE_VERSION "%s"' % PACKAGE_VERSION)
538 utils.addToConfig('#define DEVEL_VERSION 1')
543 # _GLIBCXX_CONCEPT_CHECKS
545 # items are (ENV, ARGUMENTS)
547 ('ENABLE_ASSERTIONS', 'assertions'),
548 ('ENABLE_NLS', 'nls'),
549 ('WITH_WARNINGS', 'warnings'),
550 ('_GLIBCXX_CONCEPT_CHECKS', 'concept_checks'),
554 if (env.has_key(val[0]) and env[val[0]]) or \
555 ARGUMENTS.get(val[1]):
556 utils.addToConfig('#define %s 1' % val[0])
558 utils.addToConfig('/* #undef %s */' % val[0])
560 # AIKSAURUS_H_LOCATION
561 if ARGUMENTS.get('aiksaurus'):
562 if conf.CheckLib('Aiksaurus'):
563 utils.addToConfig("#define AIKSAURUS_H_LOCATION")
565 print 'Library Aiksaurus not found'
572 # determine headers to use
573 spell_engine = ARGUMENTS.get('spell', 'auto')
574 spell_detected = False
575 if spell_engine in ['auto', 'aspell'] and \
576 conf.CheckLibWithHeader('aspell', 'aspell.h', 'C'):
577 utils.addToConfig('#define USE_ASPELL 1')
578 spell_detected = True
579 elif spell_engine in ['auto', 'pspell'] and \
580 conf.CheckLibWithHeader('pspell', 'pspell.h', 'C'):
581 utils.addToConfig('#define USE_PSPELL 1')
582 spell_detected = True
583 elif spell_engine in ['auto', 'ispell'] and \
584 conf.CheckLibWithHeader('ispell', 'ispell.h', 'C'):
585 utils.addToConfig('#define USE_ISPELL 1')
586 spell_detected = False
588 if not spell_detected:
589 # FIXME: can lyx work without an spell engine
590 if spell_engine == 'auto':
591 print "Warning: Can not locate any spell checker"
593 print "Warning: Can not locate specified spell checker:", spell_engine
595 # USE_POSIX_PACKAGING
596 # USE_MACOSX_PACKAGING
597 # USE_WINDOWS_PACKAGING
598 if packaging_method == 'windows':
599 utils.addToConfig('#define USE_WINDOWS_PACKAGING 1')
600 elif packaging_method == 'posix':
601 utils.addToConfig('#define USE_POSIX_PACKAGING 1')
602 elif packaging_method == 'mac':
603 utils.addToConfig('#define USE_MACOSX_PACKAGING 1')
607 utils.addToConfig('#define BOOST_POSIX 1')
609 utils.addToConfig('/* #undef BOOST_POSIX */')
612 if conf.CheckPutenv():
613 utils.addToConfig('#define HAVE_PUTENV 1')
615 utils.addToConfig('/* #undef HAVE_PUTENV */')
617 # HAVE_DECL_ISTREAMBUF_ITERATOR
618 if conf.CheckIstreambufIterator():
619 utils.addToConfig('#define HAVE_DECL_ISTREAMBUF_ITERATOR 1')
621 utils.addToConfig('/* #undef HAVE_DECL_ISTREAMBUF_ITERATOR */')
623 # MKDIR_TAKES_ONE_ARG
624 if conf.CheckMkdirOneArg():
625 utils.addToConfig('#define MKDIR_TAKES_ONE_ARG 1')
627 utils.addToConfig('/* #undef MKDIR_TAKES_ONE_ARG */')
630 if conf.CheckStdCount():
631 utils.addToConfig('#define HAVE_STD_COUNT 1')
633 utils.addToConfig('/* #undef HAVE_STD_COUNT */')
638 (arg1, arg234, arg5) = conf.CheckSelectArgType()
639 utils.addToConfig('#define SELECT_TYPE_ARG1 %s' % arg1)
640 utils.addToConfig('#define SELECT_TYPE_ARG234 %s' % arg234)
641 utils.addToConfig('#define SELECT_TYPE_ARG5 %s' % arg5)
645 # WANT_GETFILEATTRIBUTESEX_WRAPPER
646 utils.endConfigH(config_h)
649 # Finish auto-configuration
652 #----------------------------------------------------------
653 # Now set up our build process accordingly
654 #----------------------------------------------------------
657 # QT_LIB etc (EXTRA_LIBS holds lib for each frontend)
659 # NOTE: Tool('qt') or Tool('qt4') will be loaded later
660 # in their respective directory and specialized env.
662 if frontend == 'qt3':
663 # note: env.Tool('qt') my set QT_LIB to qt
664 env['QT_LIB'] = 'qt-mt'
665 env['EXTRA_LIBS'] = ['qt-mt']
666 if platform_name == 'cygwin' and use_X11:
667 env['EXTRA_LIBS'] += ['GL', 'Xmu', 'Xi', 'Xrender', 'Xrandr', 'Xcursor',
668 'Xft', 'freetype', 'fontconfig', 'Xext', 'X11', 'SM', 'ICE', 'resolv',
670 env.Append(LIBPATH = ['/usr/X11R6/lib'])
671 elif frontend == 'qt4':
672 # local qt4 toolset from
673 # http://www.iua.upf.es/~dgarcia/Codders/sconstools.html
674 if platform_name == "win32":
675 env['QT_LIB'] = ['QtCore4', 'QtGui4', 'Qt3Support4']
677 env['QT_LIB'] = ['QtCore', 'QtGui', 'Qt3Support']
678 env['EXTRA_LIBS'] = env['QT_LIB']
680 print "Can not locate qt tools"
681 print "What I get is "
682 print " QTDIR: ", env['QTDIR']
685 # Build parameters CPPPATH etc
688 env.Append(CPPPATH = ['#boost', '#src'])
690 # TODO: add (more) appropriate compiling options (-DNDEBUG etc)
691 # for debug/release mode
692 if ARGUMENTS.get('mode', default_build_mode) == 'debug':
693 env.Append(CCFLAGS = [])
695 env.Append(CCFLAGS = [])
698 # Customized builders
700 # install customized builders
701 env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
702 # FIXME: there must be a better way.
703 env['BUILDERS']['fileCopy'] = Builder(action = utils.env_filecopy)
706 # A Link script for cygwin see
707 # http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
708 # http://www.cygwin.com/ml/cygwin-apps/2004-09/msg00309.html
711 if platform_name == 'cygwin' and env['frontend'] == 'qt3':
712 ld_script_path = '/usr/lib/qt3/mkspecs/cygwin-g++'
713 ld_script = utils.installCygwinLDScript(ld_script_path)
714 env.Append(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc',
715 '-Wl,--script,%s' % ld_script, '-Wl,-s'])
720 # src/support/package.C.in needs the following to replace
721 env['LYX_DIR'] = LYX_DIR
722 env['LOCALEDIR'] = LOCALEDIR
723 env['TOP_SRCDIR'] = str(Dir('#'))
724 env['PROGRAM_SUFFIX'] = PROGRAM_SUFFIX
725 # needed by src/version.C.in => src/version.C
726 env['PACKAGE_VERSION'] = PACKAGE_VERSION
727 # fill in the version info
728 env['VERSION_INFO'] = '''Configuration
730 Special build flags: %s
732 C Compiler flags: %s %s
734 C++ Compiler LyX flags: %s
735 C++ Compiler flags: %s %s
737 Linker user flags: %s
739 Builing directory: %s
740 Local library directory: %s
746 LyX binary dir: FIXME
748 ''' % (platform_name,
749 env.subst('$CCFLAGS'), env.subst('$CC'),
750 env.subst('$CPPFLAGS'), env.subst('$CFLAGS'),
751 env.subst('$CXX'), env.subst('$CXXFLAGS'),
752 env.subst('$CPPFLAGS'), env.subst('$CXXFLAGS'),
753 env.subst('$LINKFLAGS'), env.subst('$LINKFLAGS'),
754 env.subst('$BUILDDIR'), env.subst('$LOCALLIBPATH'),
755 str(env['LIBPATH']), str(env['BOOST_LIBRARIES']),
756 env['frontend'], packaging_method)
758 if env['frontend'] in ['qt3', 'qt4']:
759 env['VERSION_INFO'] += ''' include dir: %s
762 ''' % (env.subst('$QT_INC_PATH'), env.subst('$QT_LIB_PATH'), use_X11)
764 print env['VERSION_INFO']
767 # Mingw command line may be too short for our link usage,
768 # Here we use a trick from scons wiki
769 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/LongCmdLinesOnWin32
771 # I also would like to add logging (commands only) capacity to the
773 logfile = ARGUMENTS.get('logfile', default_log_file)
774 if logfile != '' or platform_name == 'win32':
776 utils.setLoggedSpawn(env, logfile, longarg = (platform_name == 'win32'),
777 info = '''# This is a log of commands used by scons to build lyx
781 ''' % (time.asctime(), ' '.join(sys.argv),
782 env['VERSION_INFO'].replace('\n','\n# ')) )
789 opts.Save('options.cache', env)
790 # -h will print out help info
791 Help(opts.GenerateHelpText(env))
795 #----------------------------------------------------------
797 #----------------------------------------------------------
799 env.BuildDir('$BUILDDIR', 'src')
800 print "Building all targets recursively"
802 client = env.SConscript('#$BUILDDIR/client/SConscript')
803 lyx = env.SConscript('#$BUILDDIR/SConscript')
804 tex2lyx = env.SConscript('#$BUILDDIR/tex2lyx/SConscript')
806 # avoid using full path to build them
807 Alias('client', client)
808 Alias('tex2lyx', tex2lyx)
811 Default('lyx', 'tex2lyx')
813 print "Buinging lyx done with targets", map(str, BUILD_TARGETS)