changeset 807:d0b74a631587 0.9.7

Teach ccwrap.c to use arch-specific WRAPPER_TOPDIR values, to avoid interfering with canadian cross.
author Rob Landley <rob@landley.net>
date Fri, 14 Aug 2009 06:01:38 -0500
parents 78b05421aa9d
children cce6b8e81581
files root-filesystem.sh sources/toys/ccwrap.c
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/root-filesystem.sh	Thu Aug 13 20:58:15 2009 -0500
+++ b/root-filesystem.sh	Fri Aug 14 06:01:38 2009 -0500
@@ -197,7 +197,7 @@
 # Tell future packages to link against the libraries in the new root filesystem,
 # rather than the ones in the cross compiler directory.
 
-export WRAPPER_TOPDIR="$ROOT_TOPDIR"
+export ${ARCH}_WRAPPER_TOPDIR="$ROOT_TOPDIR"
 
 # Build and install uClibc++
 
--- a/sources/toys/ccwrap.c	Thu Aug 13 20:58:15 2009 -0500
+++ b/sources/toys/ccwrap.c	Fri Aug 14 06:01:38 2009 -0500
@@ -157,7 +157,7 @@
 	else toolprefix++;
 
 	prefixlen = strlen(toolprefix);
-	if (!strcmp(toolprefix+prefixlen-3, "gcc")) prefixlen -= 3;
+	if (prefixlen>=3 && !strcmp(toolprefix+prefixlen-3, "gcc")) prefixlen -= 3;
 	else if (!strcmp(toolprefix+prefixlen-2, "cc")) prefixlen -= 2;
 	else if (!strcmp(toolprefix+prefixlen-2, "ld")) {
 		prefixlen -= 2;
@@ -175,6 +175,16 @@
 	}
 
 	devprefix = getenv("WRAPPER_TOPDIR");
+	if (!devprefix) {
+		char *temp, *temp2;
+		xasprintf(&temp, "%.*sWRAPPER_TOPDIR", prefixlen, toolprefix);
+		temp2 = temp;
+		while (*temp2) {
+			if (*temp2 == '-') *temp2='_';
+			temp2++;
+		}
+		devprefix = getenv(temp);
+	}
 	if (!devprefix) devprefix = topdir;
 
 	incstr = getenv("UCLIBC_GCC_INC");