Merge pull request #3384 from akallabeth/android64_build

Android64 build fixes
This commit is contained in:
Norbert Federa 2016-07-06 13:58:10 +02:00 committed by GitHub
commit 89c25276b4
12 changed files with 445 additions and 571 deletions

View File

@ -102,9 +102,9 @@ if (FREERDP_EXTERNAL_PATH)
endif() endif()
# Allow to search the host machine for git # Allow to search the host machine for git
if(ANDROID OR IOS) if(CMAKE_CROSSCOMPILING)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH) SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM BOTH)
endif(ANDROID OR IOS) endif(CMAKE_CROSSCOMPILING)
include(GetGitRevisionDescription) include(GetGitRevisionDescription)
git_get_exact_tag(GIT_REVISION --tags --always) git_get_exact_tag(GIT_REVISION --tags --always)
@ -112,9 +112,9 @@ git_get_exact_tag(GIT_REVISION --tags --always)
if (${GIT_REVISION} STREQUAL "n/a") if (${GIT_REVISION} STREQUAL "n/a")
git_rev_parse (GIT_REVISION --short) git_rev_parse (GIT_REVISION --short)
endif() endif()
if(ANDROID OR IOS) if(CMAKE_CROSSCOMPILING)
SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY) SET (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
endif(ANDROID OR IOS) endif(CMAKE_CROSSCOMPILING)
message(STATUS "Git Revision ${GIT_REVISION}") message(STATUS "Git Revision ${GIT_REVISION}")
@ -468,6 +468,8 @@ endif()
if(ANDROID) if(ANDROID)
set(WITH_LIBRARY_VERSIONING "OFF") set(WITH_LIBRARY_VERSIONING "OFF")
set_property( GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ${ANDROID_LIBRARY_USE_LIB64_PATHS} )
if (${ANDROID_ABI} STREQUAL "armeabi") if (${ANDROID_ABI} STREQUAL "armeabi")
set (WITH_NEON OFF) set (WITH_NEON OFF)
endif() endif()
@ -503,12 +505,22 @@ endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
if(NOT IOS AND NOT ANDROID) if(NOT IOS)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
endif() endif()
if(NOT WIN32) if(NOT WIN32)
check_library_exists(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK) CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
CHECK_LIBRARY_EXISTS(pthreads pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
if (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
set(HAVE_PTHREAD_MUTEX_TIMEDLOCK ON)
endif (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
endif() endif()
if(WITH_VALGRIND_MEMCHECK) if(WITH_VALGRIND_MEMCHECK)

View File

@ -2,7 +2,7 @@ apply plugin: 'com.android.application'
android { android {
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion "23.0.2" buildToolsVersion "24.0.0"
defaultConfig { defaultConfig {
applicationId "com.freerdp.afreerdp" applicationId "com.freerdp.afreerdp"

View File

@ -4,7 +4,7 @@ buildscript {
jcenter() jcenter()
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:1.5.0' classpath 'com.android.tools.build:gradle:2.1.2'
} }
} }

View File

@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
android { android {
compileSdkVersion 21 compileSdkVersion 21
buildToolsVersion "23.0.2" buildToolsVersion "24.0.0"
defaultConfig { defaultConfig {
minSdkVersion 14 minSdkVersion 14

View File

@ -1,6 +1,6 @@
#Wed Oct 21 11:34:03 PDT 2015 #Wed Jul 06 13:01:23 CEST 2016
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.8-all.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip

File diff suppressed because it is too large Load Diff

View File

@ -8,10 +8,6 @@
if(OPENSLES_INCLUDE_DIR) if(OPENSLES_INCLUDE_DIR)
# Already in cache, be silent # Already in cache, be silent
set(OPENSLES_FIND_QUIETLY TRUE) set(OPENSLES_FIND_QUIETLY TRUE)
elseif(ANDROID)
# Android has no pkgconfig - fallback to default paths
set(PC_OPENSLES_INCLUDE_DIR "${ANDROID_SYSROOT}/usr/include")
set(PC_OPENSLES_LIBDIR "${ANDROID_SYSROOT}/usr/lib" )
else() else()
find_package(PkgConfig) find_package(PkgConfig)
pkg_check_modules(PC_OPENSLES QUIET OpenSLES) pkg_check_modules(PC_OPENSLES QUIET OpenSLES)

View File

@ -13,8 +13,8 @@ Build requirements
For the Android port some additional dependencies need to be fulfilled: For the Android port some additional dependencies need to be fulfilled:
* for JNI * for JNI
- Android NDK (>= r9) - CMake >= 3.0
- prebuild openssl (optionally libjpeg and openh264) - Android NDK (>= r9) (and <= 10e if build with OpenH264)
* for the Java GUI * for the Java GUI
- Android SDK - Android SDK
@ -38,9 +38,9 @@ Currently the default script builds for:
* armeabi-v7a * armeabi-v7a
* x86 * x86
* mips * mips
* arm64-v8a
64 bit architectures will be added as soon as the OpenSSL build scripts * x86_64
support the android build for those. * mips64
When the script is finished the libraries are ready for android studio to When the script is finished the libraries are ready for android studio to
be picked up in client/Android/Studio/freeRDPCore/src/main/jniLibs be picked up in client/Android/Studio/freeRDPCore/src/main/jniLibs

View File

@ -0,0 +1,26 @@
From 6e9a00d9ac02c3b3adc0613798678eadb0c4dae5 Mon Sep 17 00:00:00 2001
From: Armin Novak <armin.novak@thincast.com>
Date: Thu, 2 Jun 2016 13:55:27 +0200
Subject: [PATCH] 64bit architecture support.
---
Configure | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Configure b/Configure
index c98107a..fa20eca 100755
--- a/Configure
+++ b/Configure
@@ -473,6 +473,9 @@ my %table=(
"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-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -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)",
+"android64", "gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib64 -m64 -DL_ENDIAN -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHUNK DES_INT DES_UNROLL:${x86_64_asm}:android:dlfcn:linux-shared:-fPIC:-m64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
+"android64-aarch64","gcc:-march=armv8-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${aarch64_asm}:linux64:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)",
+"android64-mips64","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib64 -mabi=64 -O3 -Wall -DBN_DIV3W::-D_REENTRANT::-ldl:SIXTY_FOUR_BIT_LONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC:-mabi=64:.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR):::64",
#### *BSD [do see comment about ${BSDthreads} above!]
"BSD-generic32","gcc:-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)",
--
2.1.4

View File

@ -45,6 +45,7 @@ function build {
BASE=$(pwd) BASE=$(pwd)
DST_DIR=$BUILD_DST/$DST_PREFIX DST_DIR=$BUILD_DST/$DST_PREFIX
common_run cd $BUILD_SRC common_run cd $BUILD_SRC
common_run git am $(dirname "${BASH_SOURCE[0]}")/0001-64bit-architecture-support.patch
common_run git clean -xdf common_run git clean -xdf
common_run ./Configure --openssldir=$DST_DIR $CONFIG shared common_run ./Configure --openssldir=$DST_DIR $CONFIG shared
common_run make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" depend common_run make CALC_VERSIONS="SHLIB_COMPAT=; SHLIB_SOVER=" depend
@ -84,10 +85,8 @@ do
$ARCH "mipsel-linux-android-" "arch-mips" $ARCH "mipsel-linux-android-" "arch-mips"
;; ;;
"mips64") "mips64")
echo "[WARNING] Skipping unsupported architecture $ARCH" build "android64-mips64" "mips64el-linux-android-" \
continue $ARCH "mips64el-linux-android-" "arch-mips64"
build "android-mips" "mipsel-linux-android-" \
$ARCH "mipsel-linux-android-" "arch-mips"
;; ;;
"x86") "x86")
build "android-x86" "i686-linux-android-" \ build "android-x86" "i686-linux-android-" \

View File

@ -1,18 +1,26 @@
#!/bin/bash #!/bin/bash
# #
# Android build confguration # Android build confguration
#
# Note: This is a simple configuration to build all
# architectures in one rush.
# Since android 64 bit support was introduced with NDK API 21
# this is the minimal common denominator.
# If you require support for older NDK API levels,
# create seperate configurations for each NDK API level
# and architecture you want to support.
SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}") SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}")
SCRIPT_PATH=$(realpath "$SCRIPT_PATH") SCRIPT_PATH=$(realpath "$SCRIPT_PATH")
WITH_JPEG=0 WITH_JPEG=0
WITH_OPENH264=1 WITH_OPENH264=0
WITH_OPENSSL=1 WITH_OPENSSL=1
BUILD_DEPS=1 BUILD_DEPS=1
ANDROID_NATIVE_API_LEVEL=android-12 ANDROID_NATIVE_API_LEVEL=android-21
JPEG_TAG=master JPEG_TAG=master
OPENH264_TAG=v1.5.0 OPENH264_TAG=v1.5.0
OPENSSL_TAG=OpenSSL_1_0_2g OPENSSL_TAG=OpenSSL_1_0_2h
SRC_DIR=$SCRIPT_PATH/.. SRC_DIR=$SCRIPT_PATH/..
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs
@ -20,4 +28,4 @@ BUILD_SRC=$SRC_DIR/build
CMAKE_BUILD_TYPE=Debug CMAKE_BUILD_TYPE=Debug
BUILD_ARCH="armeabi armeabi-v7a x86" BUILD_ARCH="armeabi armeabi-v7a x86 mips arm64-v8a x86_64 mips64"

View File

@ -70,7 +70,7 @@ if(FREERDP_BUILD)
else() else()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE) set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
if(NOT IOS AND NOT ANDROID) if(NOT IOS)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
endif() endif()
@ -99,7 +99,17 @@ else()
endif() endif()
if(NOT WIN32) if(NOT WIN32)
check_library_exists(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK) CHECK_SYMBOL_EXISTS(pthread_mutex_timedlock pthread.h HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
CHECK_LIBRARY_EXISTS(pthread pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL)
if (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
CHECK_LIBRARY_EXISTS(pthreads pthread_mutex_timedlock "" HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
endif (NOT HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB)
if (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
set(HAVE_PTHREAD_MUTEX_TIMEDLOCK ON)
endif (HAVE_PTHREAD_MUTEX_TIMEDLOCK_SYMBOL OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIB OR HAVE_PTHREAD_MUTEX_TIMEDLOCK_LIBS)
endif() endif()
set(OPENSSL_FEATURE_TYPE "OPTIONAL") set(OPENSSL_FEATURE_TYPE "OPTIONAL")