aboutsummaryrefslogtreecommitdiff
path: root/share/zoneinfo/Makefile
blob: 6f40843c1e6115d9bac3171c4a62986581a59e79 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# $FreeBSD$

#
# HOW TO UPDATE THE ZONEINFO DATA
#
# With the use of subversion, this is a little bit simpler than the CVS method.
#
# Import the new sources to the vendor branch:
#
# $ cd ~/svn/vendor/tzdata/dist
# $ tar zxvf /usr/ports/distfile/tzdata2008X.tar.gz
#   (check with "svn stat" and "svn diff" if it all makes sense)
# $ svn commit	# Commit message: "Vendor import of tzdata2008X (+details)" 
#
# Tag it
#
# $ cd ~/svn/vendor/tzdata
# $ svn cp svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist \
#	svn+ssh://svn.freebsd.org/base/vendor/tzdata/tzdata2008X
# $ svn commit	# Commit message: "Tag of tzdata2008X"
#
# Merge-from-vendor
#
# $ cd ~/svn/head/contrib/tzdata
# $ svn update
# $ svn merge -c X --accept=postpone \
#	svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist .
# $ svn commit	# Commit message: "MFV of tzdata2008X"
#

CLEANFILES+=	yearistype
CLEANDIRS+=	builddir
CONTRIBDIR=	${.CURDIR}/../../contrib/tzdata/
.PATH:		${CONTRIBDIR}

.if defined(LEAPSECONDS)
LEAPFILE=	-L ${CONTRIBDIR}leapseconds
.else
LEAPFILE=
.endif

TZFILES=	africa antarctica asia australasia etcetera europe \
		factory northamerica southamerica
POSIXRULES=	America/New_York

.if defined(OLDTIMEZONES)
TZFILES+=	backward systemv
.endif

TZFILES:=	${TZFILES:S/^/${CONTRIBDIR}/}

TZBUILDDIR=	${.OBJDIR}/builddir
TZBUILDSUBDIRS=	\
		Africa \
		America/Argentina \
		America/Indiana \
		America/Kentucky \
		America/North_Dakota \
		Antarctica \
		Arctic \
		Asia \
		Atlantic \
		Australia \
		Etc \
		Europe \
		Indian \
		Pacific \
		SystemV

.if !defined(_SKIP_BUILD)
all: zoneinfo
.endif
META_COOKIES+=	zoneinfo install-zoneinfo

zoneinfo: yearistype ${TDATA} ${META_NOPHONY}
	${META_COOKIE_RM}
	mkdir -p ${TZBUILDDIR}
	cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
	umask 022; cd ${.CURDIR}; \
	zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
	    ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
	${META_COOKIE_TOUCH}

beforeinstall: install-zoneinfo
install-zoneinfo: ${META_NOPHONY}
	${META_COOKIE_RM}
	cd ${TZBUILDDIR} && \
	    find -s * -type f -print -exec ${INSTALL} \
	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
	    \{} ${DESTDIR}/usr/share/zoneinfo/\{} \;
	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
	    ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
	${META_COOKIE_TOUCH}

afterinstall:
#
# If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
# and the contents of it exists in /usr/share/zoneinfo, then reinstall
# it.
#
	@if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
	    -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
		zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
		if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
			if [ ! -z "${DESTDIR}" ]; then \
				optC="-C ${DESTDIR}"; \
			fi; \
			echo "Updating /etc/localtime"; \
			tzsetup $${optC} -r; \
		fi; \
	else \
		echo "Run tzsetup(8) manually to update /etc/localtime."; \
	fi

.include <bsd.prog.mk>