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

[patches] RFA: Make 'install-headers' more useful for cross-compilation



These changes simplify the task of building a cross GCC/GLIBC pair.
The ChangeLog entry should say what needs to be said:

2007-02-13  Jim Blandy  <jimb@xxxxxxxxxxxxxxxx>

	* Makefile: Amend make install-headers to install everything
	necessary for building a cross-compiler.  Install gnu/stubs.h as
	part of 'install-headers', not 'install-others'.
	If install-bootstrap-headers is 'yes', install a dummy copy of
	gnu/stubs.h, instead of computing the real thing.
	* include/stubs-bootstrap.h: New file.
	* sysdeps/unix/sysv/linux/Makefile: Install bits/syscall.h as part
	of 'install-headers' not 'install-others'.
	* stdio-common/Makefile: Similarly for bits/stdio_lim.h.
	* sunrpc/Makefile: Don't install generated headers if
	install-bootstrap-headers is 'yes'.

Index: Makefile
===================================================================
--- Makefile	(revision 1452)
+++ Makefile	(working copy)
@@ -78,7 +78,7 @@
 vpath %.h $(subdir-dirs)
 
 # What to install.
-install-others = $(inst_includedir)/gnu/stubs.h
+install-headers: $(inst_includedir)/gnu/stubs.h
 install-bin-script =
 
 ifeq (yes,$(build-shared))
@@ -158,6 +158,16 @@
 
 subdir-stubs := $(foreach dir,$(subdirs),$(common-objpfx)$(dir)/stubs)
 
+# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o
+# files in EGLIBC.  For bootstrapping a GCC/EGLIBC pair, an empty
+# gnu/stubs.h is good enough.
+ifeq ($(install-bootstrap-headers),yes)
+$(inst_includedir)/gnu/stubs.h: include/stubs-bootstrap.h $(+force)
+	$(make-target-directory)
+	$(INSTALL_DATA) $< $@
+
+installed-stubs = 
+else 
 ifeq ($(biarch),no)
 installed-stubs = $(inst_includedir)/gnu/stubs.h
 else
@@ -169,6 +179,7 @@
 
 install-others-nosubdir: $(installed-stubs)
 endif
+endif
 
 
 # Since stubs.h is never needed when building the library, we simplify the
Index: include/stubs-bootstrap.h
===================================================================
--- include/stubs-bootstrap.h	(revision 0)
+++ include/stubs-bootstrap.h	(revision 0)
@@ -0,0 +1,12 @@
+/* Placeholder stubs.h file for bootstrapping.
+
+   When bootstrapping a GCC/EGLIBC pair, GCC requires that the EGLIBC
+   headers be installed, but we can't fully build EGLIBC without that
+   GCC.  So we run the command:
+
+      make install-headers install-bootstrap-headers=yes
+
+   to install the headers GCC needs, but avoid building certain
+   difficult headers.  The <gnu/stubs.h> header depends, via the
+   EGLIBC subdir 'stubs' make targets, on every .o file in EGLIBC, but
+   an empty stubs.h like this will do fine for GCC.  */
Index: sysdeps/unix/sysv/linux/Makefile
===================================================================
--- sysdeps/unix/sysv/linux/Makefile	(revision 1452)
+++ sysdeps/unix/sysv/linux/Makefile	(working copy)
@@ -26,7 +26,7 @@
 		  sys/ultrasound.h sys/raw.h sys/personality.h sys/epoll.h \
 		  bits/a.out.h sys/inotify.h
 
-install-others += $(inst_includedir)/bits/syscall.h
+install-headers-nosubdir: $(inst_includedir)/bits/syscall.h
 
 tests += tst-clone
 
Index: stdio-common/Makefile
===================================================================
--- stdio-common/Makefile	(revision 1452)
+++ stdio-common/Makefile	(working copy)
@@ -36,10 +36,10 @@
 	remove rename renameat						      \
 	flockfile ftrylockfile funlockfile
 
-install-others = $(inst_includedir)/bits/stdio_lim.h
-
 include ../Makeconfig
 
+install-headers-nosubdir: $(inst_includedir)/bits/stdio_lim.h
+
 aux	:= errlist siglist printf-parsemb printf-parsewc fxprintf
 distribute := _itoa.h _itowa.h _i18n_number.h \
 	      printf-parse.h stdio_lim.h.in tst-unbputc.sh tst-printf.sh
Index: sunrpc/Makefile
===================================================================
--- sunrpc/Makefile	(revision 1452)
+++ sunrpc/Makefile	(working copy)
@@ -99,6 +99,7 @@
 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 := librpcsvc
@@ -107,6 +108,7 @@
 librpcsvc-inhibit-o = .os # Build no shared rpcsvc library.
 omit-deps = $(librpcsvc-routines)
 endif
+endif
 
 CFLAGS-xbootparam_prot.c = -Wno-unused $(PIC-ccflag)
 CFLAGS-xnlm_prot.c = -Wno-unused $(PIC-ccflag)