summaryrefslogtreecommitdiffstats
path: root/build
blob: b77adc9022ae0a418626833701385f8960fdeca3 (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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
#!/usr/bin/make -f

include ../source.mk

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

INSTALL = set -e; \
	INSTALL() { \
		printf '  INSTALL  %s\n' "$${*}"; \
		i=0; for d in "$${@}"; do : $$((i += 1)); done; \
		mkdir -p "$${d}"; \
		for s in "$${@}"; do [ $$((i -= 1)) -eq 0 ] && break; \
			cp "$${s}" "$${d}"; \
		done; \
	}; INSTALL

nop:
	@:

build:
	oh-autobuild -- KSHELL=/bin/sh
	touch $@

install: build
	@$(INSTALL) src/tzselect     tzselect.data/usr/bin
	@$(INSTALL) src/iso3166.tab  tzselect.data/usr/share/zoneinfo
	@$(INSTALL) src/zone1970.tab tzselect.data/usr/share/zoneinfo
	@$(INSTALL) src/zdump           zdump.data/usr/bin
	@$(INSTALL) src/zic               zic.data/usr/sbin
	@$(INSTALL) src/tzfile.5   tzcode-doc.data/usr/share/man/man5
	@$(INSTALL) src/tzselect.8 tzcode-doc.data/usr/share/man/man8
	@$(INSTALL) src/zdump.8    tzcode-doc.data/usr/share/man/man8
	@$(INSTALL) src/zic.8      tzcode-doc.data/usr/share/man/man8
	# Install the Factory zone and make it the default localtime.
	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 \
		p="tzdata-$${t}"; \
		src/zic -d "$${p}.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}"; \
			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
	# Install America/New_York in tzdata and link posixrules to it.
	mkdir -p tzdata.data/usr/share/zoneinfo/America
	mv tzdata-northamerica.data/usr/share/zoneinfo/America/New_York \
		tzdata.data/usr/share/zoneinfo/America
	ln -sf America/New_York tzdata.data/usr/share/zoneinfo/posixrules
	# Run oh-fixperms and oh-strip over everything.
	set -e; for p in $(OPK_PACKAGES); do \
		oh-fixperms -d "$${p}.data"; \
		oh-strip    -d "$${p}.data"; \
	done
	oh-shlibdeps