done])
dnl Extract the single digits from PACKAGE_VERSION and make them available.
-dnl Defines LYX_MAJOR_VERSION, LYX_MINOR_VERSION, LYX_RELEASE_LEVEL, and
-dnl LYX_RELEASE_PATCH, the latter being possibly equal to 0.
+dnl Defines LYX_MAJOR_VERSION, LYX_MINOR_VERSION, LYX_RELEASE_LEVEL,
+dnl LYX_RELEASE_PATCH (possibly equal to 0), LYX_DIR_VER, and LYX_USERDIR_VER.
AC_DEFUN([LYX_SET_VERSION_INFO],
[lyx_major=`echo $PACKAGE_VERSION | sed -e 's/[[.]].*//'`
lyx_patch=`echo $PACKAGE_VERSION | sed -e "s/^$lyx_major//" -e 's/^.//'`
lyx_release=`echo $lyx_patch | sed -e 's/[[^0-9]].*//'`
lyx_patch=`echo $lyx_patch | sed -e "s/^$lyx_release//" -e 's/^[[.]]//' -e 's/[[^0-9]].*//'`
test "x$lyx_patch" = "x" && lyx_patch=0
+ lyx_dir_ver=`echo LYX_DIR_${lyx_major}${lyx_minor}x`
+ lyx_userdir_ver=`echo LYX_USERDIR_${lyx_major}${lyx_minor}x`
AC_SUBST(LYX_MAJOR_VERSION,$lyx_major)
AC_SUBST(LYX_MINOR_VERSION,$lyx_minor)
AC_SUBST(LYX_RELEASE_LEVEL,$lyx_release)
AC_SUBST(LYX_RELEASE_PATCH,$lyx_patch)
+ AC_SUBST(LYX_DIR_VER,"$lyx_dir_ver")
+ AC_SUBST(LYX_USERDIR_VER,"$lyx_userdir_ver")
])
AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
+AC_DEFINE_UNQUOTED([LYX_DIR_VER],"$lyx_dir_ver",[Versioned env var for system dir])
+AC_DEFINE_UNQUOTED([LYX_USERDIR_VER],"$lyx_userdir_ver",[Versioned env var for user dir])
AC_DEFINE_UNQUOTED([LYX_MAJOR_VERSION],$lyx_major,[Major version number])
AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
set(LYX_DATE "2007/2008")
#TODO
set(VERSION_INFO "CMake Build")
+set(LYX_DIR_VER "LYX_DIR_16x")
+set(LYX_USERDIR_VER "LYX_USERDIR_16x")
set(PROGRAM_SUFFIX "")
set(LYX_ABS_INSTALLED_DATADIR "/usr/local/share/lyx")
#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"
#cmakedefine LYX_DATE "${LYX_DATE}"
#cmakedefine VERSION_INFO "${VERSION_INFO}"
+#cmakedefine LYX_DIR_VER "${LYX_DIR_VER}"
+#cmakedefine LYX_USERDIR_VER "${LYX_USERDIR_VER}"
#cmakedefine PROGRAM_SUFFIX "${PPROGRAM_SUFFIX}"
#cmakedefine LYX_ABS_INSTALLED_DATADIR "${LYX_DIR}"
#
# get version number from configure.ac so that JMarc does
# not have to change SConstruct during lyx release
-package_version, lyx_date = utils.getVerFromConfigure(top_src_dir)
+package_version, majmin_ver, lyx_date = utils.getVerFromConfigure(top_src_dir)
package_cygwin_version = '%s-1' % package_version
boost_version = ['1_34']
'Define to the version of this package.'),
('#define VERSION_INFO "%s"' % env['VERSION_INFO'].replace('\n', '\\n'),
'Full version info'),
+ ('#define LYX_DIR_VER "LYX_DIR_%sx"' % majmin_ver,
+ 'Versioned env var for system dir'),
+ ('#define LYX_USERDIR_VER "LYX_USERDIR_%sx"' % majmin_ver,
+ 'Versioned env var for user dir'),
('#define LYX_DATE "%s"' % lyx_date,
'Date of release'),
('#define PROGRAM_SUFFIX "%s"' % program_suffix,
def getVerFromConfigure(path):
''' get lyx version from the AC_INIT line of configure.ac,
+ packed major and minor version numbers from the lyx version,
and LYX_DATE from an AC_SUBST line.
'''
try:
# AC_INIT(LyX,1.4.4svn,[lyx-devel@lists.lyx.org],[lyx])
ver_pat = re.compile('AC_INIT\([^,]+,([^,]+),')
date_pat = re.compile('AC_SUBST\(LYX_DATE, \["(.*)"\]\)')
+ majmin_pat = re.compile('(\d+)\.(\d+)\..*')
version = 'x.x.x'
+ majmin = 'xx'
date = 'Not released'
for line in config.readlines():
if ver_pat.match(line):
(version,) = ver_pat.match(line).groups()
+ majmin_match = majmin_pat.match(version)
+ majmin = majmin_match.group(1) + majmin_match.group(2)
if date_pat.match(line):
(date,) = date_pat.match(line).groups()
if version != 'x.x.x' and date != 'Not released':
break
- return version.strip(), date.strip()
+ return version.strip(), majmin.strip(), date.strip()
def relativePath(path, base):
return path;
}
- // 2. Use the "LYX_DIR_16x" environment variable.
- // FIXME We need to iherit the actual version number from elsewhere
- // otherwise we will forget to update this for new major releases
- path = extract_env_var_dir("LYX_DIR_16x");
+ // 2. Use the "LYX_DIR_${major}${minor}x" environment variable.
+ path = extract_env_var_dir(LYX_DIR_VER);
if (!path.empty()) {
searched_dirs.push_back(path);
- if (check_env_var_dir(path, chkconfig_ltx, "LYX_DIR_16x"))
+ if (check_env_var_dir(path, chkconfig_ltx, LYX_DIR_VER))
return path;
}
// FIXME UNICODE
throw ExceptionMessage(ErrorException, _("No system directory"),
bformat(_("Unable to determine the system directory "
- "having searched\n"
- "\t%1$s\n"
- "Use the '-sysdir' command line parameter or "
- "set the environment variable LYX_DIR_16x to "
- "the LyX system directory containing the file "
- "`chkconfig.ltx'."),
+ "having searched\n"
+ "\t%1$s\n"
+ "Use the '-sysdir' command line parameter or "
+ "set the environment variable " LYX_DIR_VER " "
+ "to the LyX system directory containing the "
+ "file `chkconfig.ltx'."),
from_utf8(searched_dirs_str)));
// Keep the compiler happy.
if (!result.empty())
return true;
- // 2. Use the LYX_USERDIR_16x environment variable.
- result = extract_env_var_dir("LYX_USERDIR_16x");
+ // 2. Use the LYX_USERDIR_${major}${minor}x environment variable.
+ result = extract_env_var_dir(LYX_USERDIR_VER);
if (!result.empty())
return true;
/** The user_support directory was set explicitly using either
* the -userdir command line switch or
- * the LYX_USERDIR_16x environment variable.
+ * the LYX_USERDIR_${major}${minor}x environment variable.
*/
bool explicit_user_support() const { return explicit_user_support_dir_; }