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