xref: /freebsd-11-stable/share/zoneinfo/Makefile (revision 427890df68eaa483e5e5ef13359e435404f6ef49)
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=	${.CURDIR}/../../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 ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no"
44LEAPFILE=	-L ${CONTRIBDIR}leapseconds
45.else
46LEAPFILE=
47.endif
48
49TZFILES=	africa antarctica asia australasia etcetera europe \
50		factory northamerica southamerica
51TZFILES+=	backward systemv
52POSIXRULES=	America/New_York
53
54TZFILES:=	${TZFILES:S/^/${CONTRIBDIR}/}
55
56TZBUILDDIR=	${.OBJDIR}/builddir
57TZBUILDSUBDIRS=	\
58		Africa \
59		America/Argentina \
60		America/Indiana \
61		America/Kentucky \
62		America/North_Dakota \
63		Antarctica \
64		Arctic \
65		Asia \
66		Atlantic \
67		Australia \
68		Etc \
69		Europe \
70		Indian \
71		Pacific \
72		SystemV
73TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil
74
75.if !defined(_SKIP_BUILD)
76all: zoneinfo
77.endif
78META_TARGETS+=	zoneinfo install-zoneinfo
79
80zoneinfo: yearistype ${TDATA}
81	mkdir -p ${TZBUILDDIR}
82	cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
83	umask 022; cd ${.CURDIR}; \
84	zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
85	    ${LEAPFILE} -y ${.OBJDIR}/yearistype ${TZFILES}
86
87beforeinstall: install-zoneinfo
88install-zoneinfo:
89	mkdir -p ${DESTDIR}/usr/share/zoneinfo
90	cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS}
91	cd ${TZBUILDDIR} && \
92	    find -s * -type f -print -exec ${INSTALL} ${TAG_ARGS} \
93	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
94	    \{} ${DESTDIR}/usr/share/zoneinfo/\{} \;
95	${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
96	    ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
97	${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
98	    ${CONTRIBDIR}/zone1970.tab ${DESTDIR}/usr/share/zoneinfo/
99
100afterinstall:
101#
102# If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
103# and the contents of it exists in /usr/share/zoneinfo, then reinstall
104# it.
105#
106	@if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
107	    -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
108		zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
109		if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
110			if [ ! -z "${DESTDIR}" ]; then \
111				optC="-C ${DESTDIR}"; \
112			fi; \
113			echo "Updating /etc/localtime"; \
114			tzsetup $${optC} -r; \
115		fi; \
116	else \
117		echo "Run tzsetup(8) manually to update /etc/localtime."; \
118	fi
119
120.if ${MK_TESTS} != "no"
121SUBDIR+=	tests
122.endif
123
124.include <bsd.prog.mk>
125