]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - share/zoneinfo/Makefile
share/zoneinfo: don't build obsolete SystemV zones
[FreeBSD/FreeBSD.git] / share / zoneinfo / Makefile
1 # $FreeBSD$
2
3 #
4 # HOW TO UPDATE THE ZONEINFO DATA
5 #
6 # Import the new sources to the vendor branch:
7 #
8 # $ cd ~/freebsd/src
9 # $ git worktree add ../tzdata vendor/tzdata
10 # $ pushd ../tzdata
11 # $ tar -xvf ../tzdata-latest.tar.gz
12 #   (check with "git status" and "git diff" if it all makes sense)
13 # $ git add -A
14 # $ git commit -m "Import tzdata 20XXX"
15 # $ git tag -a -m "Tag import of tzdata 20XXX" vendor/tzdata/tzdata20XXX
16 # $ git push --follow-tags freebsd vendor/tzdata
17 # $ popd
18 #
19 # Merge-from-vendor
20 #
21 # $ git subtree merge -P contrib/tzdata vendor/tzdata
22 #   (write a meaningful commit message)
23 # $ git push freebsd HEAD:main
24 #
25 # MFC
26 #
27 # $ git checkout -b freebsd/stable/12 stable-12
28 # $ git cherry-pick -x [hash of merge commit to main] -m 1 --edit
29 #   (write a meaningful commit message)
30 # $ git push freebsd HEAD:stable/12
31 #
32
33 .include <src.opts.mk>
34
35 PACKAGE=        zoneinfo
36 CLEANDIRS+=     builddir
37 CONTRIBDIR=     ${SRCTOP}/contrib/tzdata/
38 .PATH:          ${CONTRIBDIR}
39
40 .if defined(LEAPSECONDS)
41 .warning Using backwards compatibility variable for LEAPSECONDS; please use WITH_ZONEINFO_LEAPSECONDS_SUPPORT instead
42 MK_ZONEINFO_LEAPSECONDS_SUPPORT= yes
43 .endif
44
45 .if ${MK_ZONEINFO_LEAPSECONDS_SUPPORT} != "no"
46 LEAPFILE=       -L ${CONTRIBDIR}leapseconds
47 .else
48 LEAPFILE=
49 .endif
50
51 TZFILES=        africa antarctica asia australasia etcetera europe \
52                 factory northamerica southamerica
53 TZFILES+=       backward
54 POSIXRULES=     America/New_York
55
56 TZFILES:=       ${TZFILES:S/^/${CONTRIBDIR}/}
57
58 TZBUILDDIR=     ${.OBJDIR}/builddir
59 TZBUILDSUBDIRS= \
60                 Africa \
61                 America/Argentina \
62                 America/Indiana \
63                 America/Kentucky \
64                 America/North_Dakota \
65                 Antarctica \
66                 Arctic \
67                 Asia \
68                 Atlantic \
69                 Australia \
70                 Etc \
71                 Europe \
72                 Indian \
73                 Pacific
74 TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil
75
76 .if !defined(_SKIP_BUILD)
77 all: zoneinfo
78 .endif
79 META_TARGETS+=  zoneinfo install-zoneinfo
80
81 zoneinfo: ${TDATA}
82         mkdir -p ${TZBUILDDIR}
83         cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}
84         umask 022; cd ${.CURDIR}; \
85         zic -D -d ${TZBUILDDIR} -p ${POSIXRULES} -m ${NOBINMODE} \
86             ${LEAPFILE} ${TZFILES}
87
88 #
89 # Sort TZS to ensure they are the same every build. find -s might
90 # be a shorter way to express this, but it's non-portable. Any
91 # differences between the two don't matter for this purpose.
92 #
93 .if make(*install*)
94 TZS!= cd ${TZBUILDDIR} && find * -type f | LC_ALL=C sort
95 .endif
96
97 beforeinstall: install-zoneinfo
98 install-zoneinfo:
99         mkdir -p ${DESTDIR}/usr/share/zoneinfo
100         cd ${DESTDIR}/usr/share/zoneinfo;  mkdir -p ${TZBUILDSUBDIRS}
101 .for f in ${TZS}
102         ${INSTALL} ${TAG_ARGS} \
103             -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
104             ${TZBUILDDIR}/${f} ${DESTDIR}/usr/share/zoneinfo/${f}
105 .endfor
106         ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
107             ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
108         ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
109             ${CONTRIBDIR}/zone1970.tab ${DESTDIR}/usr/share/zoneinfo/
110
111 afterinstall:
112 #
113 # If the file /var/db/zoneinfo exists, and it is owned by root:wheel,
114 # and the contents of it exists in /usr/share/zoneinfo, then reinstall
115 # it.
116 #
117         @if [ -f ${DESTDIR}/var/db/zoneinfo -a -O ${DESTDIR}/var/db/zoneinfo \
118             -a -G ${DESTDIR}/var/db/zoneinfo ]; then \
119                 zf=$$(cat ${DESTDIR}/var/db/zoneinfo); \
120                 if [ -f ${DESTDIR}/usr/share/zoneinfo/$${zf} ]; then \
121                         if [ ! -z "${DESTDIR}" ]; then \
122                                 optC="-C ${DESTDIR}"; \
123                         fi; \
124                         echo "Updating /etc/localtime"; \
125                         tzsetup $${optC} -r; \
126                 fi; \
127         else \
128                 echo "Run tzsetup(8) manually to update /etc/localtime."; \
129         fi
130
131 HAS_TESTS=
132 SUBDIR.${MK_TESTS}+= tests
133
134 .include <bsd.prog.mk>