crosstool common source patch

Carl Miller chaz@energoncube.net
Mon Nov 24 19:37:00 GMT 2003


OK, I did a fresh unpack of crosstool-0.25, applied this patch, and got a
clean build with a common source tree that can be shared among multiple
targets.  I prepopulated the source tree with some of the components, but
not others.  It downloaded the missing ones, unpacked them into the shared
source tree, and accepted the others as is.

Not exactly rigorous testing, but I'm confident enough to pass it around
and have others subject it to a better pounding now.  Enjoy!

Still working on the uClibc patch.  I think as a first pass, I'm going to
do it with the added link_os_uclibc: spec I described earlier.  The uClibc
configure process is such a mess that I'm going to try to stay out of that
as much as possible for now.


                            -----Carl
-------------- next part --------------
--- ../../crosstool-0.25/crosstool.sh	2003-11-14 08:02:20.000000000 -0800
+++ ./crosstool.sh	2003-11-24 10:48:08.000000000 -0800
@@ -59,13 +59,18 @@
     *) abort "Bad target $TARGET"
 esac
 
+# Check if our source directories aren't based off of .
+if test -n "${COMMON_SOURCE}"; then
+   echo ${COMMON_SOURCE} | grep -q '\/$' || COMMON_SOURCE=${COMMON_SOURCE}/
+fi
+
 # Make all paths absolute (it's so confusing otherwise)
 # FIXME: this doesn't work well with some automounters
-PREFIX=`cd $PREFIX; pwd`
-BINUTILS_DIR=`cd $BINUTILS_DIR; pwd`
-GCC_DIR=`cd $GCC_DIR; pwd`
-LINUX_DIR=`cd $LINUX_DIR; pwd`
-GLIBC_DIR=`cd $GLIBC_DIR; pwd`
+PREFIX=`cd ${PREFIX}; pwd`
+BINUTILS_DIR=`cd ${COMMON_SOURCE}${BINUTILS_DIR}; pwd`
+GCC_DIR=`cd ${COMMON_SOURCE}${GCC_DIR}; pwd`
+LINUX_DIR=`cd ${COMMON_SOURCE}${LINUX_DIR}; pwd`
+GLIBC_DIR=`cd ${COMMON_SOURCE}${GLIBC_DIR}; pwd`
 
 # make sure the build product's binaries are in the search path
 PATH="${PREFIX}/bin:${PATH}"
--- ../../crosstool-0.25/getandpatch.sh	2003-10-27 19:19:47.000000000 -0800
+++ ./getandpatch.sh	2003-11-24 11:06:52.000000000 -0800
@@ -30,14 +30,21 @@
 	ARCHIVE_NAME=`echo $1 | sed 's,.*/,,;'`
         BASENAME=`echo $ARCHIVE_NAME | sed 's,\.tar\.gz$,,;s,\.tar\.bz2$,,;'`
 	ZIP_METHOD=`echo $ARCHIVE_NAME | sed 's,.*\.tar\.,,;'`
-	cd $TARBALLS_DIR
+
+	# If using a common source directory tree, check for it there first
+	test -n "$COMMON_SOURCE" && test -d ${COMMON_SOURCE}/${BASENAME} && return 0
 
 	# Download if not present
 	# FIXME: supposedly red hat 9's wget can't fetch from gnu.org.  passive needed?
+	cd $TARBALLS_DIR
 	test -f $ARCHIVE_NAME || wget -c $1
-	test -f $ARCHIVE_NAME || { echo "file $ARCHIVE_NAME not found"; return 1 ; }
+	test -f $ARCHIVE_NAME || { echo "file $ARCHIVE_NAME not found"; cd $TOP_DIR ; return 1 ; }
 
-	cd $BUILD_DIR
+	if test -z "${COMMON_SOURCE}"; then
+	    cd $BUILD_DIR
+	else
+	    cd $COMMON_SOURCE
+	fi
 
 	# unpack unconditionally
 	rm -rf $BASENAME
@@ -80,7 +87,11 @@
 	test -f $ARCHIVE_NAME || wget -c $1
 	test -f $ARCHIVE_NAME || { echo "file $ARCHIVE_NAME not found"; return 1 ; }
 
-	cd $BUILD_DIR/$GLIBC_DIR
+	if test -z "${COMMON_SOURCE}"; then
+	    cd $BUILD_DIR/$GLIBC_DIR
+	else
+	    cd $COMMON_SOURCE/$GLIBC_DIR
+	fi
 
 	if test $ZIP_METHOD = "gz" ; then
 	    tar -xzvf $TARBALLS_DIR/$ARCHIVE_NAME || abort cannot unpack $TARBALLS_DIR/$ARCHIVE_NAME
@@ -126,4 +138,8 @@
 getGlibcAddon     ftp://ftp.gnu.org/pub/gnu/glibc/$GLIBCTHREADS_FILENAME.tar.bz2 || getGlibcAddon ftp://ftp.gnu.org/pub/gnu/glibc/$GLIBCTHREADS_FILENAME.tar.gz
 
 # gcc's contrib/test_summary expects version stamp, normally created by contrib/update_gcc
-test -f $BUILD_DIR/$GCC_DIR/LAST_UPDATED || echo $GCC_DIR > $BUILD_DIR/$GCC_DIR/LAST_UPDATED
+if test -z "${COMMON_SOURCE}"; then
+    test -f $BUILD_DIR/$GCC_DIR/LAST_UPDATED || echo $GCC_DIR > $BUILD_DIR/$GCC_DIR/LAST_UPDATED
+else
+    test -f $COMMON_SOURCE/$GCC_DIR/LAST_UPDATED || echo $GCC_DIR > $COMMON_SOURCE/$GCC_DIR/LAST_UPDATED
+fi

-------------- next part --------------
------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


More information about the crossgcc mailing list