1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-10-18 19:49:40 +00:00
freebsd-ports/misc/zoneinfo/Makefile
Steven Kreuzer 7fdaa12fe4
misc/zoneinfo: Update to 2023c
Briefly:
  Egypt now uses DST again, from April through October.
  This year Morocco springs forward April 23, not April 30.
  Palestine delays the start of DST this year.
  Much of Greenland still uses DST from 2024 on.
  America/Yellowknife now links to America/Edmonton.
  tzselect can now use current time to help infer timezone.
  The code now defaults to C99 or later.
  Fix use of C23 attributes.
2023-04-01 16:40:56 +00:00

103 lines
3.2 KiB
Makefile

PORTNAME= zoneinfo
DISTVERSION= 2023c
CATEGORIES= misc
MASTER_SITES= https://data.iana.org/time-zones/releases/ \
ftp://ftp.iana.org/tz/releases/
DISTNAME= tzdata${DISTVERSION}
MAINTAINER= skreuzer@FreeBSD.org
COMMENT= Updated timezone definitions
LICENSE= PD
NO_WRKSUBDIR= yes
PREFIX= /usr
NO_ARCH= yes
OPTIONS_DEFINE= BACKWARD
OPTIONS_DEFAULT= BACKWARD
OPTIONS_SUB= yes
BACKWARD_DESC= Include backwards compatible zones
BACKWARD_VARS= tzfiles+=backward
TZFILES= africa antarctica asia australasia etcetera europe \
factory northamerica southamerica
POSIXRULES= America/New_York
# Run both of:
# "make DEVELOPER=1 WITHOUT=BACKWARD do-clean test-pkgplist"
# and
# "make DEVELOPER=1 WITH=BACKWARD do-clean test-pkgplist"
# before commiting!
# Make sure it breaks when the distfile isn't there anymore.
.if !defined(PACKAGE_BUILDING)
MASTER_SITES+= http://people.freebsd.org/~edwin/
.endif
# tzsetup objects (fatally) if any entry in zone.tab or zone1970.tab
# refers to a country code that doesn't exist in misc/iso3166. While
# arguably that should be fixed, for compatibility we remove such
# entries here to avoid the problem.
#
# This used to be done by adding patch files for each country to
# remove, but that doesn't work for zone1970.tab.
#
# We generate a list of all 2-letter codes that are NOT in iso3166;
# then, for any entry in zone.tab or zone1970.tab that contains a bad
# code: first emit a commented-out version of the line, then a version
# with the bad codes stripped out of the first field (unless this
# leaves the first field empty).
post-patch:
cd ${WRKSRC}; \
badc=$$(${AWK} '/^[^\#]/ { t[$$1]=1; }; \
END { for (i=0; i<676; ++i) { \
c = sprintf("%c%c", 65+int(i/26), 65+(i%26)); \
if (!(c in t)) print c; \
} \
}' \
/usr/share/misc/iso3166 | \
${SED} -n -e '1h; 1!H; $${g;s/\n/|/g;p;}'); \
for fn in zone.tab zone1970.tab; do \
${MV} $${fn} $${fn}.bak; \
${AWK} -v FS="\t" -v OFS="\t" -v re="(^|,)($${badc})" \
'/^[^#]/ && $$1 ~ re { \
print "#" $$0; \
gsub(re,"",$$1); \
sub(/^,/,"",$$1); \
}; \
$$1 != "" { print; }' <$${fn}.bak >$${fn}; \
done
do-build:
umask 022; \
cd ${WRKSRC}; \
zic -d ${WRKSRC}/zoneinfo -p ${POSIXRULES} -m ${NOBINMODE} \
-y ${.OBJDIR}/yearistype ${TZFILES}
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/share/zoneinfo
(cd ${WRKSRC}/zoneinfo && ${COPYTREE_SHARE} . ${STAGEDIR}${PREFIX}/share/zoneinfo)
${INSTALL_DATA} ${WRKSRC}/zone.tab ${STAGEDIR}${PREFIX}/share/zoneinfo
${INSTALL_DATA} ${WRKSRC}/zone1970.tab ${STAGEDIR}${PREFIX}/share/zoneinfo
# check-plist is too lenient for us; it doesn't care if there are
# files in the stage dir that are commented out in plist due to port
# options. But we need to check for an exact match, otherwise the
# final package may be incorrect if entries move into or out of the
# "backward" file.
#
# So this rule makes the additional check that there must be no file in
# STAGEDIR not accounted for by .plist-files-no-comments.
test-pkgplist: check-plist
@(cd ${STAGEDIR} && ${FIND} . -type f -print) | \
${SED} -e 's:^[.]::' | ${SORT} | \
${COMM} -23 -- - ${WRKDIR}/.plist-files-no-comments | \
while read -r f; do ${ECHO_CMD} "MISSING FROM PLIST: $$f" >&2; ${ECHO_CMD} fail; done | \
! ${GREP} fail >/dev/null
.include <bsd.port.mk>