diff --git a/development/scons/SConscript b/development/scons/SConscript index 56e335d2a3..3fd7343f1e 100644 --- a/development/scons/SConscript +++ b/development/scons/SConscript @@ -902,7 +902,7 @@ if 'client' in targets or 'install' in targets or 'all' in targets: print "Processing files in src/client" - try: + if env['HAS_SOCKET_LIB']: client = env.Program( target = '$BUILDDIR/common/client/lyxclient', LIBS = env['BOOST_LIBRARIES'] + env['SOCKET_LIBS'] + ['supports'], @@ -916,8 +916,7 @@ if 'client' in targets or 'install' in targets or 'all' 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" + else: client = None Alias('client', client) @@ -944,36 +943,32 @@ if 'tex2lyx' in targets or 'install' in targets or 'all' 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'], - source = ["$BUILDDIR/common/tex2lyx/%s" % x for x in Split(''' - FloatList.C - Floating.C - counters.C - lyxlayout.C - lyxtextclass.C - lyxlex.C - lyxlex_pimpl.C - boost.C - context.C - gettext.C - lengthcommon.C - lyxfont.C - texparser.C - tex2lyx.C - preamble.C - math.C - table.C - text.C - ''')] - ) - 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 + tex2lyx = tex2lyx_env.Program( + target = '$BUILDDIR/common/tex2lyx/tex2lyx', + LIBS = ['supports'] + env['BOOST_LIBRARIES'] + env['SYSTEM_LIBS'], + source = ["$BUILDDIR/common/tex2lyx/%s" % x for x in Split(''' + FloatList.C + Floating.C + counters.C + lyxlayout.C + lyxtextclass.C + lyxlex.C + lyxlex_pimpl.C + boost.C + context.C + gettext.C + lengthcommon.C + lyxfont.C + texparser.C + tex2lyx.C + preamble.C + math.C + table.C + text.C + ''')] + ) + Alias('tex2lyx', env.Command(os.path.join('$BUILDDIR', os.path.split(str(tex2lyx[0]))[1]), + tex2lyx, [Copy('$TARGET', '$SOURCE')])) Alias('tex2lyx', tex2lyx) @@ -1124,34 +1119,29 @@ if build_lyx or 'lyx' in targets: # # Build lyx with given frontend # - try: - lyx = env.Program( - target = '$BUILDDIR/$frontend/lyx', - source = [], - LIBS = [ - 'lyxbase_pre', - 'mathed', - 'insets', - 'frontends', - env['frontend'], - 'controllers', - 'graphics', - 'supports', - 'lyxbase_post', - ] + - env['BOOST_LIBRARIES'] + - env['EXTRA_LIBS'] + - env['SOCKET_LIBS'] + - env['SYSTEM_LIBS'] - ) - # [/path/to/lyx.ext] => lyx-qt3.ext - target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s' % frontend) - Alias('lyx', env.Command(os.path.join('$BUILDDIR', target_name), lyx, - [Copy('$TARGET', '$SOURCE')])) - except: - print "Building of program lyx failed" - lyx = None - raise + lyx = env.Program( + target = '$BUILDDIR/$frontend/lyx', + source = [], + LIBS = [ + 'lyxbase_pre', + 'mathed', + 'insets', + 'frontends', + env['frontend'], + 'controllers', + 'graphics', + 'supports', + 'lyxbase_post', + ] + + env['BOOST_LIBRARIES'] + + env['EXTRA_LIBS'] + + env['SOCKET_LIBS'] + + env['SYSTEM_LIBS'] + ) + # [/path/to/lyx.ext] => lyx-qt3.ext + target_name = os.path.split(str(lyx[0]))[1].replace('lyx', 'lyx-%s' % frontend) + Alias('lyx', env.Command(os.path.join('$BUILDDIR', target_name), lyx, + [Copy('$TARGET', '$SOURCE')])) Alias('lyx', lyx) diff --git a/development/scons/SConstruct b/development/scons/SConstruct index d6e032a79c..f0ae741afb 100644 --- a/development/scons/SConstruct +++ b/development/scons/SConstruct @@ -411,7 +411,7 @@ else: # have to guess env['QT_INC_PATH'] = '/usr/include/$frontend/' # Note that this CPPPATH is for testing only # it will be removed before calling SConscript -env.AppendUnique(CPPPATH = env['QT_INC_PATH']) +env['CPPPATH'] = [env['QT_INC_PATH']] # # extra_inc_path and extra_lib_path @@ -525,6 +525,9 @@ if not fast_start: env['SOCKET_LIBS'] = [] if conf.CheckLib('socket'): env['SOCKET_LIBS'].append('socket') + env['HAS_SOCKET_LIB'] = True + else: + env['HAS_SOCKET_LIB'] = False # nsl is the network services library and provides a # transport-level interface to networking services. @@ -532,8 +535,10 @@ if not fast_start: env['SOCKET_LIBS'].append('nsl') env_cache['SOCKET_LIBS'] = env['SOCKET_LIBS'] + env_cache['HAS_SOCKET_LIB'] = env['HAS_SOCKET_LIB'] else: env['SOCKET_LIBS'] = env_cache['SOCKET_LIBS'] + env['HAS_SOCKET_LIB'] = env_cache['HAS_SOCKET_LIB'] if not fast_start: # check boost libraries @@ -762,13 +767,6 @@ if not fast_start: else: print "Warning: Can not locate specified spell checker:", spell_engine - # env['EXTRA_LIBS'] will be modified later, so a unique copy is needed - # NOTE that we do *not* save qt_libs in environment. - env_cache['EXTRA_LIBS'] = copy.copy(env['EXTRA_LIBS']) - env_cache['USE_ASPELL'] = env['USE_ASPELL'] - env_cache['USE_PSPELL'] = env['USE_PSPELL'] - env_cache['USE_ISPELL'] = env['USE_ISPELL'] - # USE_POSIX_PACKAGING # USE_MACOSX_PACKAGING # USE_WINDOWS_PACKAGING @@ -822,6 +820,13 @@ if not fast_start: # WANT_GETFILEATTRIBUTESEX_WRAPPER utils.endConfigH(TOP_SRC_DIR) + # env['EXTRA_LIBS'] will be modified later, so a unique copy is needed + # NOTE that we do *not* save qt_libs in environment. + env_cache['EXTRA_LIBS'] = copy.copy(env['EXTRA_LIBS']) + env_cache['USE_ASPELL'] = env['USE_ASPELL'] + env_cache['USE_PSPELL'] = env['USE_PSPELL'] + env_cache['USE_ISPELL'] = env['USE_ISPELL'] + else: # only a few variables need to be rescanned env['EXTRA_LIBS'] = copy.copy(env_cache['EXTRA_LIBS']) @@ -876,9 +881,9 @@ else: # # boost is always in, src is needed for config.h # -# Note that previously added QT_DIR/include etc is removed -# they will be added when processing for example src/qt3 -env['CPPPATH'] = ['$TOP_SRC_DIR/boost', '$TOP_SRC_DIR/src'] +# QT_INC_PATH is not needed for *every* source file +env['CPPPATH'].remove(env['QT_INC_PATH']) +env['CPPPATH'] += ['$TOP_SRC_DIR/boost', '$TOP_SRC_DIR/src'] # TODO: add (more) appropriate compiling options (-DNDEBUG etc) # for debug/release mode @@ -937,11 +942,13 @@ Build info: Boost libraries: %s Extra libraries: %s System libraries: %s + include search path: %s Frontend: Frontend: %s Packaging: %s - LyX binary dir: FIXME - LyX files dir: FIXME + LyX dir: %s + LyX binary dir: %s + LyX files dir: %s ''' % (platform_name, env.subst('$CCFLAGS'), env.subst('$CC'), env.subst('$CPPFLAGS'), env.subst('$CFLAGS'), @@ -950,8 +957,9 @@ Frontend: env.subst('$LINKFLAGS'), env.subst('$LINKFLAGS'), env.subst('$BUILDDIR'), env.subst('$LOCALLIBPATH'), str(env['LIBPATH']), str(env['BOOST_LIBRARIES']), - str(env['EXTRA_LIBS']), str(env['SYSTEM_LIBS']), - env['frontend'], packaging_method) + str(env['EXTRA_LIBS']), str(env['SYSTEM_LIBS']), str(env['CPPPATH']), + env['frontend'], packaging_method, + env['PREFIX'], env['BIN_DIR'], env['SHARE_DIR']) if env['frontend'] in ['qt3', 'qt4']: env['VERSION_INFO'] += ''' include dir: %s @@ -996,9 +1004,9 @@ cache_file.close() #---------------------------------------------------------- Export('env') -# this has been the source of problem on some platforms... -# needs more testing -env.SConsignFile('%s/.sconsign' % env['BUILDDIR'][1:]) +# this has been the source of problems on some platforms... +# I find that I need to supply it with full path name +env.SConsignFile(os.path.join(Dir(env['BUILDDIR']).abspath, '.sconsign')) # this usage needs further investigation. #env.CacheDir('%s/Cache/%s' % (env['BUILDDIR'], frontend)) diff --git a/development/scons/qt4.py b/development/scons/qt4.py index 8b3bc7f23b..9d06e3589e 100644 --- a/development/scons/qt4.py +++ b/development/scons/qt4.py @@ -210,7 +210,7 @@ def generate(env): env['QT4_QRCFLAGS'] = '' # suffixes/prefixes for the headers / sources to generate - env['QT4_MOCHPREFIX'] = 'moc_' + env['QT4_MOCHPREFIX'] = '' env['QT4_MOCHSUFFIX'] = '$CXXFILESUFFIX' env['QT4_MOCCXXPREFIX'] = 'moc_' env['QT4_MOCCXXSUFFIX'] = '.moc' diff --git a/development/scons/scons_utils.py b/development/scons/scons_utils.py index 81dd374399..36cf6c081a 100644 --- a/development/scons/scons_utils.py +++ b/development/scons/scons_utils.py @@ -64,7 +64,10 @@ def env_subst(target, source, env): if not env.has_key(k): print "Failed to subst key ", k, " from file", str(source[0]) raise - contents = re.sub('@'+k+'@', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents) + try: + contents = re.sub('@'+k+'@', env[k].replace('\n',r'\\n\\\n'), contents) + except: + print "Can not substitute %s with %s" % ('@'+k+'@', env[k]) target_file.write(contents + "\n") target_file.close() #st = os.stat(str(source[0])) @@ -211,25 +214,13 @@ int main() mkdir("somedir"); } """ - - check_mkdir_one_arg_source2 = """ -#include -int main() -{ - mkdir("somedir"); -} -""" - conf.Message('Checking for the number of args for mkdir... ') - ret = conf.TryLink(check_mkdir_one_arg_source, '.c') + ret = conf.TryLink(check_mkdir_one_arg_source, '.c') or \ + conf.TryLink('#include ' + check_mkdir_one_arg_source, '.c') if ret: conf.Result('one') else: - ret = conf.TryLink(check_mkdir_one_arg_source2, '.c') - if ret: - conf.Result('one') - else: - conf.Result('two') + conf.Result('two') return ret