[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commits] r6048 - in /branches/eglibc-2_8/libc: ChangeLog.eglibc sunrpc/Makefile sunrpc/proto.h



Author: maxim
Date: Fri Apr 25 04:18:04 2008
New Revision: 6048

Log:
	Backport:
	2008-04-25  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
	Cross-rpcgen.
	* sunrpc/Makefile: Make librpcsvc.a built when cross-building.
	Build cross-rpcgen for $build when cross-building.
	* sunrpc/proto.h: Define stuff for cross-building.

Modified:
    branches/eglibc-2_8/libc/ChangeLog.eglibc
    branches/eglibc-2_8/libc/sunrpc/Makefile
    branches/eglibc-2_8/libc/sunrpc/proto.h

Modified: branches/eglibc-2_8/libc/ChangeLog.eglibc
==============================================================================
--- branches/eglibc-2_8/libc/ChangeLog.eglibc (original)
+++ branches/eglibc-2_8/libc/ChangeLog.eglibc Fri Apr 25 04:18:04 2008
@@ -1,3 +1,12 @@
+2008-04-25  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
+
+	Backport:
+	2008-04-25  Maxim Kuvyrkov  <maxim@xxxxxxxxxxxxxxxx>
+	Cross-rpcgen.
+	* sunrpc/Makefile: Make librpcsvc.a built when cross-building.
+	Build cross-rpcgen for $build when cross-building.
+	* sunrpc/proto.h: Define stuff for cross-building.
+
 2008-04-15  Joseph Myers  <joseph@xxxxxxxxxxxxxxxx>
 
 	* sysdeps/unix/sysv/linux/configure: Regenerate.

Modified: branches/eglibc-2_8/libc/sunrpc/Makefile
==============================================================================
--- branches/eglibc-2_8/libc/sunrpc/Makefile (original)
+++ branches/eglibc-2_8/libc/sunrpc/Makefile Fri Apr 25 04:18:04 2008
@@ -105,9 +105,7 @@
 	     $(resolvobjdir)/libresolv.a
 endif
 
-ifeq (no,$(cross-compiling))
 ifneq (yes,$(install-bootstrap-headers))
-# We can only build this library if we can run the rpcgen we build.
 headers += $(rpcsvc:%.x=rpcsvc/%.h)
 extra-libs-$(OPTION_EGLIBC_SUNRPC) += librpcsvc
 # Make it in `others' pass, not `lib' pass.
@@ -115,7 +113,6 @@
 librpcsvc-routines = $(rpcsvc:%.x=x%)
 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
 omit-deps = $(librpcsvc-routines)
-endif
 endif
 
 CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
@@ -146,13 +143,30 @@
   $(addprefix $(csu-objpfx),start.o) $(+preinit) $(+postinit)
 	$(+link)
 
+$(addprefix $(objpfx)cross-,$(rpcgen-objs)): $(objpfx)cross-%.o: %.c
+	gcc $< -c -D_RPC_THREAD_SAFE_ -D_CROSS_RPCGEN_ \
+		$(OUTPUT_OPTION) $(compile-mkdep-flags)
+
+$(objpfx)cross-rpcgen: $(addprefix $(objpfx)cross-,$(rpcgen-objs))
+	gcc $^ -o $@
+
 # This makes sure -DNOT_IN_libc is passed for all these modules.
 cpp-srcs-left := $(rpcgen-objs:.o=.c)
 lib := nonlib
 include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
 
+ifeq (no,$(cross-compiling))
 # Tell rpcgen where to find the C preprocessor.
 rpcgen-cmd = CPP='$(CC) -E -x c-header' $(built-program-cmd) -Y ../scripts
+# Depend rpcsvc headers and sources on rpcgen.
+rpcgen-dep = $(objpfx)rpcgen
+else
+# Tell rpcgen where to find the C preprocessor.
+rpcgen-cmd = CPP='$(CC) -E -x c-header' $(objpfx)cross-rpcgen -Y ../scripts
+# Depend rpcsvc headers and sources on cross-rpcgen and rpcgen (to trigger
+# its build).
+rpcgen-dep = $(objpfx)rpcgen $(objpfx)cross-rpcgen
+endif
 
 # Install the rpc data base file.
 $(inst_sysconfdir)/rpc: etc.rpc $(+force)
@@ -163,7 +177,7 @@
 # relinked.
 $(rpcsvc:%.x=$(objpfx)rpcsvc/%.h): $(objpfx)rpcsvc/%.h: $(objpfx)rpcsvc/%.stmp
 	@:
-$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(objpfx)rpcgen
+$(objpfx)rpcsvc/%.stmp: rpcsvc/%.x $(rpcgen-dep)
 	$(make-target-directory)
 	-@rm -f ${@:stmp=T} $@
 	$(rpcgen-cmd) -h $< -o ${@:stmp=T}
@@ -173,7 +187,7 @@
 # Generate the rpcsvc XDR functions with rpcgen.
 $(rpcsvc:%.x=$(objpfx)x%.c): $(objpfx)x%.c: $(objpfx)x%.stmp
 	@:
-$(objpfx)x%.stmp: rpcsvc/%.x $(objpfx)rpcgen
+$(objpfx)x%.stmp: rpcsvc/%.x $(rpcgen-dep)
 	-@rm -f ${@:stmp=T} $@
 	$(rpcgen-cmd) -c $< -o ${@:stmp=T}
 	$(move-if-change) $(@:stmp=T) $(@:stmp=c)

Modified: branches/eglibc-2_8/libc/sunrpc/proto.h
==============================================================================
--- branches/eglibc-2_8/libc/sunrpc/proto.h (original)
+++ branches/eglibc-2_8/libc/sunrpc/proto.h Fri Apr 25 04:18:04 2008
@@ -50,3 +50,24 @@
 void tabify(FILE *f, int tab);
 char *make_argname(const char *pname, const char *vname);
 void add_type(int len, const char *type);
+
+/* This header is the last one included in all rpc_*.c files,
+   so we define stuff for cross-rpcgen here to avoid conflicts with
+   $build's C library and $host's GLIBC.  */
+#ifdef _CROSS_RPCGEN_
+
+/* Rather then defining _GNU_SOURCE before including $build's <string.h>
+   we just declare stpcpy here.  */
+extern char *stpcpy (char *, const char *);
+
+/* Use $build's i18n support as we can't use $host's.  */
+#define _(X) (gettext (X))
+
+/* rpcgen sources check for __GNU_LIBRARY__ to tweak for GLIBC code
+   that rpcgen generates.  The proper fix would be to rename all those checks
+   to something like '#if defined(TWEAK_FOR_GLIBC) || 1'.  */
+#ifndef __GNU_LIBRARY__
+#define __GNU_LIBRARY__
+#endif
+
+#endif