This is the mail archive of the libc-alpha@sourceware.cygnus.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

install-headers fix for cross-compiling



Hi all,

Maciej forwarded me a patch to cross compiling glibc.  Here're his
comments:

 > 2. Install-headers -- fixes the "install-headers" target.  The following
 > problems are resolved:

 > - some headers that used to be installed by "install-others" are now
 > installed by "install-headers",

 > - "gnu/stubs.h" is build and installed as a part of "install-headers".

 >  This allows to perform a full installation of glibc headers that is
 > needed to bootstrap a cross-compiler.  The installation is not completely
 > straightforward, i.e. some kind of explanation could be added to docs, but
 > it is reasonably clean. 

 >  For a successful installation, you have to fake a native build when
 > configuring and then force cross-compilation on make's command line, as
 > follows:

 > $ ./configure --prefix=/usr/mipsel-linux --enable-add-ons=yes mipsel-linux
 > $ make cross-compiling=yes install-headers

 > These are basic examples.  Other options may be needed depending on the
 > configuration, for example when preparing some kind of packages.  You need
 > to set "cross-compiling" to "yes", because some headers within
 > include/rpcsvc are generated using rpcgen and this cannot be build when
 > cross-compiling (when performing "install-headers" natively, you may omit
 > "cross-compiling=yes" but then rpcgen will be compiled, which in turn will
 > make the whole libc to be build). 

Can this be added to glibc?  Or is there a better solution for the
problem?

Andreas

diff -u --recursive --new-file glibc-2.1.2.macro/Makefile glibc-2.1.2/Makefile
--- glibc-2.1.2.macro/Makefile	Mon Feb  8 12:14:02 1999
+++ glibc-2.1.2/Makefile	Mon Oct  4 13:26:17 1999
@@ -71,11 +71,11 @@
 vpath %.h $(subdir-dirs)
 
 # What to install.
-install-others = $(inst_includedir)/gnu/stubs.h
+install-headers: $(inst_includedir)/gnu/stubs.h
 install-bin = glibcbug
 
 ifeq (yes,$(build-shared))
-install-others += $(inst_includedir)/gnu/lib-names.h
+headers += gnu/lib-names.h
 endif
 
 include Makerules
@@ -84,6 +84,8 @@
 others: $(addprefix $(objpfx),$(install-bin))
 endif
 
+install-headers: install-headers-nosubdir
+
 # Install from subdirectories too.
 install: subdir_install
 
@@ -138,7 +140,7 @@
 # iterates over all the subdirs; subdir_install in each subdir depends on
 # the subdir's stubs file.  Having more direct dependencies would result in
 # extra iterations over the list for subdirs and many recursive makes.
-$(inst_includedir)/gnu/stubs.h: subdir_install
+$(inst_includedir)/gnu/stubs.h: $(addsuffix /install-headers,$(subdirs))
 	$(make-target-directory)
 	@rm -f $(objpfx)stubs.h
 	(echo '/* This file is automatically generated.';\
@@ -150,12 +152,6 @@
 	then echo 'stubs.h unchanged'; \
 	else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
 	rm -f $(objpfx)stubs.h
-
-ifeq (yes,$(build-shared))
-
-$(inst_includedir)/gnu/lib-names.h: $(common-objpfx)gnu/lib-names.h $(+force)
-	$(do-install)
-endif
 
 # The `glibcbug' script contains the version number and it shall be rebuild
 # whenever this changes or the `glibcbug.in' file.
diff -u --recursive --new-file glibc-2.1.2.macro/Makerules glibc-2.1.2/Makerules
--- glibc-2.1.2.macro/Makerules	Sun Aug  1 22:12:23 1999
+++ glibc-2.1.2/Makerules	Mon Oct  4 12:55:01 1999
@@ -832,7 +832,7 @@
 		       $(patsubst lib%.a,lib$(libprefix)%.a,$(install-lib.a)) \
 		       $(addprefix $(libprefix),$(install-lib-non.a)))
 install-data-nosubdir: $(addprefix $(inst_datadir)/,$(install-data))
