xref: /freebsd/share/zoneinfo/Makefile (revision 1f4bcc459a76b7aa664f3fd557684cd0ba6da352)
1# $FreeBSD$
2
3#
4# HOW TO UPDATE THE ZONEINFO DATA
5#
6# With the use of subversion, this is a little bit simpler than the CVS method.
7#
8# Import the new sources to the vendor branch:
9#
10# $ cd ~/svn/vendor/tzdata/dist
11# $ tar zxvf /usr/ports/distfile/tzdata2008X.tar.gz
12#   (check with "svn stat" and "svn diff" if it all makes sense)
13# $ svn commit	# Commit message: "Vendor import of tzdata2008X (+details)"
14#
15# Tag it
16#
17# $ cd ~/svn/vendor/tzdata
18# $ svn cp svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist \
19#	svn+ssh://svn.freebsd.org/base/vendor/tzdata/tzdata2008X
20# $ svn commit	# Commit message: "Tag of tzdata2008X"
21#
22# Merge-from-vendor
23#
24# $ cd ~/svn/head/contrib/tzdata
25# $ svn update
26# $ svn merge -c X --accept=postpone \
27#	svn+ssh://svn.freebsd.org/base/vendor/tzdata/dist .
28# $ svn commit	# Commit message: "MFV of tzdata2008X"
29#
30
31CLEANFILES+=	yearistype
32CLEANDIRS+=	builddir
33CONTRIBDIR=	${.CURDIR}/../../contrib/tzdata/
34.PATH:		${CONTRIBDIR}
35
36.if defined(LEAPSECONDS)
37LEAPFILE=	-L ${CONTRIBDIR}leapseconds
38.else
39LEAPFILE=
40.endif
41
42TZFILES=	africa antarctica asia australasia etcetera europe \
43		factory northamerica southamerica
44POSIXRULES=	America/New_York
45
46.if defined(OLDTIMEZONES)
47TZFILES+=	backward systemv
48.endif
49
50TZFILES:=	${TZFILES:S/^/${CONTRIBDIR}/}
51
52TZBUILDDIR=	${.OBJDIR}/builddir
53TZBUILDSUBDIRS=	\
54		Africa \
55		America/Argentina \
56		America/Indiana \
57		America/Kentucky \
58		America/North_Dakota \
59		Antarctica \
60		Arctic \
61		Asia \
62		Atlantic \
63		Australia \
64		Etc \
65		Europe \
66		Indian \
67		Pacific \
68		SystemV
69
70all: zoneinfo
71
72.PHONY: zoneinfo
73zoneinfo: yearistype ${TDATA}
74	mkdir -p ${TZBUILDDIR}
75	cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
76	umask 022; cd ${.CURDIR}; \
77	zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
78	    ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
79
80beforeinstall:
81	cd ${TZBUILDDIR} && \
82	    find -s * -type f -print -exec ${INSTALL} \
83	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
84	    \{} ${DESTDIR}/usr/share/zoneinfo/\{} \;
85	${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
86	    ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
87
88afterinstall:
89#
90# If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
91# and the contents of it exists in /usr/share/zoneinfo, then reinstall
92# it.
93#
94	@if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
95	    -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
96		zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
97		if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
98			if [ ! -z "${DESTDIR}" ]; then \
99				optC="-C ${DESTDIR}"; \
100			fi; \
101			echo "Updating /etc/localtime"; \
102			tzsetup $${optC} -r; \
103		fi; \
104	else \
105		echo "Run tzsetup(8) manually to update /etc/localtime."; \
106	fi
107
108.include <bsd.prog.mk>
109