]> git.lyx.org Git - features.git/commitdiff
Scons: fix a few bugs: qt4, included_ libs, command line argument with blank
authorBo Peng <bpeng@lyx.org>
Sun, 21 May 2006 15:50:55 +0000 (15:50 +0000)
committerBo Peng <bpeng@lyx.org>
Sun, 21 May 2006 15:50:55 +0000 (15:50 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13894 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/SConscript
development/scons/SConstruct
development/scons/qt4.py
development/scons/scons_utils.py

index d4a36ec7af78546e94b3ed9cd52d9e4e56f0e0af..9a1eda1c0f195fcb61646a30f4ec0294afb3b77f 100644 (file)
@@ -29,7 +29,7 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
   print 'Processing files in boost/libs/filesystem/src...'
 
   filesystem = boostenv.StaticLibrary(
-    target = '$LOCALLIBPATH/boost_filesystem',
+    target = '$LOCALLIBPATH/included_boost_filesystem',
     source = ["$BUILDDIR/boost/filesystem/src/%s" % x for x in Split('''
       convenience.cpp
       exception.cpp
@@ -41,7 +41,7 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
   print 'Processing files in boost/libs/regex/src...'
 
   regex = boostenv.StaticLibrary(
-    target = '$LOCALLIBPATH/boost_regex',
+    target = '$LOCALLIBPATH/included_boost_regex',
     source = ["$BUILDDIR/boost/regex/src/%s" % x for x in Split('''
       cpp_regex_traits.cpp
       c_regex_traits.cpp
@@ -58,7 +58,7 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
   print 'Processing files in boost/libs/signals/src...'
 
   signals = boostenv.StaticLibrary(
-    target = '$LOCALLIBPATH/boost_signals',
+    target = '$LOCALLIBPATH/included_boost_signals',
     source = ["$BUILDDIR/boost/signals/src/%s" % x for x in Split('''
       connection.cpp
       named_slot_map.cpp
@@ -71,7 +71,7 @@ if env['INCLUDED_BOOST'] or 'boost' in targets:
   print 'Processing files in boost/libs/iostreams/src...'
 
   iostreams = boostenv.StaticLibrary(
-    target = '$LOCALLIBPATH/boost_iostreams',
+    target = '$LOCALLIBPATH/included_boost_iostreams',
     source = ["$BUILDDIR/boost/iostreams/src/%s" % x for x in Split('''
       file_descriptor.cpp
       mapped_file.cpp
@@ -88,7 +88,7 @@ if env['INCLUDED_GETTEXT'] or 'intl' in targets:
   # 
   # intl
   # 
-  print "Processing files in intl"
+  print "Processing files in intl..."
 
   env.BuildDir('$BUILDDIR/intl', '$TOP_SRC_DIR/intl', duplicate = 0)
 
@@ -98,13 +98,13 @@ if env['INCLUDED_GETTEXT'] or 'intl' in targets:
   intlenv['CPPPATH'] += ['intl']
   
   intlenv.Append(CCFLAGS = [
-    r'-DLOCALEDIR=\"' + env['LOCALE_DIR'] + r'\"',
-    r'-DLOCALE_ALIAS_PATH=\"' + env['LOCALE_DIR'] + r'\"',
-    r'-DLIBDIR=\"' + env['TOP_SRC_DIR'] + r'/lib\"',
+    r'-DLOCALEDIR=\"' + env['LOCALE_DIR'].replace('\\', '\\\\') + r'\"',
+    r'-DLOCALE_ALIAS_PATH=\"' + env['LOCALE_DIR'].replace('\\', '\\\\') + r'\"',
+    r'-DLIBDIR=\"' + env['TOP_SRC_DIR'].replace('\\', '\\\\') + r'/lib\"',
     '-DIN_LIBINTL',
     '-DENABLE_RELOCATABLE=1',
     '-DIN_LIBRARY',
-    r'-DINSTALLDIR=\"' + env['PREFIX'] + r'/lib\"',
+    r'-DINSTALLDIR=\"' + env['PREFIX'].replace('\\', '\\\\') + r'/lib\"',
     '-DNO_XMALLOC',
     '-Dset_relocation_prefix=libintl_set_relocation_prefix',
     '-Drelocate=libintl_relocate',
@@ -119,7 +119,7 @@ if env['INCLUDED_GETTEXT'] or 'intl' in targets:
       [Copy('$TARGET', '$SOURCE')])
   
   intl = intlenv.StaticLibrary(
-    target = '$LOCALLIBPATH/intl',
+    target = '$LOCALLIBPATH/included_intl',
     LIBS = ['c'],
     source = ["$BUILDDIR/intl/%s" % x for x in Split('''
       bindtextdom.c
@@ -160,7 +160,7 @@ if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']
   #
   # src/support
   #
-  print "Processing files in src/support"
+  print "Processing files in src/support..."
 
   env.substFile('$BUILDDIR/common/support/package.C', '$TOP_SRC_DIR/src/support/package.C.in')
 
@@ -204,7 +204,7 @@ if build_lyx or 'mathed' in targets:
   #
   # src/mathed
   #
-  print "Processing files in src/mathed"
+  print "Processing files in src/mathed..."
 
   mathed = env.StaticLibrary(
     target = '$LOCALLIBPATH/mathed',
@@ -290,7 +290,7 @@ if build_lyx or 'insets' in targets:
   #
   # src/insets
   #
-  print "Processing files in src/insets"
+  print "Processing files in src/insets..."
 
   insets = env.StaticLibrary(
     target = '$LOCALLIBPATH/insets',
@@ -353,7 +353,7 @@ if build_lyx or 'frontends' in targets:
   #
   # src/frontends
   #
-  print "Processing files in src/frontends"
+  print "Processing files in src/frontends..."
 
   frontends = env.StaticLibrary(
     target = '$LOCALLIBPATH/frontends',
@@ -376,7 +376,7 @@ if build_lyx or 'graphics' in targets:
   #
   # src/graphics
   #
-  print "Processing files in src/graphics"
+  print "Processing files in src/graphics..."
 
   graphics = env.StaticLibrary(
     target = '$LOCALLIBPATH/graphics',
@@ -401,7 +401,7 @@ if build_lyx or 'controllers' in targets:
   #
   # src/frontends/controllers
   #
-  print "Processing files in src/frontends/controllers"
+  print "Processing files in src/frontends/controllers..."
 
   controllers = env.StaticLibrary(
     target = '$LOCALLIBPATH/controllers',
@@ -475,7 +475,7 @@ else:
 
 
 if frontend == 'qt3':
-  print "Processing files in src/frontends/qt3"
+  print "Processing files in src/frontends/qt3..."
 
   qt3env = env.Copy()
   # disable auto scan to speed up non build time
@@ -704,7 +704,7 @@ if frontend == 'qt3':
 
 
 elif frontend == 'qt4':
-  print "Processing files in src/frontends/qt4"
+  print "Processing files in src/frontends/qt4..."
 
   qt4env = env.Copy()
   qt4env['QT_AUTOSCAN'] = 0
@@ -723,11 +723,8 @@ elif frontend == 'qt4':
     '$BUILDDIR/common/images',
     '$BUILDDIR/common/frontends',
     '$BUILDDIR/common/frontends/qt4',
-    '$BUILDDIR/common/frontends/controllers',
-    '$QT_INC_PATH',
-    '$QT_INC_PATH/Qt',
-    '$QT_INC_PATH/QtCore',
-    '$QT_INC_PATH/QtGui']
+    '$BUILDDIR/common/frontends/controllers' 
+    ]
   )
 
   # FIXME: replace by something from pkg_config
@@ -963,12 +960,12 @@ if 'client' in targets or 'install' in targets or 'all' in targets:
   #
   env.BuildDir('$BUILDDIR/common', '$TOP_SRC_DIR/src', duplicate = 0)
 
-  print "Processing files in src/client"
+  print "Processing files in src/client..."
 
   if env['HAVE_FCNTL']:
     client = env.Program(
       target = '$BUILDDIR/common/client/lyxclient',
-      LIBS = ['supports'] + env['INTL_LIB'] + env['SYSTEM_LIBS'] + 
+      LIBS = ['supports'] + env['INTL_LIBS'] + env['SYSTEM_LIBS'] + 
         env['SOCKET_LIBS'] + env['BOOST_LIBRARIES'],
       source = ["$BUILDDIR/common/client/%s" % x for x in Split('''
         boost.C
@@ -989,7 +986,7 @@ if 'tex2lyx' in targets or 'install' in targets or 'all' in targets:
   #
   # tex2lyx
   #
-  print "Processing files in src/tex2lyx"
+  print "Processing files in src/tex2lyx..."
 
   tex2lyx_env = env.Copy()
   # the order is important here.
@@ -1034,7 +1031,7 @@ if build_lyx or 'lyxbase' in targets:
   #
   # src/
   #
-  print "Processing files in src"
+  print "Processing files in src..."
 
   env.substFile('$BUILDDIR/common/version.C', '$TOP_SRC_DIR/src/version.C.in')
 
@@ -1192,7 +1189,7 @@ if build_lyx or 'lyx' in targets:
       ] +
       env['BOOST_LIBRARIES'] +
       env['EXTRA_LIBS'] +
-      env['INTL_LIB'] + 
+      env['INTL_LIBS'] + 
       env['SOCKET_LIBS'] +
       env['SYSTEM_LIBS']
   )
index 09d5e169d7de121808b4cf864edbbd33146f6d7b..4bdcfbbab3537ba5840e2b8f48f83c8468f1acc4 100644 (file)
@@ -361,11 +361,17 @@ if platform_name == 'win32':
 def getEnvVariable(env, name):
   # first try command line argument (override environment settings)
   if ARGUMENTS.has_key(name) and ARGUMENTS[name].strip() != '':
-    env[name] = ARGUMENTS[name]
+    # multiple options may be passed like "-02 -g"
+    env[name] = ARGUMENTS[name].split()
+    # it does not seem necessary, but it is safer to change ['a'] back to 'a'
+    if len(env[name]) == 1:
+      env[name] = env[name][0]
   # then use environment default
   elif os.environ.has_key(name) and os.environ[name].strip() != '':
-    env[name] = os.environ[name]
     print "Acquiring varaible %s from system environment: %s" % (name, env[name])
+    env[name] = os.environ[name].split()
+    if len(env[name]) == 1:
+      env[name] = env[name][0]
   # finally, env['CC'] etc is set to the default values of Options.
   # and env['CPP'] etc does not exist
 
@@ -570,8 +576,8 @@ if not fast_start:
   # now, auto and succ = false, or boost=included
   if not succ:
     # we do not need to set LIBPATH now.
-    env['BOOST_LIBRARIES'] = ['boost_signals', 'boost_regex',
-      'boost_filesystem', 'boost_iostreams']
+    env['BOOST_LIBRARIES'] = ['included_boost_signals', 'included_boost_regex',
+      'included_boost_filesystem', 'included_boost_iostreams']
     env['INCLUDED_BOOST'] = True
   env_cache['BOOST_LIBRARIES'] = env['BOOST_LIBRARIES']
   env_cache['INCLUDED_BOOST'] = env['INCLUDED_BOOST']
@@ -585,7 +591,7 @@ if not env.has_key('nls') or env['nls']:
 
 if not fast_start:
   if not env['ENABLE_NLS']:
-    env['INTL_LIB'] = []
+    env['INTL_LIBS'] = []
     env['INCLUDED_GETTEXT'] = False
   else:
     # check gettext libraries
@@ -595,6 +601,7 @@ if not fast_start:
     if gettext_opt in ['auto', 'system']:
       if conf.CheckLib('intl'):
         env['INCLUDED_GETTEXT'] = False
+        env['INTL_LIBS'] = ['intl']
         succ = True
       else: # no found
         if gettext_opt == 'system':
@@ -606,11 +613,14 @@ if not fast_start:
     if not succ:
       # we do not need to set LIBPATH now.
       env['INCLUDED_GETTEXT'] = True
-    env['INTL_LIB'] = ['intl']
+      env['INTL_LIBS'] = ['included_intl']
+    if platform_name == 'win32':
+      # for functions AddFontResouceA, RemoveFontResourceA
+      env['INTL_LIBS'].append('gdi32')
   env_cache['INCLUDED_GETTEXT'] = env['INCLUDED_GETTEXT']
-  env_cache['INTL_LIB'] = env['INTL_LIB']
+  env_cache['INTL_LIBS'] = env['INTL_LIBS']
 else:
-  env['INTL_LIB'] = env_cache['INTL_LIB']
+  env['INTL_LIBS'] = env_cache['INTL_LIBS']
   env['INCLUDED_GETTEXT'] = env_cache['INCLUDED_GETTEXT']
 
 #
@@ -672,6 +682,7 @@ if not fast_start:
   ]
 
   for header in headers:
+    utils.addToConfig("/* Define to 1 if you have the <%s> header file. */" % header[0], TOP_SRC_DIR, newline=1)
     if (header[2] == 'c' and conf.CheckCHeader(header[0])) or \
       (header[2] == 'cxx' and conf.CheckCXXHeader(header[0])):
       utils.addToConfig('#define %s 1' % header[1], TOP_SRC_DIR)
@@ -695,6 +706,7 @@ if not fast_start:
   # HAVE_MKSTEMP
   # HAVE_STRERROR
   # HAVE_STD_COUNT
+  # HAVE_GETCWD
 
   # Check functions
   functions = [
@@ -721,7 +733,8 @@ int count()
   char a[] = "hello";
   return std::count(a, a+5, 'l');
 }
-''')
+'''),
+    ('getcwd', 'HAVE_GETCWD', None),
   ]
 
   # HAVE_ASPRINTF
@@ -731,6 +744,7 @@ int count()
   # HAVE_FCNTL
   
   for func in functions:
+    utils.addToConfig("/* Define to 1 if you have the `%s' function. */" % func[0], TOP_SRC_DIR, newline=1)
     if conf.CheckFunc(func[0], header=func[2]):
       utils.addToConfig('#define %s 1' % func[1], TOP_SRC_DIR)
     else:
@@ -745,6 +759,7 @@ int count()
   ]
 
   for func in env_functions:
+    utils.addToConfig("/* Define to 1 if you have the `%s' function. */" % func[0], TOP_SRC_DIR, newline=1)
     if conf.CheckFunc(func[0]):
       utils.addToConfig('#define %s 1' % func[1], TOP_SRC_DIR)
       env[func[1]] = 1
@@ -755,17 +770,20 @@ int count()
   # HAVE_INTMAX_T
   # HAVE_INTTYPES_H_WITH_UINTMAX 
   # HAVE_DECL_ISTREAMBUF_ITERATOR
+  utils.addToConfig("/* Define to 1 if you have the `intmax_t' type. */", TOP_SRC_DIR, newline=1)
   if conf.CheckType('intmax_t', includes='#include <stdint.h>') or \
     conf.CheckType('intmax_t', includes='#include <inttypes.h>'):
     utils.addToConfig('#define HAVE_INTMAX_T 1', TOP_SRC_DIR)
   else:
     utils.addToConfig('/* #undef HAVE_INTMAX_T */', TOP_SRC_DIR)
 
+  utils.addToConfig("/* Define to 1 if you have the `uintmax_t' type. */", TOP_SRC_DIR, newline=1)
   if conf.CheckType('uintmax_t', includes='#include <inttypes.h>'):
     utils.addToConfig('#define HAVE_INTTYPES_H_WITH_UINTMAX  1', TOP_SRC_DIR)
   else:
     utils.addToConfig('/* #undef HAVE_INTTYPES_H_WITH_UINTMAX  */', TOP_SRC_DIR)
     
+  utils.addToConfig("/* Define to 1 if you have the `istreambug_iterator' type. */", TOP_SRC_DIR, newline=1)
   if conf.CheckType('std::istreambuf_iterator<std::istream>', 
     includes='#include <streambuf>\n#include <istream>'):
     utils.addToConfig('#define HAVE_DECL_ISTREAMBUF_ITERATOR 1', TOP_SRC_DIR)
index 9d06e3589e5c87a59c962a0c22e46880b02255f7..3cbb797e29f1ab9832aee13b89326fab10976520 100644 (file)
@@ -366,7 +366,7 @@ def enable_modules(self, modules, debug=False) :
                self.AppendUnique(LIBS=[lib+'4'+debugSuffix for lib in modules])
                if 'QtOpenGL' in modules:
                        self.AppendUnique(LIBS=['opengl32'])
-               self.AppendUnique(CPPPATH=[ '$QTDIR/include/'+module
+               self.AppendUnique(CPPPATH=[ '$QTDIR/include/'+module[:-1]
                        for module in modules])
                self.AppendUnique(LIBPATH=['$QTDIR/lib'])
 
index f8aff3c889e8200dc65be8bd617815958ceefca8..040f95ddb3325356c9ca81cf9d3623f69933a989 100644 (file)
@@ -108,13 +108,13 @@ def startConfigH(top_src_dir):
 '''
 
 
-def addToConfig(lines, top_src_dir):
+def addToConfig(lines, top_src_dir, newline=2):
   ''' utility function: shortcut for appending lines to outfile
     add newline at the end of lines.
   '''
   global config_content
   if lines.strip() != '':
-    config_content += lines + '\n\n'
+    config_content += lines + '\n'*newline
 
 
 def endConfigH(top_src_dir):