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