[build,android] only use CMake from SDK

* only use CMake from android SDK
* abort if CMake or ndk-build are not detected
* update default OpenSSL

(cherry picked from commit de58995006)
This commit is contained in:
Armin Novak 2023-02-08 07:48:49 +01:00 committed by Martin Fleisz
parent 0128dfaa89
commit 01d0f7c640
2 changed files with 95 additions and 86 deletions

View File

@ -8,11 +8,11 @@ case "$(uname -s)" in
Darwin)
FIND_ARGS="-perm +111 $FIND_ARGS"
;;
;;
*)
FIND_ARGS="-executable $FIND_ARGS"
;;
;;
esac
if [ -z $BUILD_ARCH ]; then
@ -96,10 +96,10 @@ function common_parse_arguments {
do
key="$1"
case $key in
--conf)
source "$2" || exit 1
shift
;;
--conf)
source "$2" || exit 1
shift
;;
--target)
NDK_TARGET="$2"
@ -217,12 +217,20 @@ function common_check_requirements {
else
echo "ndk-build not found in NDK directory $ANDROID_NDK"
echo "assuming ndk-build is in path..."
NDK_BUILD=ndk-build
NDK_BUILD=$(which ndk-build)
if [ -z $NDK_BUILD ]; then
echo "ndk-build not found in $ANDROID_NDK and not in PATH"
exit 1
fi
fi
if [ -z $CMAKE_PROGRAM ]; then
CMAKE_PROGRAM=$(find $ANDROID_SDK/cmake -name cmake $FIND_ARGS)
fi
if [ -z $CMAKE_PROGRAM ]; then
CMAKE_PROGRAM=$(find $ANDROID_SDK/cmake -name cmake $FIND_ARGS)
if [ -z $CMAKE_PROGRAM ]; then
echo "CMake not found in $ANDROID_SDK, install CMake from the android SDK!"
exit 1
fi
fi
for CMD in make git $CMAKE_PROGRAM $NDK_BUILD
do

View File

@ -2,8 +2,8 @@
OPENH264_TAG=v2.3.1
OPENH264_HASH=453afa66dacb560bc5fd0468aabee90c483741571bca820a39a1c07f0362dc32
OPENSSL_TAG=openssl-1.1.1q
OPENSSL_HASH=d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca
OPENSSL_TAG=openssl-1.1.1s
OPENSSL_HASH=c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa
FFMPEG_TAG=n4.4.1
FFMPEG_HASH=82b43cc67296bcd01a59ae6b327cdb50121d3a9e35f41a30de1edd71bb4a6666
@ -76,8 +76,8 @@ common_parse_arguments $REMAINING
if [ -z ${WITH_MEDIACODEC+x} ];
then
common_run echo "WITH_MEDIACODEC unset, defining WITH_MEDIACODEC=1"
WITH_MEDIACODEC=1
common_run echo "WITH_MEDIACODEC unset, defining WITH_MEDIACODEC=1"
WITH_MEDIACODEC=1
fi
# clean up top
@ -99,91 +99,92 @@ CMAKE_CMD_ARGS="-DANDROID_NDK=$ANDROID_NDK \
-DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake \
-DCMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \
-DFREERDP_EXTERNAL_PATH=$BUILD_DST \
-DWITH_CLIENT_SDL=OFF \
-DCMAKE_MAKE_PROGRAM=make"
BASE=$(pwd)
for ARCH in $BUILD_ARCH
do
# build dependencies.
if [ $WITH_OPENH264 -ne 0 ];
then
if [ -z "$ANDROID_NDK_OPENH264" ]
then
echo
echo "Warning: Missing openh264-ndk, using $ANDROID_NDK" >&2
echo
ANDROID_NDK_OPENH264=$ANDROID_NDK
fi
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_OPENH264" \
--arch $ARCH \
--target $NDK_TARGET \
--tag $OPENH264_TAG \
# build dependencies.
if [ $WITH_OPENH264 -ne 0 ];
then
if [ -z "$ANDROID_NDK_OPENH264" ]
then
echo
echo "Warning: Missing openh264-ndk, using $ANDROID_NDK" >&2
echo
ANDROID_NDK_OPENH264=$ANDROID_NDK
fi
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_OPENH264" \
--arch $ARCH \
--target $NDK_TARGET \
--tag $OPENH264_TAG \
--hash $OPENH264_HASH
fi
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_OPENH264=ON"
else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_OPENH264=OFF"
fi
fi
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_OPENH264=ON"
else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_OPENH264=OFF"
fi
if [ $WITH_MEDIACODEC -ne 0 ];
then
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=ON"
else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=OFF"
fi
if [ $WITH_MEDIACODEC -ne 0 ];
then
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=ON"
else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_MEDIACODEC=OFF"
fi
if [ $WITH_FFMPEG -ne 0 ];
then
then
if [ $BUILD_DEPS -ne 0 ];
then
common_run bash $SCRIPT_PATH/android-build-ffmpeg.sh \
--src $BUILD_SRC/ffmpeg --dst $BUILD_DST \
--sdk "$ANDROID_SDK" \
--ndk "$ANDROID_NDK" \
--arch $ARCH \
--target $NDK_TARGET \
--tag $FFMPEG_TAG \
--hash $FFMPEG_HASH
fi
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_FFMPEG=ON -DWITH_SWSCALE=ON -DWITH_DSP_FFMPEG=ON"
then
common_run bash $SCRIPT_PATH/android-build-ffmpeg.sh \
--src $BUILD_SRC/ffmpeg --dst $BUILD_DST \
--sdk "$ANDROID_SDK" \
--ndk "$ANDROID_NDK" \
--arch $ARCH \
--target $NDK_TARGET \
--tag $FFMPEG_TAG \
--hash $FFMPEG_HASH
fi
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_FFMPEG=ON -DWITH_SWCALE=ON"
else
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_FFMPEG=OFF -DWITH_SWSCALE=OFF -DWITH_DSP_FFMPEG=OFF"
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 \
CMAKE_CMD_ARGS="$CMAKE_CMD_ARGS -DWITH_FFMPEG=OFF"
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 \
--target $NDK_TARGET \
--tag $OPENSSL_TAG \
--hash $OPENSSL_HASH
fi
fi
--tag $OPENSSL_TAG \
--hash $OPENSSL_HASH
fi
fi
# Build and install the library.
if [ $DEPS_ONLY -eq 0 ];
then
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_PROGRAM $CMAKE_CMD_ARGS \
-DANDROID_ABI=$ARCH \
-DCMAKE_INSTALL_PREFIX=$BUILD_DST/$ARCH \
-DCMAKE_INSTALL_LIBDIR=. \
$SRC_DIR
echo $(pwd)
common_run cmake --build . --target install
fi
# Build and install the library.
if [ $DEPS_ONLY -eq 0 ];
then
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_PROGRAM $CMAKE_CMD_ARGS \
-DANDROID_ABI=$ARCH \
-DCMAKE_INSTALL_PREFIX=$BUILD_DST/$ARCH \
-DCMAKE_INSTALL_LIBDIR=. \
$SRC_DIR
echo $(pwd)
common_run $CMAKE_PROGRAM --build . --target install
fi
done
echo "Successfully build library for architectures $BUILD_ARCH"