- cd $(DIR_SRC) && tar jxf $(DIR_DL)/gcc-g++-$(VER).tar.bz2
- # fix a macro in gcc3.3.3 hurting gcc4.x !
- cd $(DIR_APP) && sed -i "s/\*((void \*\*)__o.*;/*((void **)__o->next_free) = ((void *)datum); __o->next_free += sizeof(void *);/" include/obstack.h
- cd $(DIR_APP) && patch -Np1 < $(DIR_DL)/gcc-3.3-ssp-4.patch
- cd $(DIR_APP) && sed -i -e 's|^\(LIBGCC2_CFLAGS.*\)$$|\1 -D_LIBC_PROVIDES_SSP_|' gcc/Makefile.in
-ifeq "$(ROOT)" ""
- cd $(DIR_APP) && patch -Np1 < $(DIR_DL)/$(THISAPP)-no_fixincludes-1.patch
-else
-ifeq "$(LFS_PASS)" "2"
- cd $(DIR_APP) && patch -Np1 < $(DIR_DL)/$(THISAPP)-no_fixincludes-1.patch
- cd $(DIR_APP) && patch -Np1 < $(DIR_DL)/$(THISAPP)-specs-1.patch
+ @mkdir $(DIR_SRC)/gcc-build
+
+ # Apply patches.
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-build-id.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-c++-builtin-redecl.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-i386-libgomp.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-libtool-no-rpath.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-no-add-needed.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-pr33763.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh330771.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh533181.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-rh610785.patch
+ cd $(DIR_APP) && patch -Np0 < $(DIR_SRC)/src/patches/gcc/gcc44-unwind-debug-hook.patch
+
+ # texinfo 5 syntax-fixes
+ cd $(DIR_APP) && patch -Np1 < $(DIR_SRC)/src/patches/gcc-4.4.7-texinfo-5.patch
+
+ifneq "$(ROOT)" ""
+ # Build gmp and mpfr internally in toolchain.
+ cd $(DIR_APP) && tar xfa $(DIR_DL)/gmp-$(GMP_VER).tar.bz2
+ cd $(DIR_APP) && mv -v gmp-$(GMP_VER) gmp
+ cd $(DIR_APP) && tar xfa $(DIR_DL)/mpfr-$(MPFR_VER).tar.bz2
+ cd $(DIR_APP) && mv -v mpfr-$(MPFR_VER) mpfr
+
+ifeq "$(PASS)" "1"
+ # GCC does not detect stack protection correctly, which causes problems
+ # for the build of libresolv_pic.a.
+ cd $(DIR_APP) && sed -i '/k prot/agcc_cv_libc_provides_ssp=yes' gcc/configure