summaryrefslogtreecommitdiffstats
path: root/build
blob: 6058b66e71dc591407181e6684c1c78561a28233 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/make -f

tables = \
	africa \
	antarctica \
	asia \
	australasia \
	europe \
	northamerica \
	southamerica \
	etcetera

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/tzfile.5                         dest/usr/share/man/man5
	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
	# Install Factory zone.
	src/zic -d tzdata.data/usr/share/zoneinfo src/factory; \
	mkdir -p tzdata.data/etc
	ln -sf /usr/share/zoneinfo/Factory tzdata.data/etc/localtime
	# 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}"; \
			p="tzdata-$${t}"; \
			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 \
		p="tzdata-$$(cd src && grep -l \
			"^Zone[ 	][ 	]*$${dest}[ 	].*$$" \
			$(tables))"; \
		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