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