xref: /freebsd/share/zoneinfo/Makefile (revision 5dae51da3da0cc94d17bd67b308fad304ebec7e0)
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
70.if !defined(_SKIP_BUILD)
71all: zoneinfo
72.endif
73META_TARGETS+=	zoneinfo install-zoneinfo
74
75zoneinfo: yearistype ${TDATA}
76	mkdir -p ${TZBUILDDIR}
77	cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
78	umask 022; cd ${.CURDIR}; \
79	zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
80	    ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
81
82beforeinstall: install-zoneinfo
83install-zoneinfo:
84	cd ${TZBUILDDIR} && \
85	    find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \
86	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
87	    \{} ${DESTDIR}/usr/share/zoneinfo/\{} \;
88	${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
89	    ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
90
91afterinstall:
92#
93# If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
94# and the contents of it exists in /usr/share/zoneinfo, then reinstall
95# it.
96#
97	@if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
98	    -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
99		zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
100		if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
101			if [ ! -z "${DESTDIR}" ]; then \
102				optC="-C ${DESTDIR}"; \
103			fi; \
104			echo "Updating /etc/localtime"; \
105			tzsetup $${optC} -r; \
106		fi; \
107	else \
108		echo "Run tzsetup(8) manually to update /etc/localtime."; \
109	fi
110
111.include <bsd.prog.mk>
112