-install-headers-nosubdir: $(addprefix $(inst_includedir)/,$(headers))
+install-headers-nosubdir: stubs $(addprefix $(inst_includedir)/,$(headers))
 install-others-nosubdir: $(install-others)
 
 # We need all the `-nosubdir' targets so that `install' in the parent
diff -u --recursive --new-file glibc-2.1.2.macro/db/Makefile glibc-2.1.2/db/Makefile
--- glibc-2.1.2.macro/db/Makefile	Mon Mar 22 01:14:47 1999
+++ glibc-2.1.2/db/Makefile	Mon Oct  4 11:08:38 1999
@@ -29,11 +29,13 @@
 
 include ../Makeconfig
 
-install-others	:= $(db1-headers:%=$(inst_includedir)/db1/%)
+install-db1-headers	:= $(db1-headers:%=$(inst_includedir)/db1/%)
 
 ifeq (yes,$(build-shared))
-install-others	+= $(inst_slibdir)/libdb.so$(libdb1.so-version)
+install-others	:= $(inst_slibdir)/libdb.so$(libdb1.so-version)
 endif
+
+install-headers-nosubdir: $(install-db1-headers)
 
 $(inst_slibdir)/libdb.so$(libdb1.so-version): $(inst_slibdir)/libdb1-$(version).so $(+force)
 	rm -f $@
diff -u --recursive --new-file glibc-2.1.2.macro/manual/Makefile glibc-2.1.2/manual/Makefile
--- glibc-2.1.2.macro/manual/Makefile	Mon Jan 18 09:23:38 1999
+++ glibc-2.1.2/manual/Makefile	Mon Oct  4 13:06:23 1999
@@ -153,7 +153,7 @@
 	-rm -f libc.log libc.aux libc.toc dir-add.texinfo
 	-rm -f top-menu.texi chapters.texi
 
-.PHONY: install subdir_install installdirs install-data
+.PHONY: install subdir_install installdirs install-data install-headers install-headers-nosubdir
 install-data subdir_install: install
 ifneq ($(strip $(MAKEINFO)),)
 # There are two variants of install-info out there.  The GNU version
@@ -178,6 +178,8 @@
 	else : ; fi
 endif
 endif
+install-headers: install-headers-nosubdir
+install-headers-nosubdir: stubs
 # Catchall implicit rule for other installation targets from the parent.
 install-%: ;
 
diff -u --recursive --new-file glibc-2.1.2.macro/stdio-common/Makefile glibc-2.1.2/stdio-common/Makefile
--- glibc-2.1.2.macro/stdio-common/Makefile	Sun Feb 14 20:03:38 1999
+++ glibc-2.1.2/stdio-common/Makefile	Mon Oct  4 20:57:25 1999
@@ -38,7 +38,7 @@
 
 include ../Makeconfig
 
-install-others := $(inst_includedir)/bits/stdio_lim.h
+install-headers-nosubdir: $(inst_includedir)/bits/stdio_lim.h
 
 aux	:= errlist siglist
 distribute := _itoa.h printf-parse.h stdio_lim.h.in
diff -u --recursive --new-file glibc-2.1.2.macro/sysdeps/unix/sysv/linux/Makefile glibc-2.1.2/sysdeps/unix/sysv/linux/Makefile
--- glibc-2.1.2.macro/sysdeps/unix/sysv/linux/Makefile	Sun May 16 08:52:11 1999
+++ glibc-2.1.2/sysdeps/unix/sysv/linux/Makefile	Mon Oct  4 20:56:26 1999
@@ -19,7 +19,7 @@
 		  scsi/sg.h scsi/scsi.h sys/pci.h sys/ultrasound.h \
 		  sys/sendfile.h
 
-install-others += $(inst_includedir)/bits/syscall.h
+install-headers-nosubdir: $(inst_includedir)/bits/syscall.h
 
 # Generate the list of SYS_* macros for the system calls (__NR_* macros).
 $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
-- 
 Andreas Jaeger   
  SuSE Labs aj@suse.de	
   private aj@arthur.rhein-neckar.de

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]