Minor crosstool followup patch

Carl Miller chaz@energoncube.net
Sat Dec 20 00:27:00 GMT 2003


Dan:  Minor followup patch to crosstool; addendum to my big patchset
earlier in the week.  Addresses just a few minor things I ran across
as I built the final, production compiler toolchain for my project.


                            -----Carl

-------------- next part --------------
Coupla minor things:
  1) Give the user the option of not nuking $PREFIX before building and
     installing.  $PREFIX may be shared across many targets; everything
     not under $PREFIX/$TARGET has its filename prefixed with $TARGET,
     supposedly.  Maybe just nuke $PREFIX/$TARGET in the future?
  2) If only a C compiler was built, only test compiling C.
  3) Correct the test for only building a C compiler.  Configure doesn't
     understand quotes, so we shouldn't be looking for them.
  4) Put ${GCC_EXTRA_CONFIG} last on the configure line so it can override
     contrary options specified directly in crosstool.  (Dan: is this
     necessary???)

Index: all.sh
===================================================================
RCS file: /home/cvs/tools/crosstool-0.25/all.sh,v
retrieving revision 1.2
diff -d -u -r1.2 all.sh
--- crosstool-0.25/all.sh	18 Dec 2003 02:57:06 -0000	1.2
+++ crosstool-0.25/all.sh	19 Dec 2003 23:55:57 -0000
@@ -83,8 +83,10 @@
 
 if test "$opt_no_build" = ""; then
     # Build
-    rm  -rf  $PREFIX
-    mkdir -p $PREFIX
+    if test -z "$PREFIX_NO_REMOVE"; then
+        rm  -rf  $PREFIX
+        mkdir -p $PREFIX
+    fi
     mkdir -p $BUILD_DIR
     cd $BUILD_DIR
     sh $TOP_DIR/crosstool.sh
@@ -90,8 +92,12 @@
     sh $TOP_DIR/crosstool.sh
     cd $TOP_DIR
 
+    if echo "$GCC_EXTRA_CONFIG" | \
+            egrep -- "--with-languages=c( |	|\$)"; then
+        TEST_HELLO_OPTS="--c-only";
+    fi
     # Cute little compile test
-    sh testhello.sh
+    sh testhello.sh $TEST_HELLO_OPTS
 fi
 
 if test "$opt_builduserland" = "1"; then
Index: crosstool.sh
===================================================================
RCS file: /home/cvs/tools/crosstool-0.25/crosstool.sh,v
retrieving revision 1.4
diff -d -u -r1.4 crosstool.sh
--- crosstool-0.25/crosstool.sh	19 Dec 2003 21:20:09 -0000	1.4
+++ crosstool-0.25/crosstool.sh	19 Dec 2003 23:54:19 -0000
@@ -178,7 +178,7 @@
     # pregenerated locales is not compatible with crosstool; besides,
     # crosstool downloads them as part of getandpatch.sh.
     if echo "$GCC_EXTRA_CONFIG" | \
-            egrep -v -- "--with-languages=(\"c\"|c\$)"; then
+            egrep -v -- "--with-languages=c( |	|\$)"; then
         cat >> munge-oldconfig.sed <<-ENDSED
 		s/^\\# UCLIBC_CTOR_DTOR is not set/UCLIBC_CTOR_DTOR=y/
 		s/^\\# UCLIBC_HAS_WCHAR is not set/UCLIBC_HAS_WCHAR=y/
@@ -303,14 +303,14 @@
 	--with-local-prefix=${PREFIX}/${TARGET} \
 	--disable-multilib \
 	--with-newlib \
-        ${GCC_EXTRA_CONFIG} \
         --without-headers \
 	--disable-nls \
 	--enable-threads=no \
 	--enable-symvers=gnu \
 	--enable-__cxa_atexit \
         --enable-languages=c \
-	--disable-shared
+	--disable-shared \
+        ${GCC_EXTRA_CONFIG}
 fi
 
 make all-gcc install-gcc 
@@ -445,7 +445,6 @@
     # systems don't really need message catalogs...
     # Use --with-headers, else it will define disable_glibc while building libgcc, and you'll have no profiling
     ${GCC_DIR}/configure --target=$TARGET --host=$HOST --prefix=$PREFIX \
-        ${GCC_EXTRA_CONFIG} \
         --with-headers=${PREFIX}/${TARGET}/include \
 	--disable-nls \
 	--enable-threads=posix \
@@ -454,7 +453,8 @@
         --enable-languages=c,c++ \
 	--enable-shared \
 	--enable-c99 \
-        --enable-long-long
+        --enable-long-long \
+        ${GCC_EXTRA_CONFIG}
 fi
 
 make all 
Index: testhello.sh
===================================================================
RCS file: /home/cvs/tools/crosstool-0.25/testhello.sh,v
retrieving revision 1.1.1.1
diff -d -u -r1.1.1.1 testhello.sh
--- crosstool-0.25/testhello.sh	4 Dec 2003 01:23:10 -0000	1.1.1.1
+++ crosstool-0.25/testhello.sh	19 Dec 2003 23:57:13 -0000
@@ -15,14 +15,17 @@
 $PREFIX/bin/$TARGET-gcc -static hello.c -o $TARGET-hello-static
 $PREFIX/bin/$TARGET-gcc hello.c -o $TARGET-hello
 
-# Test the C++ compiler.
-# Link statically, to maximize chances the program will run on any random target.
+if test "$1" '!=' "--c-only"; then
+    # Test the C++ compiler.
+    # Link statically, to maximize chances the program will run on any
+    # random target.
 
-cat > hello2.cc <<_eof_
+    cat > hello2.cc <<_eof_
 #include <iostream>
 int main() { std::cout << "Hello, c++!\n"; return 0; }
 _eof_
 
-$PREFIX/bin/$TARGET-g++ -static hello2.cc -o $TARGET-hello2-static
-$PREFIX/bin/$TARGET-g++ hello2.cc -o $TARGET-hello2
+    $PREFIX/bin/$TARGET-g++ -static hello2.cc -o $TARGET-hello2-static
+    $PREFIX/bin/$TARGET-g++ hello2.cc -o $TARGET-hello2
+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