Commit 75d5f6fe authored by Tom Lane's avatar Tom Lane

Adjust with-system-tzdata patch to not attempt to install a symlink,

but just hardwire the specified timezone database path into the executable.
Per discussion, this avoids some packaging disadvantages of using a
symlink.
parent 75d091a0
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.291 2007/08/20 08:53:12 petere Exp $ --> <!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.292 2007/08/25 20:29:25 tgl Exp $ -->
<chapter id="installation"> <chapter id="installation">
<title><![%standalone-include[<productname>PostgreSQL</>]]> <title><![%standalone-include[<productname>PostgreSQL</>]]>
...@@ -1028,20 +1028,21 @@ su - postgres ...@@ -1028,20 +1028,21 @@ su - postgres
</indexterm> </indexterm>
<listitem> <listitem>
<para> <para>
PostgreSQL includes its own time zone database, which it <productname>PostgreSQL</> includes its own time zone database,
requires for date and time operations. This time zone which it requires for date and time operations. This time zone
database is in fact compatible with the time zone database database is in fact compatible with the <quote>zic</> time zone
provided by many operating systems such as FreeBSD, Linux, database provided by many operating systems such as FreeBSD,
and Solaris, so it would be redundant to install it again. Linux, and Solaris, so it would be redundant to install it again.
When this option is used, the operating system supplied time When this option is used, the system-supplied time zone database
zone database in <replaceable>DIRECTORY</replaceable> is used in <replaceable>DIRECTORY</replaceable> is used instead of the one
instead of the one included in the PostgreSQL source included in the PostgreSQL source distribution.
distribution. <filename>/usr/share/zoneinfo/</filename> is a <replaceable>DIRECTORY</replaceable> must be specified as an
absolute path. <filename>/usr/share/zoneinfo</filename> is a
likely directory on some operating systems. Note that the likely directory on some operating systems. Note that the
installation routine does not detect mismatching or erroneous installation routine will not detect mismatching or erroneous time
time zone data. You are advised to run the regression tests zone data. If you use this option, you are advised to run the
to verify that the time zone data you have pointed to works regression tests to verify that the time zone data you have
correctly. pointed to works correctly with <productname>PostgreSQL</>.
</para> </para>
<para> <para>
...@@ -1049,11 +1050,10 @@ su - postgres ...@@ -1049,11 +1050,10 @@ su - postgres
who know their target operating system well. The main who know their target operating system well. The main
advantage of using this option is that the PostgreSQL package advantage of using this option is that the PostgreSQL package
won't need to be upgraded whenever any of the many local won't need to be upgraded whenever any of the many local
daylight-saving time rules changes. Another completely daylight-saving time rules change. Another advantage is that
incidental advantage is that PostgreSQL can be PostgreSQL can be cross-compiled<indexterm><primary>cross
cross-compiled<indexterm><primary>cross compilation</primary></indexterm> more straightforwardly if the
compilation</primary></indexterm> straightforwardly if the time zone database files do not need to be built during the
time-zone database does not need to be built during the
installation. installation.
</para> </para>
</listitem> </listitem>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
# Makefile for the timezone library # Makefile for the timezone library
# IDENTIFICATION # IDENTIFICATION
# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.27 2007/08/20 08:53:12 petere Exp $ # $PostgreSQL: pgsql/src/timezone/Makefile,v 1.28 2007/08/25 20:29:25 tgl Exp $
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
...@@ -27,21 +27,26 @@ TZDATAFILES = $(TZDATA:%=$(srcdir)/data/%) ...@@ -27,21 +27,26 @@ TZDATAFILES = $(TZDATA:%=$(srcdir)/data/%)
# for POSIX-style timezone specs # for POSIX-style timezone specs
POSIXRULES = US/Eastern POSIXRULES = US/Eastern
all: SUBSYS.o submake-libpgport zic # use system timezone data?
ifneq (,$(with_system_tzdata))
override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"'
endif
all: SUBSYS.o
ifeq (,$(with_system_tzdata))
all: submake-libpgport zic
endif
SUBSYS.o: $(OBJS) SUBSYS.o: $(OBJS)
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS) $(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
ifeq (,$(with_system_tzdata))
zic: $(ZICOBJS) zic: $(ZICOBJS)
$(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X) $(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
endif
install: all installdirs install: all installdirs
ifeq (,$(with_system_tzdata)) ifeq (,$(with_system_tzdata))
./zic -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES) ./zic -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
else
ln -s '$(with_system_tzdata)' '$(DESTDIR)$(datadir)/timezone'
endif endif
$(MAKE) -C tznames $@ $(MAKE) -C tznames $@
...@@ -49,7 +54,9 @@ installdirs: ...@@ -49,7 +54,9 @@ installdirs:
$(mkinstalldirs) '$(DESTDIR)$(datadir)' $(mkinstalldirs) '$(DESTDIR)$(datadir)'
uninstall: uninstall:
ifeq (,$(with_system_tzdata))
rm -rf '$(DESTDIR)$(datadir)/timezone' rm -rf '$(DESTDIR)$(datadir)/timezone'
endif
$(MAKE) -C tznames $@ $(MAKE) -C tznames $@
clean distclean maintainer-clean: clean distclean maintainer-clean:
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.53 2007/08/04 19:29:25 tgl Exp $ * $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.54 2007/08/25 20:29:25 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -38,9 +38,6 @@ pg_tz *gmt_timezone = NULL; ...@@ -38,9 +38,6 @@ pg_tz *gmt_timezone = NULL;
static pg_tz gmt_timezone_data; static pg_tz gmt_timezone_data;
static char tzdir[MAXPGPATH];
static bool done_tzdir = false;
static bool scan_directory_ci(const char *dirname, static bool scan_directory_ci(const char *dirname,
const char *fname, int fnamelen, const char *fname, int fnamelen,
char *canonname, int canonnamelen); char *canonname, int canonnamelen);
...@@ -52,9 +49,14 @@ static pg_tz *select_default_timezone(void); ...@@ -52,9 +49,14 @@ static pg_tz *select_default_timezone(void);
/* /*
* Return full pathname of timezone data directory * Return full pathname of timezone data directory
*/ */
static char * static const char *
pg_TZDIR(void) pg_TZDIR(void)
{ {
#ifndef SYSTEMTZDIR
/* normal case: timezone stuff is under our share dir */
static bool done_tzdir = false;
static char tzdir[MAXPGPATH];
if (done_tzdir) if (done_tzdir)
return tzdir; return tzdir;
...@@ -63,6 +65,10 @@ pg_TZDIR(void) ...@@ -63,6 +65,10 @@ pg_TZDIR(void)
done_tzdir = true; done_tzdir = true;
return tzdir; return tzdir;
#else
/* we're configured to use system's timezone database */
return SYSTEMTZDIR;
#endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment