Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 75d5f6f

Browse files
committed
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.
1 parent 75d091a commit 75d5f6f

File tree

3 files changed

+43
-30
lines changed

3 files changed

+43
-30
lines changed

doc/src/sgml/installation.sgml

+19-19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.291 2007/08/20 08:53:12 petere Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.292 2007/08/25 20:29:25 tgl Exp $ -->
22

33
<chapter id="installation">
44
<title><![%standalone-include[<productname>PostgreSQL</>]]>
@@ -1028,32 +1028,32 @@ su - postgres
10281028
</indexterm>
10291029
<listitem>
10301030
<para>
1031-
PostgreSQL includes its own time zone database, which it
1032-
requires for date and time operations. This time zone
1033-
database is in fact compatible with the time zone database
1034-
provided by many operating systems such as FreeBSD, Linux,
1035-
and Solaris, so it would be redundant to install it again.
1036-
When this option is used, the operating system supplied time
1037-
zone database in <replaceable>DIRECTORY</replaceable> is used
1038-
instead of the one included in the PostgreSQL source
1039-
distribution. <filename>/usr/share/zoneinfo/</filename> is a
1031+
<productname>PostgreSQL</> includes its own time zone database,
1032+
which it requires for date and time operations. This time zone
1033+
database is in fact compatible with the <quote>zic</> time zone
1034+
database provided by many operating systems such as FreeBSD,
1035+
Linux, and Solaris, so it would be redundant to install it again.
1036+
When this option is used, the system-supplied time zone database
1037+
in <replaceable>DIRECTORY</replaceable> is used instead of the one
1038+
included in the PostgreSQL source distribution.
1039+
<replaceable>DIRECTORY</replaceable> must be specified as an
1040+
absolute path. <filename>/usr/share/zoneinfo</filename> is a
10401041
likely directory on some operating systems. Note that the
1041-
installation routine does not detect mismatching or erroneous
1042-
time zone data. You are advised to run the regression tests
1043-
to verify that the time zone data you have pointed to works
1044-
correctly.
1042+
installation routine will not detect mismatching or erroneous time
1043+
zone data. If you use this option, you are advised to run the
1044+
regression tests to verify that the time zone data you have
1045+
pointed to works correctly with <productname>PostgreSQL</>.
10451046
</para>
10461047

10471048
<para>
10481049
This option is mainly aimed at binary package distributors
10491050
who know their target operating system well. The main
10501051
advantage of using this option is that the PostgreSQL package
10511052
won't need to be upgraded whenever any of the many local
1052-
daylight-saving time rules changes. Another completely
1053-
incidental advantage is that PostgreSQL can be
1054-
cross-compiled<indexterm><primary>cross
1055-
compilation</primary></indexterm> straightforwardly if the
1056-
time-zone database does not need to be built during the
1053+
daylight-saving time rules change. Another advantage is that
1054+
PostgreSQL can be cross-compiled<indexterm><primary>cross
1055+
compilation</primary></indexterm> more straightforwardly if the
1056+
time zone database files do not need to be built during the
10571057
installation.
10581058
</para>
10591059
</listitem>

src/timezone/Makefile

+13-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Makefile for the timezone library
55

66
# IDENTIFICATION
7-
# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.27 2007/08/20 08:53:12 petere Exp $
7+
# $PostgreSQL: pgsql/src/timezone/Makefile,v 1.28 2007/08/25 20:29:25 tgl Exp $
88
#
99
#-------------------------------------------------------------------------
1010

@@ -27,29 +27,36 @@ TZDATAFILES = $(TZDATA:%=$(srcdir)/data/%)
2727
# for POSIX-style timezone specs
2828
POSIXRULES = US/Eastern
2929

30-
all: SUBSYS.o submake-libpgport zic
30+
# use system timezone data?
31+
ifneq (,$(with_system_tzdata))
32+
override CPPFLAGS += '-DSYSTEMTZDIR="$(with_system_tzdata)"'
33+
endif
34+
35+
all: SUBSYS.o
36+
37+
ifeq (,$(with_system_tzdata))
38+
all: submake-libpgport zic
39+
endif
3140

3241
SUBSYS.o: $(OBJS)
3342
$(LD) $(LDREL) $(LDOUT) SUBSYS.o $(OBJS)
3443

35-
ifeq (,$(with_system_tzdata))
3644
zic: $(ZICOBJS)
3745
$(CC) $(CFLAGS) $(ZICOBJS) $(LDFLAGS) $(LIBS) -o $@$(X)
38-
endif
3946

4047
install: all installdirs
4148
ifeq (,$(with_system_tzdata))
4249
./zic -d '$(DESTDIR)$(datadir)/timezone' -p '$(POSIXRULES)' $(TZDATAFILES)
43-
else
44-
ln -s '$(with_system_tzdata)' '$(DESTDIR)$(datadir)/timezone'
4550
endif
4651
$(MAKE) -C tznames $@
4752

4853
installdirs:
4954
$(mkinstalldirs) '$(DESTDIR)$(datadir)'
5055

5156
uninstall:
57+
ifeq (,$(with_system_tzdata))
5258
rm -rf '$(DESTDIR)$(datadir)/timezone'
59+
endif
5360
$(MAKE) -C tznames $@
5461

5562
clean distclean maintainer-clean:

src/timezone/pgtz.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
77
*
88
* IDENTIFICATION
9-
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.53 2007/08/04 19:29:25 tgl Exp $
9+
* $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.54 2007/08/25 20:29:25 tgl Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -38,9 +38,6 @@ pg_tz *gmt_timezone = NULL;
3838
static pg_tz gmt_timezone_data;
3939

4040

41-
static char tzdir[MAXPGPATH];
42-
static bool done_tzdir = false;
43-
4441
static bool scan_directory_ci(const char *dirname,
4542
const char *fname, int fnamelen,
4643
char *canonname, int canonnamelen);
@@ -52,9 +49,14 @@ static pg_tz *select_default_timezone(void);
5249
/*
5350
* Return full pathname of timezone data directory
5451
*/
55-
static char *
52+
static const char *
5653
pg_TZDIR(void)
5754
{
55+
#ifndef SYSTEMTZDIR
56+
/* normal case: timezone stuff is under our share dir */
57+
static bool done_tzdir = false;
58+
static char tzdir[MAXPGPATH];
59+
5860
if (done_tzdir)
5961
return tzdir;
6062

@@ -63,6 +65,10 @@ pg_TZDIR(void)
6365

6466
done_tzdir = true;
6567
return tzdir;
68+
#else
69+
/* we're configured to use system's timezone database */
70+
return SYSTEMTZDIR;
71+
#endif
6672
}
6773

6874

0 commit comments

Comments
 (0)