xref: /freebsd/share/zoneinfo/Makefile (revision 4a711b8d04cca5a50566a78a62f769eed0f0de65)
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 ${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
87#
88# Sort TZS to ensure they are the same every build. find -s might
89# be a shorter way to express this, but it's non-portable. Any
90# differences between the two don't matter for this purpose.
91#
92.if make(*install*)
93TZS!= cd ${TZBUILDDIR} && find * -type f | LC_ALL=C sort
94.endif
95
96beforeinstall: install-zoneinfo
97install-zoneinfo:
98	mkdir -p ${DESTDIR}/usr/share/zoneinfo
99	cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS}
100.for f in ${TZS}
101	${INSTALL} ${TAG_ARGS} \
102	    -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
103	    ${TZBUILDDIR}/${f} ${DESTDIR}/usr/share/zoneinfo/${f}
104.endfor
105	${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
106	    ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
107	${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
108	    ${CONTRIBDIR}/zone1970.tab ${DESTDIR}/usr/share/zoneinfo/
109
110afterinstall:
111#
112# If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
113# and the contents of it exists in /usr/share/zoneinfo, then reinstall
114# it.
115#
116	@if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
117	    -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
118		zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
119		if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
120			if [ ! -z "${DESTDIR}" ]; then \
121				optC="-C ${DESTDIR}"; \
122			fi; \
123			echo "Updating /etc/localtime"; \
124			tzsetup $${optC} -r; \
125		fi; \
126	else \
127		echo "Run tzsetup(8) manually to update /etc/localtime."; \
128	fi
129
130HAS_TESTS=
131SUBDIR.${MK_TESTS}+= tests
132
133.include <bsd.prog.mk>
134