summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2006-11-20 16:35:22 +0000
committerNick Mathewson <nickm@torproject.org>2006-11-20 16:35:22 +0000
commit858e939556b24741e1b303cceed5d733d70855ba (patch)
tree2e6b8b92bdd9df6c65738f460ba11bac48651eba
parentb1dc014fc6ca1e5fde44dc0ab8b15689b92f1d8a (diff)
downloadtor-858e939556b24741e1b303cceed5d733d70855ba.tar.gz
tor-858e939556b24741e1b303cceed5d733d70855ba.zip
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. svn:r8973
-rw-r--r--ChangeLog2
-rwxr-xr-xcontrib/cross.sh45
2 files changed, 36 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index dfef549a80..562465f05d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,8 @@ Changes in version 0.1.2.4-alpha - 2006-11-??
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
diff --git a/contrib/cross.sh b/contrib/cross.sh
index 8d107a4bec..dc9716039c 100755
--- a/contrib/cross.sh
+++ b/contrib/cross.sh
@@ -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,11 +53,21 @@ export CROSS_COMPILE=yes
# 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 ]
@@ -76,12 +86,12 @@ then
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 @@ then
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 @@ fi
# 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 @@ fi
# 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