]> git.lyx.org Git - features.git/commitdiff
scons: lyx2lyx_version.py.in, less rebuild, filter installed files, bug fix for substFile
authorBo Peng <bpeng@lyx.org>
Wed, 17 May 2006 04:07:45 +0000 (04:07 +0000)
committerBo Peng <bpeng@lyx.org>
Wed, 17 May 2006 04:07:45 +0000 (04:07 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13853 a592a061-630c-0410-9148-cb99ea01b6c8

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

index 3fd7343f1e5063d6f932f09be232b9be07e38b18..195a63b67152771112f0a68e6d0d1e032434fdc2 100644 (file)
@@ -96,7 +96,6 @@ if build_lyx or True in [x in targets for x in ['supports', 'client', 'tex2lyx']
   #
   print "Processing files in src/support"
 
-  env['SUBST_KEYS'] = ['LYX_DIR', 'LOCALEDIR', 'TOP_SRCDIR', 'PROGRAM_SUFFIX']
   env.substFile('$BUILDDIR/common/support/package.C', '$TOP_SRC_DIR/src/support/package.C.in')
 
   supports = env.StaticLibrary(
@@ -902,7 +901,7 @@ if 'client' in targets or 'install' in targets or 'all' in targets:
 
   print "Processing files in src/client"
 
-  if env['HAS_SOCKET_LIB']:
+  if env['HAVE_FCNTL']:
     client = env.Program(
       target = '$BUILDDIR/common/client/lyxclient',
       LIBS = env['BOOST_LIBRARIES'] + env['SOCKET_LIBS'] + ['supports'],
@@ -978,7 +977,6 @@ if build_lyx or 'lyxbase' in targets:
   #
   print "Processing files in src"
 
-  env['SUBST_KEYS'] = ['PACKAGE_VERSION', 'VERSION_INFO']
   env.substFile('$BUILDDIR/common/version.C', '$TOP_SRC_DIR/src/version.C.in')
 
   lyx_source_pre = Split('''
@@ -1200,12 +1198,15 @@ if 'install' in targets:
   # windows: $PREFIX/Resources/locale
   # others:  $PREFIX/share/locale
   locale_dir = env['LOCALE_DIR']
+  # do not install these files
+  execlude_list = ['Makefile.am', 'Makefile.in', 'Makefile', 
+    'lyx2lyx_version.py', 'lyx2lyx_version.py.in']
 
   def install(dest, src):
     ''' recusive installation of src to dest '''
     # separate file and directory
-    files = filter(os.path.isfile, [x for x in src])
-    dirs = filter(os.path.isdir, [x for x in src])
+    files = filter(lambda x: os.path.isfile(x) and not os.path.split(x)[1] in execlude_list, src)
+    dirs = filter(os.path.isdir, src)
     # install file
     env.Install(dest, files)
     # install directory
@@ -1226,6 +1227,8 @@ if 'install' in targets:
      'lyxrc.example', 'syntax.default', 'bind', 'images', 'layouts', 'scripts', 
      'templates', 'examples', 'kbd', 'lyx2lyx', 'tex', 'clipart', 'doc',  'ui']]
   )
+  env.substFile('$SHARE_DIR/lyx2lyx/lyx2lyx_version.py', 
+    '$TOP_SRC_DIR/lib/lyx2lyx/lyx2lyx_version.py.in')
   Alias('install', dirs)
   # man
   env.InstallAs(os.path.join(env['MAN_DIR'], 'lyx.1'),
index f0ae741afb1bca5206b16ced600cb6d252ed58ba..36bb8655810fc04ba95f5175b6ee327faef136bb 100644 (file)
@@ -111,7 +111,6 @@ PACKAGE_BUGREPORT = 'lyx-devel@lists.lyx.org'
 PACKAGE_NAME = 'LyX'
 PACKAGE_TARNAME = 'lyx'
 PACKAGE_STRING = '%s %s' % (PACKAGE_NAME, PACKAGE_VERSION)
-PROGRAM_SUFFIX = ''
 
 # various cache/log files
 default_log_file = 'scons_lyx.log'
@@ -238,8 +237,6 @@ opts.AddOptions(
   BoolOption('fast_start', 'Whether or not use cached tests and keep current config.h', True),
   # FIXME: I do not know how pch is working. Ignore this option now.
   BoolOption('pch', '(NA) Whether or not use pch', default_pch_opt),
-  # FIXME: Not implemented yet.
-  BoolOption('version_suffix', '(NA) Whether or not add version suffix', False),
   # enable assertion, (config.h has ENABLE_ASSERTIOS
   BoolOption('assertions', 'Use assertions', True),
   # enable warning, (config.h has WITH_WARNINGS)
@@ -274,6 +271,8 @@ opts.AddOptions(
   PathOption('extra_lib_path1', 'Extra library path', None),
   # can be set to a non-existing directory
   ('prefix', 'install architecture-independent files in PREFIX', None),
+  # version suffix
+  ('version_suffix', 'install lyx as lyx-suffix', ''),
   #
   PathOption('exec_prefix', 'install architecture-independent executable files in PREFIX', None),
   # FIXME: not implemented
@@ -525,9 +524,6 @@ 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.
@@ -535,10 +531,8 @@ 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
@@ -674,7 +668,6 @@ if not fast_start:
     ('mktemp', 'HAVE_MKTEMP'),
     ('mkstemp', 'HAVE_MKSTEMP'),
     ('strerror', 'HAVE_STRERROR'),
-    ('fcntl', 'HAVE_FCNTL')
   ]
 
   for func in functions:
@@ -683,6 +676,13 @@ if not fast_start:
     else:
       utils.addToConfig('/* #undef %s */' % func[1], TOP_SRC_DIR)
 
+  if conf.CheckFunc('fcntl'):
+    utils.addToConfig('#define HAVE_FCNTL 1', TOP_SRC_DIR)
+    env['HAVE_FCNTL'] = True
+  else:
+    utils.addToConfig('/* #undef HAVE_FCNTL */', TOP_SRC_DIR)
+    env['HAVE_FCNTL'] = False
+
   # PACKAGE
   # PACKAGE_VERSION
   # DEVEL_VERSION
@@ -826,13 +826,21 @@ if not fast_start:
   env_cache['USE_ASPELL'] = env['USE_ASPELL']
   env_cache['USE_PSPELL'] = env['USE_PSPELL']
   env_cache['USE_ISPELL'] = env['USE_ISPELL']
+  env_cache['HAVE_FCNTL'] = env['HAVE_FCNTL']
 
 else:
+  #
+  # this comes as a big surprise, without this line 
+  # (doing nothing obvious), adding fast_start=yes
+  # to a build with fast_start=no will result in a rebuild
+  # Note that the exact header file to check does not matter
+  conf.CheckCHeader('io.h')
   # only a few variables need to be rescanned
   env['EXTRA_LIBS'] = copy.copy(env_cache['EXTRA_LIBS'])
   env['USE_ASPELL'] = env_cache['USE_ASPELL']
   env['USE_PSPELL'] = env_cache['USE_PSPELL']
   env['USE_ISPELL'] = env_cache['USE_ISPELL']
+  env['HAVE_FCNTL'] = env_cache['HAVE_FCNTL']
 
 #
 # Finish auto-configuration
@@ -921,7 +929,11 @@ env['LYX_DIR'] = env['SHARE_DIR']
 #  LYX_ABS_INSTALLED_LOCALEDIR
 env['LOCALEDIR'] = env['LOCALE_DIR']
 env['TOP_SRCDIR'] = env['TOP_SRC_DIR']
-env['PROGRAM_SUFFIX'] = PROGRAM_SUFFIX
+# program suffix
+if env.has_key('version_suffix'):
+  env['PROGRAM_SUFFIX'] = env['version_suffix']
+else:
+  env['PROGRAM_SUFFIX'] = ''
 # needed by src/version.C.in => src/version.C
 env['PACKAGE_VERSION'] = PACKAGE_VERSION
 # fill in the version info
index 36cf6c081a1e142d718b49b9edb69eccda727b1d..28d38664a121777c20a1c64bc6424d901d974f80 100644 (file)
@@ -60,14 +60,12 @@ def env_subst(target, source, env):
   source_file = file(str(source[0]), "r")
   
   contents = source_file.read()
-  for k in env.get('SUBST_KEYS', []):
-    if not env.has_key(k):
-      print "Failed to subst key ", k, " from file", str(source[0])
-      raise
+  for k, v in env.items():
     try:
-      contents = re.sub('@'+k+'@', env[k].replace('\n',r'\\n\\\n'), contents)
+      contents = re.sub('@'+k+'@', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents)
+      contents = re.sub('%'+k+'%', env.subst('$'+k).replace('\n',r'\\n\\\n'), contents)
     except:
-      print "Can not substitute %s with %s" % ('@'+k+'@', env[k])
+      pass
   target_file.write(contents + "\n")
   target_file.close()
   #st = os.stat(str(source[0]))