From dd037c390dea7ff828e201125b46b62fe4f94d88 Mon Sep 17 00:00:00 2001
From: Christian Wiese <chris@opensde.org>
Date: Mon, 29 Oct 2012 02:27:44 +0100
Subject: [PATCH] gcc: fixed cross build by explicitely setting the path to
 find build prerequisites only at toolchain stage

Note:

This reverts the changes done by following commit:
-----------------------------------------------------------------------------
commit 041df7170f384cb2e056529af1501e8459b49ce4
Author:     Christian Wiese <chris@opensde.org>
AuthorDate: Mon Aug 6 23:56:15 2012 +0200
Commit:     Christian Wiese <chris@opensde.org>
CommitDate: Tue Oct 23 00:25:40 2012 +0200

    gcc: changed to set locations of build prerequisites in all stages instead of toolchain stage only
-----------------------------------------------------------------------------

which badly broke the cross-build of gcc when using uclibc!
---
 base/gcc/gcc.conf | 50 +++++++++++++++++++++++------------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/base/gcc/gcc.conf b/base/gcc/gcc.conf
index 218b2cf4b..afff51ce7 100644
--- a/base/gcc/gcc.conf
+++ b/base/gcc/gcc.conf
@@ -136,31 +136,6 @@ if [ "$SDECFG_LIBC" = 'glibc' ]; then
 fi
 
 
-# build prerequisites
-var_append extraconfopt ' ' "--with-gmp=$( pkgprefix -r gmp )"
-var_append extraconfopt ' ' "--with-gmp-lib=$( pkgprefix -r libdir gmp )"
-var_append extraconfopt ' ' "--with-gmp-include=$( pkgprefix -r includedir gmp )"
-var_append extraconfopt ' ' "--with-mpfr=$( pkgprefix -r mpfr )"
-var_append extraconfopt ' ' "--with-mpfr-lib=$( pkgprefix -r libdir mpfr )"
-var_append extraconfopt ' ' "--with-mpfr-include=$( pkgprefix -r includedir mpfr )"
-var_append extraconfopt ' ' "--with-mpc=$( pkgprefix -r libmpc )"
-var_append extraconfopt ' ' "--with-mpc-lib=$( pkgprefix -r libdir libmpc )"
-var_append extraconfopt ' ' "--with-mpc-include=$( pkgprefix -r includedir libmpc )"
-
-# Graphite loop optimization
-if pkginstalled -f cloog && pkginstalled -f ppl; then
-	# use the cloog-isl backend
-	var_append extraconfopt ' ' "--enable-cloog-backend=isl"
-	var_append extraconfopt ' ' "--with-cloog=$( pkgprefix -r cloog )"
-	var_append extraconfopt ' ' "--with-cloog-lib=$( pkgprefix -r libdir cloog )"
-	var_append extraconfopt ' ' "--with-cloog-include=$( pkgprefix -r includedir cloog )"
-
-	# even when using the cloog-isl backend ppl is still needed to build gcc
-	var_append extraconfopt ' ' "--with-ppl=$( pkgprefix -r ppl )"
-	var_append extraconfopt ' ' "--with-ppl-lib=$( pkgprefix -r libdir ppl )"
-	var_append extraconfopt ' ' "--with-ppl-include=$( pkgprefix -r includedir ppl )"
-fi
-
 if atstage toolchain; then
 	bindir="/$prefix/crosscc"
 
@@ -175,7 +150,32 @@ if atstage toolchain; then
 	var_append confopt " " "--disable-libitm"
 
 	# use the native libraries we build in the toolchain directory
+	var_append extraconfopt ' ' "--with-gmp=$( pkgprefix -r gmp )"
+	var_append extraconfopt ' ' "--with-gmp-lib=$( pkgprefix -r libdir gmp )"
+	var_append extraconfopt ' ' "--with-gmp-include=$( pkgprefix -r includedir gmp )"
+	var_append extraconfopt ' ' "--with-mpfr=$( pkgprefix -r mpfr )"
+	var_append extraconfopt ' ' "--with-mpfr-lib=$( pkgprefix -r libdir mpfr )"
+	var_append extraconfopt ' ' "--with-mpfr-include=$( pkgprefix -r includedir mpfr )"
+	var_append extraconfopt ' ' "--with-mpc=$( pkgprefix -r libmpc )"
+	var_append extraconfopt ' ' "--with-mpc-lib=$( pkgprefix -r libdir libmpc )"
+	var_append extraconfopt ' ' "--with-mpc-include=$( pkgprefix -r includedir libmpc )"
+
 	export LDFLAGS="-Wl,-rpath,${root}${libdir}"
+
+fi
+
+# Graphite loop optimization
+if pkginstalled -f cloog && pkginstalled -f ppl; then
+	# use the cloog-isl backend
+	var_append extraconfopt ' ' "--enable-cloog-backend=isl"
+	var_append extraconfopt ' ' "--with-cloog=$( pkgprefix -r cloog )"
+	var_append extraconfopt ' ' "--with-cloog-lib=$( pkgprefix -r libdir cloog )"
+	var_append extraconfopt ' ' "--with-cloog-include=$( pkgprefix -r includedir cloog )"
+
+	# even when using the cloog-isl backend ppl is still needed to build gcc
+	var_append extraconfopt ' ' "--with-ppl=$( pkgprefix -r ppl )"
+	var_append extraconfopt ' ' "--with-ppl-lib=$( pkgprefix -r libdir ppl )"
+	var_append extraconfopt ' ' "--with-ppl-include=$( pkgprefix -r includedir ppl )"
 fi
 
 if atstage cross; then