A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/Haivision/srt/commit/a32e975f2403c8b2335e7ab9e77f21291a7e2b3c below:

[build] Update for Android build scripts (#2009) · Haivision/srt@a32e975 · GitHub

File tree Expand file treeCollapse file tree 8 files changed

+100

-180

lines changed

Filter options

Expand file treeCollapse file tree 8 files changed

+100

-180

lines changed Original file line number Diff line number Diff line change

@@ -2,31 +2,17 @@

2 2 3 3

**NOTE:** The scripts have been moved to [scripts/build-android](../../scripts/build-android/) folder.

4 4 5 -

## Establishing a Build Environment

6 - 7 -

### Installing the Android NDK

5 +

## Install the NDK and CMake

8 6 9 7

The Android NDK is required to build native modules for Android.

8 +

[Install and configure the NDK](https://developer.android.com/studio/projects/install-ndk)

9 + 10 10

Consider installing the latest version of cmake. The higher version of cmake the better. As of writing the current version of CMake is 3.18.4

11 11

You can download Cmake from the following website:

12 12

[https://cmake.org/download](https://cmake.org/download/)

13 13 14 -

Download the NDK r19 or newer archive from the following site:

15 -

[Download the Android NDK on developer.android.com](https://developer.android.com/ndk/downloads/index.html)

16 -

To install the Android NDK, simply expand the archive in the folder where you want to install it.

17 - 18 -

### OpenSSL

19 - 20 -

Google removed openssl from Android 7+. You must build openssl libs by yourself.

21 - 22 -

## Configure the NDK Path

23 - 24 -

Edit the ```mkall``` script to configure NDK path. Set the ```NDK``` to the directory where the NDK is installed.

25 - 26 14

## Build SRT for Android

27 15 28 -

Run ```/bin/bash mkall > build.log``` script. Libraries will be installed to ```./target-architecture/lib```.

29 - 30 -

## Export SRT Libraries

16 +

Run ```./build-android -n /path/to/ndk```. E.g. ```./build-android -n /home/username/Android/Sdk/ndk/21.4.7075529```

31 17 32 -

Run ```/bin/bash packjni``` to generate ```jniLibs``` archive for Android Studio.

18 +

[Include prebuilt native libraries](https://developer.android.com/studio/projects/gradle-external-native-builds#jniLibs) from ```prebuilt``` folder into Android Studio project.

Original file line number Diff line number Diff line change

@@ -1,5 +1,3 @@

1 1

## Scripts for building SRT for Android

2 2 3 -

**NOTE:** The scripts have been moved from `docs/Android/` folder. Updating the paths might be required.

4 - 5 3

See [Building SRT for Android](../../docs/build/build-android.md) for the instructions.

Original file line number Diff line number Diff line change

@@ -0,0 +1,69 @@

1 +

#!/bin/sh

2 + 3 +

echo_help()

4 +

{

5 +

echo "Usage: $0 [options...]"

6 +

echo " -n Specify NDK root path for the build."

7 +

echo " -a Select target API level."

8 +

echo " -t Select target architectures."

9 +

echo " Android supports the following architectures: armeabi armeabi-v7a arm64-v8a x86 x86_64."

10 +

echo " -o Select OpenSSL (1.1.1 series) version. E.g. 1.1.1h"

11 +

echo " -s Select a specific SRT tag. E.g. v1.4.3"

12 +

echo

13 +

echo "Example: ./build-android -n /home/username/Android/Sdk/ndk/21.4.7075529 -a 28 -t \"armeabi-v7a arm64-v8a x86 x86_64\" -o 1.1.1h -s v1.4.3"

14 +

echo

15 +

}

16 + 17 +

# Init optional command line vars

18 +

NDK_ROOT=""

19 +

API_LEVEL=28

20 +

BUILD_TARGETS="armeabi armeabi-v7a arm64-v8a x86 x86_64"

21 +

OPENSSL_VERSION=1.1.1h

22 +

SRT_VERSION=""

23 + 24 +

while getopts n:a:t:o:s: option

25 +

do

26 +

case "${option}"

27 +

in

28 +

n) NDK_ROOT=${OPTARG};;

29 +

a) API_LEVEL=${OPTARG};;

30 +

t) BUILD_TARGETS=${OPTARG};;

31 +

o) OPENSSL_VERSION=${OPTARG};;

32 +

s) SRT_VERSION=${OPTARG};;

33 +

*) twentytwo=${OPTARG};;

34 +

esac

35 +

done

36 + 37 +

echo_help

38 + 39 +

if [ -z "$NDK_ROOT" ] ; then

40 +

echo "NDK directory not set."

41 +

exit 128

42 +

else

43 +

if [ ! -d "$NDK_ROOT" ]; then

44 +

echo "NDK directory does not exist: $NDK_ROOT"

