]> git.lyx.org Git - lyx.git/commitdiff
Scons: get version info from configure.ac, add fonts and postinstall script for cygwin
authorBo Peng <bpeng@lyx.org>
Tue, 26 Sep 2006 19:37:09 +0000 (19:37 +0000)
committerBo Peng <bpeng@lyx.org>
Tue, 26 Sep 2006 19:37:09 +0000 (19:37 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15158 a592a061-630c-0410-9148-cb99ea01b6c8

development/scons/SConstruct
development/scons/scons_manifest.py
development/scons/scons_utils.py

index 2e2fab77c91632cb3c671f7e5f11cc44d2bd3631..71e5ed3b4176bc60e9748965aeb91a92fb8d5f85 100644 (file)
@@ -53,8 +53,10 @@ else:
 
 # some global settings
 #
-package_version = '1.5.0svn'
-package_cygwin_version = '1.5.0svn-1'
+# get version number from configure.ac so that JMarc does
+# not have to change SConstruct during lyx release
+package_version = utils.getVerFromConfigure(top_src_dir)
+package_cygwin_version = '%s-1' % package_version
 boost_version = '1_33_1'
 
 devel_version = True
@@ -2252,6 +2254,15 @@ if 'install' in targets:
         env.Install(Cygwin_Doc, [os.path.join(env.subst('$TOP_SRCDIR'), x) for x in \
             ['INSTALL', 'README', 'README.Cygwin', 'RELEASE-NOTES', 'COPYING', 'ANNOUNCE']])
         Alias('install', Cygwin_Doc)
+        # cygwin fonts also need to be installed
+        env.Install(os.path.join(share_dest_dir, 'font'),
+            [env.subst('$TOP_SRC_DIR/development/Win32/packaging/bakoma/%s' % file) \
+                  for file in win32_bakoma_fonts])
+        # we also need a post installation script
+        tmp_script = utils.installCygwinPostinstallScript('/tmp')
+        postinstall_script = os.path.join(dest_dir, 'etc', 'postinstall', 'lyx.sh')
+        env.Install(postinstall_script, tmp_script)
+        Alias('install', postinstall_script)
 
     # lyx1.4.x does not have lyx2lyx_version.py.in
     if os.path.isfile(env.subst('$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in')):
index 8bc2869f9910d31c418a08d7dab0862bdf7ddd41..be61a3ff07b5bbb83d12be934498acfa9df1a1e7 100644 (file)
@@ -2658,3 +2658,15 @@ lib_lyx2lyx_files = Split('''
     test_parser_tools.py
 ''')
 
+win32_bakoma_fonts = Split('''
+    Readme.txt   
+    Licence.txt  
+    cmex10.ttf  
+    cmr10.ttf   
+    eufm10.ttf  
+    msbm10.ttf
+    cmmi10.ttf  
+    cmsy10.ttf  
+    msam10.ttf  
+    wasy10.ttf
+''')
index 6eaa686be75d6761a26155cee922cecd6d009a30..114ebab03b9766675b4520783a2a994f96b18502 100644 (file)
@@ -16,6 +16,24 @@ import os, sys, re, shutil, glob
 from SCons.Util import WhereIs
 
 
+def getVerFromConfigure(path):
+    " get lyx version from the AC_INIT line of configure.ac "
+    try:
+        config = open(os.path.join(path, 'configure.ac'))
+    except:
+        print "Can not open configure.ac. "
+        return 'x.x.x'
+    # find a line like follows
+    # AC_INIT(LyX,1.4.4svn,[lyx-devel@lists.lyx.org],[lyx])
+    pat = re.compile('AC_INIT\([^,]+,([^,]+),')
+    for line in config.readlines():
+        if pat.match(line):
+            (version,) = pat.match(line).groups()
+            return version.strip()
+    return 'x.x.x'
+
+
+
 def writeToFile(filename, lines, append = False):
     " utility function: write or append lines to filename "
     # create directory if needed
@@ -601,6 +619,27 @@ SECTIONS
     return(ld_script)
 
 
+def installCygwinPostinstallScript(path):
+    ''' Install lyx.sh '''
+    postinstall_script = os.path.join(path, 'lyx.sh')
+    script = open(postinstall_script, 'w')
+    script.write('''#!/bin/sh
+
+# Add /usr/share/lyx/fonts to /etc/fonts/local.conf
+# if it is not already there.
+if [ -f /etc/fonts/local.conf ]; then
+    grep -q /usr/share/lyx/fonts /etc/fonts/local.conf
+    if [ $? -ne 0 ]; then
+        sed 's/^<\/fontconfig>/<dir>\/usr\/share\/lyx\/fonts<\/dir>\n<\/fontconfig>/' /etc/fonts/local.conf > /etc/fonts/local.conf.tmp
+        mv -f /etc/fonts/local.conf.tmp /etc/fonts/local.conf
+        fc-cache /usr/share/lyx/fonts
+    fi
+fi
+    ''')
+    script.close()
+    return(postinstall_script)
+
+
 try:
     # these will be used under win32
     import win32file