diff --git a/.gitignore b/.gitignore index 5c3fd29109..1e590a76e8 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,4 @@ *.a *.la *.in +/client/Makefile diff --git a/android/build_all.sh b/android/build_all.sh new file mode 100644 index 0000000000..a345cf99dc --- /dev/null +++ b/android/build_all.sh @@ -0,0 +1,7 @@ +#/bin/sh +#script to compile everything BOINC needs for Android + +./build_androidtc.sh +./build_openssl.sh +./build_curl.sh +./build_boinc.sh diff --git a/android/build_androidtc.sh b/android/build_androidtc.sh new file mode 100644 index 0000000000..b9ab7ca940 --- /dev/null +++ b/android/build_androidtc.sh @@ -0,0 +1,21 @@ +#/bin/sh +#script to setup Android toolchain + +export ANDROIDTC="~/android-tc" +export TCBINARIES="$ANDROIDTC/bin" +export TCINCLUDES="$ANDROIDTC/arm-linux-androideabi" +export TCSYSROOT="$ANDROIDTC/sysroot" +export STDCPPTC="$TCINCLUDES/lib/libstdc++.a" + +export PATH="$PATH:$TCBINARIES:$TCINCLUDES/bin" +export CC=arm-linux-androideabi-gcc +export CXX=arm-linux-androideabi-g++ +export LD=arm-linux-androideabi-ld + +if [ ! -d "$ANDROIDTC" ]; then + + cd ~/NVPACK/android-ndk-r8 + build/tools/make-standalone-toolchain.sh --platform=android-4 --install-dir=$ANDROIDTC + cd ~ + +fi diff --git a/android/build_boinc.sh b/android/build_boinc.sh index 955a31675d..7a0f962253 100644 --- a/android/build_boinc.sh +++ b/android/build_boinc.sh @@ -1,42 +1,24 @@ #/bin/sh #script to compile BOINC for Android -#++++++++++++++++++++++++CONFIGURATION++++++++++++++++++++++++++++ - -#===locations -#Android toolchain -export ANDROIDTC="/tmp/tc" - -#sources -export BOINC=".." #BOINC source code -export OPENSSL_DIR=$BOINC/../boinc_depends_android_eclipse/openssl -export CURL_DIR=$BOINC/../boinc_depends_android_eclipse/curl - -#===script behavior -export PKG_CONFIG_DEBUG_SPEW=1 - +COMPILEBOINC="yes" CONFIGURE="yes" MAKECLEAN="yes" -COMPILEBOINC="yes" -#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +export BOINC=".." #BOINC source code +export OPENSSL_DIR=$BOINC/../boinc_depends_android_eclipse/openssl +export CURL_DIR=$BOINC/../boinc_depends_android_eclipse/curl +export PKG_CONFIG_DEBUG_SPEW=1 -export TCBINARIES="$ANDROIDTC/bin" #cross compiler location -export TCINCLUDES="$ANDROIDTC/arm-linux-androideabi" #libraries to include in build -export TCSYSROOT="$ANDROIDTC/sysroot" #SYSROOT of Android device -export STDCPPTC="$TCINCLUDES/lib/libstdc++.a" #stdc++ library - -export PATH="$PATH:$TCBINARIES:$TCINCLUDES/bin" #add location of compiler binaries to PATH -export CC=arm-linux-androideabi-gcc #C compiler -export CXX=arm-linux-androideabi-g++ #C++ compiler -export LD=arm-linux-androideabi-ld #LD tool export CFLAGS="--sysroot=$TCSYSROOT -DANDROID -DDECLARE_TIMEZONE -Wall -I$TCINCLUDES/include -O3 -fomit-frame-pointer" export CXXFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -I$TCINCLUDES/include -funroll-loops -fexceptions -O3 -fomit-frame-pointer" -export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog" #log is Logcat +export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog" export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" export PKG_CONFIG_SYSROOT_DIR=$TCSYSROOT export PKG_CONFIG_PATH=$CURL_DIR/lib/pkgconfig:$OPENSSL_DIR/lib/pkgconfig +# Prepare android toolchain and environment +./build_androidtc.sh if [ -n "$COMPILEBOINC" ]; then echo "==================building BOINC from $BOINC==========================" diff --git a/android/build_curl.sh b/android/build_curl.sh new file mode 100644 index 0000000000..2018a88716 --- /dev/null +++ b/android/build_curl.sh @@ -0,0 +1,30 @@ +#/bin/sh +#script to compile Libcurl for Android + +COMPILECURL="yes" +CONFIGURE="yes" +MAKECLEAN="yes" + +CURL="/home/boincadm/src/curl-7.28.1" #CURL sources, required by BOINC + +export CFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -I$TCINCLUDES/include -O3 -fomit-frame-pointer" +export CXXFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -funroll-loops -fexceptions -O3 -fomit-frame-pointer" +export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog" +export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" + +# Prepare android toolchain and environment +./build_androidtc.sh + +if [ -n "$COMPILECURL" ]; then +echo "==================building curl from $CURL=================================" +cd $CURL +if [ -n "$MAKECLEAN" ]; then +make clean +fi +if [ -n "$CONFIGURE" ]; then +./configure --host=arm-linux --prefix=$TCINCLUDES --libdir="$TCINCLUDES/lib" --disable-shared --enable-static --with-random=/dev/urandom +fi +make +make install +echo "========================curl done=================================" +fi diff --git a/android/build_openssl.sh b/android/build_openssl.sh new file mode 100644 index 0000000000..89fcf6e838 --- /dev/null +++ b/android/build_openssl.sh @@ -0,0 +1,34 @@ +#/bin/sh +#script to compile OpenSSL for Android + +COMPILEOPENSSL="yes" +CONFIGURE="yes" +MAKECLEAN="yes" + +OPENSSL="/home/boincadm/src/openssl-1.0.1c" #openSSL sources, requiered by BOINC + +export CFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -I$TCINCLUDES/include -O3 -fomit-frame-pointer" +export CXXFLAGS="--sysroot=$TCSYSROOT -DANDROID -Wall -funroll-loops -fexceptions -O3 -fomit-frame-pointer" +export LDFLAGS="-L$TCSYSROOT/usr/lib -L$TCINCLUDES/lib -llog" +export GDB_CFLAGS="--sysroot=$TCSYSROOT -Wall -g -I$TCINCLUDES/include" + +# Prepare android toolchain and environment +./build_androidtc.sh + +if [ -n "$COMPILEOPENSSL" ]; then +echo "================building openssl from $OPENSSL=============================" +cd $OPENSSL +if [ -n "$MAKECLEAN" ]; then +make clean +fi +if [ -n "$CONFIGURE" ]; then +./Configure linux-generic32 no-shared no-dso -DL_ENDIAN --openssldir="$TCINCLUDES/ssl" +#override flags in Makefile +sed -e "s/^CFLAG=.*$/`grep -e \^CFLAG= Makefile` \$(CFLAGS)/g +s%^INSTALLTOP=.*%INSTALLTOP=$TCINCLUDES%g" Makefile > Makefile.out +mv Makefile.out Makefile +fi +make +make install_sw +echo "========================openssl DONE==================================" +fi