8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 22:43:03 +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 #directories
makeDirs "@FB_BINDIR@ @FB_SBINDIR@ @FB_CONFDIR@ @FB_LIBDIR@ @FB_INCDIR@ @FB_DOCDIR@/sql.extensions @FB_SAMPLEDIR@ \ 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 for i in metadata security; do
makeDirs @FB_MISCDIR@/upgrade/$i makeDirs @FB_MISCDIR@/upgrade/$i
@ -255,6 +256,10 @@ copyFiles() {
chown root:wheel ${TargetDir}@FB_PLUGDIR@/*.so* chown root:wheel ${TargetDir}@FB_PLUGDIR@/*.so*
chmod 0755 ${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 #intl
cp $BuiltFBDir/intl/libfbintl.so ${TargetDir}@FB_INTLDIR@/fbintl cp $BuiltFBDir/intl/libfbintl.so ${TargetDir}@FB_INTLDIR@/fbintl
cp $BuiltFBDir/intl/fbintl.conf ${TargetDir}@FB_INTLDIR@ cp $BuiltFBDir/intl/fbintl.conf ${TargetDir}@FB_INTLDIR@

View File

@ -156,7 +156,7 @@ copyFiles() {
#directories #directories
makeDirs "@FB_BINDIR@ @FB_SBINDIR@ @FB_CONFDIR@ @FB_LIBDIR@ @FB_INCDIR@/firebird @FB_DOCDIR@/sql.extensions \ 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_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 for i in udf; do
makeDirs @FB_MISCDIR@/upgrade/$i makeDirs @FB_MISCDIR@/upgrade/$i
@ -261,6 +261,10 @@ copyFiles() {
chmod 0755 ${file} chmod 0755 ${file}
done done
makeDirs ${TargetDir}@FB_TZDATADIR@
cp $BuiltFBDir/tzdata/*.res ${TargetDir}@FB_TZDATADIR@
chmod 0444 ${TargetDir}@FB_TZDATADIR@/*.res
#intl #intl
cp $BuiltFBDir/intl/libfbintl.so ${TargetDir}@FB_INTLDIR@/fbintl cp $BuiltFBDir/intl/libfbintl.so ${TargetDir}@FB_INTLDIR@/fbintl
cp $BuiltFBDir/intl/fbintl.conf ${TargetDir}@FB_INTLDIR@ cp $BuiltFBDir/intl/fbintl.conf ${TargetDir}@FB_INTLDIR@

View File

@ -41,6 +41,7 @@ fb_msgdir=@FB_MSGDIR@
fb_logdir=@FB_LOGDIR@ fb_logdir=@FB_LOGDIR@
fb_glockdir=@FB_GUARDDIR@ fb_glockdir=@FB_GUARDDIR@
fb_pluginsdir=@FB_PLUGDIR@ fb_pluginsdir=@FB_PLUGDIR@
fb_tzdatadir=@FB_TZDATADIR@
fb_cflags="-I$fb_incdir" fb_cflags="-I$fb_incdir"
fb_libs="-L$fb_libdir -lfbclient" fb_libs="-L$fb_libdir -lfbclient"
@ -107,6 +108,7 @@ while test $# -gt 0
--logdir) echo $fb_logdir ;; --logdir) echo $fb_logdir ;;
--glockdir) echo $fb_glockdir ;; --glockdir) echo $fb_glockdir ;;
--pluginsdir) echo $fb_pluginsdir ;; --pluginsdir) echo $fb_pluginsdir ;;
--tzdatadir) echo $fb_tzdatadir ;;
--sampledbdir) echo $fb_sampledbdir ;; --sampledbdir) echo $fb_sampledbdir ;;
--version) echo $fb_version ;; --version) echo $fb_version ;;
--help) usage ;; --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@ \ 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_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 if [ -d $rootDir ]; then
for i in `find $rootDir -type d -print`; do for i in `find $rootDir -type d -print`; do
@ -875,7 +875,7 @@ fixFilePermissions() {
# Build list of interesting directories all over the FS # 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 \ 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_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` dirs2=`for i in $dirs; do echo $i; done|sort|uniq`
MakeTemp 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_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(fbglock, [guardian lock DIR (PREFIX)], FB_GUARDDIR)
XE_CONF_DIR(fbplugins, [plugins DIR (PREFIX)], FB_PLUGDIR, /plugins) 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) AC_SUBST(CHANGE_PATH_SUPPORT)
dnl gpre built-in language support (C/C++ are mandatory) dnl gpre built-in language support (C/C++ are mandatory)

View File

@ -196,10 +196,18 @@ InitInstance<PathName> TimeZoneUtil::tzDataPath;
void TimeZoneUtil::initTimeZoneEnv() void TimeZoneUtil::initTimeZoneEnv()
{ {
PathName path; PathName path;
// Could not call fb_utils::getPrefix here.
if (FB_TZDATADIR[0])
path = FB_TZDATADIR;
else
PathUtils::concatPath(path, Config::getRootDirectory(), "tzdata"); PathUtils::concatPath(path, Config::getRootDirectory(), "tzdata");
if (fb_utils::setenv("ICU_TIMEZONE_FILES_DIR", path.c_str(), false)) const static char* const ICU_TIMEZONE_FILES_DIR = "ICU_TIMEZONE_FILES_DIR";
tzDataPath() = path;
// 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() const PathName& TimeZoneUtil::getTzDataPath()

View File

@ -55,6 +55,7 @@
#include "firebird/impl/sqlda_pub.h" #include "firebird/impl/sqlda_pub.h"
#include "../common/classes/ClumpletReader.h" #include "../common/classes/ClumpletReader.h"
#include "../common/StatusArg.h" #include "../common/StatusArg.h"
#include "../common/TimeZoneUtil.h"
#ifdef WIN_NT #ifdef WIN_NT
#include <direct.h> #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) bool setenv(const char* name, const char* value, bool overwrite)
{ {
#ifdef WIN_NT #ifdef WIN_NT
@ -314,7 +317,7 @@ bool setenv(const char* name, const char* value, bool overwrite)
size_t envsize = 0; size_t envsize = 0;
errcode = getenv_s(&envsize, NULL, 0, name); errcode = getenv_s(&envsize, NULL, 0, name);
if (errcode || envsize) if (errcode || envsize)
return false; return errcode ? false : true;
} }
// In Windows, _putenv_s sets only the environment data in the CRT. // 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[] = { const char* configDir[] = {
FB_BINDIR, FB_SBINDIR, FB_CONFDIR, FB_LIBDIR, FB_INCDIR, FB_DOCDIR, "", FB_SAMPLEDIR, 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_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); fb_assert(FB_NELEM(configDir) == Firebird::IConfigManager::DIR_COUNT);
@ -1090,6 +1093,10 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
s = "plugins"; s = "plugins";
break; break;
case Firebird::IConfigManager::DIR_TZDATA:
PathUtils::concatPath(s, Firebird::TimeZoneUtil::getTzDataPath(), name);
return s;
case Firebird::IConfigManager::DIR_INC: case Firebird::IConfigManager::DIR_INC:
s = "include"; s = "include";
break; break;

View File

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

View File

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

View File

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

View File

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

View File

@ -309,7 +309,8 @@ interface ConfigManager : Versioned
const uint DIR_LOG = 14; const uint DIR_LOG = 14;
const uint DIR_GUARD = 15; const uint DIR_GUARD = 15;
const uint DIR_PLUGINS = 16; 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); const string getDirectory(uint code);
FirebirdConf getFirebirdConf(); FirebirdConf getFirebirdConf();

View File

@ -958,7 +958,8 @@ namespace Firebird
static const unsigned DIR_LOG = 14; static const unsigned DIR_LOG = 14;
static const unsigned DIR_GUARD = 15; static const unsigned DIR_GUARD = 15;
static const unsigned DIR_PLUGINS = 16; 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) const char* getDirectory(unsigned code)
{ {

View File

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