[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r6047 - in /trunk/libc: ChangeLog.eglibc sunrpc/Makefile sunrpc/proto.h
- To: commits@xxxxxxxxxx
- Subject: [commits] r6047 - in /trunk/libc: ChangeLog.eglibc sunrpc/Makefile sunrpc/proto.h
- From: maxim@xxxxxxxxxx
- Date: Fri, 25 Apr 2008 11:12:06 -0000
Author: maxim
Date: Fri Apr 25 04:12:05 2008
New Revision: 6047
Log:
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:
trunk/libc/ChangeLog.eglibc
trunk/libc/sunrpc/Makefile
trunk/libc/sunrpc/proto.h
Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Fri Apr 25 04:12:05 2008
@@ -1,3 +1,11 @@
+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: trunk/libc/sunrpc/Makefile
==============================================================================
--- trunk/libc/sunrpc/Makefile (original)
+++ trunk/libc/sunrpc/Makefile Fri Apr 25 04:12:05 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: trunk/libc/sunrpc/proto.h
==============================================================================
--- trunk/libc/sunrpc/proto.h (original)
+++ trunk/libc/sunrpc/proto.h Fri Apr 25 04:12:05 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