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
39 # * (Important) use scons logfile=logfile.log to enable command line
40 # logging. (default is no logging)
43 # * Currently, all scons does is building lyx in
44 # $LYXROOT/$mode/$build_dir/
45 # where $mode is debug or release, $build_dir is the build_dir name
48 # * scons install etc may be added later. Interested contributors can follow
49 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/AccumulateBuilder
51 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/DistTarBuilder
52 # Please also see the commented out code in scons_utils.py
54 # * NSIS support can be found here.
55 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/NsisSconsTool
58 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/RpmHonchoTemp
60 # However, I decide to wait since scons seems to be standardizing these
66 # scons_util defines a few utility function
67 import scons_utils as utils
69 #----------------------------------------------------------
70 # Required runtime environment
71 #----------------------------------------------------------
73 # FIXME: I remember lyx requires higher version of python?
74 EnsurePythonVersion(1, 5)
75 # Please use at least 0.96.91 (not 0.96.1)
76 EnsureSConsVersion(0, 96)
78 #----------------------------------------------------------
80 #----------------------------------------------------------
82 # some global settings
83 PACKAGE_VERSION = '1.5.0svn'
85 default_build_mode = 'debug'
88 PACKAGE_BUGREPORT = 'lyx-devel@lists.lyx.org'
90 PACKAGE_TARNAME = 'lyx'
91 PACKAGE_STRING = '%s %s' % (PACKAGE_NAME, PACKAGE_VERSION)
93 config_h = os.path.join('src', 'config.h')
94 default_log_file = 'scons_lyx.log'
96 # FIXME: what is this? (They are used in src/support/package.C.in
97 LOCALEDIR = "../locale/"
98 LYX_DIR = "/usr/local/share/lyx"
100 # platform dependent default build_dir and other settings
102 # I know, somebody would say:
103 # This is TOTALLY wrong! Everything should be automatically
107 platform_name = 'win32'
108 default_frontend = 'qt4'
109 # boost and gettext are unlikely to be installed already
110 default_boost_opt = 'included'
111 default_gettext_opt = 'included'
112 default_pch_opt = False
113 default_with_x = False
114 spell_checker = 'auto'
115 # FIXME: I need to know what exactly is boost_posix
117 packaging_method = 'windows'
118 elif os.name == 'posix' and sys.platform != 'cygwin':
119 platform_name = 'linux'
120 default_frontend = 'qt3'
121 # try to use system boost/gettext libraries
122 default_boost_opt = 'auto'
123 default_gettext_opt = 'auto'
124 default_pch_opt = False
125 default_with_x = True
127 packaging_method = 'posix'
128 elif os.name == 'posix' and sys.platform == 'cygwin':
129 platform_name = 'cygwin'
130 default_frontend = 'qt3'
131 # force the use of cygwin/boost/gettext
132 default_boost_opt = 'system'
133 default_gettext_opt = 'system'
134 default_pch_opt = False
135 default_with_x = True
137 packaging_method = 'posix'
138 elif os.name == 'darwin':
139 platform_name = 'mac'
140 default_frontend = 'qt3'
142 default_boost_opt = 'included'
143 default_gettext_opt = 'included'
144 default_pch_opt = False
145 default_with_x = False
147 packaging_method = 'msc'
148 else: # unsupported system
149 platform_name = 'others'
150 default_frontend = 'qt3'
152 default_boost_opt = 'included'
153 default_gettext_opt = 'included'
154 default_pch_opt = False
155 default_with_x = True
157 packaging_method = 'posix'
159 #---------------------------------------------------------
161 #----------------------------------------------------------
162 # Note that if you set the options via the command line,
163 # they will be remembered in the file 'options.cache'
165 # NOTE: the scons people are trying to fix scons so that
166 # options like --prefix will be accepted. Right now,
167 # we have to use the KEY=VALUE style of scons
169 opts = Options(['options.cache', 'config.py'])
172 EnumOption('frontend', 'Main GUI',
174 allowed_values = ('xform', 'qt3', 'qt4', 'gtk') ),
175 # debug or release build
176 EnumOption('mode', 'Building method', default_build_mode,
177 allowed_values = ('debug', 'release') ),
180 'Use included, system boost library, or try sytem first.',
183 'auto', # detect boost, if not found, use included
184 'included', # always use included boost
185 'system', # always use system boost, fail if can not find
187 EnumOption('gettext',
188 'Use included, system gettext library, or try sytem first',
191 'auto', # detect gettext, if not found, use included
192 'included', # always use included gettext
193 'system', # always use system gettext, fail if can not find
195 # FIXME: I am not allowed to use '' as default, '.' is not good either.
196 PathOption('qt_dir', 'Path to qt directory', '.'),
197 PathOption('qt_include_path', 'Path to qt include directory', '.'),
198 PathOption('qt_lib_path', 'Path to qt library directory', '.'),
199 # FIXME: I do not know how pch is working. Ignore this option now.
200 BoolOption('pch', '(NA) Whether or not use pch', default_pch_opt),
201 # FIXME: Not implemented yet.
202 BoolOption('version_suffix', '(NA) Whether or not add version suffix', False),
203 # build directory, will replace build_dir if set
204 PathOption('build_dir', 'Build directory', '.'),
205 # extra include and libpath
206 PathOption('extra_inc_path', 'Extra include path', '.'),
207 PathOption('extra_lib_path', 'Extra library path', '.'),
208 # enable assertion, (config.h has ENABLE_ASSERTIOS
209 BoolOption('assertions', 'Use assertions', True),
210 # enable warning, (config.h has WITH_WARNINGS)
211 BoolOption('warnings', 'Use warnings', True),
212 # enable glib, (config.h has _GLIBCXX_CONCEPT_CHECKS)
213 BoolOption('concept_checks', 'Enable concept checks', True),
214 # FIXME: I do not know what is nls
215 BoolOption('nls', '(NA) Whether or not use native language support', False),
216 # FIXME: not implemented
217 BoolOption('profile', '(NA) Whether or not enable profiling', False),
218 # FIXME: not implemented
219 PathOption('prefix', '(NA) install architecture-independent files in PREFIX', '.'),
220 # FIXME: not implemented
221 PathOption('exec_prefix', '(NA) install architecture-independent executable files in PREFIX', '.'),
222 # FIXME: not implemented
223 BoolOption('std_debug', '(NA) Whether or not turn on stdlib debug', False),
225 BoolOption('X11', 'Use x11 windows system', default_with_x),
226 # FIXME: not implemented
227 BoolOption('libintl', '(NA) Use libintl library', False),
228 # FIXME: not implemented
229 PathOption('intl_prefix', '(NA) Path to intl library', '.'),
231 ('logfile', 'save commands (not outputs) to logfile', default_log_file),
233 BoolOption('aikasurus', 'Whether or not use aikasurus library', False),
235 EnumOption('spell', 'Choose spell checker to use.', 'auto',
236 allowed_values = ('aspell', 'pspell', 'ispell', 'auto') )
239 # Determine the frontend to use
240 frontend = ARGUMENTS.get('frontend', default_frontend)
241 use_X11 = ARGUMENTS.get('X11', default_with_x)
243 #---------------------------------------------------------
244 # Setting up environment
245 #---------------------------------------------------------
251 # set environment since I do not really like ENV = os.environ
252 env['ENV']['PATH'] = os.environ.get('PATH')
253 env['ENV']['HOME'] = os.environ.get('HOME')
254 env['ENV']['PKG_CONFIG_PATH'] = os.environ.get('PKG_CONFIG_PATH')
255 env['TOP_SRC_DIR'] = Dir('.').abspath
258 # frontend, mode, BUILDDIR and LOCALLIBPATH=BUILDDIR/libs
260 env['frontend'] = frontend
261 env['mode'] = ARGUMENTS.get('mode', default_build_mode)
262 # lyx will be built to $build/build_dir so it is possible
263 # to build multiple build_dirs using the same source
264 # $mode can be debug or release
265 if ARGUMENTS.has_key('build_dir'):
266 build_dir = ARGUMENTS['build_dir']
267 env['BUILDDIR'] = build_dir
269 # Determine the name of the build (platform+frontend
270 build_dir = '%s-%s' % (platform_name, frontend)
271 if use_X11 and platform_name == 'cygwin':
273 env['BUILDDIR'] = os.path.join('$mode', build_dir)
274 # all built libraries will go to build_dir/libs
275 # (This is different from the make file approach)
276 env['LOCALLIBPATH'] = '#$BUILDDIR/libs'
277 env.Append(LIBPATH = ['$LOCALLIBPATH'])
280 # QTDIR, QT_LIB_PATH, QT_INC_PATH
282 if platform_name == 'win32':
285 if ARGUMENTS.has_key('qt_dir'):
286 env['QTDIR'] = ARGUMENTS['qt_dir']
287 # add path to the qt tools
288 env.Append(LIBPATH = [os.path.join(ARGUMENTS['qt_dir'], 'lib')])
289 env.Append(CPPPATH = [os.path.join(ARGUMENTS['qt_dir'], 'include')])
290 # set environment so that moc etc can be found even if its path is not set properly
291 env['ENV']['PATH'] = os.path.join(ARGUMENTS['qt_dir'], 'bin') + os.pathsep + env['ENV']['PATH']
293 env['QTDIR'] = os.environ.get('QTDIR', '/usr/lib/qt-3.3')
295 if ARGUMENTS.has_key('qt_lib_path'):
296 env['QT_LIB_PATH'] = ARGUMENTS['qt_lib_path']
298 env['QT_LIB_PATH'] = '$QTDIR/lib'
299 env.Append(LIBPATH = ['$QT_LIB_PATH'])
300 # qt4 seems to be using pkg_config
301 env['ENV']['PKG_CONFIG_PATH'] = env.subst('$QT_LIB_PATH')
303 if ARGUMENTS.has_key('qt_inc_path'):
304 env['QT_INC_PATH'] = ARGUMENTS['qt_inc_path']
305 elif os.path.isdir(os.path.join(env.subst('$QTDIR'), 'include')):
306 env['QT_INC_PATH'] = '$QTDIR/include'
307 else: # have to guess
308 env['QT_INC_PATH'] = '/usr/include/$frontend/'
309 env.Append(CPPPATH = env['QT_INC_PATH'])
312 # extra_inc_path and extra_lib_path
314 if ARGUMENTS.has_key('extra_inc_path'):
315 env.Append(CPPPATH = [ARGUMENTS['extra_inc_path']])
316 if ARGUMENTS.has_key('extra_lib_path'):
317 env.Append(LIBPATH = [ARGUMENTS['extra_lib_path']])
320 # this is a bit out of place (after auto-configration)
321 # but it is required to do the tests.
322 if platform_name == 'win32':
323 env.Append(CPPPATH = ['#c:/MinGW/include'])
325 #----------------------------------------------------------
327 #----------------------------------------------------------
329 conf = Configure(env,
331 'CheckPkgConfig' : utils.checkPkgConfig,
332 'CheckPackage' : utils.checkPackage,
333 'CheckPutenv' : utils.checkPutenv,
334 'CheckIstreambufIterator' : utils.checkIstreambufIterator,
335 'CheckMkdirOneArg' : utils.checkMkdirOneArg,
336 'CheckStdCount' : utils.checkStdCount,
337 'CheckSelectArgType' : utils.checkSelectArgType,
338 'CheckBoostLibraries' : utils.checkBoostLibraries,
342 # pkg-config? (if not, we use hard-coded options)
343 if conf.CheckPkgConfig('0.15.0'):
344 env['HAS_PKG_CONFIG'] = True
346 print 'pkg-config >= 0.1.50 is not found'
347 env['HAS_PKG_CONFIG'] = False
349 # zlib? This is required.
350 if not conf.CheckLibWithHeader('z', 'zlib.h', 'C'):
351 print 'Did not find libz or zlib.h, exiting!'
356 # qt3 does not use pkg_config
357 if env['frontend'] == 'qt3':
358 if not conf.CheckLibWithHeader('qt-mt', 'qapp.h', 'c++', 'QApplication qapp();'):
359 print 'Did not find qt libraries, exiting!'
361 elif env['frontend'] == 'qt4':
363 # first: try pkg_config
364 if env['HAS_PKG_CONFIG']:
365 succ = conf.CheckPackage('QtCore')
366 env['QT4_PKG_CONFIG'] = succ
367 # second: try to link to it
369 # FIXME: under linux, I can test the following perfectly
370 # However, under windows, lib names need to passed as libXXX4.a ...
371 succ = conf.CheckLibWithHeader('QtCore', 'QtGui/QApplication', 'c++', 'QApplication qapp();')
372 # third: try to look up the path
375 for lib in ['QtCore', 'QtGui', 'Qt3Support']:
376 # windows version has something like QtGui4 ...
377 if not (os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s.a' % lib)) or \
378 os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s4.a' % lib))):
381 # still can not find it
383 print 'Did not find qt libraries, exiting!'
387 env['socket_libs'] = []
388 if conf.CheckLib('socket'):
389 env.Append(socket_libs = ['socket'])
391 # FIXME: What is nsl, is it related to socket?
392 if conf.CheckLib('nsl'):
393 env.Append(socket_libs = ['nsl'])
395 # check boost libraries
396 boost_opt = ARGUMENTS.get('boost', default_boost_opt)
397 # check for system boost
399 if boost_opt in ['auto', 'system']:
400 pathes = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
401 sig = conf.CheckBoostLibraries('boost_signals', pathes)
402 reg = conf.CheckBoostLibraries('boost_regex', pathes)
403 fil = conf.CheckBoostLibraries('boost_filesystem', pathes)
404 ios = conf.CheckBoostLibraries('boost_iostreams', pathes)
405 # if any them is not found
406 if ('' in [sig[0], reg[0], fil[0], ios[0]]):
407 if boost_opt == 'system':
408 print "Can not find system boost libraries"
409 print "Please supply a path through extra_lib_path"
410 print "and try again."
413 env['BOOST_LIBRARIES'] = [sig[1], reg[1], fil[1], ios[1]]
414 # assume all boost libraries are in the same path...
415 env.Append(LIBPATH = sig[0])
416 env['INCLUDED_BOOST'] = False
418 # now, auto and succ = false, or included
420 # we do not need to set LIBPATH now.
421 env['BOOST_LIBRARIES'] = ['boost_signals', 'boost_regex',
422 'boost_filesystem', 'boost_iostreams']
423 env['INCLUDED_BOOST'] = True
429 print "Generating ", config_h, "..."
431 # I do not handle all macros in src/config.h.in, rather I am following a list
432 # of *used-by-lyx* macros compiled by Abdelrazak Younes <younes.a@free.fr>
434 # Note: addToConfig etc are defined in scons_util
435 utils.startConfigH(config_h)
455 ('io.h', 'HAVE_IO_H', 'c'),
456 ('limits.h', 'HAVE_LIMITS_H', 'c'),
457 ('locale.h', 'HAVE_LOCALE_H', 'c'),
458 ('locale', 'HAVE_LOCALE', 'cxx'),
459 ('process.h', 'HAVE_PROCESS_H', 'c'),
460 ('stdlib.h', 'HAVE_STDLIB_H', 'c'),
461 ('sys/stat.h', 'HAVE_SYS_STAT_H', 'c'),
462 ('sys/time.h', 'HAVE_SYS_TIME_H', 'c'),
463 ('sys/types.h', 'HAVE_SYS_TYPES_H', 'c'),
464 ('sys/utime.h', 'HAVE_SYS_UTIME_H', 'c'),
465 ('sys/socket.h', 'HAVE_SYS_SOCKET_H', 'c'),
466 ('unistd.h', 'HAVE_UNISTD_H', 'c'),
467 ('utime.h', 'HAVE_UTIME_H', 'c'),
468 ('istream', 'HAVE_ISTREAM', 'cxx'),
469 ('ostream', 'HAVE_OSTREAM', 'cxx'),
470 ('ios', 'HAVE_IOS', 'cxx')
473 for header in headers:
474 if (header[2] == 'c' and conf.CheckCHeader(header[0])) or \
475 (header[2] == 'cxx' and conf.CheckCXXHeader(header[0])):
476 utils.addToConfig('#define %s 1' % header[1])
478 utils.addToConfig('/* #undef %s */' % header[1])
498 ('open', 'HAVE_OPEN'),
499 ('close', 'HAVE_CLOSE'),
500 ('popen', 'HAVE_POPEN'),
501 ('pclose', 'HAVE_PCLOSE'),
502 ('_open', 'HAVE__OPEN'),
503 ('_close', 'HAVE__CLOSE'),
504 ('_popen', 'HAVE__POPEN'),
505 ('_pclose', 'HAVE__PCLOSE'),
506 ('getpid', 'HAVE_GETPID'),
507 ('_getpid', 'HAVE__GETPID'),
508 ('mkdir', 'HAVE_MKDIR'),
509 ('_mkdir', 'HAVE__MKDIR'),
510 ('mktemp', 'HAVE_MKTEMP'),
511 ('mkstemp', 'HAVE_MKSTEMP'),
512 ('strerror', 'HAVE_STRERROR')
515 for func in functions:
516 if conf.CheckFunc(func[0]):
517 utils.addToConfig('#define %s 1' % func[1])
519 utils.addToConfig('/* #undef %s */' % func[1])
524 utils.addToConfig('#define PACKAGE "%s"' % PACKAGE)
525 utils.addToConfig('#define PACKAGE_VERSION "%s"' % PACKAGE_VERSION)
527 utils.addToConfig('#define DEVEL_VERSION 1')
532 # _GLIBCXX_CONCEPT_CHECKS
534 # items are (ENV, ARGUMENTS)
536 ('ENABLE_ASSERTIONS', 'assertions'),
537 ('ENABLE_NLS', 'nls'),
538 ('WITH_WARNINGS', 'warnings'),
539 ('_GLIBCXX_CONCEPT_CHECKS', 'concept_checks'),
543 if (env.has_key(val[0]) and env[val[0]]) or \
544 ARGUMENTS.get(val[1]):
545 utils.addToConfig('#define %s 1' % val[0])
547 utils.addToConfig('/* #undef %s */' % val[0])
549 # AIKSAURUS_H_LOCATION
550 if ARGUMENTS.get('aiksaurus'):
551 if conf.CheckLib('Aiksaurus'):
552 utils.addToConfig("#define AIKSAURUS_H_LOCATION")
554 print 'Library Aiksaurus not found'
561 # determine headers to use
562 spell_engine = ARGUMENTS.get('spell', 'auto')
563 spell_detected = False
564 if spell_engine in ['auto', 'aspell'] and \
565 conf.CheckLibWithHeader('aspell', 'aspell.h', 'C'):
566 utils.addToConfig('#define USE_ASPELL 1')
567 spell_detected = True
568 elif spell_engine in ['auto', 'pspell'] and \
569 conf.CheckLibWithHeader('pspell', 'pspell.h', 'C'):
570 utils.addToConfig('#define USE_PSPELL 1')
571 spell_detected = True
572 elif spell_engine in ['auto', 'ispell'] and \
573 conf.CheckLibWithHeader('ispell', 'ispell.h', 'C'):
574 utils.addToConfig('#define USE_ISPELL 1')
575 spell_detected = False
577 if not spell_detected:
578 # FIXME: can lyx work without an spell engine
579 if spell_engine == 'auto':
580 print "Warning: Can not locate any spell checker"
582 print "Warning: Can not locate specified spell checker:", spell_engine
584 # USE_POSIX_PACKAGING
585 # USE_MACOSX_PACKAGING
586 # USE_WINDOWS_PACKAGING
587 if packaging_method == 'windows':
588 utils.addToConfig('#define USE_WINDOWS_PACKAGING 1')
589 elif packaging_method == 'posix':
590 utils.addToConfig('#define USE_POSIX_PACKAGING 1')
591 elif packaging_method == 'mac':
592 utils.addToConfig('#define USE_MACOSX_PACKAGING 1')
596 utils.addToConfig('#define BOOST_POSIX 1')
598 utils.addToConfig('/* #undef BOOST_POSIX */')
601 if conf.CheckPutenv():
602 utils.addToConfig('#define HAVE_PUTENV 1')
604 utils.addToConfig('/* #undef HAVE_PUTENV */')
606 # HAVE_DECL_ISTREAMBUF_ITERATOR
607 if conf.CheckIstreambufIterator():
608 utils.addToConfig('#define HAVE_DECL_ISTREAMBUF_ITERATOR 1')
610 utils.addToConfig('/* #undef HAVE_DECL_ISTREAMBUF_ITERATOR */')
612 # MKDIR_TAKES_ONE_ARG
613 if conf.CheckMkdirOneArg():
614 utils.addToConfig('#define MKDIR_TAKES_ONE_ARG 1')
616 utils.addToConfig('/* #undef MKDIR_TAKES_ONE_ARG */')
619 if conf.CheckStdCount():
620 utils.addToConfig('#define HAVE_STD_COUNT 1')
622 utils.addToConfig('/* #undef HAVE_STD_COUNT */')
627 (arg1, arg234, arg5) = conf.CheckSelectArgType()
628 utils.addToConfig('#define SELECT_TYPE_ARG1 %s' % arg1)
629 utils.addToConfig('#define SELECT_TYPE_ARG234 %s' % arg234)
630 utils.addToConfig('#define SELECT_TYPE_ARG5 %s' % arg5)
634 # WANT_GETFILEATTRIBUTESEX_WRAPPER
635 utils.endConfigH(config_h)
638 # Finish auto-configuration
641 #----------------------------------------------------------
642 # Now set up our build process accordingly
643 #----------------------------------------------------------
646 # QT_LIB etc (EXTRA_LIBS holds lib for each frontend)
648 # NOTE: Tool('qt') or Tool('qt4') will be loaded later
649 # in their respective directory and specialized env.
651 if frontend == 'qt3':
652 # note: env.Tool('qt') my set QT_LIB to qt
653 env['QT_LIB'] = 'qt-mt'
654 env['EXTRA_LIBS'] = ['qt-mt']
655 if platform_name == 'cygwin' and use_X11:
656 env['EXTRA_LIBS'] += ['GL', 'Xmu', 'Xi', 'Xrender', 'Xrandr', 'Xcursor',
657 'Xft', 'freetype', 'fontconfig', 'Xext', 'X11', 'SM', 'ICE', 'resolv',
659 env.Append(LIBPATH = ['/usr/X11R6/lib'])
660 elif frontend == 'qt4':
661 # local qt4 toolset from
662 # http://www.iua.upf.es/~dgarcia/Codders/sconstools.html
663 env['QT_LIB'] = ['QtCore', 'QtGui', 'Qt3Support']
664 env['EXTRA_LIBS'] = env['QT_LIB']
666 print "Can not locate qt tools"
667 print "What I get is "
668 print " QTDIR: ", env['QTDIR']
671 # Build parameters CPPPATH etc
674 env.Append(CPPPATH = ['#boost', '#src'])
676 # TODO: add (more) appropriate compiling options (-DNDEBUG etc)
677 # for debug/release mode
678 if ARGUMENTS.get('mode', default_build_mode) == 'debug':
679 env.Append(CCFLAGS = [])
681 env.Append(CCFLAGS = [])
684 # Customized builders
686 # install customized builders
687 env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
688 # FIXME: there must be a better way.
689 env['BUILDERS']['fileCopy'] = Builder(action = utils.env_filecopy)
692 # A Link script for cygwin see
693 # http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
694 # http://www.cygwin.com/ml/cygwin-apps/2004-09/msg00309.html
697 if platform_name == 'cygwin' and env['frontend'] == 'qt3':
698 ld_script_path = '/usr/lib/qt3/mkspecs/cygwin-g++'
699 ld_script = utils.installCygwinLDScript(ld_script_path)
700 env.Append(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc',
701 '-Wl,--script,%s' % ld_script, '-Wl,-s'])
706 # src/support/package.C.in needs the following to replace
707 env['LYX_DIR'] = LYX_DIR
708 env['LOCALEDIR'] = LOCALEDIR
709 env['TOP_SRCDIR'] = str(Dir('#'))
710 env['PROGRAM_SUFFIX'] = PROGRAM_SUFFIX
711 # needed by src/version.C.in => src/version.C
712 env['PACKAGE_VERSION'] = PACKAGE_VERSION
713 # fill in the version info
714 env['VERSION_INFO'] = '''Configuration
716 Special build flags: %s
718 C Compiler flags: %s %s
720 C++ Compiler LyX flags: %s
721 C++ Compiler flags: %s %s
723 Linker user flags: %s
725 Builing directory: %s
726 Local library directory: %s
732 LyX binary dir: FIXME
734 ''' % (platform_name,
735 env.subst('$CCFLAGS'), env.subst('$CC'),
736 env.subst('$CPPFLAGS'), env.subst('$CFLAGS'),
737 env.subst('$CXX'), env.subst('$CXXFLAGS'),
738 env.subst('$CPPFLAGS'), env.subst('$CXXFLAGS'),
739 env.subst('$LINKFLAGS'), env.subst('$LINKFLAGS'),
740 env.subst('$BUILDDIR'), env.subst('$LOCALLIBPATH'),
741 str(env['LIBPATH']), str(env['BOOST_LIBRARIES']),
742 env['frontend'], packaging_method)
744 if env['frontend'] in ['qt3', 'qt4']:
745 env['VERSION_INFO'] += ''' include dir: %s
748 ''' % (env.subst('$QT_INC_PATH'), env.subst('$QT_LIB_PATH'), use_X11)
750 print env['VERSION_INFO']
753 # Mingw command line may be too short for our link usage,
754 # Here we use a trick from scons wiki
755 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/LongCmdLinesOnWin32
757 # I also would like to add logging (commands only) capacity to the
759 logfile = ARGUMENTS.get('logfile', default_log_file)
760 if logfile != '' or platform_name == 'win32':
762 utils.setLoggedSpawn(env, logfile, longarg = (platform_name == 'win32'),
763 info = '''# This is a log of commands used by scons to build lyx
767 ''' % (time.asctime(), ' '.join(sys.argv),
768 env['VERSION_INFO'].replace('\n','\n# ')) )
775 opts.Save('options.cache', env)
776 # -h will print out help info
777 Help(opts.GenerateHelpText(env))
781 #----------------------------------------------------------
783 #----------------------------------------------------------
785 env.BuildDir('$BUILDDIR', 'src')
786 print "Building all targets recursively"
788 client = env.SConscript('#$BUILDDIR/client/SConscript')
789 lyx = env.SConscript('#$BUILDDIR/SConscript')
790 tex2lyx = env.SConscript('#$BUILDDIR/tex2lyx/SConscript')
792 # avoid using full path to build them
793 Alias('client', client)
794 Alias('tex2lyx', tex2lyx)
797 Default('lyx', 'tex2lyx')
799 print "Buinging lyx done with targets", map(str, BUILD_TARGETS)