local-bootstrap-headers
authorGNU Libc Maintainers <debian-glibc@lists.debian.org>
Mon, 13 Jul 2020 19:34:17 +0000 (20:34 +0100)
committerAurelien Jarno <aurel32@debian.org>
Mon, 13 Jul 2020 19:34:17 +0000 (20:34 +0100)
Taken from EGLIBC, r1484 + r1525

2018-03-09  Aurelien Jarno <aurelien@aurel32.net>

* Makefile (install-headers): Amend to install gnu/lib-names-$abi.h.

2014-07-30  Helmut Grohne <helmut@subdivi.de>

* With the advent of multilib gnu/stubs.h became a meta-header that
includes the correct stubs-$abi.h. So install gnu/stubs.h as usual
and install stubs-bootstrap.h as gnu/stubs-$abi.h

2007-02-20  Jim Blandy  <jimb@codesourcery.com>

* Makefile (install-headers): Preserve old behavior: depend on
$(inst_includedir)/gnu/stubs.h only if install-bootstrap-headers
is set; otherwise, place gnu/stubs.h on the 'install-others' list.

2007-02-16  Jim Blandy  <jimb@codesourcery.com>

        * 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.

Gbp-Pq: Topic any
Gbp-Pq: Name local-bootstrap-headers.diff

Makefile
include/stubs-bootstrap.h [new file with mode: 0644]

index 8f0a93aceb824e556f519847d322cbe5ee5eec7d..d76aceafaf0bfe0d21e4db4727ab049c0c2fd5ce 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -434,6 +434,14 @@ $(inst_includedir)/gnu/stubs.h: $(+force)
 install-others-nosubdir: $(installed-stubs)
 endif
 
+# If we're bootstrapping, install a dummy gnu/stubs.h along with the
+# other headers, so 'make install-headers' produces a useable include
+# tree.  Otherwise, install gnu/stubs.h later, after the rest of the
+# build is done.
+ifeq ($(install-bootstrap-headers),yes)
+install-headers: $(inst_includedir)/gnu/stubs.h $(installed-stubs) \
+                $(inst_includedir)/$(lib-names-h-abi)
+endif
 
 # Since stubs.h is never needed when building the library, we simplify the
 # hairy installation process by producing it in place only as the last part
@@ -441,6 +449,14 @@ endif
 # 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.
+ifeq ($(install-bootstrap-headers),yes)
+# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o
+# files in GLIBC.  For bootstrapping a GCC/GLIBC pair, an empty
+# gnu/stubs.h is good enough.
+$(installed-stubs): include/stubs-bootstrap.h $(+force)
+       $(make-target-directory)
+       $(INSTALL_DATA) $< $@
+else
 $(installed-stubs): include/stubs-prologue.h subdir_install
        $(make-target-directory)
        @rm -f $(objpfx)stubs.h
@@ -449,6 +465,7 @@ $(installed-stubs): include/stubs-prologue.h subdir_install
        then echo 'stubs.h unchanged'; \
        else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi
        rm -f $(objpfx)stubs.h
+endif
 \f
 # This makes the Info or DVI file of the documentation from the Texinfo source.
 .PHONY: info dvi pdf html
diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h
new file mode 100644 (file)
index 0000000..8d96201
--- /dev/null
@@ -0,0 +1,12 @@
+/* Placeholder stubs.h file for bootstrapping.
+
+   When bootstrapping a GCC/GLIBC pair, GCC requires that the GLIBC
+   headers be installed, but we can't fully build GLIBC 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
+   GLIBC subdir 'stubs' make targets, on every .o file in GLIBC, but
+   an empty stubs.h like this will do fine for GCC.  */