1.1 --- a/patches/gcc/3.3.6/100-fix-fixincl.patch Wed Oct 28 12:03:38 2009 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,70 +0,0 @@
1.4 -See http://gcc.gnu.org/PR22541
1.5 -
1.6 -From: Dan Kegel
1.7 -
1.8 -When building gcc-3.4.3 or gcc-4.0.0 as a cross into a clean $PREFIX
1.9 -(the only two I've tried like this), the configure script happily copies
1.10 -the glibc include files from include to sys-include; here's the line
1.11 -from the log file (with $PREFIX instead of the real prefix):
1.12 -
1.13 -Copying $PREFIX/i686-unknown-linux-gnu/include to $PREFIX/i686-unknown-linux-gnu/sys-include
1.14 -
1.15 -But later, when running fixincludes, it gives the error message
1.16 - The directory that should contain system headers does not exist:
1.17 - $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/../../../../i686-unknown-linux-gnu/sys-include
1.18 -
1.19 -Nevertheless, it continues building; the header files it installs in
1.20 - $PREFIX/lib/gcc/i686-unknown-linux-gnu/3.4.3/include
1.21 -do not include the boilerplate that would cause it to #include_next the
1.22 -glibc headers in the system header directory.
1.23 -Thus the resulting toolchain can't compile the following program:
1.24 -#include <limits.h>
1.25 -int x = PATH_MAX;
1.26 -because its limits.h doesn't include the glibc header.
1.27 -
1.28 -That's not nice. I suspect the problem is that gcc/Makefile.in assumes that
1.29 -it can refer to $PREFIX/i686-unknown-linux-gnu with the path
1.30 - $PREFIX/lib/../i686-unknown-linux-gnu, but
1.31 -that fails because the directory $PREFIX/lib doesn't exist during 'make all';
1.32 -it is only created later, during 'make install'. (Which makes this problem
1.33 -confusing, since one only notices the breakage well after 'make install',
1.34 -at which point the path configure complained about does exist, and has the
1.35 -right stuff in it.)
1.36 -
1.37 -A possible fix is to replace the line in gcc/Makefile.in that says
1.38 - SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
1.39 -with a version that gets rid of extra ..'s, e.g.
1.40 - SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,,;ta"`
1.41 -(hey, that's the first time I've ever used a label in a sed script; thanks to the sed faq
1.42 -for explaining the :a ... ta method of looping to repeat a search-and-replace until it doesn't match.)
1.43 -
1.44 -
1.45 ---- gcc-3.4.3/gcc/Makefile.in.foo 2005-05-20 11:41:39.000000000 -0700
1.46 -+++ gcc-3.4.3/gcc/Makefile.in 2005-05-20 12:08:46.000000000 -0700
1.47 -@@ -350,7 +350,10 @@
1.48 - CROSS_SYSTEM_HEADER_DIR = @CROSS_SYSTEM_HEADER_DIR@
1.49 -
1.50 - # autoconf sets SYSTEM_HEADER_DIR to one of the above.
1.51 --SYSTEM_HEADER_DIR = @SYSTEM_HEADER_DIR@
1.52 -+# Purge it of unneccessary internal relative paths
1.53 -+# to directories that might not exist yet.
1.54 -+# The sed idiom for this is to repeat the search-and-replace until it doesn't match, using :a ... ta.
1.55 -+SYSTEM_HEADER_DIR = `echo @SYSTEM_HEADER_DIR@ | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`
1.56 -
1.57 - # Control whether to run fixproto and fixincludes.
1.58 - STMP_FIXPROTO = @STMP_FIXPROTO@
1.59 -@@ -2532,11 +2535,13 @@
1.60 - $(SHELL) ${srcdir}/mkinstalldirs $(DESTDIR)$(gcc_tooldir)
1.61 -
1.62 - # Build fixed copies of system files.
1.63 -+# Abort if no system headers available, unless building a crosscompiler.
1.64 -+# FIXME: abort unless building --without-headers would be more accurate and less ugly
1.65 - stmp-fixinc: fixinc.sh gsyslimits.h
1.66 - @if test ! -d ${SYSTEM_HEADER_DIR}; then \
1.67 - echo The directory that should contain system headers does not exist: >&2 ; \
1.68 - echo " ${SYSTEM_HEADER_DIR}" >&2 ; \
1.69 -- if test "x${SYSTEM_HEADER_DIR}" = "x${gcc_tooldir}/sys-include"; \
1.70 -+ if test "x${SYSTEM_HEADER_DIR}" = "x`echo "${gcc_tooldir}/sys-include" | sed -e :a -e "s,[^/]*/\.\.\/,," -e ta`"; \
1.71 - then sleep 1; else exit 1; fi; \
1.72 - fi
1.73 - rm -rf include; mkdir include