Fix share/zoneinfo for DIRDEPS_BUILD

The tranditional build makes multiple passes through the tree.
The DIRDEPS_BUILD visits each directory only once per architecture,
thus makefiles should be able to everything they need in a single pass.

The use of TZS!= when doing make(*install*)
only works if the directory has previously been visited to do zoneinfo
since before the zoneinfo target is run TZS will be empty.

To fix this, have the zoneinfo target capture the list of files to
zoneinfo, and install-zoneinfo use that list.
Rename that target to zonefiles - since that is now what it does.

This is more efficient - we only gather the list of zones when it is
likely to have changed, and allows the makefile to do everything in a
single pass.

Reviewed by:	stevek
Differential Revision:	https://reviews.freebsd.org/D42624
This commit is contained in:
Simon J. Gerraty
2023-11-20 12:51:25 -08:00
parent fec0c3fb08
commit 0a45a7e99f
2 changed files with 11 additions and 18 deletions
+9 -15
View File
@@ -78,9 +78,9 @@ TZBUILDSUBDIRS= \
TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil TZBUILDSUBDIRS+= US Mexico Chile Canada Brazil
.if !defined(_SKIP_BUILD) .if !defined(_SKIP_BUILD)
all: zoneinfo all: zonefiles
.endif .endif
META_TARGETS+= zoneinfo install-zoneinfo META_TARGETS+= zonefiles install-zoneinfo
# #
# Produce “fat” zoneinfo files for backward compatibility. # Produce “fat” zoneinfo files for backward compatibility.
@@ -89,33 +89,27 @@ ZICFLAGS?= -b fat
.if ${MK_DIRDEPS_BUILD} == "yes" .if ${MK_DIRDEPS_BUILD} == "yes"
ZIC= ${STAGE_HOST_OBJTOP}/usr/sbin/zic ZIC= ${STAGE_HOST_OBJTOP}/usr/sbin/zic
# we do everything in a single visit
install-zoneinfo: zonefiles
.endif .endif
zoneinfo: ${TDATA} zonefiles: ${TDATA}
mkdir -p ${TZBUILDDIR} mkdir -p ${TZBUILDDIR}
(cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS}) (cd ${TZBUILDDIR}; mkdir -p ${TZBUILDSUBDIRS})
(umask 022; cd ${.CURDIR}; \ (umask 022; cd ${.CURDIR}; \
${ZIC:Uzic} -D -d ${TZBUILDDIR} ${ZICFLAGS} -m ${NOBINMODE} \ ${ZIC:Uzic} -D -d ${TZBUILDDIR} ${ZICFLAGS} -m ${NOBINMODE} \
${LEAPFILE} ${TZFILES}) ${LEAPFILE} ${TZFILES})
(cd ${TZBUILDDIR} && find * -type f | LC_ALL=C sort) > ${.TARGET}
#
# Sort TZS to ensure they are the same every build. find -s might
# be a shorter way to express this, but it's non-portable. Any
# differences between the two don't matter for this purpose.
#
.if make(*install*)
TZS!= cd ${TZBUILDDIR} && find * -type f | LC_ALL=C sort
.endif
beforeinstall: install-zoneinfo beforeinstall: install-zoneinfo
install-zoneinfo: install-zoneinfo:
mkdir -p ${DESTDIR}/usr/share/zoneinfo mkdir -p ${DESTDIR}/usr/share/zoneinfo
(cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS}) (cd ${DESTDIR}/usr/share/zoneinfo; mkdir -p ${TZBUILDSUBDIRS})
.for f in ${TZS} for f in `cat zonefiles`; do \
${INSTALL} ${TAG_ARGS} \ ${INSTALL} ${TAG_ARGS} \
-o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
${TZBUILDDIR}/${f} ${DESTDIR}/usr/share/zoneinfo/${f} ${TZBUILDDIR}/$${f} ${DESTDIR}/usr/share/zoneinfo/$${f}; \
.endfor done
${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/ ${CONTRIBDIR}/zone.tab ${DESTDIR}/usr/share/zoneinfo/
${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \ ${INSTALL} ${TAG_ARGS} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
-1
View File
@@ -1,7 +1,6 @@
# Autogenerated - do NOT edit! # Autogenerated - do NOT edit!
DIRDEPS = \ DIRDEPS = \
usr.bin/xinstall.host \
usr.sbin/zic.host \ usr.sbin/zic.host \