source: clfs-sysroot/patches/glibc-2.8-cross_hacks-1.patch@ 0e17eae

Last change on this file since 0e17eae was cf77be8, checked in by Joe Ciccone <jciccone@…>, 16 years ago

Update patch to fix compilation problem.

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