summaryrefslogtreecommitdiff
path: root/toolchain/glibc/patches/tz.patch
blob: 990458aa476f15e727e938caa6b4f32427114123 (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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
--- glibc-2.12.1/timezone/Makefile	2010-07-27 13:34:39.000000000 +0200
+++ glibc-2.12.1.orig/timezone/Makefile	2011-01-10 15:20:02.576150764 +0100
@@ -69,13 +69,10 @@
 					 $(addprefix $(inst_zonedir)/, \
 						     $(posixrules-file)))
 
-ifeq ($(cross-compiling),no)
-# Don't try to install the zoneinfo files since we can't run zic.
 install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \
 					      $(zonenames:%=posix/%) \
 					      $(zonenames:%=right/%)) \
 		 $(installed-localtime-file) $(installed-posixrules-file)
-endif
 
 ifeq ($(have-ksh),yes)
 install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab
@@ -106,18 +103,35 @@
 	   echo '$$(addprefix $$(inst_zonedir)/,$$($*-zones)): \'	    ;\
 	   echo '$$(foreach t,$$(tzbases),$$(addprefix $$(inst_zonedir)/,$$($$t-zones)))' ;\
 	 fi								    ;\
-	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;\
-	 echo '$< $$(objpfx)zic leapseconds yearistype'			    ;\
-	 echo '	$$(tzcompile)'						    ;\
-	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;\
-	 echo '$< $$(objpfx)zic /dev/null yearistype'			    ;\
-	 echo '	$$(tzcompile)'						    ;\
-	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;\
-	 echo '$< $$(objpfx)zic $$(leapseconds) yearistype'		    ;\
-	 echo '	$$(tzcompile)'						    ;\
+	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/right/,$$($*-zones)): \' ;) > $@.new
+
+ifeq (no,$(cross-compiling))
+	(echo '$< $$(objpfx)zic leapseconds yearistype'			    ;) >> $@.new
+else
+	(echo '$< $$(objpfx)cross-zic leapseconds yearistype'		    ;) >> $@.new
+endif
+
+	(echo '	$$(tzcompile)'						    ;\
+	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/posix/,$$($*-zones)): \' ;) >> $@.new
+
+ifeq (no,$(cross-compiling))
+	(echo '$< $$(objpfx)zic /dev/null yearistype'			    ;) >> $@.new
+else
+	(echo '$< $$(objpfx)cross-zic /dev/null yearistype'		    ;) >> $@.new
+endif
+
+	(echo '	$$(tzcompile)'						    ;\
+	 echo '$$(addprefix $$(dir $$(inst_zonedir))zone%/,$$($*-zones)): \' ;) >> $@.new
+
+ifeq (no,$(cross-compiling))
+	(echo '$< $$(objpfx)zic $$(leapseconds) yearistype'		    ;) >> $@.new
+else
+	(echo '$< $$(objpfx)cross-zic $$(leapseconds) yearistype'	    ;) >> $@.new
+endif
+
+	(echo '	$$(tzcompile)'						    ;\
 	 echo 'endif'							    ;\
-	 echo 'zonenames := $$(zonenames) $$($*-zones)'			    ;\
-	) > $@.new
+	 echo 'zonenames := $$(zonenames) $$($*-zones)'			    ;) >> $@.new
 	mv $@.new $@
 
 .PHONY: echo-zonenames
@@ -128,7 +142,11 @@
 # We have to use `-d $(inst_zonedir)' to explictly tell zic where to
 # place the output files although $(zonedir) is compiled in.  But the
 # user might have set $(install_root) on the command line of `make install'.
+ifeq (no,$(cross-compiling))
 zic-cmd = $(built-program-cmd) -d $(inst_zonedir)
+else
+zic-cmd = $(objpfx)cross-zic -d $(inst_zonedir)
+endif
 tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
 	    -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
 
@@ -158,8 +176,17 @@
 	$(zic-cmd) -p $(posixrules)
 endif
 
+zic-objs = zic.o ialloc.o scheck.o
+
+$(objpfx)zic: $(addprefix $(objpfx), $(zic-objs))
+
+$(addprefix $(objpfx)cross-,$(zic-objs)): $(objpfx)cross-%.o: %.c
+	gcc $< -c $(OUTPUT_OPTION) \
+		$(filter-out -DHAVE_GETTEXT,$(CFLAGS-$*.c)) \
+		$(CPPFLAGS-$*) -DCROSS_ZIC $(compile-mkdep-flags)
 
-$(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
+$(objpfx)cross-zic: $(addprefix $(objpfx)cross-,$(zic-objs))
+	gcc $(addprefix $(objpfx)cross-,$(zic-objs)) -o $@
 
 tz-cflags = -DTZDIR='"$(zonedir)"' \
 	    -DTZDEFAULT='"$(localtime-file)"' \
@@ -176,10 +203,17 @@
 # Don't add leapseconds here since test-tz made checks that work only without
 # leapseconds.
 testdata = $(objpfx)testdata
+ifeq (no,$(cross-compiling))
 define build-testdata
 GCONV_PATH=${common-objpfx}iconvdata LANGUAGE=C LC_ALL=C \
   $(built-program-cmd) -d $(testdata) -y ./yearistype $<
 endef
+else
+define build-testdata
+LANGUAGE=C LC_ALL=C \
+  $(objpfx)cross-zic -d $(testdata) -y ./yearistype $<
+endef
+endif
 
 $(objpfx)test-tz.out: $(addprefix $(testdata)/, America/New_York Etc/UTC UTC)
 $(objpfx)tst-timezone.out: $(addprefix $(testdata)/, \
@@ -192,7 +226,11 @@
 tst-timezone-ENV = TZDIR=$(testdata)
 
 # Note this must come second in the deps list for $(built-program-cmd) to work.
+ifeq (no,$(cross-compiling))
 zic-deps = $(objpfx)zic $(leapseconds) yearistype
+else
+zic-deps = $(objpfx)cross-zic $(objpfx)zic $(leapseconds) yearistype
+endif
 
 $(testdata)/America/New_York: northamerica $(zic-deps)
 	$(build-testdata)
@@ -214,7 +252,9 @@
 
 $(objpfx)tzselect: tzselect.ksh $(common-objpfx)config.make
 	sed -e 's%@KSH@%$(KSH)%g' \
-	    -e 's%@TZDIR@%$(zonedir)%g' < $< > $@.new
+	    -e 's%@TZDIR@%$(zonedir)%g' \
+	    -e 's%@PKGVERSION@%$(PKGVERSION)%g' \
+	    -e 's%@REPORT_BUGS_TO@%$(REPORT_BUGS_TO)%g' < $< > $@.new
 	chmod 555 $@.new
 	mv -f $@.new $@