mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-09 18:31:04 +00:00
Automate setting of LYX_DIR_XXx and LYX_USERDIR_XXx environment variable names.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25898 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
c4ff55c340
commit
bc72d3fc58
@ -736,8 +736,8 @@ do
|
|||||||
done])
|
done])
|
||||||
|
|
||||||
dnl Extract the single digits from PACKAGE_VERSION and make them available.
|
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 Defines LYX_MAJOR_VERSION, LYX_MINOR_VERSION, LYX_RELEASE_LEVEL,
|
||||||
dnl LYX_RELEASE_PATCH, the latter being possibly equal to 0.
|
dnl LYX_RELEASE_PATCH (possibly equal to 0), LYX_DIR_VER, and LYX_USERDIR_VER.
|
||||||
AC_DEFUN([LYX_SET_VERSION_INFO],
|
AC_DEFUN([LYX_SET_VERSION_INFO],
|
||||||
[lyx_major=`echo $PACKAGE_VERSION | sed -e 's/[[.]].*//'`
|
[lyx_major=`echo $PACKAGE_VERSION | sed -e 's/[[.]].*//'`
|
||||||
lyx_patch=`echo $PACKAGE_VERSION | sed -e "s/^$lyx_major//" -e 's/^.//'`
|
lyx_patch=`echo $PACKAGE_VERSION | sed -e "s/^$lyx_major//" -e 's/^.//'`
|
||||||
@ -746,8 +746,12 @@ AC_DEFUN([LYX_SET_VERSION_INFO],
|
|||||||
lyx_release=`echo $lyx_patch | sed -e 's/[[^0-9]].*//'`
|
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]].*//'`
|
lyx_patch=`echo $lyx_patch | sed -e "s/^$lyx_release//" -e 's/^[[.]]//' -e 's/[[^0-9]].*//'`
|
||||||
test "x$lyx_patch" = "x" && lyx_patch=0
|
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_MAJOR_VERSION,$lyx_major)
|
||||||
AC_SUBST(LYX_MINOR_VERSION,$lyx_minor)
|
AC_SUBST(LYX_MINOR_VERSION,$lyx_minor)
|
||||||
AC_SUBST(LYX_RELEASE_LEVEL,$lyx_release)
|
AC_SUBST(LYX_RELEASE_LEVEL,$lyx_release)
|
||||||
AC_SUBST(LYX_RELEASE_PATCH,$lyx_patch)
|
AC_SUBST(LYX_RELEASE_PATCH,$lyx_patch)
|
||||||
|
AC_SUBST(LYX_DIR_VER,"$lyx_dir_ver")
|
||||||
|
AC_SUBST(LYX_USERDIR_VER,"$lyx_userdir_ver")
|
||||||
])
|
])
|
||||||
|
@ -451,6 +451,8 @@ AC_DEFINE_UNQUOTED([PROGRAM_SUFFIX],
|
|||||||
|
|
||||||
AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
|
AC_DEFINE_UNQUOTED([LYX_DATE],"$LYX_DATE",[Date of release])
|
||||||
AC_DEFINE_UNQUOTED([VERSION_INFO],"$VERSION_INFO",[Full version info])
|
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_MAJOR_VERSION],$lyx_major,[Major version number])
|
||||||
AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
|
AC_DEFINE_UNQUOTED([LYX_MINOR_VERSION],$lyx_minor,[Minor version number])
|
||||||
AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
|
AC_DEFINE_UNQUOTED([LYX_RELEASE_LEVEL],$lyx_release,[Release version number])
|
||||||
|
@ -28,6 +28,8 @@ set(PACKAGE_VERSION 1.6svn)
|
|||||||
set(LYX_DATE "2007/2008")
|
set(LYX_DATE "2007/2008")
|
||||||
#TODO
|
#TODO
|
||||||
set(VERSION_INFO "CMake Build")
|
set(VERSION_INFO "CMake Build")
|
||||||
|
set(LYX_DIR_VER "LYX_DIR_16x")
|
||||||
|
set(LYX_USERDIR_VER "LYX_USERDIR_16x")
|
||||||
|
|
||||||
set(PROGRAM_SUFFIX "")
|
set(PROGRAM_SUFFIX "")
|
||||||
set(LYX_ABS_INSTALLED_DATADIR "/usr/local/share/lyx")
|
set(LYX_ABS_INSTALLED_DATADIR "/usr/local/share/lyx")
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"
|
#cmakedefine PACKAGE_VERSION "${PACKAGE_VERSION}"
|
||||||
#cmakedefine LYX_DATE "${LYX_DATE}"
|
#cmakedefine LYX_DATE "${LYX_DATE}"
|
||||||
#cmakedefine VERSION_INFO "${VERSION_INFO}"
|
#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 PROGRAM_SUFFIX "${PPROGRAM_SUFFIX}"
|
||||||
#cmakedefine LYX_ABS_INSTALLED_DATADIR "${LYX_DIR}"
|
#cmakedefine LYX_ABS_INSTALLED_DATADIR "${LYX_DIR}"
|
||||||
|
@ -58,7 +58,7 @@ if version[0] == 0 and version[1] == 96 and version[2] < 92:
|
|||||||
#
|
#
|
||||||
# get version number from configure.ac so that JMarc does
|
# get version number from configure.ac so that JMarc does
|
||||||
# not have to change SConstruct during lyx release
|
# 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
|
package_cygwin_version = '%s-1' % package_version
|
||||||
boost_version = ['1_34']
|
boost_version = ['1_34']
|
||||||
|
|
||||||
@ -1038,6 +1038,10 @@ result = utils.createConfigFile(conf,
|
|||||||
'Define to the version of this package.'),
|
'Define to the version of this package.'),
|
||||||
('#define VERSION_INFO "%s"' % env['VERSION_INFO'].replace('\n', '\\n'),
|
('#define VERSION_INFO "%s"' % env['VERSION_INFO'].replace('\n', '\\n'),
|
||||||
'Full version info'),
|
'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,
|
('#define LYX_DATE "%s"' % lyx_date,
|
||||||
'Date of release'),
|
'Date of release'),
|
||||||
('#define PROGRAM_SUFFIX "%s"' % program_suffix,
|
('#define PROGRAM_SUFFIX "%s"' % program_suffix,
|
||||||
|
@ -18,6 +18,7 @@ from SCons.Util import *
|
|||||||
|
|
||||||
def getVerFromConfigure(path):
|
def getVerFromConfigure(path):
|
||||||
''' get lyx version from the AC_INIT line of configure.ac,
|
''' 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.
|
and LYX_DATE from an AC_SUBST line.
|
||||||
'''
|
'''
|
||||||
try:
|
try:
|
||||||
@ -29,16 +30,20 @@ def getVerFromConfigure(path):
|
|||||||
# AC_INIT(LyX,1.4.4svn,[lyx-devel@lists.lyx.org],[lyx])
|
# AC_INIT(LyX,1.4.4svn,[lyx-devel@lists.lyx.org],[lyx])
|
||||||
ver_pat = re.compile('AC_INIT\([^,]+,([^,]+),')
|
ver_pat = re.compile('AC_INIT\([^,]+,([^,]+),')
|
||||||
date_pat = re.compile('AC_SUBST\(LYX_DATE, \["(.*)"\]\)')
|
date_pat = re.compile('AC_SUBST\(LYX_DATE, \["(.*)"\]\)')
|
||||||
|
majmin_pat = re.compile('(\d+)\.(\d+)\..*')
|
||||||
version = 'x.x.x'
|
version = 'x.x.x'
|
||||||
|
majmin = 'xx'
|
||||||
date = 'Not released'
|
date = 'Not released'
|
||||||
for line in config.readlines():
|
for line in config.readlines():
|
||||||
if ver_pat.match(line):
|
if ver_pat.match(line):
|
||||||
(version,) = ver_pat.match(line).groups()
|
(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):
|
if date_pat.match(line):
|
||||||
(date,) = date_pat.match(line).groups()
|
(date,) = date_pat.match(line).groups()
|
||||||
if version != 'x.x.x' and date != 'Not released':
|
if version != 'x.x.x' and date != 'Not released':
|
||||||
break
|
break
|
||||||
return version.strip(), date.strip()
|
return version.strip(), majmin.strip(), date.strip()
|
||||||
|
|
||||||
|
|
||||||
def relativePath(path, base):
|
def relativePath(path, base):
|
||||||
|
@ -461,13 +461,11 @@ get_system_support_dir(FileName const & abs_binary,
|
|||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Use the "LYX_DIR_16x" environment variable.
|
// 2. Use the "LYX_DIR_${major}${minor}x" environment variable.
|
||||||
// FIXME We need to iherit the actual version number from elsewhere
|
path = extract_env_var_dir(LYX_DIR_VER);
|
||||||
// otherwise we will forget to update this for new major releases
|
|
||||||
path = extract_env_var_dir("LYX_DIR_16x");
|
|
||||||
if (!path.empty()) {
|
if (!path.empty()) {
|
||||||
searched_dirs.push_back(path);
|
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;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -555,12 +553,12 @@ get_system_support_dir(FileName const & abs_binary,
|
|||||||
// FIXME UNICODE
|
// FIXME UNICODE
|
||||||
throw ExceptionMessage(ErrorException, _("No system directory"),
|
throw ExceptionMessage(ErrorException, _("No system directory"),
|
||||||
bformat(_("Unable to determine the system directory "
|
bformat(_("Unable to determine the system directory "
|
||||||
"having searched\n"
|
"having searched\n"
|
||||||
"\t%1$s\n"
|
"\t%1$s\n"
|
||||||
"Use the '-sysdir' command line parameter or "
|
"Use the '-sysdir' command line parameter or "
|
||||||
"set the environment variable LYX_DIR_16x to "
|
"set the environment variable " LYX_DIR_VER " "
|
||||||
"the LyX system directory containing the file "
|
"to the LyX system directory containing the "
|
||||||
"`chkconfig.ltx'."),
|
"file `chkconfig.ltx'."),
|
||||||
from_utf8(searched_dirs_str)));
|
from_utf8(searched_dirs_str)));
|
||||||
|
|
||||||
// Keep the compiler happy.
|
// Keep the compiler happy.
|
||||||
@ -579,8 +577,8 @@ bool userSupportDir(FileName const & default_user_support_dir,
|
|||||||
if (!result.empty())
|
if (!result.empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// 2. Use the LYX_USERDIR_16x environment variable.
|
// 2. Use the LYX_USERDIR_${major}${minor}x environment variable.
|
||||||
result = extract_env_var_dir("LYX_USERDIR_16x");
|
result = extract_env_var_dir(LYX_USERDIR_VER);
|
||||||
if (!result.empty())
|
if (!result.empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ public:
|
|||||||
|
|
||||||
/** The user_support directory was set explicitly using either
|
/** The user_support directory was set explicitly using either
|
||||||
* the -userdir command line switch or
|
* 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_; }
|
bool explicit_user_support() const { return explicit_user_support_dir_; }
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user