45 +

exit 128

46 +

fi

47 +

fi

48 + 49 +

# Determine the path of the executing script

50 +

BASE_DIR=$(readlink -f $0 | xargs dirname)

51 + 52 +

$BASE_DIR/mkssl -n $NDK_ROOT -a $API_LEVEL -t "$BUILD_TARGETS" -o $OPENSSL_VERSION

53 + 54 +

if [ ! -d $BASE_DIR/srt ]; then

55 +

git clone https://github.com/Haivision/srt srt

56 +

if [ ! -z "$SRT_VERSION" ]; then

57 +

git -C $BASE_DIR/srt checkout $SRT_VERSION

58 +

fi

59 +

fi

60 + 61 +

JNI_DIR=$BASE_DIR/prebuilt

62 + 63 +

for build_target in $BUILD_TARGETS; do

64 +

git -C $BASE_DIR/srt clean -fd

65 +

$BASE_DIR/mksrt -n $NDK_ROOT -a $API_LEVEL -t $build_target -s $BASE_DIR/srt -i $BASE_DIR/$build_target

66 + 67 +

mkdir -p $JNI_DIR/$build_target

68 +

cp $BASE_DIR/$build_target/lib/libsrt.so $JNI_DIR/$build_target/libsrt.so

69 +

done

Original file line number Diff line number Diff line change

@@ -1,7 +1,25 @@

1 -

#!/bin/bash

1 +

#!/bin/sh

2 2 3 -

source prepare_build

3 +

while getopts s:i:t:n:a: option

4 +

do

5 +

case "${option}"

6 +

in

7 +

s) SRC_DIR=${OPTARG};;

8 +

i) INSTALL_DIR=${OPTARG};;

9 +

t) ARCH_ABI=${OPTARG};;

10 +

n) NDK_ROOT=${OPTARG};;

11 +

a) API_LEVEL=${OPTARG};;

12 +

*) twentytwo=${OPTARG};;

13 +

esac

14 +

done

4 15 5 -

./configure --use-openssl-pc=OFF --CMAKE_PREFIX_PATH=$install_dir --CMAKE_INSTALL_PREFIX=$install_dir --CMAKE_SYSTEM_NAME=Android --CMAKE_SYSTEM_VERSION=$api_lev --CMAKE_ANDROID_NDK=$NDK_HOME --CMAKE_ANDROID_ARCH_ABI=$arch_abi

16 + 17 +

cd $SRC_DIR

18 +

./configure --use-openssl-pc=OFF --OPENSSL_USE_STATIC_LIBS=true \

19 +

--CMAKE_PREFIX_PATH=$INSTALL_DIR --CMAKE_INSTALL_PREFIX=$INSTALL_DIR --CMAKE_ANDROID_NDK=$NDK_ROOT \

20 +

--CMAKE_SYSTEM_NAME=Android --CMAKE_SYSTEM_VERSION=$API_LEVEL --CMAKE_ANDROID_ARCH_ABI=$ARCH_ABI \

21 +

--CMAKE_C_FLAGS="-fPIC" --CMAKE_SHARED_LINKER_FLAGS="-Wl,--build-id" \

22 +

--enable-c++11 --enable-stdcxx-sync \

23 +

--enable-debug=2 --enable-logging=0 --enable-heavy-logging=0 --enable-apps=0

6 24

make

7 25

make install

Original file line number Diff line number Diff line change

@@ -1,27 +1,21 @@

1 1

#!/bin/sh

2 2 3 -

while getopts n:o:a: option

3 +

while getopts n:o:a:t: option

4 4

do

5 5

case "${option}"

6 6

in

7 -

n) ndk_home=${OPTARG};;

8 -

o) ssl_ver=${OPTARG};;

9 -

a) api_lev=${OPTARG};;

7 +

n) ANDROID_NDK=${OPTARG};;

8 +

o) OPENSSL_VERSION=${OPTARG};;

9 +

a) API_LEVEL=${OPTARG};;

10 +

t) BUILD_TARGETS=${OPTARG};;

10 11

*) twentytwo=${OPTARG};;

11 12

esac

12 13

done

13 14 14 15 15 -

ANDROID_NDK=$ndk_home

16 -

OPENSSL_VERSION=$ssl_ver

17 - 18 -

API_LEVEL=$api_lev

19 - 20 16

BUILD_DIR=/tmp/openssl_android_build

21 17

OUT_DIR=$(pwd)

22 18 23 -

BUILD_TARGETS="armeabi armeabi-v7a arm64-v8a x86 x86_64"

24 - 25 19

if [ ! -d openssl-${OPENSSL_VERSION} ]

26 20

then

27 21

if [ ! -f openssl-${OPENSSL_VERSION}.tar.gz ]

You can’t perform that action at this time.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4