#!/usr/bin/make -f tables = \ africa \ antarctica \ asia \ australasia \ europe \ northamerica \ southamerica \ etcetera \ factory nop: @: build: oh-autobuild -- KSHELL=/bin/sh touch $@ install: build install -D src/tzselect src/zdump dest/usr/bin install -D src/zic dest/usr/sbin install -D src/tzselect.8 src/zdump.8 src/zic.8 dest/usr/share/man/man8 oh-fixperms oh-strip oh-installfiles # Install tzdata files. mkdir -p tzdata.data/usr/share/zoneinfo/Etc mv tzdata-etcetera.data/usr/share/zoneinfo/Etc/UTC \ tzdata.data/usr/share/zoneinfo/Etc cp src/*.tab tzdata.data/usr/share/zoneinfo ln -sf Universal tzdata.data/usr/share/zoneinfo/posixrules mkdir -p tzdata.data/etc ln -sf /usr/share/zoneinfo/Universal tzdata.data/etc/localtime ln -sf . tzdata.data/usr/share/zoneinfo/posix # Install time zones. set -e; for t in $(tables); do \ src/zic -d tzdata-$${t}.data/usr/share/zoneinfo src/$${t}; \ grep '^L' src/$${t} | while read type dest src etc; do \ rm -f "tzdata-$${t}.data/usr/share/zoneinfo/$${src}"; \ if [ x"$${dest}" = x'Etc/UTC' ]; then \ p='tzdata'; \ else \ p="tzdata-$${t}"; \ fi; \ link="$${src}" up=''; \ while [ x"$${link#*/}" != x"$${link}" ] && \ [ x"$${link%%/*}" = x"$${dest%%/*}" ]; do \ link="$${link#*/}"; \ dest="$${dest#*/}"; \ done; \ while [ x"$${link#*/}" != x"$${link}" ]; do \ link="$${link#*/}"; \ up="../$${up}"; \ done; \ src="$${p}.data/usr/share/zoneinfo/$${src}"; \ ln -sf "$${up}$${dest}" "$${src}"; \ done; \ done # Install links listed in the "backward" table into the relevant time # zone data package. grep '^L' src/backward | while read type dest src etc; do \ if [ x"$${dest}" = x'Etc/UTC' ]; then \ p='tzdata'; \ else \ p="tzdata-$$(cd src && grep -l \ "^Zone[ ][ ]*$${dest}[ ].*$$" \ $(tables))"; \ fi; \ link="$${src}" up=''; \ while [ x"$${link#*/}" != x"$${link}" ] && \ [ x"$${link%%/*}" = x"$${dest%%/*}" ]; do \ link="$${link#*/}"; \ dest="$${dest#*/}"; \ done; \ while [ x"$${link#*/}" != x"$${link}" ]; do \ link="$${link#*/}"; \ up="../$${up}"; \ done; \ src="$${p}.data/usr/share/zoneinfo/$${src}"; \ mkdir -p "$${src%/*}"; \ ln -sf "$${up}$${dest}" "$${src}"; \ done