updated makefile to fix path issues

This commit is contained in:
n8fr8 2012-05-03 15:07:02 -04:00
parent 8f1c0e6abb
commit f7cf202b00
1 changed files with 28 additions and 40 deletions

View File

@ -1,9 +1,12 @@
#!/bin/sh #!/bin/sh
export ORBOT_BASE=$PWD
# begin by testing NDK_ROOT # begin by testing NDK_ROOT
if test -z $NDK_ROOT; then echo "NDK_ROOT is not exported, do so by something close to this: export NDK_ROOT=/path/to/android-ndk-r5"; exit; fi if test -z $NDK_ROOT; then echo "NDK_ROOT is not exported, do so by something close to this: export NDK_ROOT=/path/to/android-ndk-r5"; exit; fi
#clean #clean
cd $ORBOT_BASE
rm -rf native rm -rf native
rm res/raw/privoxy rm res/raw/privoxy
rm res/raw/tor rm res/raw/tor
@ -14,17 +17,14 @@ mkdir native
mkdir native/lib mkdir native/lib
mkdir native/include mkdir native/include
mkdir libs mkdir libs
cd native
#Build openssl using default ndk-build #Build openssl using default ndk-build
echo "BUILDING OPENSSL STATIC..." echo "BUILDING OPENSSL STATIC..."
git clone git://github.com/guardianproject/android-external-openssl-ndk-static.git cd external/openssl-static
cd android-external-openssl-ndk-static
ndk-build ndk-build
cp obj/local/armeabi/*.a ../lib cp obj/local/armeabi/*.a $ORBOT_BASE/native/lib
cp -R include/openssl ../include cp -R include/openssl $ORBOT_BASE/native/include
cd ../.. cd $ORBOT_BASE
echo "SETTING UP NDK CROSS COMPILER..." echo "SETTING UP NDK CROSS COMPILER..."
# export needed variables # export needed variables
@ -54,68 +54,56 @@ export OBJDUMP=$HOST-objdump
export CPPFLAGS="--sysroot=$NDK_TOOLCHAIN/sysroot -I$NDK_TOOLCHAIN/sysroot/usr/include -I$NDK_TOOLCHAIN/include" export CPPFLAGS="--sysroot=$NDK_TOOLCHAIN/sysroot -I$NDK_TOOLCHAIN/sysroot/usr/include -I$NDK_TOOLCHAIN/include"
export LDFLAGS="-L$NDK_TOOLCHAIN/sysroot/usr/lib -L$NDK_TOOLCHAIN/lib" export LDFLAGS="-L$NDK_TOOLCHAIN/sysroot/usr/lib -L$NDK_TOOLCHAIN/lib"
echo $BUILD
#Build libevent #Build libevent
echo "BUILDING LIBEVENT..." echo "BUILDING LIBEVENT..."
mkdir native/libevent cd external/libevent
cd native/libevent
svn co https://levent.svn.sourceforge.net/svnroot/levent/tags/release-1.4.13-stable/libevent/ .
./autogen.sh ./autogen.sh
./configure --host=arm-linux-eabi --build=$BUILD --prefix=$NDK_TOOLCHAIN ./configure --host=arm-linux-eabi --prefix=$NDK_TOOLCHAIN
make clean
make make
cp .libs/libevent.a ../lib cp .libs/libevent.a $ORBOT_BASE/native/lib
cp *.h ../include cp *.h $ORBOT_BASE/native/include
cd ../.. cd $ORBOT_BASE
#Build Tor #Build Tor
echo "BUILDING TOR..." echo "BUILDING TOR..."
cd native cd external/tor
git clone git://git.torproject.org/git/tor.git
cd tor/
./autogen.sh ./autogen.sh
./configure --host=arm-linux-eabi --disable-asciidoc --prefix=$NDK_TOOLCHAIN --with-libevent-dir=$PWD/../ --enable-static-libevent --with-openssl-dir=$PWD/../ --enable-static-openssl ./configure --host=arm-linux-eabi --disable-asciidoc --prefix=$NDK_TOOLCHAIN --with-libevent-dir=$ORBOT_BASE/native --enable-static-libevent --with-openssl-dir=$ORBOT_BASE/native --enable-static-openssl
make clean
make make
cd ../.. cd $ORBOT_BASE
#Build JTorControl #Build JTorControl
echo "BUILDING JTORCTRL..." echo "BUILDING JTORCTRL..."
cd libs cd external/jtorctl
git clone git://git.torproject.org/git/jtorctl
cd jtorctl
mkdir bin mkdir bin
javac net/freehaven/tor/control/TorControlConnection.java -d bin javac net/freehaven/tor/control/TorControlConnection.java -d bin
cd bin cd bin
jar cvf jtorctrl.jar * jar cvf jtorctrl.jar *
cp jtorctrl.jar ../.. cp jtorctrl.jar $ORBOT_BASE/libs
cd ../../.. cd $ORBOT_BASE
#BUILD privoxy #BUILD privoxy
echo "BUILDING PRIVOXY..." echo "BUILDING PRIVOXY..."
mkdir native/privoxy cd $ORBOT_BASE/external/privoxy
cd native/privoxy
rm download*
wget http://sourceforge.net/projects/ijbswa/files/Sources/3.0.12%20%28stable%29/privoxy-3.0.12-stable-src.tar.gz/download
tar xzvf download
cd privoxy-3.0.12-stable
autoheader autoheader
autoconf autoconf
#need to disable setpgrp check in configure #need to disable setpgrp check in configure
export ac_cv_func_setpgrp_void=yes export ac_cv_func_setpgrp_void=yes
./configure --host=arm-linux-eabi --build=$BUILD --prefix=$NDK_TOOLCHAIN --disable-pthread ./configure --host=arm-linux-eabi --prefix=$NDK_TOOLCHAIN --disable-pthread
make clean
make make
cd ../../..
cd $ORBOT_BASE
#create assets folder and put the binaries in it #create assets folder and put the binaries in it
echo "MOVING BINARIES TO ANDROID RESOURCES..." echo "MOVING BINARIES TO ANDROID RESOURCES..."
mkdir res/raw mkdir res/raw
cp native/privoxy/privoxy-3.0.12-stable/privoxy res/raw cp external/privoxy/privoxy res/raw
cp native/tor/src/or/tor res/raw cp external/tor/src/or/tor res/raw
echo "READY TO BUILD ANDROID APP" echo "Setting Android build configuration"
echo "> android update project --name Orbot --target 9 --path ." android update project --name Orbot --target 9 --path .
echo "> ant debug"
echo "READY TO BUILD ANDROID APP: run 'ant debug'"
echo "BUILD COMPLETE" echo "BUILD COMPLETE"