summaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2019-06-05 19:08:50 (EDT)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2019-06-05 19:08:50 (EDT)
commitb1d7abc7ad5d6ba5f2c1384e018aa86ced83c9f1 (patch)
treee5466d72ca44ef0723f6d5c098b575c9243a2b73 /build
parent4c1e8c6e1d611ed3b8f0540286b9da676dc8ea06 (diff)
build: Add tzdata target commands
Diffstat (limited to 'build')
-rwxr-xr-xbuild72
1 files changed, 72 insertions, 0 deletions
diff --git a/build b/build
index 1aa0ac3..2343dbd 100755
--- a/build
+++ b/build
@@ -1,10 +1,26 @@
#!/usr/bin/make -f
+tables = \
+ africa \
+ antarctica \
+ asia \
+ australasia \
+ europe \
+ northamerica \
+ southamerica \
+ etcetera \
+ factory
+
nop:
@:
build:
oh-autobuild -- KSHELL=/bin/sh TZDIR=/usr/share/zoneinfo
+ for t in $(tables); do \
+ /usr/sbin/zic -d tzdata-$${t}.data/usr/share/zoneinfo \
+ -L /dev/null -y yearistype.sh \
+ src/$${t} || exit $?; \
+ done
touch $@
install: build
@@ -15,3 +31,59 @@ install: build
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/iso3166.tab src/zone.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.
+ for t in $(tables); do \
+ grep '^Link' 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 '^Link' 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