xref: /freebsd/share/zoneinfo/Makefile (revision 13464e4a44fc58490a03bb8bfc7e3c972e9c30b2)
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
31.include <src.opts.mk>
32
33CLEANFILES+=	yearistype
34CLEANDIRS+=	builddir
35CONTRIBDIR=	${SRCTOP}/contrib/tzdata/
36.PATH:		${CONTRIBDIR}
37
38.if defined(LEAPSECONDS)
39.warning "Using backwards compatibility variable for LEAPSECONDS; please use WITH_ZONEINFO_LEAPSECONDS_SUPPORT instead"
40MK_ZONEINFO_LEAPSECONDS_SUPPORT= yes
41.endif
42
43.if defined(OLDTIMEZONES)
44.warning "Using backwards compatibility variable for OLDTIMEZONES; please use WITH_ZONEINFO_OLD_TIMEZONES_SUPPORT instead"
45MK_ZONEINFO_OLD_TIMEZONES_SUPPORT= yes
46.endif
47
48.if ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no"
49LEAPFILE=	-L ${CONTRIBDIR}leapseconds
50.else
51LEAPFILE=
52.endif
53
54TZFILES=	africa antarctica asia australasia etcetera europe \
55		factory northamerica southamerica
56POSIXRULES=	America/New_York
57
58.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no"
59TZFILES+=	backward systemv
60.endif
61
62TZFILES:=	${TZFILES:S/^/${CONTRIBDIR}/}
63
64TZBUILDDIR=	${.OBJDIR}/builddir
65TZBUILDSUBDIRS=	\
66		Africa \
67		America/Argentina \
68		America/Indiana \
69		America/Kentucky \
70		America/North_Dakota \
71		Antarctica \
72		Arctic \
73		Asia \
74		Atlantic \
75		Australia \
76		Etc \
77		Europe \
78		Indian \
79		Pacific \
80		SystemV
81
82.if ${MK_ZONEINFO_OLD_TIMEZONES_SUPPORT} != "no"
83TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil
84.endif
85
86.if !defined(_SKIP_BUILD)
87all: zoneinfo
88.endif
89META_TARGETS+=	zoneinfo install-zoneinfo
90
91zoneinfo: yearistype ${TDATA}
92	mkdir -p ${TZBUILDDIR}
93	cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
94	umask 022; cd ${.CURDIR}; \
95	zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
96	    ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
97
98.if make(*install*)
99TZS!= cd ${TZBUILDDIR} && find -s * -type f
100.endif
101
102beforeinstall: install-zoneinfo
103install-zoneinfo:
104	mkdir -p ${DESTDIR}/usr/share/zoneinfo
105	cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS}
106.for f in ${TZS}
107	${INSTALL} ${TAG_ARGS} \
108	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
109	    ${TZBUILDDIR}/${f} ${DESTDIR}/usr/share/zoneinfo/${f}
110.endfor
111	${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
112	    ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
113
114afterinstall:
115#
116# If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
117# and the contents of it exists in /usr/share/zoneinfo, then reinstall
118# it.
119#
120	@if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
121	    -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
122		zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
123		if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
124			if [ ! -z "${DESTDIR}" ]; then \
125				optC="-C ${DESTDIR}"; \
126			fi; \
127			echo "Updating /etc/localtime"; \
128			tzsetup $${optC} -r; \
129		fi; \
130	else \
131		echo "Run tzsetup(8) manually to update /etc/localtime."; \
132	fi
133
134.if ${MK_TESTS} != "no"
135SUBDIR+=	tests
136.endif
137
138.include <bsd.prog.mk>
139