8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 16: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

@ -28,7 +28,7 @@ fb_install_prefix=@prefix@
# Script to copy install files from the build/transport area
# This script builds an image of the installed system into
# This script builds an image of the installed system into
# the gen/buildroot directory.
if [ "`whoami`" != "root" ]; then
@ -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
@ -147,18 +148,18 @@ copyFiles() {
makeDirs /usr/include
#bin
cp $BuiltFBDir/bin/gbak ${TargetDir}@FB_BINDIR@/gbak
cp $BuiltFBDir/bin/gdef ${TargetDir}@FB_BINDIR@/gdef
cp $BuiltFBDir/bin/gfix ${TargetDir}@FB_BINDIR@/gfix
cp $BuiltFBDir/bin/gpre ${TargetDir}@FB_BINDIR@/gpre
cp $BuiltFBDir/bin/gsec ${TargetDir}@FB_BINDIR@/gsec
cp $BuiltFBDir/bin/nbackup ${TargetDir}@FB_BINDIR@/nbackup
cp $BuiltFBDir/bin/gbak ${TargetDir}@FB_BINDIR@/gbak
cp $BuiltFBDir/bin/gdef ${TargetDir}@FB_BINDIR@/gdef
cp $BuiltFBDir/bin/gfix ${TargetDir}@FB_BINDIR@/gfix
cp $BuiltFBDir/bin/gpre ${TargetDir}@FB_BINDIR@/gpre
cp $BuiltFBDir/bin/gsec ${TargetDir}@FB_BINDIR@/gsec
cp $BuiltFBDir/bin/nbackup ${TargetDir}@FB_BINDIR@/nbackup
copyIfExists $BuiltFBDir/bin/gsplit ${TargetDir}@FB_BINDIR@
cp $BuiltFBDir/bin/gstat ${TargetDir}@FB_BINDIR@/gstat
cp $BuiltFBDir/bin/gstat ${TargetDir}@FB_BINDIR@/gstat
copyIfExists $BuiltFBDir/bin/fbsvcmgr ${TargetDir}@FB_BINDIR@
copyIfExists $BuiltFBDir/bin/fbtracemgr ${TargetDir}@FB_BINDIR@
cp $BuiltFBDir/bin/isql ${TargetDir}@FB_BINDIR@/isql
cp $BuiltFBDir/bin/qli ${TargetDir}@FB_BINDIR@/qli
cp $BuiltFBDir/bin/isql ${TargetDir}@FB_BINDIR@/isql
cp $BuiltFBDir/bin/qli ${TargetDir}@FB_BINDIR@/qli
chown root:wheel ${TargetDir}@FB_BINDIR@/*
chmod 0755 ${TargetDir}@FB_BINDIR@/*
@ -224,7 +225,7 @@ copyFiles() {
chown root:wheel ${TargetDir}@FB_HELPDIR@/*.fdb
chmod 0444 ${TargetDir}@FB_HELPDIR@/*.fdb
#message file
cp $BuiltFBDir/*.msg ${TargetDir}@FB_MSGDIR@
@ -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@
@ -304,7 +309,7 @@ copyFiles() {
cd $origDir
linkFiles "@FB_LIBDIR@" "$Libraries" "${TargetDir}@libdir@" "${TargetDir}@FB_LIBDIR@"
# link include files to /usr/include
# link include files to /usr/include
linkFiles "@FB_INCDIR@" "iberror.h ibase.h ib_util.h" "${TargetDir}/usr/include" "${TargetDir}@FB_INCDIR@"
}
@ -335,9 +340,9 @@ MakeFileFirebirdWritable() {
#------------------------------------------------------------------------
# fixFilePermissions
# Change the permissions to restrict access to server programs to
# firebird group only. This is MUCH better from a safety point of
# view than installing as root user, even if it requires a little
# Change the permissions to restrict access to server programs to
# firebird group only. This is MUCH better from a safety point of
# view than installing as root user, even if it requires a little
# more work.
fixFilePermissions() {
@ -353,7 +358,7 @@ fixFilePermissions() {
cd @FB_LOGDIR@
touch firebird.log
MakeFileFirebirdWritable firebird.log
# Security database
cd @FB_SECDBDIR@
MakeFileFirebirdWritable $SecurityDatabase

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;
PathUtils::concatPath(path, Config::getRootDirectory(), "tzdata");
if (fb_utils::setenv("ICU_TIMEZONE_FILES_DIR", path.c_str(), false))
tzDataPath() = path;
// Could not call fb_utils::getPrefix here.
if (FB_TZDATADIR[0])
path = FB_TZDATADIR;
else
PathUtils::concatPath(path, Config::getRootDirectory(), "tzdata");
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);
@ -1060,7 +1063,7 @@ Firebird::PathName getPrefix(unsigned int prefType, const char* name)
}
}
switch(prefType)
switch (prefType)
{
case Firebird::IConfigManager::DIR_BIN:
case Firebird::IConfigManager::DIR_SBIN:
@ -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();
@ -551,7 +552,7 @@ interface Replicator : ReferenceCounted
*/
void process(Status status, uint length, const uchar* data);
void close(Status status);
}
}
interface Request : ReferenceCounted
{

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"