source: clfs-sysroot/patches/glibc-2.5-cross_hacks-1.patch@ 977c5d0

Last change on this file since 977c5d0 was 32edd3a, checked in by Joe Ciccone <jciccone@…>, 18 years ago

Replace the glibc crosscompile timezone fix patch with the glibc cross hacks patch. The new patch has support for zoneinfo, locales, and librpcsvc.

  • Property mode set to 100644
File size: 16.2 KB
RevLine 
[32edd3a]1Submitted By: Joe Ciccone <jciccone@linuxfromscratch.org>
2Date: 2006-11-23
3Initial Package Version: 2.5
4Origin: Joe Ciccone
5Upstream Status: Will not be accepted.
6 See, http://sourceware.org/bugzilla/show_bug.cgi?id=2838
7Description: Adds native compile support to the build system then uses that
8 support to build zic-native, for installing timezone info,
9 rpcgen-native, for building librpcsvc.a, and localedef-native,
10 for creating the locale-archive.
11
12diff -Naur glibc-2.5.orig/Makeconfig glibc-2.5/Makeconfig
13--- glibc-2.5.orig/Makeconfig 2006-11-23 23:07:52.000000000 -0500
14+++ glibc-2.5/Makeconfig 2006-11-23 23:08:09.000000000 -0500
15@@ -447,6 +447,13 @@
16 $(common-objpfx)libc% $(+postinit),$^) \
17 $(link-extra-libs-static) $(link-libc-static) $(+postctor) $(+postinit)
18 endif
19+# Command for linking programs against the host system.
20+ifndef +link-native
21++link-native = $(BUILD_CC) -static -g -o $@ $^ \
22+ $(LDFLAGS) $(LDFLAGS-$(@F)) \
23+ $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \
24+ $(link-extra-libs)
25+endif
26 # Command for statically linking bounded-pointer programs with the C library.
27 ifndef +link-bounded
28 +link-bounded = $(CC) -nostdlib -nostartfiles -static -fbounded-pointers -o $@ \
29@@ -668,6 +675,8 @@
30 $(+sysdep-includes) $(includes) \
31 $(patsubst %/,-I%,$(..)) $(libio-include) -I. $(sysincludes)
32
33++includes-native = -I$(..)include-native -I$(objpfx) -I.
34+
35 # Since libio has several internal header files, we use a -I instead
36 # of many little headers in the include directory.
37 libio-include = -I$(..)libio
38@@ -682,6 +691,9 @@
39 $(foreach lib,$(libof-$(basename $(@F))) \
40 $(libof-$(<F)) $(libof-$(@F)),$(CPPFLAGS-$(lib))) \
41 $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
42+CPPFLAGS-native = -D_GNU_SOURCE $($(subdir)-CPPFLAGS) $(+includes-native) $(defines) \
43+ $(CPPFLAGS-$(suffix $@)) -include $(..)include/libc-symbols.h \
44+ $(CPPFLAGS-$(<F)) $(CPPFLAGS-$(@F)) $(CPPFLAGS-$(basename $(@F)))
45 override CFLAGS = -std=gnu99 \
46 $(filter-out %frame-pointer,$(+cflags)) $(+gccwarn-c) \
47 $(sysdep-CFLAGS) $(CFLAGS-$(suffix $@)) $(CFLAGS-$(<F)) \
48diff -Naur glibc-2.5.orig/Makerules glibc-2.5/Makerules
49--- glibc-2.5.orig/Makerules 2006-11-23 23:07:53.000000000 -0500
50+++ glibc-2.5/Makerules 2006-11-23 23:08:09.000000000 -0500
51@@ -292,6 +292,9 @@
52 object-suffixes-left := $(all-object-suffixes)
53 include $(o-iterator)
54
55+$(objpfx)%-native.o: %.c $(before-compile)
56+ $(native-compile-command.c)
57+
58 # Omit the objpfx rules when building in the source tree, because
59 # objpfx is empty and so these rules just override the ones above.
60 ifdef objpfx
61@@ -368,6 +371,8 @@
62 compile-command.s = $(COMPILE.s) $< $(OUTPUT_OPTION) $(compile-mkdep-flags)
63 compile-command.c = $(compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
64 compile-command.cc = $(compile.cc) $(OUTPUT_OPTION) $(compile-mkdep-flags)
65+# Native commands
66+native-compile-command.c = $(native-compile.c) $(OUTPUT_OPTION) $(compile-mkdep-flags)
67
68 # GCC can grok options after the file name, and it looks nicer that way.
69 compile.c = $(CC) $< -c $(CFLAGS) $(CPPFLAGS)
70@@ -377,6 +382,8 @@
71 COMPILE.S = $(CC) -c $(CPPFLAGS) $(S-CPPFLAGS) \
72 $(ASFLAGS) $(ASFLAGS-$(suffix $@))
73 COMPILE.s = $(filter-out -pipe,$(CC)) -c $(ASFLAGS)
74+# Native commands
75+native-compile.c = $(BUILD_CC) -g $< -c $(CFLAGS) $(CPPFLAGS-native)
76
77 # We need this for the output to go in the right place. It will default to
78 # empty if make was configured to work with a cc that can't grok -c and -o
79@@ -1168,7 +1175,7 @@
80 $(make-target-directory)
81 $(patsubst %/,cd % &&,$(objpfx)) \
82 $(BUILD_CC) $($(basename $(<F))-CFLAGS) $(ALL_BUILD_CFLAGS) \
83- $(firstword $(filter /%,$< $(shell pwd)/$<)) -o $(@F)
84+ $(addprefix $(shell pwd)/, $^) -o $(@F)
85 endef
86
87 # Command to compile $< in $(common-objdir) using the native libraries.
88diff -Naur glibc-2.5.orig/Rules glibc-2.5/Rules
89--- glibc-2.5.orig/Rules 2006-11-23 23:07:52.000000000 -0500
90+++ glibc-2.5/Rules 2006-11-23 23:08:09.000000000 -0500
91@@ -87,7 +87,7 @@
92
93 .PHONY: others tests
94 ifeq ($(build-programs),yes)
95-others: $(addprefix $(objpfx),$(others) $(sysdep-others) $(extra-objs))
96+others: $(addprefix $(objpfx),$(others) $(others-native) $(sysdep-others) $(extra-objs))
97 else
98 others: $(addprefix $(objpfx),$(extra-objs))
99 endif
100@@ -106,9 +106,11 @@
101 ifeq ($(build-programs),yes)
102 binaries-all = $(others) $(sysdep-others) $(tests) $(xtests) $(test-srcs)
103 binaries-static = $(others-static) $(tests-static) $(xtests-static)
104+binaries-native = $(others-native)
105 else
106 binaries-all = $(tests) $(xtests) $(test-srcs)
107 binaries-static =
108+binaries-native =
109 endif
110
111 binaries-shared = $(filter-out $(binaries-static), $(binaries-all))
112@@ -127,6 +129,11 @@
113 $(+link-static)
114 endif
115
116+ifneq "$(strip $(binaries-native))" ""
117+$(addprefix $(objpfx),$(binaries-native)): %: %.o
118+ $(+link-native)
119+endif
120+
121 ifeq ($(build-bounded),yes)
122 binaries-bounded = $(addsuffix -bp,$(tests) $(xtests) $(test-srcs))
123 $(addprefix $(objpfx),$(binaries-bounded)): %-bp: %.ob \
124diff -Naur glibc-2.5.orig/iconv/Makefile glibc-2.5/iconv/Makefile
125--- glibc-2.5.orig/iconv/Makefile 2006-11-23 23:07:51.000000000 -0500
126+++ glibc-2.5/iconv/Makefile 2006-11-23 23:08:09.000000000 -0500
127@@ -56,6 +56,9 @@
128 iconvconfig.h
129
130 others = iconv_prog iconvconfig
131+ifneq ($(cross-compiling),no)
132+others-native = iconvconfig-native
133+endif
134 install-others = $(inst_bindir)/iconv
135 install-sbin = iconvconfig
136
137@@ -78,6 +81,7 @@
138
139 $(objpfx)iconv_prog: $(iconv_prog-modules:%=$(objpfx)%.o)
140 $(objpfx)iconvconfig: $(iconvconfig-modules:%=$(objpfx)%.o)
141+$(objpfx)iconvconfig-native: $(iconvconfig-modules:%=$(objpfx)%-native.o)
142
143 ifneq ($(cross-compiling),yes)
144 xtests: test-iconvconfig
145diff -Naur glibc-2.5.orig/iconvdata/Makefile glibc-2.5/iconvdata/Makefile
146--- glibc-2.5.orig/iconvdata/Makefile 2006-11-23 23:07:51.000000000 -0500
147+++ glibc-2.5/iconvdata/Makefile 2006-11-23 23:08:09.000000000 -0500
148@@ -311,23 +311,25 @@
149
150 headers: $(addprefix $(objpfx), $(generated-modules:=.h))
151
152+ifeq ($(cross-compiling),no)
153+iconvconfig-cmd = LC_ALL=C LANGUAGE=C \
154+ $(common-objpfx)elf/ld.so --library-path $(rpath-link) \
155+ $(common-objpfx)iconv/iconvconfig
156+else
157+iconvconfig-cmd = LC_ALL=C LANGUAGE=C \
158+ $(common-objpfx)iconv/iconvconfig-native
159+endif
160+
161 $(addprefix $(inst_gconvdir)/, $(modules.so)): \
162 $(inst_gconvdir)/%: $(objpfx)% $(+force)
163 $(do-install-program)
164 $(inst_gconvdir)/gconv-modules: gconv-modules $(+force)
165 $(do-install)
166-ifeq (no,$(cross-compiling))
167 # Update the $(prefix)/lib/gconv/gconv-modules.cache file. This is necessary
168 # if this libc has more gconv modules than the previously installed one.
169 if test -f "$(inst_gconvdir)/gconv-modules.cache"; then \
170- LC_ALL=C LANGUAGE=C \
171- $(common-objpfx)elf/ld.so --library-path $(rpath-link) \
172- $(common-objpfx)iconv/iconvconfig \
173- $(addprefix --prefix=,$(install_root)); \
174+ $(iconvconfig-cmd) $(addprefix --prefix=,$(install_root)); \
175 fi
176-else
177- @echo '*@*@*@ You should recreate $(inst_gconvdir)/gconv-modules.cache'
178-endif
179
180 endif # build-shared = yes
181
182diff -Naur glibc-2.5.orig/include-native/bits/libc-tsd.h glibc-2.5/include-native/bits/libc-tsd.h
183--- glibc-2.5.orig/include-native/bits/libc-tsd.h 1969-12-31 19:00:00.000000000 -0500
184+++ glibc-2.5/include-native/bits/libc-tsd.h 2006-11-23 23:08:09.000000000 -0500
185@@ -0,0 +1,3 @@
186+#ifndef __libc_tsd_define
187+#define __libc_tsd_define(A,B)
188+#endif
189diff -Naur glibc-2.5.orig/include-native/config.h glibc-2.5/include-native/config.h
190--- glibc-2.5.orig/include-native/config.h 1969-12-31 19:00:00.000000000 -0500
191+++ glibc-2.5/include-native/config.h 2006-11-23 23:08:09.000000000 -0500
192@@ -0,0 +1 @@
193+/* Empty */
194diff -Naur glibc-2.5.orig/include-native/gnu/stubs.h glibc-2.5/include-native/gnu/stubs.h
195--- glibc-2.5.orig/include-native/gnu/stubs.h 1969-12-31 19:00:00.000000000 -0500
196+++ glibc-2.5/include-native/gnu/stubs.h 2006-11-23 23:08:09.000000000 -0500
197@@ -0,0 +1 @@
198+/* Empty */
199diff -Naur glibc-2.5.orig/include-native/intl/loadinfo.h glibc-2.5/include-native/intl/loadinfo.h
200--- glibc-2.5.orig/include-native/intl/loadinfo.h 1969-12-31 19:00:00.000000000 -0500
201+++ glibc-2.5/include-native/intl/loadinfo.h 2006-11-23 23:08:09.000000000 -0500
202@@ -0,0 +1,4 @@
203+#ifndef LOADINFO_H
204+#define LOADINFO_H
205+struct loaded_l10nfile;
206+#endif
207diff -Naur glibc-2.5.orig/include-native/libintl.h glibc-2.5/include-native/libintl.h
208--- glibc-2.5.orig/include-native/libintl.h 1969-12-31 19:00:00.000000000 -0500
209+++ glibc-2.5/include-native/libintl.h 2006-11-23 23:08:09.000000000 -0500
210@@ -0,0 +1,13 @@
211+#include_next <libintl.h>
212+
213+#ifndef _
214+#define _(X) (X)
215+#endif
216+
217+#ifndef N_
218+#define N_(X) (X)
219+#endif
220+
221+#ifndef _libc_intl_domainname
222+#define _libc_intl_domainname "libc"
223+#endif
224diff -Naur glibc-2.5.orig/include-native/symbol-hacks.h glibc-2.5/include-native/symbol-hacks.h
225--- glibc-2.5.orig/include-native/symbol-hacks.h 1969-12-31 19:00:00.000000000 -0500
226+++ glibc-2.5/include-native/symbol-hacks.h 2006-11-23 23:08:09.000000000 -0500
227@@ -0,0 +1 @@
228+/* Empty */
229diff -Naur glibc-2.5.orig/include-native/tls.h glibc-2.5/include-native/tls.h
230--- glibc-2.5.orig/include-native/tls.h 1969-12-31 19:00:00.000000000 -0500
231+++ glibc-2.5/include-native/tls.h 2006-11-23 23:08:09.000000000 -0500
232@@ -0,0 +1,11 @@
233+#ifndef _include_tls_h
234+#define _include_tls_h 1
235+
236+#if USE_TLS && HAVE___THREAD \
237+ && (!defined NOT_IN_libc || defined IS_IN_libpthread)
238+# define USE___THREAD 1
239+#else
240+# define USE___THREAD 0
241+#endif
242+
243+#endif
244diff -Naur glibc-2.5.orig/locale/Makefile glibc-2.5/locale/Makefile
245--- glibc-2.5.orig/locale/Makefile 2006-11-23 23:07:53.000000000 -0500
246+++ glibc-2.5/locale/Makefile 2006-11-23 23:08:09.000000000 -0500
247@@ -44,6 +44,9 @@
248 aux = $(categories:%=lc-%) $(categories:%=C-%) SYS_libc C_name \
249 xlocale localename global-locale coll-lookup
250 others = localedef locale
251+ifneq ($(cross-compiling),no)
252+others-native = localedef-native
253+endif
254 #others-static = localedef locale
255 install-bin = localedef locale
256 extra-objs = $(localedef-modules:=.o) $(localedef-aux:=.o) \
257@@ -81,6 +84,12 @@
258 $(objpfx)locale: $(locale-modules:%=$(objpfx)%.o)
259 $(objpfx)localedef $(objpfx)locale: $(lib-modules:%=$(objpfx)%.o)
260
261+ifneq ($(cross-compiling),no)
262+$(objpfx)localedef-native: $(localedef-modules:%=$(objpfx)%-native.o)
263+$(objpfx)localedef-native: $(localedef-aux:%=$(objpfx)%-native.o)
264+$(objpfx)localedef-native: $(lib-modules:%=$(objpfx)%-native.o)
265+endif
266+
267 C-translit.h: C-translit.h.in gen-translit.pl
268 $(PERL) gen-translit.pl < $< > $@.tmp
269 mv -f $@.tmp $@
270diff -Naur glibc-2.5.orig/localedata/Makefile glibc-2.5/localedata/Makefile
271--- glibc-2.5.orig/localedata/Makefile 2006-11-23 23:07:52.000000000 -0500
272+++ glibc-2.5/localedata/Makefile 2006-11-23 23:08:09.000000000 -0500
273@@ -206,8 +206,13 @@
274 INSTALL-SUPPORTED-LOCALES=$(addprefix install-, $(SUPPORTED-LOCALES))
275
276 # Sometimes the whole collection of locale files should be installed.
277+ifeq ($(cross-compiling),no)
278 LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
279 $(common-objpfx)elf/ld.so --library-path $(rpath-link) $(common-objpfx)locale/localedef
280+else
281+LOCALEDEF=I18NPATH=. GCONV_PATH=$(common-objpfx)iconvdata LC_ALL=C \
282+$(common-objpfx)locale/localedef-native
283+endif
284 install-locales: $(INSTALL-SUPPORTED-LOCALES)
285
286 install-locales-dir:
287diff -Naur glibc-2.5.orig/malloc/Makefile glibc-2.5/malloc/Makefile
288--- glibc-2.5.orig/malloc/Makefile 2006-11-23 23:07:52.000000000 -0500
289+++ glibc-2.5/malloc/Makefile 2006-11-23 23:08:09.000000000 -0500
290@@ -73,10 +73,6 @@
291 endif
292 endif
293
294-# Unless we get a test for the availability of libgd which also works
295-# for cross-compiling we disable the memusagestat generation in this
296-# situation.
297-ifneq ($(cross-compiling),yes)
298 # If the gd library is available we build the `memusagestat' program.
299 ifneq ($(LIBGD),no)
300 others: $(objpfx)memusage
301@@ -91,7 +87,6 @@
302 # is to presume that the standard system headers will be ok for this file.
303 $(objpfx)memusagestat.o: sysincludes = # nothing
304 endif
305-endif
306
307 # Another goal which can be used to override the configure decision.
308 .PHONY: do-memusagestat
309diff -Naur glibc-2.5.orig/sunrpc/Makefile glibc-2.5/sunrpc/Makefile
310--- glibc-2.5.orig/sunrpc/Makefile 2006-11-23 23:07:52.000000000 -0500
311+++ glibc-2.5/sunrpc/Makefile 2006-11-23 23:08:09.000000000 -0500
312@@ -70,6 +70,9 @@
313 clnt_unix svc_unix create_xid xdr_intXX_t
314
315 others := rpcinfo
316+ifneq ($(cross-compiling),no)
317+others-native := rpcgen-native
318+endif
319 install-bin := rpcgen
320 install-sbin := rpcinfo
321 rpcgen-objs = rpc_main.o rpc_hout.o rpc_cout.o rpc_parse.o \
322@@ -98,15 +101,12 @@
323 $(resolvobjdir)/libresolv.a
324 endif
325
326-ifeq (no,$(cross-compiling))
327-# We can only build this library if we can run the rpcgen we build.
328 headers += $(rpcsvc:%.x=rpcsvc/%.h)
329 extra-libs := librpcsvc
330 extra-libs-others := librpcsvc # Make it in `others' pass, not `lib' pass.
331 librpcsvc-routines = $(rpcsvc:%.x=x%)
332 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
333 omit-deps = $(librpcsvc-routines)
334-endif
335
336 CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
337 CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag)
338@@ -136,13 +136,26 @@
339 $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
340 $(+link)
341
342+ifneq ($(cross-compiling),no)
343+rpcgen.c:
344+ touch rpcgen.c
345+
346+$(objpfx)rpcgen-native: $(addprefix $(objpfx),$(rpcgen-objs:%.o=%-native.o))
347+endif
348+
349 # This makes sure -DNOT_IN_libc is passed for all these modules.
350 cpp-srcs-left := $(rpcgen-objs:.o=.c)
351 lib := nonlib
352 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
353
354 # Tell rpcgen where to find the C preprocessor.
355+ifeq ($(cross-compiling),no)
356 rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
357+rpcgen = $(objpfx)rpcgen
358+else
359+rpcgen-cmd = CPP='$(CC) -E -x c-header' $(objpfx)rpcgen-native -Y ../scripts
360+rpcgen = $(objpfx)rpcgen-native
361+endif
362
363 # Install the rpc data base file.
364 $(inst_sysconfdir)/rpc: etc.rpc $(+force)
365@@ -153,7 +166,7 @@
366 # relinked.
367 $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
368 @:
369-$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen
370+$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(rpcgen)
371 $(make-target-directory)
372 -@rm -f ${@:stmp=T} $@
373 $(rpcgen-cmd) -h $< -o ${@:stmp=T}
374@@ -163,7 +176,7 @@
375 # Generate the rpcsvc XDR functions with rpcgen.
376 $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
377 @:
378-$(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
379+$(objpfx)x%.stmp: rpcsvc/%.x $(rpcgen)
380 -@rm -f ${@:stmp=T} $@
381 $(rpcgen-cmd) -c $< -o ${@:stmp=T}
382 $(move-if-change) $(@:stmp=T) $(@:stmp=c)
383diff -Naur glibc-2.5.orig/timezone/Makefile glibc-2.5/timezone/Makefile
384--- glibc-2.5.orig/timezone/Makefile 2006-11-23 23:07:53.000000000 -0500
385+++ glibc-2.5/timezone/Makefile 2006-11-23 23:08:09.000000000 -0500
386@@ -28,6 +28,9 @@
387 extra-objs := scheck.o ialloc.o
388
389 others := zdump zic
390+ifneq ($(cross-compiling),no)
391+others-native := zic-native
392+endif
393 tests := test-tz tst-timezone
394
395 tzbases := africa antarctica asia australasia europe northamerica \
396@@ -69,13 +72,10 @@
397 $(addprefix $(inst_zonedir)/, \
398 $(posixrules-file)))
399
400-ifeq ($(cross-compiling),no)
401-# Don't try to install the zoneinfo files since we can't run zic.
402 install-others = $(addprefix $(inst_zonedir)/,$(zonenames) \
403 $(zonenames:%=posix/%) \
404 $(zonenames:%=right/%)) \
405 $(installed-localtime-file) $(installed-posixrules-file)
406-endif
407
408 ifeq ($(have-ksh),yes)
409 install-others += $(inst_zonedir)/iso3166.tab $(inst_zonedir)/zone.tab
410@@ -128,7 +128,11 @@
411 # We have to use `-d $(inst_zonedir)' to explictly tell zic where to
412 # place the output files although $(zonedir) is compiled in. But the
413 # user might have set $(install_root) on the command line of `make install'.
414+ifeq ($(cross-compiling),no)
415 zic-cmd = $(built-program-cmd) -d $(inst_zonedir)
416+else
417+zic-cmd = $(common-objpfx)/timezone/zic-native -d $(inst_zonedir)
418+endif
419 tzcompile = $(zic-cmd)$(target-zone-flavor) -L $(word 3,$^) \
420 -y $(dir $(word 4,$^))$(notdir $(word 4,$^)) $<
421
422@@ -158,8 +162,10 @@
423 $(zic-cmd) -p $(posixrules)
424 endif
425
426-
427 $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
428+ifneq ($(cross-compiling),no)
429+$(objpfx)zic-native: $(objpfx)scheck-native.o $(objpfx)ialloc-native.o
430+endif
431
432 tz-cflags = -DTZDIR='"$(zonedir)"' \
433 -DTZDEFAULT='"$(localtime-file)"' \
Note: See TracBrowser for help on using the repository browser.