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:
14 # $ cd development/scons
15 # $ scons [options] [targets]
17 # $ scons -f development/scons/SConstruct [options] [targets]
19 # $ scons [prefix=.] install
22 # * targets can be one or more of lyx, tex2lyx, client, po, install.
23 # default to lyx, you can use 'scons all' to build all targets except
25 # * options: use scons -h for details about options, the most important
26 # one is frontend=qt2|qt3|qt4.
27 # - qt2 is used by lyx1.4.x
28 # - qt3 is used by default on linux, cygwin and mac
29 # - qt4 is used by default on win32/mingw
31 # File layouts (Important):
32 # * Unless you specify builddir=dir, building will happen
33 # in $BUILDDIR = $mode, which can be debug or release
34 # * $BUILDDIR has subdirectories
35 # libs: all intermediate libraries
36 # boost: boost libraries, if boost=included is used
37 # qt3/4: frontend-specific objects
38 # * executables will be copied to $BUILDDIR/
41 # * scons fast_start=yes
42 # If env.cache exists, bypass all tests and use existing src/config.h
44 # * scons --config=force
45 # force re-configuration (use scons -H for details)
47 # * check config.log to see why config has failed
49 # * use extra_inc_path, extra_lib_path, qt_dir, qt_inc_path
50 # qt_lib_path to help locate qt and other libraries.
51 # There are also extra_inc_path1, extra_lib_path1 if you need to spacify
52 # more than one extra paths.
54 # * executed commands will be logged in scons_lyx.log. You can use logfile=
55 # option to save log to another file.
59 # * scons dist etc may be added later. Interested contributors can follow
60 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/AccumulateBuilder
62 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/DistTarBuilder
63 # Please also see the commented out code in scons_utils.py
65 # * NSIS support can be found here.
66 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/NsisSconsTool
69 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/RpmHonchoTemp
71 # However, I decide to wait since scons seems to be standardizing these
75 import os, sys, copy, cPickle, glob
77 # config/scons_utils.py defines a few utility function
78 sys.path.append('config')
79 import scons_utils as utils
81 #----------------------------------------------------------
82 # Required runtime environment
83 #----------------------------------------------------------
85 # scons asks for 1.5.2, lyx requires 2.2
86 EnsurePythonVersion(2, 2)
87 # Please use at least 0.96.91 (not 0.96.1)
88 EnsureSConsVersion(0, 96)
90 # determine where I am ...
92 # called as 'scons -f development/scons/SConstruct'
93 if os.path.isfile('SConstruct'):
96 # called as 'cd development/scons; scons'
99 SCONS_DIR = 'development/scons'
101 #----------------------------------------------------------
103 #----------------------------------------------------------
105 # some global settings
107 # detect version of lyx
108 # only 1.4.x has frontends/qt2
109 if os.path.isdir(os.path.join(TOP_SRC_DIR, 'src', 'frontends', 'qt2')):
110 PACKAGE_VERSION = '1.4.2svn'
112 PACKAGE_VERSION = '1.5.0svn'
115 default_build_mode = 'debug'
119 PACKAGE_BUGREPORT = 'lyx-devel@lists.lyx.org'
121 PACKAGE_TARNAME = 'lyx'
122 PACKAGE_STRING = '%s %s' % (PACKAGE_NAME, PACKAGE_VERSION)
124 # various cache/log files
125 default_log_file = 'scons_lyx.log'
126 env_cache_file = 'env.cache'
129 #----------------------------------------------------------
130 # platform dependent settings
131 #----------------------------------------------------------
133 platform_name = 'win32'
134 default_frontend = 'qt4'
135 # boost and gettext are unlikely to be installed already
136 default_boost_opt = 'included'
137 default_gettext_opt = 'included'
138 default_pch_opt = False
139 default_with_x = False
140 spell_checker = 'auto'
141 # boost_posix indicates to boost which API to use (posix or windows).
142 # If not specified, boost tries to figure out by itself, but it may fail.
144 packaging_method = 'windows'
145 default_prefix = 'c:/program files/lyx'
146 share_dir = 'Resources'
147 man_dir = 'Resources/man/man1'
148 locale_dir = 'Resources/locale'
149 elif os.name == 'posix' and sys.platform != 'cygwin':
150 platform_name = sys.platform
151 default_frontend = 'qt3'
152 # try to use system boost/gettext libraries
153 default_boost_opt = 'auto'
154 default_gettext_opt = 'auto'
155 default_pch_opt = False
156 default_with_x = True
158 packaging_method = 'posix'
159 default_prefix = '/usr/local/'
160 share_dir = 'share/lyx'
162 locale_dir = 'share/locale'
163 elif os.name == 'posix' and sys.platform == 'cygwin':
164 platform_name = 'cygwin'
165 default_frontend = 'qt3'
166 # force the use of cygwin/boost/gettext
167 default_boost_opt = 'system'
168 default_gettext_opt = 'system'
169 default_pch_opt = False
170 default_with_x = True
172 packaging_method = 'posix'
173 default_prefix = '/usr/local/'
174 share_dir = 'share/lyx'
176 locale_dir = 'share/locale'
177 elif os.name == 'darwin':
178 platform_name = 'mac'
179 default_frontend = 'qt3'
181 default_boost_opt = 'included'
182 default_gettext_opt = 'included'
183 default_pch_opt = False
184 default_with_x = False
186 packaging_method = 'mac'
187 # FIXME: where to install?
188 default_prefix = '/usr/local/'
189 share_dir = 'Resources'
190 man_dir = 'Resources/man/man1'
191 locale_dir = 'Resources/locale'
192 else: # unsupported system
193 platform_name = 'others'
194 default_frontend = 'qt3'
196 default_boost_opt = 'included'
197 default_gettext_opt = 'included'
198 default_pch_opt = False
199 default_with_x = True
201 packaging_method = 'posix'
202 default_prefix = '/usr/local/'
203 share_dir = 'share/lyx'
205 locale_dir = 'share/locale'
208 #---------------------------------------------------------
210 #----------------------------------------------------------
212 if os.path.isfile('config.py'):
213 print "Getting options from config.py..."
214 print open('config.py').read()
216 opts = Options(['config.py'])
219 EnumOption('frontend', 'Main GUI', default_frontend,
220 allowed_values = ('xform', 'qt2', 'qt3', 'qt4', 'gtk') ),
221 # debug or release build
222 EnumOption('mode', 'Building method', default_build_mode,
223 allowed_values = ('debug', 'release') ),
226 'Use included, system boost library, or try sytem boost first.',
229 'auto', # detect boost, if not found, use included
230 'included', # always use included boost
231 'system', # always use system boost, fail if can not find
233 # FIXME: not implemented yet.
234 EnumOption('gettext',
235 'Use included, system gettext library, or try sytem gettext first',
238 'auto', # detect gettext, if not found, use included
239 'included', # always use included gettext
240 'system', # always use system gettext, fail if can not find
243 EnumOption('spell', 'Choose spell checker to use.', 'auto',
244 allowed_values = ('aspell', 'pspell', 'ispell', 'auto') ),
246 BoolOption('fast_start', 'Whether or not use cached tests and keep current config.h', True),
248 BoolOption('load_option', 'load option from previous scons run', True),
249 # FIXME: I do not know how pch is working. Ignore this option now.
250 BoolOption('pch', '(NA) Whether or not use pch', default_pch_opt),
251 # enable assertion, (config.h has ENABLE_ASSERTIOS
252 BoolOption('assertions', 'Use assertions', True),
253 # enable warning, (config.h has WITH_WARNINGS)
254 BoolOption('warnings', 'Use warnings', True),
255 # enable glib, (config.h has _GLIBCXX_CONCEPT_CHECKS)
256 BoolOption('concept_checks', 'Enable concept checks', True),
258 BoolOption('nls', 'Whether or not use native language support', True),
259 # FIXME: not implemented
260 BoolOption('profile', '(NA) Whether or not enable profiling', False),
261 # FIXME: not implemented
262 BoolOption('std_debug', '(NA) Whether or not turn on stdlib debug', False),
264 BoolOption('X11', 'Use x11 windows system', default_with_x),
265 # use MS VC++ to build lyx
266 BoolOption('use_vc', 'Use MS VC++ to build lyx', False),
268 PathOption('qt_dir', 'Path to qt directory', None),
270 PathOption('qt_include_path', 'Path to qt include directory', None),
272 PathOption('qt_lib_path', 'Path to qt library directory', None),
273 # build directory, will use $mode if not set
274 PathOption('build_dir', 'Build directory', None),
275 # extra include and libpath
276 PathOption('extra_inc_path', 'Extra include path', None),
278 PathOption('extra_lib_path', 'Extra library path', None),
280 PathOption('extra_bin_path', 'A convenient way to add a path to $PATH', None),
282 PathOption('extra_inc_path1', 'Extra include path', None),
284 PathOption('extra_lib_path1', 'Extra library path', None),
285 # rebuild only specifed, comma separated targets
286 ('rebuild', 'rebuild only specifed, comma separated targets', None),
287 # can be set to a non-existing directory
288 ('prefix', 'install architecture-independent files in PREFIX', None),
289 # will install to dest_dir if defined. Otherwise, prefix will be used.
290 ('dest_dir', 'install to dest_dir', None),
292 ('version_suffix', 'install lyx as lyx-suffix', ''),
294 PathOption('exec_prefix', 'install architecture-independent executable files in PREFIX', None),
296 ('logfile', 'save commands (not outputs) to logfile', default_log_file),
298 PathOption('aiksaurus_path', 'Path to aiksaurus library', None),
299 # environment variable can be set as options. (DO NOT set defaults)
301 ('LINK', '$LINK', None),
302 ('CPP', '$CPP', None),
303 ('CXX', '$CXX', None),
304 ('CXXCPP', '$CXXCPP', None),
305 ('CCFLAGS', '$CCFLAGS', None),
306 ('CPPFLAGS', '$CPPFLAGS', None),
307 ('LDFLAGS', '$LDFLAGS', None),
310 # whether or not use current config.h, and cached tests
311 if (not ARGUMENTS.has_key('fast_start') or \
312 ARGUMENTS['fast_start'] in ['y', 'yes', 't', 'true', '1', 'all']) \
313 and os.path.isfile(env_cache_file):
315 cache_file = open(env_cache_file)
316 env_cache = cPickle.load(cache_file)
318 print '------------ fast_start mode --------------------'
319 print ' Use cached test results and current config.h'
320 print ' use fast_start=no to override'
326 if (not ARGUMENTS.has_key('load_option') or \
327 ARGUMENTS['load_option'] in ['y', 'yes', 't', 'true', '1', 'all']) \
328 and os.path.isfile(env_cache_file):
329 cache_file = open(env_cache_file)
330 opt_cache = cPickle.load(cache_file)['arg_cache']
332 # import cached options, but we should ignore qt_dir when frontend changes
333 if ARGUMENTS.has_key('frontend') and opt_cache.has_key('frontend') \
334 and ARGUMENTS['frontend'] != opt_cache['frontend'] \
335 and opt_cache.has_key('qt_dir'):
336 opt_cache.pop('qt_dir')
337 # some options will require full rebuild
338 # these are in general things that will change src/config.h
339 for arg in ['version_suffix', 'nls', 'boost']:
340 if ARGUMENTS.has_key(arg) and ((not opt_cache.has_key(arg)) or \
341 ARGUMENTS[arg] != opt_cache[arg]):
343 print " ** fast_start is disabled because of the change of option", arg
346 # and we do not cache some options
347 for arg in ['fast_start', 'load_option']:
348 if opt_cache.has_key(arg):
350 for key in opt_cache.keys():
351 if not ARGUMENTS.has_key(key):
352 ARGUMENTS[key] = opt_cache[key]
353 print "Restoring cached option %s=%s" % (key, ARGUMENTS[key])
357 env_cache['arg_cache'] = ARGUMENTS
360 #---------------------------------------------------------
361 # Setting up environment
362 #---------------------------------------------------------
364 # I do not really like ENV=os.environ, but you may
365 # add it here if you experience some environment related problem
366 env = Environment(options = opts)
368 # Determine the frontend to use, which may be loaded
370 frontend = env.get('frontend', default_frontend)
371 # make sure the key exists
372 env['frontend'] = frontend
373 env['LYX_EXT'] = lyx_ext
375 use_X11 = env.get('X11', default_with_x)
376 use_vc = env.get('use_vc', False)
377 # use it only once for s scons-bug, will remove it later.
378 env['USE_VC'] = use_vc
381 # set individual variables since I do not really like ENV = os.environ
382 env['ENV']['PATH'] = os.environ.get('PATH')
383 env['ENV']['HOME'] = os.environ.get('HOME')
384 # these are defined for MSVC
385 env['ENV']['LIB'] = os.environ.get('LIB')
386 env['ENV']['INCLUDE'] = os.environ.get('INCLUDE')
388 # full path name is used to build msvs project files
389 env['TOP_SRC_DIR'] = Dir(TOP_SRC_DIR).abspath
391 env['TOP_SRC_DIR'] = TOP_SRC_DIR
392 env['SCONS_DIR'] = SCONS_DIR
393 # install to default_prefix by default
394 env['PREFIX'] = env.get('prefix', default_prefix)
396 if env.has_key('version_suffix'):
397 if env['version_suffix'] in ['y', 'yes', 't', 'true', '1', 'all']:
398 env['PROGRAM_SUFFIX'] = PACKAGE_VERSION
400 env['PROGRAM_SUFFIX'] = env['version_suffix']
402 env['PROGRAM_SUFFIX'] = ''
404 # whether or not add suffix to file and directory names
405 env['ADD_SUFFIX'] = packaging_method != 'windows'
406 if env['ADD_SUFFIX']:
407 env['SHARE_DIR'] = os.path.join(env['PREFIX'], share_dir + env['PROGRAM_SUFFIX'])
409 env['SHARE_DIR'] = os.path.join(env['PREFIX'], share_dir)
410 env['LOCALE_DIR'] = os.path.join(env['PREFIX'], locale_dir)
412 # if dest_dir is different from prefix.
413 env['DEST_DIR'] = env.get('dest_dir', env['PREFIX'])
414 if env.has_key('exec_prefix'):
415 env['BIN_DEST_DIR'] = env['exec_prefix']
417 env['BIN_DEST_DIR'] = os.path.join(env['DEST_DIR'], 'bin')
418 if env['ADD_SUFFIX']:
419 env['SHARE_DEST_DIR'] = os.path.join(env['DEST_DIR'], share_dir + env['PROGRAM_SUFFIX'])
421 env['SHARE_DEST_DIR'] = os.path.join(env['DEST_DIR'], share_dir)
422 env['MAN_DEST_DIR'] = os.path.join(env['DEST_DIR'], man_dir)
423 env['LOCALE_DEST_DIR'] = os.path.join(env['DEST_DIR'], locale_dir)
426 # this is a bit out of place (after auto-configration) but
427 # it is required to do the tests. Since Tool('mingw') will
428 # reset CCFLAGS etc, this should be done before getEnvVariable
429 if platform_name == 'win32' and not use_vc:
431 env.AppendUnique(CPPPATH = ['#c:/MinGW/include'])
437 # speed up source file processing
438 #env['CPPSUFFIXES'] = ['.C', '.cc', '.cpp']
439 #env['CXXSUFFIX'] = ['.C']
441 def getEnvVariable(env, name):
442 # first try command line argument (override environment settings)
443 if ARGUMENTS.has_key(name) and ARGUMENTS[name].strip() != '':
444 # multiple options may be passed like "-02 -g"
445 env[name] = ARGUMENTS[name].split()
446 # it does not seem necessary, but it is safer to change ['a'] back to 'a'
447 if len(env[name]) == 1:
448 env[name] = env[name][0]
449 # then use environment default
450 elif os.environ.has_key(name) and os.environ[name].strip() != '':
451 print "Acquiring varaible %s from system environment: %s" % (name, env[name])
452 env[name] = os.environ[name].split()
453 if len(env[name]) == 1:
454 env[name] = env[name][0]
455 # finally, env['CC'] etc is set to the default values of Options.
456 # and env['CPP'] etc does not exist
458 getEnvVariable(env, 'CC')
459 getEnvVariable(env, 'LINK')
460 getEnvVariable(env, 'CPP')
461 getEnvVariable(env, 'CXX')
462 getEnvVariable(env, 'CXXCPP')
463 getEnvVariable(env, 'CCFLAGS')
464 getEnvVariable(env, 'CXXFLAGS')
465 getEnvVariable(env, 'CPPFLAGS')
466 getEnvVariable(env, 'LDFLAGS')
470 # frontend, mode, BUILDDIR and LOCALLIBPATH=BUILDDIR/libs
472 env['mode'] = env.get('mode', default_build_mode)
473 # lyx will be built to $build/build_dir so it is possible
474 # to build multiple build_dirs using the same source
475 # $mode can be debug or release
476 if env.has_key('build_dir') and env['build_dir']:
477 build_dir = env['build_dir']
478 env['BUILDDIR'] = build_dir
480 # Determine the name of the build $mode
481 env['BUILDDIR'] = '#' + env['mode']
482 # all built libraries will go to build_dir/libs
483 # (This is different from the make file approach)
484 env['LOCALLIBPATH'] = '$BUILDDIR/libs'
485 # to make use of local cached parameters, this one has to be '.'
486 env['MSVSPATH'] = '.'
487 env.AppendUnique(LIBPATH = ['$LOCALLIBPATH'])
490 # QTDIR, QT_LIB_PATH, QT_INC_PATH
492 if env.has_key('qt_dir') and env['qt_dir']:
493 env['QTDIR'] = env['qt_dir']
494 # add path to the qt tools
495 env.AppendUnique(LIBPATH = [os.path.join(env['qt_dir'], 'lib')])
496 # set environment so that moc etc can be found even if its path is not set properly
497 env.PrependENVPath('PATH', os.path.join(env['qt_dir'], 'bin'))
499 env['QTDIR'] = os.environ.get('QTDIR', '/usr/lib/qt-3.3')
501 if env.has_key('qt_lib_path') and env['qt_lib_path']:
502 env['QT_LIB_PATH'] = env['qt_lib_path']
504 env['QT_LIB_PATH'] = '$QTDIR/lib'
505 env.AppendUnique(LIBPATH = ['$QT_LIB_PATH'])
506 # qt4 seems to be using pkg_config
507 env.PrependENVPath('PKG_CONFIG_PATH', env.subst('$QT_LIB_PATH'))
509 if env.has_key('qt_inc_path') and env['qt_inc_path']:
510 env['QT_INC_PATH'] = env['qt_inc_path']
511 elif os.path.isdir(os.path.join(env.subst('$QTDIR'), 'include')):
512 env['QT_INC_PATH'] = '$QTDIR/include'
513 else: # have to guess
514 env['QT_INC_PATH'] = '/usr/include/$frontend/'
515 # Note that this CPPPATH is for testing only
516 # it will be removed before calling SConscript
517 env['CPPPATH'] = [env['QT_INC_PATH']]
520 # extra_inc_path and extra_lib_path
522 if env.has_key('extra_inc_path') and env['extra_inc_path']:
523 env.AppendUnique(CPPPATH = [env['extra_inc_path']])
524 if env.has_key('extra_lib_path') and env['extra_lib_path']:
525 env.AppendUnique(LIBPATH = [env['extra_lib_path']])
526 if env.has_key('extra_inc_path1') and env['extra_inc_path1']:
527 env.AppendUnique(CPPPATH = [env['extra_inc_path1']])
528 if env.has_key('extra_lib_path1') and env['extra_lib_path1']:
529 env.AppendUnique(LIBPATH = [env['extra_lib_path1']])
530 if env.has_key('extra_bin_path') and env['extra_bin_path']:
531 # maybe only one of them is needed
532 os.environ['PATH'] += os.pathsep + env['extra_bin_path']
533 env['ENV']['PATH'] += os.pathsep + env['extra_bin_path']
534 if env.has_key('aiksaurus_path') and env['aiksaurus_path']:
535 env.AppendUnique(LIBPATH = [env['aiksaurus_path']])
538 # under windows, scons is confused by .C/.c and uses gcc instead of
539 # g++. I am forcing the use of g++ here. This is expected to change
540 # after lyx renames all .C files to .cpp
542 # Note that this step has to be after env.Tool('mingw') step
543 # since env.Tool('mingw') will set env['CC'] etc.
545 # save the old c compiler and CCFLAGS (used by libintl)
546 env['C_COMPILER'] = env.subst('$CC')
547 env['C_CCFLAGS'] = env.subst('$CCFLAGS').split()
548 # if we use ms vc, the commands are fine (cl.exe and link.exe)
550 if env.has_key('CXX') and env['CXX']:
551 env['CC'] = env.subst('$CXX')
552 env['LINK'] = env.subst('$CXX')
557 # /TP treat all source code as C++
558 # C4819: The file contains a character that cannot be represented
559 # in the current code page (number)
560 # C4996: foo was decleared deprecated
561 env.Append(CCFLAGS=['/TP', '/EHsc', '/wd4819', '/wd4996'])
562 env.Append(C_CCFLAGS=['/Dinline#', '/D__attribute__(x)#', '/Duintmax_t=UINT_MAX'])
565 #----------------------------------------------------------
567 #----------------------------------------------------------
569 conf = Configure(env,
571 'CheckPkgConfig' : utils.checkPkgConfig,
572 'CheckPackage' : utils.checkPackage,
573 'CheckMkdirOneArg' : utils.checkMkdirOneArg,
574 'CheckSelectArgType' : utils.checkSelectArgType,
575 'CheckBoostLibraries' : utils.checkBoostLibraries,
576 'CheckCommand' : utils.checkCommand,
577 'CheckCXXGlobalCstd' : utils.checkCXXGlobalCstd,
578 'CheckLC_MESSAGES' : utils.checkLC_MESSAGES,
579 'CheckIconvConst' : utils.checkIconvConst,
584 # pkg-config? (if not, we use hard-coded options)
586 if conf.CheckPkgConfig('0.15.0'):
587 env['HAS_PKG_CONFIG'] = True
589 print 'pkg-config >= 0.1.50 is not found'
590 env['HAS_PKG_CONFIG'] = False
591 env_cache['HAS_PKG_CONFIG'] = env['HAS_PKG_CONFIG']
593 env['HAS_PKG_CONFIG'] = env_cache['HAS_PKG_CONFIG']
595 # zlib? This is required. (fast_start assumes the existance of zlib)
597 if (not use_vc and not conf.CheckLibWithHeader('z', 'zlib.h', 'C')) \
598 or (use_vc and not conf.CheckLibWithHeader('zdll', 'zlib.h', 'C')):
599 print 'Did not find zdll.lib or zlib.h, exiting!'
605 # qt3 does not use pkg_config
606 if frontend in ['qt2', 'qt3']:
607 if not conf.CheckLibWithHeader('qt-mt', 'qapp.h', 'c++', 'QApplication qapp();'):
608 print 'Did not find qt libraries, exiting!'
610 elif frontend == 'qt4':
612 # first: try pkg_config
613 if env['HAS_PKG_CONFIG']:
614 succ = conf.CheckPackage('QtCore') or conf.CheckPackage('QtCore4')
615 env['QT4_PKG_CONFIG'] = succ
616 # second: try to link to it
618 # FIXME: under linux, I can test the following perfectly
619 # However, under windows, lib names need to passed as libXXX4.a ...
620 succ = conf.CheckLibWithHeader('QtCore', 'QtGui/QApplication', 'c++', 'QApplication qapp();') or \
621 conf.CheckLibWithHeader('QtCore4', 'QtGui/QApplication', 'c++', 'QApplication qapp();')
622 # third: try to look up the path
625 for lib in ['QtCore', 'QtGui']:
626 # windows version has something like QtGui4 ...
627 if not (os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s.a' % lib)) or \
628 os.path.isfile(os.path.join(env.subst('$QT_LIB_PATH'), 'lib%s4.a' % lib))):
631 # still can not find it
633 print "Qt4 libraries are found."
635 print 'Did not find qt libraries, exiting!'
638 # now, if msvc2005 is used, we will need that QT_LIB_PATH/QT_LIB.manifest file
640 # glob file xxx.dll.manifest (msvc 2003 may not have it)
641 manifests = glob.glob(os.path.join(env.subst('$QT_LIB_PATH'), '*.dll.manifest'))
643 env['LINKCOM'] = [env['LINKCOM'], 'mt.exe /MANIFEST %s /outputresource:$TARGET;1' % manifests[0]]
647 env['SOCKET_LIBS'] = []
648 if conf.CheckLib('socket'):
649 env['SOCKET_LIBS'].append('socket')
651 # nsl is the network services library and provides a
652 # transport-level interface to networking services.
653 if conf.CheckLib('nsl'):
654 env['SOCKET_LIBS'].append('nsl')
656 env_cache['SOCKET_LIBS'] = env['SOCKET_LIBS']
658 env['SOCKET_LIBS'] = env_cache['SOCKET_LIBS']
661 # check boost libraries
662 boost_opt = ARGUMENTS.get('boost', default_boost_opt)
663 # check for system boost
664 paths = env['LIBPATH'] + ['/usr/lib', '/usr/local/lib']
665 env['BOOST_LIBRARIES'] = []
667 # here I assume that all libraries are in the same directory
668 for lib in ['signals', 'regex', 'filesystem', 'iostreams']:
669 # lyx1.4 does not use iostreams
670 if not os.path.isdir(os.path.join(env.subst('$TOP_SRC_DIR'), 'boost', 'libs', lib)):
672 if boost_opt == 'included':
673 env['BOOST_LIBRARIES'].append('included_boost_%s' % lib)
674 env['INCLUDED_BOOST'] = True
675 elif boost_opt == 'auto':
676 res = conf.CheckBoostLibraries('boost_%s' % lib , paths)
679 env['BOOST_LIBRARIES'].append('included_boost_%s' % lib)
680 env['INCLUDED_BOOST'] = True
682 env['BOOST_LIBRARIES'].append(res[1])
683 env['INCLUDED_BOOST'] = False
684 boost_libpath = res[0]
685 elif boost_opt == 'system':
686 res = conf.CheckBoostLibraries('boost_%s' % lib , paths)
688 print "Can not find system boost libraries"
689 print "Please supply a path through extra_lib_path and try again."
690 print "Or use boost=included to use included boost libraries."
693 env['BOOST_LIBRARIES'].append(res[1])
694 env.AppendUnique(LIBPATH = [res[0]])
695 boost_libpath = res[0]
696 env_cache['BOOST_LIBRARIES'] = env['BOOST_LIBRARIES']
697 env_cache['INCLUDED_BOOST'] = env['INCLUDED_BOOST']
698 env_cache['BOOST_LIBPATH'] = boost_libpath
700 env['BOOST_LIBRARIES'] = env_cache['BOOST_LIBRARIES']
701 if env_cache['BOOST_LIBPATH'] is not None:
702 env.AppendUnique(LIBPATH = [env_cache['BOOST_LIBPATH']])
703 env['INCLUDED_BOOST'] = env_cache['INCLUDED_BOOST']
706 env['ENABLE_NLS'] = not env.has_key('nls') or env['nls']
709 if not env['ENABLE_NLS']:
710 env['INTL_LIBS'] = []
711 env['INCLUDED_GETTEXT'] = False
713 # check gettext libraries
714 gettext_opt = ARGUMENTS.get('gettext', default_gettext_opt)
715 # check for system gettext
717 if gettext_opt in ['auto', 'system']:
718 if conf.CheckLib('intl'):
719 env['INCLUDED_GETTEXT'] = False
720 env['INTL_LIBS'] = ['intl']
723 if gettext_opt == 'system':
724 print "Can not find system gettext library"
725 print "Please supply a path through extra_lib_path and try again."
726 print "Or use gettext=included to use included gettext libraries."
728 # now, auto and succ = false, or gettext=included
730 # we do not need to set LIBPATH now.
731 env['INCLUDED_GETTEXT'] = True
732 env['INTL_LIBS'] = ['included_intl']
733 env_cache['INCLUDED_GETTEXT'] = env['INCLUDED_GETTEXT']
734 env_cache['INTL_LIBS'] = env['INTL_LIBS']
736 env['INTL_LIBS'] = env_cache['INTL_LIBS']
737 env['INCLUDED_GETTEXT'] = env_cache['INCLUDED_GETTEXT']
740 # check for msgfmt command
742 env['MSGFMT'] = conf.CheckCommand('msgfmt')
743 env_cache['MSGFMT'] = env['MSGFMT']
745 env['MSGFMT'] = env_cache['MSGFMT']
748 #----------------------------------------------------------
749 # Generating config.h
750 #----------------------------------------------------------
752 print "Generating ", utils.config_h, "..."
754 # I do not handle all macros in src/config.h.in, rather I am following a list
755 # of *used-by-lyx* macros compiled by Abdelrazak Younes <younes.a@free.fr>
757 # Note: addToConfig etc are defined in scons_util
778 # for libintl % grep HAVE * | grep _H | cut -d: -f2 | sort -u
794 ('io.h', 'HAVE_IO_H', 'c'),
795 ('limits.h', 'HAVE_LIMITS_H', 'c'),
796 ('locale.h', 'HAVE_LOCALE_H', 'c'),
797 ('locale', 'HAVE_LOCALE', 'cxx'),
798 ('process.h', 'HAVE_PROCESS_H', 'c'),
799 ('stdlib.h', 'HAVE_STDLIB_H', 'c'),
800 ('sys/stat.h', 'HAVE_SYS_STAT_H', 'c'),
801 ('sys/time.h', 'HAVE_SYS_TIME_H', 'c'),
802 ('sys/types.h', 'HAVE_SYS_TYPES_H', 'c'),
803 ('sys/utime.h', 'HAVE_SYS_UTIME_H', 'c'),
804 ('sys/socket.h', 'HAVE_SYS_SOCKET_H', 'c'),
805 ('unistd.h', 'HAVE_UNISTD_H', 'c'),
806 ('inttypes.h', 'HAVE_INTTYPES_H', 'c'),
807 ('utime.h', 'HAVE_UTIME_H', 'c'),
808 ('string.h', 'HAVE_STRING_H', 'c'),
809 ('strings.h', 'HAVE_STRINGS_H', 'c'),
810 ('direct.h', 'HAVE_DIRECT_H', 'c'),
811 ('istream', 'HAVE_ISTREAM', 'cxx'),
812 ('ostream', 'HAVE_OSTREAM', 'cxx'),
813 ('ios', 'HAVE_IOS', 'cxx'),
814 ('argz.h', 'HAVE_ARGZ_H', 'c'),
815 ('limits.h', 'HAVE_LIMITS_H', 'c'),
816 ('alloca.h', 'HAVE_ALLOCA_H', 'c'),
817 ('stddef.h', 'HAVE_STDDEF_H', 'c'),
818 ('stdint.h', 'HAVE_STDINT_H', 'c'),
819 ('sys/param.h', 'HAVE_SYS_PARAM_H', 'c'),
822 for header in headers:
823 description = "Define to 1 if you have the <%s> header file." % header[0]
824 if (header[2] == 'c' and conf.CheckCHeader(header[0])) or \
825 (header[2] == 'cxx' and conf.CheckCXXHeader(header[0])):
826 utils.addToConfig('#define %s 1' % header[1], desc = description)
828 utils.addToConfig('/* #undef %s */' % header[1], desc = description)
860 # HAVE___ARGZ_STRINGIFY
870 ('open', 'HAVE_OPEN', None),
871 ('close', 'HAVE_CLOSE', None),
872 ('popen', 'HAVE_POPEN', None),
873 ('pclose', 'HAVE_PCLOSE', None),
874 ('_open', 'HAVE__OPEN', None),
875 ('_close', 'HAVE__CLOSE', None),
876 ('_popen', 'HAVE__POPEN', None),
877 ('_pclose', 'HAVE__PCLOSE', None),
878 ('getpid', 'HAVE_GETPID', None),
879 ('_getpid', 'HAVE__GETPID', None),
880 ('mkdir', 'HAVE_MKDIR', None),
881 ('_mkdir', 'HAVE__MKDIR', None),
882 ('putenv', 'HAVE_PUTENV', None),
883 ('mktemp', 'HAVE_MKTEMP', None),
884 ('mkstemp', 'HAVE_MKSTEMP', None),
885 ('strerror', 'HAVE_STRERROR', None),
886 ('count', 'HAVE_STD_COUNT', '''
891 return std::count(a, a+5, 'l');
894 ('getcwd', 'HAVE_GETCWD', None),
895 ('stpcpy', 'HAVE_STPCPY', None),
896 ('strcasecmp', 'HAVE_STRCASECMP', None),
897 ('strdup', 'HAVE_STRDUP', None),
898 ('strtoul', 'HAVE_STRTOUL', None),
899 ('alloca', 'HAVE_ALLOCA', None),
900 ('__fsetlocking', 'HAVE___FSETLOCKING', None),
901 ('mempcpy', 'HAVE_MEMPCPY', None),
902 ('__argz_count', 'HAVE___ARGZ_COUNT', None),
903 ('__argz_next', 'HAVE___ARGZ_NEXT', None),
904 ('__argz_stringify', 'HAVE___ARGZ_STRINGIFY', None),
905 ('setlocale', 'HAVE_SETLOCALE', None),
906 ('tsearch', 'HAVE_TSEARCH', None),
907 ('getegid', 'HAVE_GETEGID', None),
908 ('getgid', 'HAVE_GETGID', None),
909 ('getuid', 'HAVE_GETUID', None),
910 ('wcslen', 'HAVE_WCSLEN', None)
913 for func in functions:
914 description = "Define to 1 if you have the `%s' function." % func[0]
915 if conf.CheckFunc(func[0], header=func[2]):
916 utils.addToConfig('#define %s 1' % func[1], desc = description)
918 utils.addToConfig('/* #undef %s */' % func[1], desc = description)
928 ('asprintf', 'HAVE_ASPRINTF'),
929 ('wprintf', 'HAVE_WPRINTF'),
930 ('snprintf', 'HAVE_SNPRINTF'),
931 ('printf', 'HAVE_POSIX_PRINTF'),
932 ('fcntl', 'HAVE_FCNTL')
935 for func in env_functions:
936 description = "Define to 1 if you have the `%s' function." % func[0]
937 if conf.CheckFunc(func[0]):
938 utils.addToConfig('#define %s 1' % func[1], desc = description)
941 utils.addToConfig('/* #undef %s */' % func[1], desc = description)
945 # HAVE_DECL_ISTREAMBUF_ITERATOR
946 description = "Define to 1 if you have the `intmax_t' type."
947 if conf.CheckType('intmax_t', includes='#include <stdint.h>') or \
948 conf.CheckType('intmax_t', includes='#include <inttypes.h>'):
949 utils.addToConfig('#define HAVE_INTMAX_T 1', desc = description)
951 utils.addToConfig('/* #undef HAVE_INTMAX_T */',desc = description)
958 # HAVE_INTTYPES_H_WITH_UINTMAX
959 # HAVE_STDINT_H_WITH_UINTMAX
962 ('intmax_t', 'HAVE_INTMAX_T', None),
963 ('long double', 'HAVE_LONG_DOUBLE', None),
964 ('long long', 'HAVE_LONG_LONG', None),
965 ('wchar_t', 'HAVE_WCHAR_T', None),
966 ('wint_t', 'HAVE_WINT_T', None),
967 ('uintmax_t', 'HAVE_INTTYPES_H_WITH_UINTMAX', '#include <inttypes.h>'),
968 ('uintmax_t', 'HAVE_STDINT_H_WITH_UINTMAX', '#include <stdint.h>'),
969 ('std::istreambuf_iterator<std::istream>', 'HAVE_DECL_ISTREAMBUF_ITERATOR',
970 '#include <streambuf>\n#include <istream>')
973 description = "Define to 1 if you have the `%s' type." % t[0]
974 if conf.CheckType(t[0], includes=t[2]):
975 utils.addToConfig('#define %s 1' % t[1], desc = description)
977 utils.addToConfig('/* #undef %s */' % t[1], desc = description)
979 # windows/msvc sys/types.h does not have pid_t
980 # FIXME: #include <windows.h> is the right way?
981 if not conf.CheckType('pid_t', includes='#include <sys/types.h>'):
982 utils.addToConfig('#define pid_t int', desc = 'Define is sys/types.h does not have pid_t')
984 # determine the use of std::tolower or tolower
985 description = 'Define if your C++ compiler puts C library functions in the global namespace'
986 if conf.CheckCXXGlobalCstd():
987 utils.addToConfig('#define CXX_GLOBAL_CSTD 1', desc = description)
989 utils.addToConfig('/* #undef CXX_GLOBAL_CSTD */', desc = description)
996 ('gdi32', 'HAVE_LIBGDI32'),
997 ('iconv', 'HAVE_ICONV'),
999 ('Aiksaurus', 'HAVE_LIBAIKSAURUS'),
1002 description = "Define to 1 if you have the `%s' library (-l%s)." % (lib[0], lib[0])
1003 if conf.CheckLib(lib[0]):
1004 utils.addToConfig('#define %s 1' % lib[1], desc = description)
1007 utils.addToConfig('/* #undef %s */' % lib[1], desc = description)
1011 description = 'Define if your <locale.h> file defines LC_MESSAGES.'
1012 if conf.CheckLC_MESSAGES():
1013 utils.addToConfig('#define HAVE_LC_MESSAGES 1', desc = description)
1015 utils.addToConfig('/* #undef HAVE_LC_MESSAGES */', desc = description)
1018 description = 'Define as const if the declaration of iconv() needs const.'
1019 if conf.CheckIconvConst():
1020 utils.addToConfig('#define ICONV_CONST', desc = description)
1022 utils.addToConfig('/* #undef ICONV_CONST */', desc = description)
1030 utils.addToConfig('#define PACKAGE "%s%s"' % (PACKAGE, env['PROGRAM_SUFFIX']),
1031 desc = "Name of package")
1033 utils.addToConfig('#define PACKAGE_BUGREPORT "%s"' % PACKAGE_BUGREPORT,
1034 desc = 'Define to the address where bug reports for this package should be sent.')
1036 utils.addToConfig('#define PACKAGE_NAME "%s"' % PACKAGE_NAME,
1037 desc = 'Define to the full name of this package.')
1039 utils.addToConfig('#define PACKAGE_STRING "%s"' % PACKAGE_STRING,
1040 desc = "Define to the full name and version of this package.")
1042 utils.addToConfig('#define PACKAGE_TARNAME "%s"' % PACKAGE_TARNAME,
1043 desc = "Define to the one symbol short name of this package.")
1045 utils.addToConfig('#define PACKAGE_VERSION "%s"' % PACKAGE_VERSION,
1046 desc = "Define to the version of this package.")
1049 utils.addToConfig('#define DEVEL_VERSION 1')
1054 # _GLIBCXX_CONCEPT_CHECKS
1056 # items are (ENV, ARGUMENTS)
1058 ('ENABLE_ASSERTIONS', 'assertions', 'Define if you want assertions to be enabled in the code'),
1059 ('ENABLE_NLS', 'nls', "Define to 1 if translation of program messages to the user's native anguage is requested."),
1060 ('WITH_WARNINGS', 'warnings', 'Define this if you want to see the warning directives put here and there by the developpers to get attention'),
1061 ('_GLIBCXX_CONCEPT_CHECKS', 'concept_checks', 'libstdc++ concept checking'),
1065 if (env.has_key(val[0]) and env[val[0]]) or \
1066 (env.has_key(val[1]) and env[val[1]]):
1067 utils.addToConfig('#define %s 1' % val[0], desc = val[2])
1069 utils.addToConfig('/* #undef %s */' % val[0], desc = val[2])
1071 # disable automatic linking of boost libraries.
1072 # This is an interesting feature that is supposed to be useful under
1073 # windows but since I can not find a way to use it on all platforms,
1074 # I disable it for now.
1075 utils.addToConfig('#define BOOST_ALL_NO_LIB 1')
1077 # AIKSAURUS_H_LOCATION
1078 if (conf.CheckCXXHeader("Aiksaurus.h")):
1079 utils.addToConfig("#define AIKSAURUS_H_LOCATION <Aiksaurus.h>")
1080 elif (conf.CheckCXXHeader("Aiksaurus/Aiksaurus.h")):
1081 utils.addToConfig("#define AIKSAURUS_H_LOCATION <Aiksaurus/Aiksaurus.h>")
1083 utils.addToConfig("#define AIKSAURUS_H_LOCATION")
1089 # determine headers to use
1090 spell_engine = ARGUMENTS.get('spell', 'auto')
1091 spell_detected = False
1092 if spell_engine in ['auto', 'aspell'] and \
1093 conf.CheckLib('aspell'):
1094 utils.addToConfig('#define USE_ASPELL 1', desc = 'Define as 1 to use the aspell library')
1095 env['USE_ASPELL'] = True
1096 env['USE_PSPELL'] = False
1097 env['USE_ISPELL'] = False
1098 spell_detected = True
1099 elif spell_engine in ['auto', 'pspell'] and \
1100 conf.CheckLib('pspell'):
1101 utils.addToConfig('#define USE_PSPELL 1', desc = 'Define as 1 to use the pspell library')
1102 env['USE_ASPELL'] = False
1103 env['USE_PSPELL'] = True
1104 env['USE_ISPELL'] = False
1105 spell_detected = True
1106 elif spell_engine in ['auto', 'ispell'] and \
1107 conf.CheckLib('ispell'):
1108 utils.addToConfig('#define USE_ISPELL 1', desc = 'Define as 1 to use the ispell library')
1109 env['USE_ASPELL'] = False
1110 env['USE_PSPELL'] = False
1111 env['USE_ISPELL'] = True
1112 spell_detected = True
1114 if not spell_detected:
1115 env['USE_ASPELL'] = False
1116 env['USE_PSPELL'] = False
1117 env['USE_ISPELL'] = False
1118 # FIXME: can lyx work without an spell engine
1119 if spell_engine == 'auto':
1120 print "Warning: Can not locate any spell checker"
1122 print "Warning: Can not locate specified spell checker:", spell_engine
1124 # USE_POSIX_PACKAGING
1125 # USE_MACOSX_PACKAGING
1126 # USE_WINDOWS_PACKAGING
1127 if packaging_method == 'windows':
1128 utils.addToConfig('#define USE_WINDOWS_PACKAGING 1')
1129 elif packaging_method == 'posix':
1130 utils.addToConfig('#define USE_POSIX_PACKAGING 1')
1131 elif packaging_method == 'mac':
1132 utils.addToConfig('#define USE_MACOSX_PACKAGING 1')
1136 utils.addToConfig('#define BOOST_POSIX 1')
1138 utils.addToConfig('/* #undef BOOST_POSIX */')
1140 # MKDIR_TAKES_ONE_ARG
1141 description = 'Define if mkdir takes only one argument.'
1142 if conf.CheckMkdirOneArg():
1143 utils.addToConfig('#define MKDIR_TAKES_ONE_ARG 1', desc = description)
1145 utils.addToConfig('/* #undef MKDIR_TAKES_ONE_ARG */', desc = description)
1148 # SELECT_TYPE_ARG234
1150 (arg1, arg234, arg5) = conf.CheckSelectArgType()
1151 utils.addToConfig('#define SELECT_TYPE_ARG1 %s' % arg1,
1152 desc = "Define to the type of arg 1 for `select'.")
1153 utils.addToConfig('#define SELECT_TYPE_ARG234 %s' % arg234,
1154 desc = "Define to the type of arg 2, 3, 4 for `select'.")
1155 utils.addToConfig('#define SELECT_TYPE_ARG5 %s' % arg5,
1156 desc = "Define to the type of arg 5 for `select'.")
1160 # WANT_GETFILEATTRIBUTESEX_WRAPPER
1161 utils.endConfigH(TOP_SRC_DIR)
1163 for key in ['USE_ASPELL', 'USE_PSPELL', 'USE_ISPELL', 'HAVE_ASPRINTF', \
1164 'HAVE_WPRINTF', 'HAVE_SNPRINTF', 'HAVE_POSIX_PRINTF', 'HAVE_FCNTL', \
1165 'HAVE_ICONV', 'HAVE_LIBGDI32', 'HAVE_LIBC', 'HAVE_LIBAIKSAURUS']:
1166 env_cache[key] = env[key]
1169 # this comes as a big surprise, without this line
1170 # (doing nothing obvious), adding fast_start=yes
1171 # to a build with fast_start=no will result in a rebuild
1172 # Note that the exact header file to check does not matter
1173 conf.CheckCHeader('io.h')
1174 # only a few variables need to be rescanned
1175 for key in ['USE_ASPELL', 'USE_PSPELL', 'USE_ISPELL', 'HAVE_ASPRINTF', \
1176 'HAVE_WPRINTF', 'HAVE_SNPRINTF', 'HAVE_POSIX_PRINTF', 'HAVE_FCNTL', \
1177 'HAVE_ICONV', 'HAVE_LIBGDI32', 'HAVE_LIBC', 'HAVE_LIBAIKSAURUS']:
1178 env[key] = env_cache[key]
1182 # Finish auto-configuration
1185 #----------------------------------------------------------
1186 # Now set up our build process accordingly
1187 #----------------------------------------------------------
1192 # NOTE: Tool('qt') or Tool('qt4') will be loaded later
1193 # in their respective directory and specialized env.
1195 if frontend in ['qt2', 'qt3']:
1196 # note: env.Tool('qt') my set QT_LIB to qt
1197 env['QT_LIB'] = 'qt-mt'
1198 env['FRONTEND_LIBS'] = ['qt-mt']
1199 if platform_name == 'cygwin' and use_X11:
1200 env.AppendUnique(LIBPATH = ['/usr/X11R6/lib'])
1201 elif frontend == 'qt4':
1202 if platform_name == "win32":
1203 env['QT_LIB'] = ['QtCore4', 'QtGui4']
1205 env['QT_LIB'] = ['QtCore', 'QtGui']
1206 env['FRONTEND_LIBS'] = env['QT_LIB']
1208 print "Can not locate qt tools"
1209 print "What I get is "
1210 print " QTDIR: ", env['QTDIR']
1213 if platform_name in ['win32', 'cygwin']:
1214 # the final link step needs stdc++ to succeed under mingw
1215 # FIXME: shouldn't g++ automatically link to stdc++?
1217 env['SYSTEM_LIBS'] = ['shlwapi', 'shell32', 'advapi32', 'zdll']
1219 env['SYSTEM_LIBS'] = ['shlwapi', 'stdc++', 'z']
1220 elif platform_name == 'cygwin' and use_X11:
1221 env['SYSTEM_LIBS'] = ['GL', 'Xmu', 'Xi', 'Xrender', 'Xrandr', 'Xcursor',
1222 'Xft', 'freetype', 'fontconfig', 'Xext', 'X11', 'SM', 'ICE', 'resolv',
1225 env['SYSTEM_LIBS'] = ['z']
1228 ('HAVE_ICONV', 'iconv'),
1229 ('HAVE_LIBGDI32', 'gdi32'),
1230 ('HAVE_LIBAIKSAURUS', 'Aiksaurus'),
1231 ('USE_ASPELL', 'aspell'),
1232 ('USE_ISPELL', 'ispell'),
1233 ('USE_PSPELL', 'pspell'),
1238 env['SYSTEM_LIBS'].append(lib[1])
1241 # Build parameters CPPPATH etc
1243 # boost is always in, src is needed for config.h
1245 # QT_INC_PATH is not needed for *every* source file
1246 env['CPPPATH'].remove(env['QT_INC_PATH'])
1247 env['CPPPATH'] += ['$TOP_SRC_DIR/boost', '$TOP_SRC_DIR/src']
1249 # add appropriate compiling options (-DNDEBUG etc)
1250 # for debug/release mode
1252 if ARGUMENTS.get('mode', default_build_mode) == 'debug':
1254 env.AppendUnique(CCFLAGS = ['/Zi'])
1255 env.AppendUnique(LINKFLAGS = ['/debug', '/map'])
1257 env.AppendUnique(CCFLAGS = ['-Wall', '-g'])
1260 env.AppendUnique(CCFLAGS = ['/O2'])
1262 env.AppendUnique(CCFLAGS = ['-Wall', '-O2'])
1265 # Customized builders
1267 # install customized builders
1268 env['BUILDERS']['substFile'] = Builder(action = utils.env_subst)
1271 # A Link script for cygwin see
1272 # http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html
1273 # http://www.cygwin.com/ml/cygwin-apps/2004-09/msg00309.html
1276 if platform_name == 'cygwin':
1277 ld_script_path = '/usr/lib/qt3/mkspecs/cygwin-g++'
1278 ld_script = utils.installCygwinLDScript(ld_script_path)
1279 env.AppendUnique(LINKFLAGS = ['-Wl,--enable-runtime-pseudo-reloc',
1280 '-Wl,--script,%s' % ld_script, '-Wl,-s'])
1285 # src/support/package.C.in needs the following to replace
1286 # LYX_ABS_INSTALLED_DATADIR (e.g. /usr/local/lyx/share/lyx)
1287 env['LYX_DIR'] = Dir(env['SHARE_DIR']).abspath
1288 # LYX_ABS_INSTALLED_LOCALEDIR
1289 env['LOCALEDIR'] = Dir(env['LOCALE_DIR']).abspath
1290 # during variable substitution, absolute path is needed.
1291 env['TOP_SRCDIR'] = Dir(env['TOP_SRC_DIR']).abspath
1292 # needed by src/version.C.in => src/version.C
1293 env['PACKAGE_VERSION'] = PACKAGE_VERSION
1294 # fill in the version info
1295 env['VERSION_INFO'] = '''Configuration
1297 Special build flags: %s
1299 C Compiler flags: %s %s
1301 C++ Compiler LyX flags: %s
1302 C++ Compiler flags: %s %s
1304 Linker user flags: %s
1306 Builing directory: %s
1307 Local library directory: %s
1310 Frontend libraries: %s
1311 System libraries: %s
1312 include search path: %s
1319 ''' % (platform_name,
1320 env.subst('$CCFLAGS'), env.subst('$CC'),
1321 env.subst('$CPPFLAGS'), env.subst('$CFLAGS'),
1322 env.subst('$CXX'), env.subst('$CXXFLAGS'),
1323 env.subst('$CPPFLAGS'), env.subst('$CXXFLAGS'),
1324 env.subst('$LINKFLAGS'), env.subst('$LINKFLAGS'),
1325 env.subst('$BUILDDIR'), env.subst('$LOCALLIBPATH'),
1326 str(env['LIBPATH']), str(env['BOOST_LIBRARIES']),
1327 str(env['FRONTEND_LIBS']), str(env['SYSTEM_LIBS']), str(env['CPPPATH']),
1328 env['frontend'], packaging_method,
1329 env['PREFIX'], env['BIN_DEST_DIR'], env['SHARE_DIR'])
1331 if env['frontend'] in ['qt2', 'qt3', 'qt4']:
1332 env['VERSION_INFO'] += ''' include dir: %s
1335 ''' % (env.subst('$QT_INC_PATH'), env.subst('$QT_LIB_PATH'), use_X11)
1338 print env['VERSION_INFO']
1341 # Mingw command line may be too short for our link usage,
1342 # Here we use a trick from scons wiki
1343 # http://www.scons.org/cgi-sys/cgiwrap/scons/moin.cgi/LongCmdLinesOnWin32
1345 # I also would like to add logging (commands only) capacity to the
1347 logfile = env.get('logfile', default_log_file)
1348 if logfile != '' or platform_name == 'win32':
1350 utils.setLoggedSpawn(env, logfile, longarg = (platform_name == 'win32'),
1351 info = '''# This is a log of commands used by scons to build lyx
1355 ''' % (time.asctime(), ' '.join(sys.argv),
1356 env['VERSION_INFO'].replace('\n','\n# ')) )
1362 # -h will print out help info
1363 Help(opts.GenerateHelpText(env))
1364 # save environment settings (for fast_start option)
1365 cache_file = open(env_cache_file, 'w')
1366 cPickle.dump(env_cache, cache_file)
1369 #----------------------------------------------------------
1371 #----------------------------------------------------------
1374 # this has been the source of problems on some platforms...
1375 # I find that I need to supply it with full path name
1376 env.SConsignFile(os.path.join(Dir(env['BUILDDIR']).abspath, '.sconsign'))
1377 # this usage needs further investigation.
1378 #env.CacheDir('%s/Cache/%s' % (env['BUILDDIR'], frontend))
1380 env['BUILD_TARGETS'] = BUILD_TARGETS
1381 if env.has_key('rebuild'):
1382 env['REBUILD_TARGETS'] = env['rebuild'].split(',')
1384 env['REBUILD_TARGETS'] = None
1386 print "Building all targets recursively"
1388 env.SConscript('$SCONS_DIR/SConscript', duplicate = 0)