8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 20:03:02 +01:00

Added tzdata directory to Linux install and allow to configure its default location in build time (#267)

* Added tzdata directory to Linux install and allow to configure its default location in build time.
This commit is contained in:
Adriano dos Santos Fernandes 2020-04-30 12:36:23 -03:00 committed by GitHub
parent 63fae7cabb
commit f440a7d77c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 71 additions and 29 deletions

View File

@ -137,7 +137,8 @@ copyFiles() {
#directories
makeDirs "@FB_BINDIR@ @FB_SBINDIR@ @FB_CONFDIR@ @FB_LIBDIR@ @FB_INCDIR@ @FB_DOCDIR@/sql.extensions @FB_SAMPLEDIR@ \
@FB_SAMPLEDBDIR@ @FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ @FB_GUARDDIR@ @FB_PLUGDIR@"
@FB_SAMPLEDBDIR@ @FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ \
@FB_GUARDDIR@ @FB_PLUGDIR@ @FB_TZDATADIR@"
for i in metadata security; do
makeDirs @FB_MISCDIR@/upgrade/$i
@ -255,6 +256,10 @@ copyFiles() {
chown root:wheel ${TargetDir}@FB_PLUGDIR@/*.so*
chmod 0755 ${TargetDir}@FB_PLUGDIR@/*.so*
makeDirs ${TargetDir}@FB_TZDATADIR@
cp $BuiltFBDir/tzdata/*.res ${TargetDir}@FB_TZDATADIR@
chmod 0444 ${TargetDir}@FB_TZDATADIR@/*.res
#intl
cp $BuiltFBDir/intl/libfbintl.so ${TargetDir}@FB_INTLDIR@/fbintl
cp $BuiltFBDir/intl/fbintl.conf ${TargetDir}@FB_INTLDIR@

View File

@ -156,7 +156,7 @@ copyFiles() {
#directories
makeDirs "@FB_BINDIR@ @FB_SBINDIR@ @FB_CONFDIR@ @FB_LIBDIR@ @FB_INCDIR@/firebird @FB_DOCDIR@/sql.extensions \
@FB_SAMPLEDIR@ @FB_SAMPLEDBDIR@ @FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ \
@FB_GUARDDIR@ @FB_PLUGDIR@"
@FB_GUARDDIR@ @FB_PLUGDIR@ @FB_TZDATADIR@"
for i in udf; do
makeDirs @FB_MISCDIR@/upgrade/$i
@ -261,6 +261,10 @@ copyFiles() {
chmod 0755 ${file}
done
makeDirs ${TargetDir}@FB_TZDATADIR@
cp $BuiltFBDir/tzdata/*.res ${TargetDir}@FB_TZDATADIR@
chmod 0444 ${TargetDir}@FB_TZDATADIR@/*.res
#intl
cp $BuiltFBDir/intl/libfbintl.so ${TargetDir}@FB_INTLDIR@/fbintl
cp $BuiltFBDir/intl/fbintl.conf ${TargetDir}@FB_INTLDIR@

View File

@ -41,6 +41,7 @@ fb_msgdir=@FB_MSGDIR@
fb_logdir=@FB_LOGDIR@
fb_glockdir=@FB_GUARDDIR@
fb_pluginsdir=@FB_PLUGDIR@
fb_tzdatadir=@FB_TZDATADIR@
fb_cflags="-I$fb_incdir"
fb_libs="-L$fb_libdir -lfbclient"
@ -107,6 +108,7 @@ while test $# -gt 0
--logdir) echo $fb_logdir ;;
--glockdir) echo $fb_glockdir ;;
--pluginsdir) echo $fb_pluginsdir ;;
--tzdatadir) echo $fb_tzdatadir ;;
--sampledbdir) echo $fb_sampledbdir ;;
--version) echo $fb_version ;;
--help) usage ;;

View File

@ -827,7 +827,7 @@ removeEmptyDirs() {
for rootDir in @FB_BINDIR@ @FB_SBINDIR@ @FB_LIBDIR@ @FB_INCDIR@ @FB_DOCDIR@ @FB_SAMPLEDIR@ @FB_SAMPLEDBDIR@ \
@FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ @FB_GUARDDIR@ @FB_PLUGDIR@ \
@FB_CONFDIR@; do
@FB_TZDATADIR@ @FB_CONFDIR@; do
if [ -d $rootDir ]; then
for i in `find $rootDir -type d -print`; do
@ -875,7 +875,7 @@ fixFilePermissions() {
# Build list of interesting directories all over the FS
dirs="@FB_BINDIR@ @FB_SBINDIR@ @FB_CONFDIR@ @FB_LIBDIR@ @FB_INCDIR@/firebird @FB_DOCDIR@/sql.extensions \
@FB_SAMPLEDIR@ @FB_SAMPLEDBDIR@ @FB_HELPDIR@ @FB_INTLDIR@ @FB_MISCDIR@ @FB_SECDBDIR@ @FB_MSGDIR@ @FB_LOGDIR@ \
@FB_GUARDDIR@ @FB_PLUGDIR@"
@FB_GUARDDIR@ @FB_PLUGDIR@ @FB_TZDATADIR@"
dirs2=`for i in $dirs; do echo $i; done|sort|uniq`
MakeTemp

View File

@ -682,6 +682,7 @@ XE_CONF_DIR(fblog, [log files DIR (PREFIX)], FB_LOGDIR)
XE_CONF_FILE(fblogfilename, [log file name within log dir (firebird.log)], FB_LOGFILENAME, firebird.log)
XE_CONF_DIR(fbglock, [guardian lock DIR (PREFIX)], FB_GUARDDIR)
XE_CONF_DIR(fbplugins, [plugins DIR (PREFIX)], FB_PLUGDIR, /plugins)
XE_CONF_DIR(fbtzdata, [tzdata DIR (PREFIX/tzdata)], FB_TZDATADIR, /tzdata)
AC_SUBST(CHANGE_PATH_SUPPORT)
dnl gpre built-in language support (C/C++ are mandatory)

View File

@ -196,10 +196,18 @@ InitInstance<PathName> TimeZoneUtil::tzDataPath;
void TimeZoneUtil::initTimeZoneEnv()
{
PathName path;
// Could not call fb_utils::getPrefix here.
if (FB_TZDATADIR[0])
path = FB_TZDATADIR;
else
PathUtils::concatPath(path, Config::getRootDirectory(), "tzdata");
if (fb_utils::setenv("ICU_TIMEZONE_FILES_DIR", path.c_str(), false))
tzDataPath() = path;
const static char* const ICU_TIMEZONE_FILES_DIR = "ICU_TIMEZONE_FILES_DIR";
// Do not update ICU_TIMEZONE_FILES_DIR if it's already set.
fb_utils::setenv(ICU_TIMEZONE_FILES_DIR, path.c_str(), false);
fb_utils::readenv(ICU_TIMEZONE_FILES_DIR, tzDataPath());
}
const PathName& TimeZoneUtil::getTzDataPath()

View File

@ -55,6 +55,7 @@
#include "firebird/impl/sqlda_pub.h"
#include "../common/classes/ClumpletReader.h"
#include "../common/StatusArg.h"
#include "../common/TimeZoneUtil.h"
#ifdef WIN_NT
#include <direct.h>
@ -304,6 +305,8 @@ bool readenv(const char* env_name, Firebird::PathName& env_value)
}
// Set environment variable.
// If overwrite == false and variable already exist, return true.
bool setenv(const char* name, const char* value, bool overwrite)
{
#ifdef WIN_NT
@ -314,7 +317,7 @@ bool setenv(const char* name, const char* value, bool overwrite)
size_t envsize = 0;
errcode = getenv_s(&envsize, NULL, 0, name);
if (errcode || envsize)
return false;
return errcode ? false : true;
}
// In Windows, _putenv_s sets only the environment data in the CRT.
@ -1042,7 +1045,7 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
const char* configDir[] = {
FB_BINDIR, FB_SBINDIR, FB_CONFDIR, FB_LIBDIR, FB_INCDIR, FB_DOCDIR, "", FB_SAMPLEDIR,
FB_SAMPLEDBDIR, FB_HELPDIR, FB_INTLDIR, FB_MISCDIR, FB_SECDBDIR, FB_MSGDIR, FB_LOGDIR,
FB_GUARDDIR, FB_PLUGDIR
FB_GUARDDIR, FB_PLUGDIR, FB_TZDATADIR
};
fb_assert(FB_NELEM(configDir) == Firebird::IConfigManager::DIR_COUNT);
@ -1090,6 +1093,10 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
s = "plugins";
break;
case Firebird::IConfigManager::DIR_TZDATA:
PathUtils::concatPath(s, Firebird::TimeZoneUtil::getTzDataPath(), name);
return s;
case Firebird::IConfigManager::DIR_INC:
s = "include";
break;

View File

@ -70,6 +70,9 @@
/* plugins DIR (PREFIX) */
#define FB_PLUGDIR ""
/* tzdata DIR (PREFIX) */
#define FB_TZDATADIR ""
/* Installation path prefix */
#define FB_PREFIX "/opt/firebird"

View File

@ -76,6 +76,9 @@
/* plugins DIR (PREFIX) */
#define FB_PLUGDIR ""
/* tzdata DIR (PREFIX) */
#define FB_TZDATADIR ""
/* Installation path prefix */
#define FB_PREFIX "/opt/firebird"

View File

@ -70,6 +70,9 @@
/* plugins DIR (PREFIX) */
#define FB_PLUGDIR ""
/* tzdata DIR (PREFIX) */
#define FB_TZDATADIR ""
/* Installation path prefix */
#define FB_PREFIX "/opt/firebird"

View File

@ -70,6 +70,9 @@
/* plugins DIR (PREFIX) */
#define FB_PLUGDIR ""
/* tzdata DIR (PREFIX) */
#define FB_TZDATADIR ""
/* Installation path prefix */
#define FB_PREFIX "/opt/firebird"

View File

@ -309,7 +309,8 @@ interface ConfigManager : Versioned
const uint DIR_LOG = 14;
const uint DIR_GUARD = 15;
const uint DIR_PLUGINS = 16;
const uint DIR_COUNT = 17; // keep in sync
const uint DIR_TZDATA = 17;
const uint DIR_COUNT = 18; // keep in sync
const string getDirectory(uint code);
FirebirdConf getFirebirdConf();

View File

@ -958,7 +958,8 @@ namespace Firebird
static const unsigned DIR_LOG = 14;
static const unsigned DIR_GUARD = 15;
static const unsigned DIR_PLUGINS = 16;
static const unsigned DIR_COUNT = 17;
static const unsigned DIR_TZDATA = 17;
static const unsigned DIR_COUNT = 18;
const char* getDirectory(unsigned code)
{

View File

@ -338,6 +338,7 @@
#define FB_SAMPLEDIR ""
#define FB_SBINDIR ""
#define FB_SECDBDIR ""
#define FB_TZDATADIR ""
#define FB_LOGFILENAME "firebird.log"