[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r8973: Apply cross.sh patch from Mike Mohr: rename ARCH_PREFIX to H (in tor/trunk: . contrib)



Author: nickm
Date: 2006-11-20 11:35:22 -0500 (Mon, 20 Nov 2006)
New Revision: 8973

Modified:
   tor/trunk/
   tor/trunk/ChangeLog
   tor/trunk/contrib/cross.sh
Log:
 r9349@totoro:  nickm | 2006-11-20 11:35:14 -0500
 Apply cross.sh patch from Mike Mohr: rename ARCH_PREFIX to HOST_TRIPLET; work even when autogen.sh has not yet been run.



Property changes on: tor/trunk
___________________________________________________________________
 svk:merge ticket from /tor/trunk [r9349] on 96637b51-b116-0410-a10e-9941ebb49b64

Modified: tor/trunk/ChangeLog
===================================================================
--- tor/trunk/ChangeLog	2006-11-20 16:26:52 UTC (rev 8972)
+++ tor/trunk/ChangeLog	2006-11-20 16:35:22 UTC (rev 8973)
@@ -6,6 +6,8 @@
 
   o Minor features
     - Add breakdown of public key operations to dumped statistics.
+    - Make cross.sh cross-compilation script work even when autogen.sh hasn't
+      been run. (Patch from Michael Mohr.)
 
   o Minor features, controller
     - Make all connections to addresses of the form .noconnect immediately

Modified: tor/trunk/contrib/cross.sh
===================================================================
--- tor/trunk/contrib/cross.sh	2006-11-20 16:26:52 UTC (rev 8972)
+++ tor/trunk/contrib/cross.sh	2006-11-20 16:35:22 UTC (rev 8973)
@@ -15,7 +15,7 @@
 #
 #  A number of environment variables must be set in order for this
 #  script to work:
-#        $PREFIX, $CROSSPATH, $ARCH_PREFIX, $HOST,
+#        $PREFIX, $CROSSPATH, $HOST_TRIPLET, $HOST,
 #        and (optionally) $BUILD
 #  Please run the script for a description of each one.  If automated
 #  builds are desired, the above variables can be exported at the top
@@ -53,13 +53,23 @@
 # for error conditions
 EXITVAL=0
 
-if [ ! -f configure ]
+if [ ! -f autogen.sh ]
 then
   echo "Please run this script from the root of the Tor distribution"
-  echo "and ensure that autogen.sh has been run."
-  EXITVAL=-1
+  exit -1
 fi
 
+if [ ! -f configure ]
+then
+  if [ -z $GEN_BUILD ]
+  then
+    echo "To automatically generate the build environment, set \$GEN_BUILD"
+    echo "to yes; for example,"
+    echo "	export GEN_BUILD=yes"
+    EXITVAL=-1
+  fi
+fi
+
 if [ -z $PREFIX ]
 then
   echo "You must define \$PREFIX since you are cross-compiling."
@@ -76,12 +86,12 @@
   EXITVAL=-1
 fi
 
-if [ -z $ARCH_PREFIX ]
+if [ -z $HOST_TRIPLET ]
 then
-  echo "You must define \$ARCH_PREFIX to continue.  For example,"
+  echo "You must define \$HOST_TRIPLET to continue.  For example,"
   echo "if you normally cross-compile applications using"
-  echo "mipsel-linux-uclibc-gcc, you would set \$ARCH_PREFIX like so:"
-  echo "	export ARCH_PREFIX=mipsel-linux-uclibc-"
+  echo "mipsel-linux-uclibc-gcc, you would set \$HOST_TRIPLET like so:"
+  echo "	export HOST_TRIPLET=mipsel-linux-uclibc-"
   EXITVAL=-1
 fi
 
@@ -101,12 +111,25 @@
   EXITVAL=-1
 fi
 
+if [ ! -x $CROSSPATH/$HOST_TRIPLETgcc ]
+then
+  echo "The specified toolchain does not contain an executable C compiler."
+  echo "Please double-check your settings and rerun cross.sh."
+  EXITVAL=-1
+fi
+
 if [ $EXITVAL -ne 0 ]
 then
   echo "Remember, you can hard-code these values in cross.sh if needed."
   exit $EXITVAL
 fi
 
+if [ ! -z $GEN_BUILD -a ! -f configure ]
+then
+  export NOCONF=yes
+  ./autogen.sh
+fi
+
 # clean up any existing object files
 if [ -f src/or/tor ]
 then
@@ -115,8 +138,8 @@
 
 # Set up the build environment and try to run configure
 export PATH=$PATH:$CROSSPATH
-export RANLIB=${ARCH_PREFIX}ranlib
-export CC=${ARCH_PREFIX}gcc
+export RANLIB=${HOST_TRIPLET}ranlib
+export CC=${HOST_TRIPLET}gcc
 
 if [ $BUILD == "auto" ]
 then
@@ -161,7 +184,7 @@
 # if $STRIP has length (i.e. STRIP=yes), strip the binaries
 if [ ! -z $STRIP ]
 then
-${ARCH_PREFIX}strip \
+${HOST_TRIPLET}strip \
 	src/or/tor \
 	src/or/test \
 	src/tools/tor-resolve