summaryrefslogtreecommitdiffstats
path: root/build
blob: cfa976f94a3f0c678d14e33d6f18257faaeda0e0 (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
#!/usr/bin/make -f

include ../source.mk

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

nop:
	@:

build:
	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
	# Install tzdata-common files.
	mkdir -p tzdata-common.data/usr/share/zoneinfo
	cp src/iso3166.tab src/zone.tab tzdata-common.data/usr/share/zoneinfo
	cp -p tzdata-northamerica.data/usr/share/zoneinfo/America/New_York \
		tzdata-common.data/usr/share/zoneinfo
	# 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}"; \
			link="$${src}" up=''; \
			while [ "$${link#*/}" != "$${link}" ] && \
			      [ "$${link%%/*}" = "$${dest%%/*}" ]; do \
				link="$${link#*/}"; \
				dest="$${dest#*/}"; \
			done; \
			while [ "$${link#*/}" != "$${link}" ]; do \
				link="$${link#*/}"; \
				up="../$${up}"; \
			done; \
			src="tzdata-$${t}.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 \
		t="$$(cd src &&  grep -l \
			"^Zone[ 	][ 	]*$${dest}[ 	].*$$" \
			$(tables))"; \
		link="$${src}" up=''; \
		while [ "$${link#*/}" != "$${link}" ] && \
		      [ "$${link%%/*}" = "$${dest%%/*}" ]; do \
			link="$${link#*/}"; \
			dest="$${dest#*/}"; \
		done; \
		while [ "$${link#*/}" != "$${link}" ]; do \
			link="$${link#*/}"; \
			up="../$${up}"; \
		done; \
		src="tzdata-$${t}.data/usr/share/zoneinfo/$${src}"; \
		mkdir -p "$${src%/*}"; \
		ln -sf "$${up}$${dest}" "$${src}"; \
	done
	ln -sf . tzdata-common.data/usr/share/zoneinfo/posix