瀏覽代碼

r9391@Kushana: nickm | 2006-10-25 21:51:33 -0400
Patch to cross.sh from Michael Mohr; check more values before failing; always --enable-eventdns


svn:r8830

Nick Mathewson 17 年之前
父節點
當前提交
3e26083a4f
共有 1 個文件被更改,包括 31 次插入8 次删除
  1. 31 8
      contrib/cross.sh

+ 31 - 8
contrib/cross.sh

@@ -50,10 +50,14 @@
 # disable the platform-specific tests in configure
 # disable the platform-specific tests in configure
 export CROSS_COMPILE=yes
 export CROSS_COMPILE=yes
 
 
+# for error conditions
+EXITVAL=0
+
 if [ ! -f configure ]
 if [ ! -f configure ]
 then
 then
-  echo "Please run this script from the root of the Tor distribution."
-  exit -1
+  echo "Please run this script from the root of the Tor distribution"
+  echo "and ensure that autogen.sh has been run."
+  EXITVAL=-1
 fi
 fi
 
 
 if [ -z $PREFIX ]
 if [ -z $PREFIX ]
@@ -61,7 +65,7 @@ then
   echo "You must define \$PREFIX since you are cross-compiling."
   echo "You must define \$PREFIX since you are cross-compiling."
   echo "Select a non-system location (i.e. /tmp/tor-cross):"
   echo "Select a non-system location (i.e. /tmp/tor-cross):"
   echo "	export PREFIX=/tmp/tor-cross"
   echo "	export PREFIX=/tmp/tor-cross"
-  exit -1
+  EXITVAL=-1
 fi
 fi
 
 
 if [ -z $CROSSPATH ]
 if [ -z $CROSSPATH ]
@@ -69,7 +73,7 @@ then
   echo "You must define the location of your cross-compiler's"
   echo "You must define the location of your cross-compiler's"
   echo "directory using \$CROSSPATH; for example,"
   echo "directory using \$CROSSPATH; for example,"
   echo "	export CROSSPATH=/opt/cross/staging_dir_mipsel/bin"
   echo "	export CROSSPATH=/opt/cross/staging_dir_mipsel/bin"
-  exit -1
+  EXITVAL=-1
 fi
 fi
 
 
 if [ -z $ARCH_PREFIX ]
 if [ -z $ARCH_PREFIX ]
@@ -78,14 +82,14 @@ then
   echo "if you normally cross-compile applications using"
   echo "if you normally cross-compile applications using"
   echo "mipsel-linux-uclibc-gcc, you would set \$ARCH_PREFIX like so:"
   echo "mipsel-linux-uclibc-gcc, you would set \$ARCH_PREFIX like so:"
   echo "	export ARCH_PREFIX=mipsel-linux-uclibc-"
   echo "	export ARCH_PREFIX=mipsel-linux-uclibc-"
-  exit -1
+  EXITVAL=-1
 fi
 fi
 
 
 if [ -z $HOST ]
 if [ -z $HOST ]
 then
 then
   echo "You must specify a target processor with \$HOST; for example:"
   echo "You must specify a target processor with \$HOST; for example:"
   echo "	export HOST=mipsel-unknown-elf"
   echo "	export HOST=mipsel-unknown-elf"
-  exit -1
+  EXITVAL=-1
 fi
 fi
 
 
 if [ -z $BUILD ]
 if [ -z $BUILD ]
@@ -94,7 +98,13 @@ then
   echo "	export BUILD=i686-pc-linux-gnu"
   echo "	export BUILD=i686-pc-linux-gnu"
   echo "If you wish to let configure autodetect the host, set \$BUILD to 'auto':"
   echo "If you wish to let configure autodetect the host, set \$BUILD to 'auto':"
   echo "	export BUILD=auto"
   echo "	export BUILD=auto"
-  exit -1
+  EXITVAL=-1
+fi
+
+if [ $EXITVAL -ne 0 ]
+then
+  echo "Remember, you can hard-code these values in cross.sh if needed."
+  exit $EXITVAL
 fi
 fi
 
 
 # clean up any existing object files
 # clean up any existing object files
@@ -111,10 +121,14 @@ export CC=${ARCH_PREFIX}gcc
 if [ $BUILD == "auto" ]
 if [ $BUILD == "auto" ]
 then
 then
   ./configure \
   ./configure \
+	--enable-debug \
+	--enable-eventdns \
 	--prefix=$PREFIX \
 	--prefix=$PREFIX \
 	--host=$HOST
 	--host=$HOST
 else
 else
   ./configure \
   ./configure \
+	--enable-debug \
+	--enable-eventdns \
 	--prefix=$PREFIX \
 	--prefix=$PREFIX \
 	--host=$HOST \
 	--host=$HOST \
 	--build=$BUILD
 	--build=$BUILD
@@ -134,6 +148,16 @@ fi
 
 
 make
 make
 
 
+# has a problem occurred?
+if [ $? -ne 0 ]
+then
+  echo ""
+  echo "A problem has been detected with make."
+  echo "Please check the output above and rerun make."
+  echo ""
+  exit -1
+fi
+
 # if $STRIP has length (i.e. STRIP=yes), strip the binaries
 # if $STRIP has length (i.e. STRIP=yes), strip the binaries
 if [ ! -z $STRIP ]
 if [ ! -z $STRIP ]
 then
 then
@@ -147,4 +171,3 @@ echo ""
 echo "Tor should be compiled at this point.  Now run 'make install' to"
 echo "Tor should be compiled at this point.  Now run 'make install' to"
 echo "install to $PREFIX"
 echo "install to $PREFIX"
 echo ""
 echo ""
-