Browse Source

android compiling

miguelfreitas
Miguel Freitas 11 years ago
parent
commit
15d7fd07b0
  1. 11
      libtorrent/runme-android.sh
  2. 4
      libtorrent/src/asio_ssl.cpp
  3. 41
      src/makefile.android
  4. 5
      src/runme-android.sh

11
libtorrent/runme-android.sh

@ -4,10 +4,9 @@ export NDK_BASE=$NDK @@ -4,10 +4,9 @@ export NDK_BASE=$NDK
export SYSROOT=$NDK/platforms/android-9/arch-arm
export BOOSTDIR=/home/miguel/android/Boost-for-Android/build/
#make -j2
#exit
./configure --host=arm-linux-androideabi --enable-shared=no --enable-static=yes\
if [ $1 == "configure" ]; then
./configure --host=arm-linux-androideabi --enable-shared=no --enable-static=yes \
--enable-debug \
CPPFLAGS="-I$SYSROOT/usr/include/ -I$BOOSTDIR/include \
-I$NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/include \
-I$NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include \
@ -17,3 +16,7 @@ export BOOSTDIR=/home/miguel/android/Boost-for-Android/build/ @@ -17,3 +16,7 @@ export BOOSTDIR=/home/miguel/android/Boost-for-Android/build/
$NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/libgnustl_static.a" \
LIBS="-lc" CFLAGS="-nostdlib" --prefix="$SYSROOT/usr" \
--with-boost=$BOOSTDIR --with-boost-libdir=$BOOSTDIR/lib && make -j2
fi
make -j2

4
libtorrent/src/asio_ssl.cpp

@ -1,6 +1,10 @@ @@ -1,6 +1,10 @@
// builds all boost.asio SSL source as a separate compilation unit
#include <boost/version.hpp>
#ifdef __ANDROID__
#define OPENSSL_NO_ENGINE 1
#endif
#if BOOST_VERSION >= 104610
#include <boost/asio/ssl/impl/src.hpp>
#endif

41
src/makefile.android

@ -13,7 +13,7 @@ USE_IPV6:=0 @@ -13,7 +13,7 @@ USE_IPV6:=0
LINK:=$(CXX)
DEFS=-DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64
DEFS=-DBOOST_SPIRIT_THREADSAFE -D_FILE_OFFSET_BITS=64 -DBOOST_THREAD_USE_LIB
DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH))
LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
@ -21,7 +21,7 @@ LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) @@ -21,7 +21,7 @@ LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH))
TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data)
LMODE = static
LMODE2 = static
LMODE2 = dynamic
ifdef STATIC
LMODE = static
ifeq (${STATIC}, all)
@ -31,17 +31,6 @@ else @@ -31,17 +31,6 @@ else
TESTDEFS += -DBOOST_TEST_DYN_LINK
endif
# for boost 1.37, add -mt to the boost libraries
LIBS += \
-Wl,-B$(LMODE) \
-l boost_system$(BOOST_LIB_SUFFIX) \
-l boost_filesystem$(BOOST_LIB_SUFFIX) \
-l boost_program_options$(BOOST_LIB_SUFFIX) \
-l boost_thread$(BOOST_LIB_SUFFIX) \
-l db_cxx$(BDB_LIB_SUFFIX) \
-l ssl \
-l crypto \
-l rt
TESTLIBS += \
-Wl,-B$(LMODE) \
@ -59,11 +48,6 @@ ifneq (${USE_IPV6}, -) @@ -59,11 +48,6 @@ ifneq (${USE_IPV6}, -)
DEFS += -DUSE_IPV6=$(USE_IPV6)
endif
LIBS+= \
-Wl,-B$(LMODE2) \
-l z \
-l dl \
-l pthread
# Hardening
@ -179,6 +163,27 @@ DEFS += -DBOOST_ASIO_SEPARATE_COMPILATION @@ -179,6 +163,27 @@ DEFS += -DBOOST_ASIO_SEPARATE_COMPILATION
@echo "Building libtorrent ..." && cd ../libtorrent && $(MAKE) CC=$(CC) CXX=$(CXX) OPT="$(xCXXFLAGS)" && cd ../src
# for boost 1.37, add -mt to the boost libraries
LIBS += \
-Wl,-B$(LMODE) \
-Wl,--entry=main,-rpath-link=$(SYSROOT)/usr/lib/ -L$(SYSROOT)/usr/lib/ \
-L$(BOOSTDIR)/lib \
-l boost_system$(BOOST_LIB_SUFFIX) \
-l boost_filesystem$(BOOST_LIB_SUFFIX) \
-l boost_program_options$(BOOST_LIB_SUFFIX) \
-l boost_thread$(BOOST_LIB_SUFFIX) \
-l db_cxx$(BDB_LIB_SUFFIX) \
-L$(NDK_BASE)/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/ -lgnustl_static
# -l ssl_static \
# -l crypto_static \
LIBS+= \
-Wl,-B$(LMODE2) \
-Wl,--entry=main,-rpath-link=$(SYSROOT)/usr/lib/ -L$(SYSROOT)/usr/lib/ \
-lssl -lcrypto -lstdc++ -lm -lgcc -nostdlib -lc \
$(NDK_BASE)/platforms/android-9/arch-arm/usr/lib/crtbegin_static.o
# auto-generated dependencies:
-include obj/*.P
-include obj-test/*.P

5
src/runme-android.sh

@ -9,7 +9,10 @@ export CXX=arm-linux-androideabi-gcc @@ -9,7 +9,10 @@ export CXX=arm-linux-androideabi-gcc
export CXXFLAGS="-I$SYSROOT/usr/include/ -I$BOOSTDIR/include/boost-1_49 \
-I$NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/include \
-I$NDK_BASE/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include \
-fexceptions -frtti -DHAVE_CXX_STDHEADERS -DANDROID"
-fexceptions -frtti -DHAVE_CXX_STDHEADERS -DANDROID -nostdlib \
-fno-use-cxa-atexit"
export BOOST_LIB_SUFFIX=-gcc-mt-1_49
export BDB_LIB_SUFFIX=-4.8
make -f makefile.android -j2
#make -j2

Loading…
Cancel
Save