From bf5d6e670ab52f3e8623595f5112c107598d695b Mon Sep 17 00:00:00 2001 From: sapier Date: Sat, 3 Jan 2015 23:49:46 +0100 Subject: [PATCH] Switch to official openssl version and update to 1.0.1j --- build/android/Makefile | 38 +++++++++++++++++++------------- build/android/jni/Android.mk | 4 ++-- build/android/openssl_arch.patch | 11 +++++++++ 3 files changed, 36 insertions(+), 17 deletions(-) create mode 100644 build/android/openssl_arch.patch diff --git a/build/android/Makefile b/build/android/Makefile index d4760ee21..f96036fc4 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -34,6 +34,7 @@ TARGET_ABI = armeabi TARGET_LIBDIR = armeabi TARGET_TOOLCHAIN = arm-linux-androideabi- TARGET_CFLAGS_ADDON = -mfloat-abi=softfp -mfpu=vfp +TARGET_ARCH = armv7 CROSS_PREFIX = arm-linux-androideabi- COMPILER_VERSION = 4.8 HAVE_LEVELDB = 1 @@ -49,6 +50,7 @@ HAVE_LEVELDB = 1 # -mfloat-abi=hard -march=armv7-a #TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) #TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch -lm_hard +#TARGET_ARCH = arm #CROSS_PREFIX = arm-linux-androideabi- #COMPILER_VERSION = 4.8 #HAVE_LEVELDB = 1 @@ -60,6 +62,7 @@ HAVE_LEVELDB = 1 #TARGET_ABI = mips #TARGET_LIBDIR = mips #TARGET_TOOLCHAIN = mipsel-linux-android- +#TARGET_ARCH = mips32 #CROSS_PREFIX = mipsel-linux-android- #COMPILER_VERSION = 4.8 #HAVE_LEVELDB = 0 @@ -72,6 +75,7 @@ HAVE_LEVELDB = 1 #TARGET_LIBDIR = x86 #TARGET_TOOLCHAIN = x86- #CROSS_PREFIX = i686-linux-android- +#TARGET_ARCH = x86 #COMPILER_VERSION = 4.8 #HAVE_LEVELDB = 1 @@ -103,12 +107,13 @@ IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp IRRLICHT_TIMESTAMP_INT = $(ROOT)/deps/irrlicht_timestamp IRRLICHT_URL_SVN = http://svn.code.sf.net/p/irrlicht/code/branches/ogl-es/ -OPENSSL_BASEDIR = openssl-android +OPENSSL_VERSION = 1.0.1j +OPENSSL_BASEDIR = openssl-$(OPENSSL_VERSION) OPENSSL_DIR = $(ROOT)/deps/$(OPENSSL_BASEDIR)/ -OPENSSL_LIB = $(OPENSSL_DIR)libs/$(TARGET_ABI)/libopenssl.so +OPENSSL_LIB = $(OPENSSL_DIR)/libssl.so.1.0.0 OPENSSL_TIMESTAMP = $(OPENSSL_DIR)timestamp OPENSSL_TIMESTAMP_INT = $(ROOT)/deps/openssl_timestamp -OPENSSL_URL_GIT = https://github.com/wobbals/openssl-android +OPENSSL_URL = http://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz CURL_VERSION = 7.35.0 CURL_DIR = $(ROOT)/deps/curl-$(CURL_VERSION) @@ -118,7 +123,7 @@ CURL_TIMESTAMP_INT = $(ROOT)/deps/curl_timestamp CURL_URL_HTTP = http://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2 FREETYPE_DIR = $(ROOT)/deps/freetype2-android/ -FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGER_ABI)/libfreetype2-static.a +FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGET_ABI)/libfreetype2-static.a FREETYPE_TIMESTAMP = $(FREETYPE_DIR)timestamp FREETYPE_TIMESTAMP_INT = $(ROOT)/deps/freetype_timestamp FREETYPE_URL_GIT = https://github.com/cdave1/freetype2-android @@ -283,7 +288,10 @@ openssl_download : echo "openssl sources missing, downloading..."; \ mkdir -p ${ROOT}/deps; \ cd ${ROOT}/deps ; \ - git clone ${OPENSSL_URL_GIT} || exit 1; \ + wget ${OPENSSL_URL} || exit 1; \ + tar -xzf ${OPENSSL_BASEDIR}.tar.gz; \ + cd ${OPENSSL_BASEDIR}; \ + patch -p1 < ../../openssl_arch.patch; \ fi openssl : $(OPENSSL_LIB) @@ -298,16 +306,16 @@ $(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) REFRESH=1; \ fi; \ if [ $$REFRESH -ne 0 ] ; then \ - export PATH=$$PATH:${SDKFOLDER}/platform-tools:${ANDROID_NDK}; \ echo "changed timestamp for openssl detected building..."; \ cd ${OPENSSL_DIR}; \ - cat jni/Application.mk | grep -v NDK_TOOLCHAIN_VERSION >jni/Application.mk.new;\ - mv jni/Application.mk.new jni/Application.mk; \ - ndk-build NDEBUG=${NDEBUG} NDK_MODULE_PATH=${NDK_MODULE_PATH} \ - APP_ABI=${TARGET_ABI} APP_PLATFORM=${APP_PLATFORM} -j${PARALLEL} \ - TARGET_CFLAGS+="${TARGET_CFLAGS_ADDON}" \ - TARGET_LDFLAGS+="${TARGET_LDFLAGS_ADDON}" \ - TARGET_CXXFLAGS+="${TARGET_CXXFLAGS_ADDON}" || exit 1; \ + ln -s ${OPENSSL_DIR} ../openssl; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}; \ + ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ + --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ + --install-dir=$${TOOLCHAIN} --system=linux-x86_64; \ + export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ + CC=${CROSS_PREFIX}gcc ./Configure -shared android-${TARGET_ARCH}; \ + CC=${CROSS_PREFIX}gcc ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make all; \ touch ${OPENSSL_TIMESTAMP}; \ touch ${OPENSSL_TIMESTAMP_INT}; \ else \ @@ -346,7 +354,7 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP) echo "changed timestamp for leveldb detected building..."; \ cd deps/leveldb; \ export CROSS_PREFIX=${CROSS_PREFIX}; \ - export TOOLCHAIN=/tmp/ndk-arm; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ --install-dir=$${TOOLCHAIN} --system=linux-x86_64; \ @@ -503,7 +511,7 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB) echo "changed timestamp for curl detected building..."; \ cd deps/curl-${CURL_VERSION}; \ export CROSS_PREFIX=${CROSS_PREFIX}; \ - export TOOLCHAIN=/tmp/ndk-arm; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ --install-dir=$${TOOLCHAIN} --system=linux-x86_64; \ diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index b472da203..b1cb9a382 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -41,12 +41,12 @@ include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := ssl -LOCAL_SRC_FILES := deps/openssl-android/libs/$(TARGET_LIBDIR)/libssl.so +LOCAL_SRC_FILES := deps/openssl/libssl.so include $(PREBUILT_SHARED_LIBRARY) include $(CLEAR_VARS) LOCAL_MODULE := crypto -LOCAL_SRC_FILES := deps/openssl-android/libs/$(TARGET_LIBDIR)/libcrypto.so +LOCAL_SRC_FILES := deps/openssl/libcrypto.so include $(PREBUILT_SHARED_LIBRARY) diff --git a/build/android/openssl_arch.patch b/build/android/openssl_arch.patch new file mode 100644 index 000000000..d9ebbd59c --- /dev/null +++ b/build/android/openssl_arch.patch @@ -0,0 +1,11 @@ +--- openssl-1.0.1j/Configure.orig 2014-10-15 14:53:39.000000000 +0200 ++++ openssl-1.0.1j/Configure 2015-01-03 22:41:43.505749921 +0100 +@@ -407,6 +407,8 @@ + "android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + "android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + "android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"android-arm","gcc:-march=armv4 -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"android-mips32","gcc:-march=mips32 -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + + #### *BSD [do see comment about ${BSDthreads} above!] + "BSD-generic32","gcc:-DTERMIOS -O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",