Added new android build scripts.
This commit is contained in:
parent
61633a1c66
commit
d04eb12a47
269
scripts/android-build-common.sh
Normal file
269
scripts/android-build-common.sh
Normal file
@ -0,0 +1,269 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z $BUILD_ARCH ]; then
|
||||
BUILD_ARCH="armeabi armeabi-v7a mips mips64 x86 x86_64 arm64-v8a"
|
||||
fi
|
||||
|
||||
if [ -z $NDK_TARGET ]; then
|
||||
NDK_TARGET=21
|
||||
fi
|
||||
|
||||
if [ -z $ANDROID_SDK ]; then
|
||||
ANDROID_SDK="missing"
|
||||
fi
|
||||
|
||||
if [ -z $ANDROID_NDK ]; then
|
||||
ANDROID_NDK="missing"
|
||||
fi
|
||||
|
||||
if [ -z $BUILD_DST ]; then
|
||||
BUILD_DST=$(pwd)/libs
|
||||
fi
|
||||
|
||||
if [ -z $BUILD_SRC ]; then
|
||||
BUILD_SRC=$(pwd)/src
|
||||
fi
|
||||
|
||||
if [ -z $SCM_URL ]; then
|
||||
SCM_URL="missing"
|
||||
fi
|
||||
|
||||
if [ -z $SCM_TAG ]; then
|
||||
SCM_TAG=master
|
||||
fi
|
||||
|
||||
CLEAN_BUILD_DIR=0
|
||||
|
||||
function common_help {
|
||||
echo "$(BASHSOURCE[0]) supports the following arguments:"
|
||||
echo " --sdk The base directory of your android SDK"
|
||||
echo " ANDROID_SDK=$ANDROID_SDK"
|
||||
echo " --ndk The base directory of your android NDK defa"
|
||||
echo " ANDROID_NDK=$ANDROID_NDK"
|
||||
echo " --arch A list of architectures to build"
|
||||
echo " BUILD_ARCH=$BUILD_ARCH"
|
||||
echo " --dst The destination directory for include and library files"
|
||||
echo " BUILD_DST=$BUILD_DST"
|
||||
echo " --src The source directory for SCM checkout"
|
||||
echo " BUILD_SRC=$BUILD_SRC"
|
||||
echo " --url The SCM source url"
|
||||
echo " SCM_URL=$SCM_URL"
|
||||
echo " --tag The SCM branch or tag to check out"
|
||||
echo " SCM_TAG=$SCM_TAG"
|
||||
echo " --clean Clean the destination before build"
|
||||
echo " --help Display this help"
|
||||
exit 0
|
||||
}
|
||||
|
||||
function common_run {
|
||||
echo "[RUN] $@"
|
||||
"$@"
|
||||
RES=$?
|
||||
if [[ $RES -ne 0 ]];
|
||||
then
|
||||
echo "[ERROR] $@ retured $RES"
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function common_parse_arguments {
|
||||
while [[ $# > 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
case $key in
|
||||
--conf)
|
||||
source "$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--sdk)
|
||||
ANDROID_SDK="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--ndk)
|
||||
ANDROID_NDK="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--arch)
|
||||
BUILD_ARCH="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--dst)
|
||||
BUILD_DST="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--src)
|
||||
BUILD_SRC="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--url)
|
||||
SCM_URL="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--tag)
|
||||
SCM_TAG="$2"
|
||||
shift
|
||||
;;
|
||||
|
||||
--clean)
|
||||
CLEAN_BUILD_DIR=1
|
||||
shift
|
||||
;;
|
||||
|
||||
--help)
|
||||
common_help
|
||||
shift
|
||||
;;
|
||||
|
||||
*) # Unknown
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
}
|
||||
|
||||
function common_check_requirements {
|
||||
if [[ ! -d $ANDROID_SDK ]];
|
||||
then
|
||||
echo "export ANDROID_SDK to point to your SDK location."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -d $ANDROID_NDK ]];
|
||||
then
|
||||
echo "export ANDROID_NDK to point to your NDK location."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $BUILD_DST ]];
|
||||
then
|
||||
echo "Destination directory not valid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $BUILD_SRC ]];
|
||||
then
|
||||
echo "Source directory not valid"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $SCM_URL ]];
|
||||
then
|
||||
echo "Source URL not defined! Define SCM_URL"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $SCM_TAG ]];
|
||||
then
|
||||
echo "SCM TAG / BRANCH not defined! Define SCM_TAG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -z $NDK_TARGET ]];
|
||||
then
|
||||
echo "Android platform NDK_TARGET not defined"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -x $ANDROID_NDK/ndk-build ]; then
|
||||
NDK_BUILD=$ANDROID_NDK/ndk-build
|
||||
else
|
||||
echo "ndk-build not found in NDK directory $ANDROID_NDK"
|
||||
echo "assuming ndk-build is in path..."
|
||||
NDK_BUILD=ndk-build
|
||||
fi
|
||||
|
||||
if [[ -z $NDK_BUILD ]];
|
||||
then
|
||||
echo "Android ndk-build not detected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for CMD in make git cmake $NDK_BUILD
|
||||
do
|
||||
if ! type $CMD >/dev/null; then
|
||||
echo "Command $CMD not found. Install and add it to the PATH."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "${BUILD_SRC:0:1}" != "/" ];
|
||||
then
|
||||
BUILD_SRC=$(pwd)/$BUILD_SRC
|
||||
fi
|
||||
if [ "${BUILD_DST:0:1}" != "/" ];
|
||||
then
|
||||
BUILD_DST=$(pwd)/$BUILD_DST
|
||||
fi
|
||||
}
|
||||
|
||||
function common_update {
|
||||
if [ $# -ne 3 ];
|
||||
then
|
||||
echo "Invalid arguments to update function $@"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Preparing checkout..."
|
||||
BASE=$(pwd)
|
||||
if [[ ! -d $3 ]];
|
||||
then
|
||||
common_run mkdir -p $3
|
||||
common_run cd $3
|
||||
common_run git clone $1 $3
|
||||
fi
|
||||
|
||||
common_run cd $BASE
|
||||
common_run cd $3
|
||||
common_run git fetch
|
||||
common_run git reset --hard HEAD
|
||||
common_run git checkout $2
|
||||
common_run cd $BASE
|
||||
}
|
||||
|
||||
function common_clean {
|
||||
if [ $CLEAN_BUILD_DIR -ne 1 ];
|
||||
then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ $# -ne 1 ];
|
||||
then
|
||||
echo "Invalid arguments to clean function $@"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cleaning up $1..."
|
||||
common_run rm -rf $1
|
||||
}
|
||||
|
||||
function common_copy {
|
||||
if [ $# -ne 2 ];
|
||||
then
|
||||
echo "Invalid arguments to copy function $@"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -d $1 ] || [ ! -d $1/include ] || [ ! -d $1/libs ];
|
||||
then
|
||||
echo "Invalid source $1"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z $2 ];
|
||||
then
|
||||
echo "Invalid destination $2"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d $2 ];
|
||||
then
|
||||
common_run mkdir -p $2
|
||||
fi
|
||||
common_run cp -L -r $1/include $2
|
||||
common_run cp -L -r $1/libs/* $2
|
||||
}
|
140
scripts/android-build-freerdp.sh
Executable file
140
scripts/android-build-freerdp.sh
Executable file
@ -0,0 +1,140 @@
|
||||
#!/bin/bash
|
||||
|
||||
JPEG_TAG=master
|
||||
OPENH264_TAG=master
|
||||
OPENSSL_TAG=master
|
||||
|
||||
WITH_JPEG=0
|
||||
WITH_OPENH264=0
|
||||
WITH_OPENSSL=0
|
||||
|
||||
SRC_DIR=$(pwd)
|
||||
BUILD_SRC=$(pwd)
|
||||
BUILD_DST=$(pwd)
|
||||
|
||||
CMAKE_BUILD_TYPE=Debug
|
||||
BUILD_DEPS=0
|
||||
|
||||
SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}")
|
||||
source $SCRIPT_PATH/android-build-common.sh
|
||||
source $SCRIPT_PATH/android-build.conf
|
||||
|
||||
# Parse arguments.
|
||||
REMAINING=""
|
||||
while [[ $# > 0 ]]
|
||||
do
|
||||
key="$1"
|
||||
case $key in
|
||||
--src)
|
||||
SRC_DIR="$2"
|
||||
shift
|
||||
;;
|
||||
--jpeg)
|
||||
WITH_JPEG=1
|
||||
shift
|
||||
;;
|
||||
--openh264)
|
||||
WITH_OPENH264=1
|
||||
shift
|
||||
;;
|
||||
--openssl)
|
||||
WITH_OPENSSL=1
|
||||
shift
|
||||
;;
|
||||
--debug)
|
||||
CMAKE_BUILD_TYPE=Debug
|
||||
shift
|
||||
;;
|
||||
--release)
|
||||
CMAKE_BUILD_TYPE=Release
|
||||
shift
|
||||
;;
|
||||
--relWithDebug)
|
||||
CMAKE_BUILD_TYPE=RelWithDebug
|
||||
shift
|
||||
;;
|
||||
--build-deps)
|
||||
BUILD_DEPS=1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
REMAINING="$REMAINING $key"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
common_parse_arguments $REMAINING
|
||||
|
||||
# clean up top
|
||||
if [ -d $BUILD_SRC ];
|
||||
then
|
||||
common_clean $BUILD_SRC
|
||||
fi
|
||||
|
||||
if [ -d $BUILD_DST ];
|
||||
then
|
||||
common_run mkdir -p $BUILD_DST
|
||||
fi
|
||||
|
||||
# Prepare the environment
|
||||
common_run mkdir -p $BUILD_SRC
|
||||
|
||||
CMAKE_CMD_ARGS="-DANDROID_NDK=$ANDROID_NDK \
|
||||
-DCMAKE_TOOLCHAIN_FILE=$SRC_DIR/cmake/AndroidToolchain.cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=$BUILD_DST \
|
||||
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
|
||||
-DFREERDP_EXTERNAL_PATH=$BUILD_DST"
|
||||
|
||||
BASE=$(pwd)
|
||||
for ARCH in $BUILD_ARCH
|
||||
do
|
||||
# build dependencies.
|
||||
if [ $WITH_JPEG -ne 0 ];
|
||||
then
|
||||
if [ $BUILD_DEPS -ne 0 ];
|
||||
then
|
||||
common_run bash $SCRIPT_PATH/android-build-jpeg.sh \
|
||||
--src $BUILD_SRC/jpeg --dst $BUILD_DST \
|
||||
--sdk $ANDROID_SDK --ndk $ANDROID_NDK \
|
||||
--arch $ARCH \
|
||||
--tag $JPEG_TAG
|
||||
fi
|
||||
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_JPEG=ON"
|
||||
fi
|
||||
if [ $WITH_OPENH264 -ne 0 ];
|
||||
then
|
||||
if [ $BUILD_DEPS -ne 0 ];
|
||||
then
|
||||
common_run bash $SCRIPT_PATH/android-build-openh264.sh \
|
||||
--src $BUILD_SRC/openh264 --dst $BUILD_DST \
|
||||
--sdk $ANDROID_SDK --ndk $ANDROID_NDK \
|
||||
--arch $ARCH \
|
||||
--tag $OPENH264_TAG
|
||||
fi
|
||||
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_OPENH264=ON"
|
||||
fi
|
||||
if [ $WITH_OPENSSL -ne 0 ];
|
||||
then
|
||||
if [ $BUILD_DEPS -ne 0 ];
|
||||
then
|
||||
common_run bash $SCRIPT_PATH/android-build-openssl.sh \
|
||||
--src $BUILD_SRC/openssl --dst $BUILD_DST \
|
||||
--sdk $ANDROID_SDK --ndk $ANDROID_NDK \
|
||||
--arch $ARCH \
|
||||
--tag $OPENSSL_TAG
|
||||
fi
|
||||
fi
|
||||
|
||||
# Build and install the library.
|
||||
common_run cd $BASE
|
||||
common_run mkdir -p $BUILD_SRC/freerdp-build/$ARCH
|
||||
common_run cd $BUILD_SRC/freerdp-build/$ARCH
|
||||
common_run export ANDROID_NDK=$ANDROID_NDK
|
||||
common_run cmake $CMAKE_CMD_ARGS \
|
||||
-DANDROID_ABI=$ARCH \
|
||||
$SRC_DIR
|
||||
echo $(pwd)
|
||||
common_run cmake --build . --target install
|
||||
done
|
||||
|
||||
echo "Successfully build library for architectures $BUILD_ARCH"
|
41
scripts/android-build-jpeg.sh
Executable file
41
scripts/android-build-jpeg.sh
Executable file
@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
SCM_URL=https://github.com/akallabeth/jpeg8d.git
|
||||
SCM_TAG=master
|
||||
|
||||
source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh
|
||||
|
||||
function usage {
|
||||
echo $0 [arguments]
|
||||
echo "\tThe script checks out the OpenH264 git repository"
|
||||
echo "\tto a local source directory, builds and installs"
|
||||
echo "\tthe library for all architectures defined to"
|
||||
echo "\tthe destination directory."
|
||||
echo ""
|
||||
echo "\t[-s|--source-dir <path>]"
|
||||
echo "\t[-d|--destination-dir <path>]"
|
||||
echo "\t[-a|--arch <architectures>]"
|
||||
echo "\t[-t|--tag <tag or branch>]"
|
||||
echo "\t[--scm-url <url>]"
|
||||
echo "\t[--ndk <android NDK path>]"
|
||||
echo "\t[--sdk <android SDK path>]"
|
||||
exit 1
|
||||
}
|
||||
|
||||
function build {
|
||||
echo "Building architectures $BUILD_ARCH..."
|
||||
BASE=$(pwd)
|
||||
common_run cd $BUILD_SRC
|
||||
common_run $NDK_BUILD V=1 APP_ABI="${BUILD_ARCH}" -j clean
|
||||
common_run $NDK_BUILD V=1 APP_ABI="${BUILD_ARCH}" -j
|
||||
common_run cd $BASE
|
||||
}
|
||||
|
||||
# Run the main program.
|
||||
common_parse_arguments $@
|
||||
common_check_requirements
|
||||
common_update $SCM_URL $SCM_TAG $BUILD_SRC
|
||||
common_clean $BUILD_DST
|
||||
|
||||
build
|
||||
|
||||
common_copy $BUILD_SRC $BUILD_DST
|
58
scripts/android-build-openh264.sh
Executable file
58
scripts/android-build-openh264.sh
Executable file
@ -0,0 +1,58 @@
|
||||
#!/bin/bash
|
||||
SCM_URL=https://github.com/cisco/openh264
|
||||
SCM_TAG=master
|
||||
|
||||
source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh
|
||||
|
||||
function build {
|
||||
echo "Building architecture $1..."
|
||||
BASE=$(pwd)
|
||||
common_run cd $BUILD_SRC
|
||||
PATH=$ANDROID_SDK/tools:$ANDROID_NDK:$PATH
|
||||
MAKE="make PATH=$PATH OS=android NDKROOT=$ANDROID_NDK TARGET=android-$2 NDKLEVEL=$2 ARCH=$1 -j"
|
||||
common_run git clean -xdf
|
||||
common_run $MAKE
|
||||
# Install creates a non optimal directory layout, fix that
|
||||
common_run $MAKE PREFIX=$BUILD_SRC/libs/$1 install
|
||||
common_run cd $BASE
|
||||
}
|
||||
|
||||
# Run the main program.
|
||||
common_parse_arguments $@
|
||||
common_check_requirements
|
||||
common_update $SCM_URL $SCM_TAG $BUILD_SRC
|
||||
common_clean $BUILD_DST
|
||||
|
||||
for ARCH in $BUILD_ARCH
|
||||
do
|
||||
case $ARCH in
|
||||
"armeabi")
|
||||
OARCH="arm"
|
||||
;;
|
||||
"armeabi-v7a")
|
||||
OARCH="arm"
|
||||
;;
|
||||
"arm64-v8a")
|
||||
OARCH="arm64"
|
||||
;;
|
||||
*)
|
||||
OARCH=$ARCH
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "$ARCH=$OARCH"
|
||||
|
||||
build $OARCH $NDK_TARGET
|
||||
|
||||
if [ ! -d $BUILD_DST/include ];
|
||||
then
|
||||
common_run mkdir -p $BUILD_DST/include
|
||||
fi
|
||||
|
||||
common_run cp -L -r $BUILD_SRC/libs/$OARCH/include/ $BUILD_DST/
|
||||
if [ ! -d $BUILD_DST/$ARCH ];
|
||||
then
|
||||
common_run mkdir -p $BUILD_DST/$ARCH
|
||||
fi
|
||||
common_run cp -L $BUILD_SRC/libs/$OARCH/lib/*.so $BUILD_DST/$ARCH/
|
||||
done
|
121
scripts/android-build-openssl.sh
Executable file
121
scripts/android-build-openssl.sh
Executable file
@ -0,0 +1,121 @@
|
||||
#!/bin/bash
|
||||
|
||||
SCM_URL=https://github.com/openssl/openssl
|
||||
SCM_TAG=master
|
||||
|
||||
COMPILER=4.9
|
||||
|
||||
source $(dirname "${BASH_SOURCE[0]}")/android-build-common.sh
|
||||
|
||||
function build {
|
||||
if [ $# -ne 5 ];
|
||||
then
|
||||
echo "Invalid arguments $@"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CONFIG=$1
|
||||
ARCH_PREFIX=$2
|
||||
DST_PREFIX=$3
|
||||
TOOLCHAIN_PREFIX=$4
|
||||
PLATFORM_PREFIX=$5
|
||||
|
||||
TMP_DIR=$ANDROID_NDK/toolchains/$TOOLCHAIN_PREFIX$COMPILER/prebuilt/
|
||||
HOST_PLATFORM=$(ls $TMP_DIR)
|
||||
if [ ! -d $TMP_DIR$HOST_POLATFORM ];
|
||||
then
|
||||
echo "could not determine NDK host platform in $ANDROID_NDK/toolchains/$TOOLCHAIN_PREFIX$COMPILER/prebuilt/"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
common_run export CROSS_SYSROOT=$ANDROID_NDK/platforms/android-$NDK_TARGET/$PLATFORM_PREFIX
|
||||
common_run export ANDROID_DEV=$ANDROID_NDK/platforms/android-$NDK_TARGET/$PLATFORM_PREFIX/usr
|
||||
common_run export CROSS_COMPILE=$ARCH_PREFIX
|
||||
common_run export PATH=$ANDROID_NDK/toolchains/$TOOLCHAIN_PREFIX$COMPILER/prebuilt/$HOST_PLATFORM/bin/:$ORG_PATH
|
||||
|
||||
echo "CONFIG=$CONFIG"
|
||||
echo "ARCH_PREFIX=$ARCH_PREFIX"
|
||||
echo "DST_PREFIX=$DST_PREFIX"
|
||||
echo "TOOLCHAIN_PREFIX=$TOOLCHAIN_PREFIX"
|
||||
echo "PLATFORM_PREFIX=$PLATFORM_PREFIX"
|
||||
echo "CROSS_SYSROOT=$CROSS_SYSROOT"
|
||||
echo "CROSS_COMPILE=$CROSS_COMPILE"
|
||||
echo "PATH=$PATH"
|
||||
|
||||
BASE=$(pwd)
|
||||
DST_DIR=$BUILD_DST/$DST_PREFIX
|
||||
common_run cd $BUILD_SRC
|
||||
common_run git clean -xdf
|
||||
common_run ./Configure --openssldir=$DST_DIR $CONFIG shared
|
||||
common_run make -j build_libs
|
||||
|
||||
if [ ! -d $DST_DIR ];
|
||||
then
|
||||
common_run mkdir -p $DST_DIR
|
||||
fi
|
||||
|
||||
common_run cp -L libssl.so $DST_DIR
|
||||
common_run cp -L libcrypto.so $DST_DIR
|
||||
common_run cd $BASE
|
||||
}
|
||||
|
||||
# Run the main program.
|
||||
common_parse_arguments $@
|
||||
common_check_requirements
|
||||
common_update $SCM_URL $SCM_TAG $BUILD_SRC
|
||||
common_clean $BUILD_DST
|
||||
|
||||
# Patch openssl
|
||||
BASE=$(pwd)
|
||||
common_run cd $BUILD_SRC
|
||||
common_run git am $(dirname "${BASH_SOURCE[0]}")/openssl-disable-library-versioning.patch
|
||||
common_run cd $BASE
|
||||
|
||||
ORG_PATH=$PATH
|
||||
for ARCH in $BUILD_ARCH
|
||||
do
|
||||
|
||||
case $ARCH in
|
||||
"armeabi")
|
||||
build "android" "arm-linux-androideabi-" \
|
||||
$ARCH "arm-linux-androideabi-" "arch-arm"
|
||||
;;
|
||||
"armeabi-v7a")
|
||||
build "android-armv7" "arm-linux-androideabi-" \
|
||||
$ARCH "arm-linux-androideabi-" "arch-arm"
|
||||
;;
|
||||
"mips")
|
||||
build "android-mips" "mipsel-linux-android-" \
|
||||
$ARCH "mipsel-linux-android-" "arch-mips"
|
||||
;;
|
||||
"mips64")
|
||||
echo "[WARNING] Skipping unsupported architecture $ARCH"
|
||||
continue
|
||||
build "android-mips" "mipsel-linux-android-" \
|
||||
$ARCH "mipsel-linux-android-" "arch-mips"
|
||||
;;
|
||||
"x86")
|
||||
build "android-x86" "i686-linux-android-" \
|
||||
$ARCH "x86-" "arch-x86"
|
||||
;;
|
||||
"arm64-v8a")
|
||||
build "android64-aarch64" "aarch64-linux-android-" \
|
||||
$ARCH "aarch64-linux-android-" "arch-arm64"
|
||||
;;
|
||||
"x86_64")
|
||||
build "android64" "x86_64-linux-android-" \
|
||||
$ARCH "x86_64-" "arch-x86_64"
|
||||
;;
|
||||
*)
|
||||
echo "[WARNING] Skipping unsupported architecture $ARCH"
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -d $BUILD_DST/include ];
|
||||
then
|
||||
common_run mkdir -p $BUILD_DST/include
|
||||
fi
|
||||
common_run cp -L -r $BUILD_SRC/include/openssl $BUILD_DST/include/
|
||||
|
22
scripts/android-build.conf
Normal file
22
scripts/android-build.conf
Normal file
@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Android build confguration
|
||||
SCRIPT_PATH=$(dirname "${BASH_SOURCE[0]}")
|
||||
SCRIPT_PATH=$(realpath "$SCRIPT_PATH")
|
||||
|
||||
WITH_JPEG=1
|
||||
WITH_OPENH264=1
|
||||
WITH_OPENSSL=1
|
||||
BUILD_DEPS=1
|
||||
|
||||
JPEG_TAG=master
|
||||
OPENH264_TAG=v1.5.0
|
||||
OPENSSL_TAG=OpenSSL_1_0_2f
|
||||
|
||||
SRC_DIR=$SCRIPT_PATH/..
|
||||
BUILD_DST=$SCRIPT_PATH/../client/Android/Studio/freeRDPCore/src/main/jniLibs
|
||||
BUILD_SRC=$SRC_DIR/build
|
||||
|
||||
CMAKE_BUILD_TYPE=Debug
|
||||
|
||||
BUILD_ARCH="armeabi armeabi-v7a x86"
|
@ -1,134 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This script checks out or updates and builds third party libraries
|
||||
# required for the android build.
|
||||
#
|
||||
# Specifically these are:
|
||||
# - OpenSSL
|
||||
# - Android NDK Profiler
|
||||
# - Jpeg library
|
||||
#
|
||||
# Usage:
|
||||
# android_setup_build_env.sh <source root>
|
||||
|
||||
OPENSSL_SCM=https://github.com/akallabeth/openssl-android.git
|
||||
OPENSSL_TAG=1.0.1h-fips-2.0.7
|
||||
NDK_PROFILER_SCM=https://github.com/richq/android-ndk-profiler.git
|
||||
JPEG_LIBRARY_SCM=https://github.com/akallabeth/jpeg8d.git
|
||||
|
||||
SCRIPT_NAME=$(basename $0)
|
||||
|
||||
if [ -x $ANDROID_NDK/ndk-build ]; then
|
||||
NDK_BUILD=$ANDROID_NDK/ndk-build
|
||||
else
|
||||
echo "ndk-build not found in NDK directory $ANDROID_NDK"
|
||||
echo "assuming ndk-build is in path..."
|
||||
NDK_BUILD=ndk-build
|
||||
fi
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
|
||||
echo "Missing command line argument, current directory as root."
|
||||
ROOT=`pwd`
|
||||
ROOT=$ROOT/external
|
||||
else
|
||||
ROOT=`readlink -f $1`
|
||||
fi
|
||||
|
||||
if [ ! -d $ROOT ]; then
|
||||
echo "Argument '$ROOT' is not a directory."
|
||||
exit -2
|
||||
fi
|
||||
echo "Using '$ROOT' as root."
|
||||
|
||||
echo "Preparing OpenSSL..."
|
||||
OPENSSL_SRC=$ROOT/openssl-build
|
||||
if [ -d $OPENSSL_SRC ]; then
|
||||
cd $OPENSSL_SRC
|
||||
git fetch
|
||||
RETVAL=$?
|
||||
else
|
||||
git clone $OPENSSL_SCM $OPENSSL_SRC
|
||||
RETVAL=$?
|
||||
fi
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute git command [$RETVAL]"
|
||||
exit -3
|
||||
fi
|
||||
cd $OPENSSL_SRC
|
||||
|
||||
# We want to build a specific TAG
|
||||
git checkout $OPENSSL_TAG
|
||||
|
||||
make clean
|
||||
# The makefile has a bug, which aborts during
|
||||
# first compilation. Rerun make to build the whole lib.
|
||||
make
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute make command [$RETVAL]"
|
||||
exit -4
|
||||
fi
|
||||
# Copy the created library to the default openssl directory,
|
||||
# so that CMake will detect it automatically.
|
||||
SSL_ROOT=`find $OPENSSL_SRC -type d -name "openssl-?.?.*"`
|
||||
if [ -z "$SSL_ROOT" ]; then
|
||||
echo "OpenSSL was not build successfully, aborting."
|
||||
exit -42
|
||||
fi
|
||||
mkdir -p $SSL_ROOT/lib
|
||||
cp $SSL_ROOT/*.a $SSL_ROOT/lib/
|
||||
|
||||
rm -f $ROOT/openssl
|
||||
ln -s $SSL_ROOT $ROOT/openssl
|
||||
|
||||
echo "Preparing NDK profiler..."
|
||||
NDK_PROFILER_SRC=$ROOT/android-ndk-profiler
|
||||
if [ -d $NDK_PROFILER_SRC ]; then
|
||||
cd $NDK_PROFILER_SRC
|
||||
git pull
|
||||
RETVAL=$?
|
||||
else
|
||||
git clone $NDK_PROFILER_SCM $NDK_PROFILER_SRC
|
||||
RETVAL=$?
|
||||
fi
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute git command [$RETVAL]"
|
||||
exit -5
|
||||
fi
|
||||
cd $NDK_PROFILER_SRC
|
||||
$NDK_BUILD V=1 APP_ABI=armeabi-v7a clean
|
||||
$NDK_BUILD V=1 APP_ABI=armeabi-v7a
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute $NDK_BUILD command [$RETVAL]"
|
||||
exit -6
|
||||
fi
|
||||
|
||||
echo "Preparing JPEG library..."
|
||||
JPEG_LIBRARY_SRC=$ROOT/jpeg8d
|
||||
if [ -d $JPEG_LIBRARY_SRC ]; then
|
||||
cd $JPEG_LIBRARY_SRC
|
||||
git pull
|
||||
RETVAL=$?
|
||||
else
|
||||
git clone $JPEG_LIBRARY_SCM $JPEG_LIBRARY_SRC
|
||||
RETVAL=$?
|
||||
fi
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute git command [$RETVAL]"
|
||||
exit -6
|
||||
fi
|
||||
cd $JPEG_LIBRARY_SRC
|
||||
$NDK_BUILD V=1 APP_ABI=armeabi-v7a clean
|
||||
$NDK_BUILD V=1 APP_ABI=armeabi-v7a
|
||||
RETVAL=$?
|
||||
if [ $RETVAL -ne 0 ]; then
|
||||
echo "Failed to execute $NDK_BUILD command [$RETVAL]"
|
||||
exit -7
|
||||
fi
|
||||
mkdir -p $JPEG_LIBRARY_SRC/lib
|
||||
cp $JPEG_LIBRARY_SRC/obj/local/armeabi-v7a/*.a $JPEG_LIBRARY_SRC/lib/
|
||||
|
||||
echo "Prepared external libraries, you can now build the application."
|
||||
exit 0
|
24
scripts/openssl-disable-library-versioning.patch
Normal file
24
scripts/openssl-disable-library-versioning.patch
Normal file
@ -0,0 +1,24 @@
|
||||
From 12f0521bbb3f046db8c7854364135d8247cf982e Mon Sep 17 00:00:00 2001
|
||||
From: Armin Novak <armin.novak@thincast.com>
|
||||
Date: Fri, 29 Jan 2016 17:04:12 +0100
|
||||
Subject: [PATCH] Disabled library versioning.
|
||||
|
||||
---
|
||||
Makefile.shared | 1 -
|
||||
1 file changed, 1 deletion(-)
|
||||
|
||||
diff --git a/Makefile.shared b/Makefile.shared
|
||||
index e753f44..5cffcc2 100644
|
||||
--- a/Makefile.shared
|
||||
+++ b/Makefile.shared
|
||||
@@ -81,7 +81,6 @@ CALC_VERSIONS= \
|
||||
prev=""; \
|
||||
for v in `echo "$(LIBVERSION) $(LIBCOMPATVERSIONS)" | cut -d';' -f1`; do \
|
||||
SHLIB_SOVER_NODOT=$$v; \
|
||||
- SHLIB_SOVER=.$$v; \
|
||||
if [ -n "$$prev" ]; then \
|
||||
SHLIB_COMPAT="$$SHLIB_COMPAT .$$prev"; \
|
||||
fi; \
|
||||
--
|
||||
2.1.4
|
||||
|
Loading…
Reference in New Issue
Block a user