From 8ea06ae221ed7dd7295d309db697464bb04711ab Mon Sep 17 00:00:00 2001 From: A2va <49582555+A2va@users.noreply.github.com> Date: Tue, 27 Jul 2021 21:07:14 +0200 Subject: [PATCH 1/9] Create .gitattributes --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..0de99a7 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +# Set always lf for shell file +*.sh text eol=lf From bacbe4a4a906d2684f1b1ef2b51e4f4f5a3b8c7b Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 13:42:23 +0300 Subject: [PATCH 2/9] Disabling neon for libvpx in case llvm and armv7 --- scripts/export-build-variables.sh | 5 +++++ scripts/libvpx/build.sh | 3 +++ scripts/libvpx/download.sh | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/export-build-variables.sh b/scripts/export-build-variables.sh index 7f69983..2ef4ac1 100755 --- a/scripts/export-build-variables.sh +++ b/scripts/export-build-variables.sh @@ -82,6 +82,11 @@ export FAM_CC=${TOOLCHAIN_PATH}/bin/${TARGET}-clang export FAM_CXX=${FAM_CC}++ export FAM_LD=${FAM_CC} +if [[ $DESIRED_BINUTILS == "llvm" ]]; then + # The llvm-as doesn't work in place of gnu as, so just using clang here + export FAM_AS=${FAM_CC} +fi + # TODO consider abondaning this strategy of defining the name of the clang wrapper # in favour of just passing -mstackrealign and -fno-addrsig depending on # ANDROID_ABI, ANDROID_PLATFORM and NDK's version diff --git a/scripts/libvpx/build.sh b/scripts/libvpx/build.sh index 566c594..e2b7b66 100755 --- a/scripts/libvpx/build.sh +++ b/scripts/libvpx/build.sh @@ -13,6 +13,9 @@ case $ANDROID_ABI in ;; armeabi-v7a) EXTRA_BUILD_FLAGS="--target=armv7-android-gcc --enable-thumb" + if [[ $DESIRED_BINUTILS == "llvm" ]]; then + EXTRA_BUILD_FLAGS+=" --disable-neon" + fi ;; arm64-v8a) EXTRA_BUILD_FLAGS="--target=arm64-android-gcc --enable-thumb" diff --git a/scripts/libvpx/download.sh b/scripts/libvpx/download.sh index 4730d80..82d2167 100755 --- a/scripts/libvpx/download.sh +++ b/scripts/libvpx/download.sh @@ -2,7 +2,7 @@ source ${SCRIPTS_DIR}/common-functions.sh -VPX_VERSION=v1.10.0 +VPX_VERSION=v1.11.0 downloadTarArchive \ "libvpx" \ From f358f0a70b7c05b8bd58df2c39254559e0b90f9e Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 17:52:44 +0300 Subject: [PATCH 3/9] Checking both gnu and llvm binutils on CI. --- .github/workflows/compilability_check.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compilability_check.yml b/.github/workflows/compilability_check.yml index c486aee..beba27a 100644 --- a/.github/workflows/compilability_check.yml +++ b/.github/workflows/compilability_check.yml @@ -6,6 +6,7 @@ jobs: strategy: matrix: abi: [ "armeabi-v7a", "arm64-v8a", "x86", "x86_64" ] + binutils: [ "gnu", "llvm" ] fail-fast: false steps: - uses: actions/checkout@v2 @@ -18,4 +19,4 @@ jobs: - name: Executing the script run: | export ANDROID_SDK_HOME=$ANDROID_HOME - ./ffmpeg-android-maker.sh -all-free -all-gpl -android=18 -abis=${{ matrix.abi }} \ No newline at end of file + ./ffmpeg-android-maker.sh -all-free -all-gpl -android=21 -abis=${{ matrix.abi }} -binutils=${{ matrix.binutils }} \ No newline at end of file From d4d600c70529cd4e12a03530df74ce22ebeffc40 Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 18:47:37 +0300 Subject: [PATCH 4/9] Dropping support of gnu binutils --- .github/workflows/compilability_check.yml | 3 +-- scripts/export-build-variables.sh | 15 ++------------- scripts/libvpx/build.sh | 5 +---- scripts/parse-arguments.sh | 14 -------------- 4 files changed, 4 insertions(+), 33 deletions(-) diff --git a/.github/workflows/compilability_check.yml b/.github/workflows/compilability_check.yml index beba27a..9af82f6 100644 --- a/.github/workflows/compilability_check.yml +++ b/.github/workflows/compilability_check.yml @@ -6,7 +6,6 @@ jobs: strategy: matrix: abi: [ "armeabi-v7a", "arm64-v8a", "x86", "x86_64" ] - binutils: [ "gnu", "llvm" ] fail-fast: false steps: - uses: actions/checkout@v2 @@ -19,4 +18,4 @@ jobs: - name: Executing the script run: | export ANDROID_SDK_HOME=$ANDROID_HOME - ./ffmpeg-android-maker.sh -all-free -all-gpl -android=21 -abis=${{ matrix.abi }} -binutils=${{ matrix.binutils }} \ No newline at end of file + ./ffmpeg-android-maker.sh -all-free -all-gpl -android=21 -abis=${{ matrix.abi }} \ No newline at end of file diff --git a/scripts/export-build-variables.sh b/scripts/export-build-variables.sh index 2ef4ac1..5c58904 100755 --- a/scripts/export-build-variables.sh +++ b/scripts/export-build-variables.sh @@ -54,18 +54,11 @@ export TARGET_TRIPLE_MACHINE_CC=$TARGET_TRIPLE_MACHINE_CC export CPU_FAMILY=$CPU_FAMILY # Common prefix for ld, as, etc. -if [ $DESIRED_BINUTILS = "gnu" ] ; then - export CROSS_PREFIX=${TARGET_TRIPLE_MACHINE_BINUTILS}-linux-${TARGET_TRIPLE_OS}- -else - export CROSS_PREFIX=llvm- -fi - -export CROSS_PREFIX_WITH_PATH=${TOOLCHAIN_PATH}/bin/${CROSS_PREFIX} +export CROSS_PREFIX_WITH_PATH=${TOOLCHAIN_PATH}/bin/llvm- # Exporting Binutils paths, if passing just CROSS_PREFIX_WITH_PATH is not enough # The FAM_ prefix is used to eliminate passing those values implicitly to build systems export FAM_ADDR2LINE=${CROSS_PREFIX_WITH_PATH}addr2line -export FAM_AS=${CROSS_PREFIX_WITH_PATH}as export FAM_AR=${CROSS_PREFIX_WITH_PATH}ar export FAM_NM=${CROSS_PREFIX_WITH_PATH}nm export FAM_OBJCOPY=${CROSS_PREFIX_WITH_PATH}objcopy @@ -81,11 +74,7 @@ export TARGET=${TARGET_TRIPLE_MACHINE_CC}-linux-${TARGET_TRIPLE_OS}${ANDROID_PLA export FAM_CC=${TOOLCHAIN_PATH}/bin/${TARGET}-clang export FAM_CXX=${FAM_CC}++ export FAM_LD=${FAM_CC} - -if [[ $DESIRED_BINUTILS == "llvm" ]]; then - # The llvm-as doesn't work in place of gnu as, so just using clang here - export FAM_AS=${FAM_CC} -fi +export FAM_AS=${FAM_CC} # TODO consider abondaning this strategy of defining the name of the clang wrapper # in favour of just passing -mstackrealign and -fno-addrsig depending on diff --git a/scripts/libvpx/build.sh b/scripts/libvpx/build.sh index e2b7b66..4a39815 100755 --- a/scripts/libvpx/build.sh +++ b/scripts/libvpx/build.sh @@ -12,10 +12,7 @@ case $ANDROID_ABI in VPX_AS=${FAM_YASM} ;; armeabi-v7a) - EXTRA_BUILD_FLAGS="--target=armv7-android-gcc --enable-thumb" - if [[ $DESIRED_BINUTILS == "llvm" ]]; then - EXTRA_BUILD_FLAGS+=" --disable-neon" - fi + EXTRA_BUILD_FLAGS="--target=armv7-android-gcc --enable-thumb --disable-neon" ;; arm64-v8a) EXTRA_BUILD_FLAGS="--target=arm64-android-gcc --enable-thumb" diff --git a/scripts/parse-arguments.sh b/scripts/parse-arguments.sh index 9a73929..26bb280 100755 --- a/scripts/parse-arguments.sh +++ b/scripts/parse-arguments.sh @@ -10,7 +10,6 @@ ABIS_TO_BUILD=() API_LEVEL=16 SOURCE_TYPE=TAR SOURCE_VALUE=4.4 -BINUTILS=gnu EXTERNAL_LIBRARIES=() FFMPEG_GPL_ENABLED=false @@ -73,18 +72,6 @@ for argument in "$@"; do SOURCE_TYPE=TAR SOURCE_VALUE="${argument#*=}" ;; - # Which binutils to use (gnu or llvm) - --binutils=* | -binutils=*) - binutils_value="${argument#*=}" - case $binutils_value in - gnu | llvm) - BINUTILS=$binutils_value - ;; - *) - echo "Unknown binutils: $binutils_value" - ;; - esac - ;; # Arguments below enable certain external libraries to build into FFmpeg --enable-libaom | -aom) EXTERNAL_LIBRARIES+=("libaom") @@ -154,4 +141,3 @@ export FFMPEG_EXTERNAL_LIBRARIES=${EXTERNAL_LIBRARIES[@]} # Desired Android API level to use during compilation # Will be replaced with 21 for 64bit ABIs if the value is less than 21 export DESIRED_ANDROID_API_LEVEL=${API_LEVEL} -export DESIRED_BINUTILS=${BINUTILS} From 5c14447e864d271891a6ffbe694a4254aa901d59 Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 19:12:09 +0300 Subject: [PATCH 5/9] Using Make from Android SDK --- scripts/export-host-variables.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/export-host-variables.sh b/scripts/export-host-variables.sh index 751b9d5..0d43dfd 100755 --- a/scripts/export-host-variables.sh +++ b/scripts/export-host-variables.sh @@ -27,8 +27,8 @@ export HOST_NPROC=$HOST_NPROC # Using CMake from the Android SDK export CMAKE_EXECUTABLE=${ANDROID_SDK_HOME}/cmake/3.10.2.4988404/bin/cmake -# Using Build machine's Make, because Android NDK's Make (before r21) doesn't work properly in MSYS2 on Windows -export MAKE_EXECUTABLE=$(which make) +# Using Make from the Android SDK +export MAKE_EXECUTABLE=${ANDROID_NDK_HOME}/prebuilt/${HOST_TAG}/bin/make # Using Build machine's Ninja. It is used for libdav1d building. Needs to be installed export NINJA_EXECUTABLE=$(which ninja) # Meson is used for libdav1d building. Needs to be installed From 3c62f13eed47cbcdbbcb59e31e3902cd48f051e3 Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 19:28:47 +0300 Subject: [PATCH 6/9] Further simplifying of export-build-variables.sh --- scripts/export-build-variables.sh | 19 +++++++------------ scripts/ffmpeg/build.sh | 2 +- scripts/libdav1d/build.sh | 2 +- 3 files changed, 9 insertions(+), 14 deletions(-) diff --git a/scripts/export-build-variables.sh b/scripts/export-build-variables.sh index 5c58904..13ae035 100755 --- a/scripts/export-build-variables.sh +++ b/scripts/export-build-variables.sh @@ -23,34 +23,29 @@ export TARGET_TRIPLE_OS="android" case $ANDROID_ABI in armeabi-v7a) #cc armv7a-linux-androideabi16-clang - #binutils arm -linux-androideabi -ld - export TARGET_TRIPLE_MACHINE_BINUTILS=arm + export TARGET_TRIPLE_MACHINE_ARCH=arm TARGET_TRIPLE_MACHINE_CC=armv7a export TARGET_TRIPLE_OS=androideabi ;; arm64-v8a) #cc aarch64-linux-android21-clang - #binutils aarch64-linux-android -ld - export TARGET_TRIPLE_MACHINE_BINUTILS=aarch64 + export TARGET_TRIPLE_MACHINE_ARCH=aarch64 ;; x86) #cc i686-linux-android16-clang - #binutils i686-linux-android -ld - export TARGET_TRIPLE_MACHINE_BINUTILS=i686 + export TARGET_TRIPLE_MACHINE_ARCH=i686 CPU_FAMILY=x86 ;; x86_64) #cc x86_64-linux-android21-clang - #binutils x86_64-linux-android -ld - export TARGET_TRIPLE_MACHINE_BINUTILS=x86_64 + export TARGET_TRIPLE_MACHINE_ARCH=x86_64 ;; esac # If the cc-specific variable isn't set, we fallback to binutils version -[ -z "${TARGET_TRIPLE_MACHINE_CC}" ] && TARGET_TRIPLE_MACHINE_CC=${TARGET_TRIPLE_MACHINE_BINUTILS} -export TARGET_TRIPLE_MACHINE_CC=$TARGET_TRIPLE_MACHINE_CC +[ -z "${TARGET_TRIPLE_MACHINE_CC}" ] && TARGET_TRIPLE_MACHINE_CC=${TARGET_TRIPLE_MACHINE_ARCH} -[ -z "${CPU_FAMILY}" ] && CPU_FAMILY=${TARGET_TRIPLE_MACHINE_BINUTILS} +[ -z "${CPU_FAMILY}" ] && CPU_FAMILY=${TARGET_TRIPLE_MACHINE_ARCH} export CPU_FAMILY=$CPU_FAMILY # Common prefix for ld, as, etc. @@ -70,7 +65,7 @@ export FAM_STRINGS=${CROSS_PREFIX_WITH_PATH}strings export FAM_STRIP=${CROSS_PREFIX_WITH_PATH}strip export TARGET=${TARGET_TRIPLE_MACHINE_CC}-linux-${TARGET_TRIPLE_OS}${ANDROID_PLATFORM} -# The name for compiler is slightly different, so it is defined separatly. +# The name for compiler is slightly different, so it is defined separately. export FAM_CC=${TOOLCHAIN_PATH}/bin/${TARGET}-clang export FAM_CXX=${FAM_CC}++ export FAM_LD=${FAM_CC} diff --git a/scripts/ffmpeg/build.sh b/scripts/ffmpeg/build.sh index eabf874..18f7b29 100755 --- a/scripts/ffmpeg/build.sh +++ b/scripts/ffmpeg/build.sh @@ -29,7 +29,7 @@ DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS" --prefix=${BUILD_DIR_FFMPEG}/${ANDROID_ABI} \ --enable-cross-compile \ --target-os=android \ - --arch=${TARGET_TRIPLE_MACHINE_BINUTILS} \ + --arch=${TARGET_TRIPLE_MACHINE_ARCH} \ --sysroot=${SYSROOT_PATH} \ --cc=${FAM_CC} \ --cxx=${FAM_CXX} \ diff --git a/scripts/libdav1d/build.sh b/scripts/libdav1d/build.sh index ce60d61..b186ac6 100755 --- a/scripts/libdav1d/build.sh +++ b/scripts/libdav1d/build.sh @@ -19,7 +19,7 @@ sys_root = '${SYSROOT_PATH}' [host_machine] system = 'linux' cpu_family = '${CPU_FAMILY}' -cpu = '${TARGET_TRIPLE_MACHINE_BINUTILS}' +cpu = '${TARGET_TRIPLE_MACHINE_ARCH}' endian = 'little' [paths] From 91c15bae02c4bf6384fab5fd62bebec65e11be86 Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 19:37:49 +0300 Subject: [PATCH 7/9] Using Android API 19 as the default one due to upcoming NDK r24 change --- scripts/parse-arguments.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/parse-arguments.sh b/scripts/parse-arguments.sh index 26bb280..f818a2b 100755 --- a/scripts/parse-arguments.sh +++ b/scripts/parse-arguments.sh @@ -7,7 +7,7 @@ # Can be overridden with specific arguments. # See the end of this file for more description. ABIS_TO_BUILD=() -API_LEVEL=16 +API_LEVEL=19 SOURCE_TYPE=TAR SOURCE_VALUE=4.4 EXTERNAL_LIBRARIES=() From 5432afb8e1ca75f32cfd5ea8d6ce45d273686010 Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 19:40:55 +0300 Subject: [PATCH 8/9] Actually using Android NDK r23 on CI --- .github/workflows/compilability_check.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/compilability_check.yml b/.github/workflows/compilability_check.yml index 9af82f6..e3f5a50 100644 --- a/.github/workflows/compilability_check.yml +++ b/.github/workflows/compilability_check.yml @@ -18,4 +18,5 @@ jobs: - name: Executing the script run: | export ANDROID_SDK_HOME=$ANDROID_HOME + export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME ./ffmpeg-android-maker.sh -all-free -all-gpl -android=21 -abis=${{ matrix.abi }} \ No newline at end of file From 33207e2e3a8d0d4f8d465e26ee363e4a2342b138 Mon Sep 17 00:00:00 2001 From: Javernaut Date: Thu, 21 Oct 2021 21:08:21 +0300 Subject: [PATCH 9/9] Updating the README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 082e006..ea10af7 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,8 @@ Also there are a lot of arguments that you can pass to the `ffmpeg-android-maker If you need to build only some of these ABIs, you can do so by specifying a [flag](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Available-script-arguments#desired-abis-to-build). +The default Android API version used to compile these binaries is **19**, as the minimum supported by the Android NDK r24. However, with NDK r23 it is still possible to have it **16**. Some external libraries (like libvpx) require to use higher API - **21**. This is explained at this [WIKI page](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Available-script-arguments#android-platform-version) in more details. + ## Supported host OS Regardless of the OS you use, you need to setup it before executing the script. Please follow the instructions in [Requirements](#Requirements) section. @@ -58,7 +60,7 @@ The script assumes you have Android SDK and NDK already installed. In order to t * `ANDROID_SDK_HOME` - absolute path to your Android SDK * `ANDROID_NDK_HOME` - absolute path to your Android NDK -The script expects to use **at least** Android NDK **r19** (both **r20** and **r21** also work ok). +The script expects to use **at least** Android NDK **r23**. It doesn't matter if you use other version of NDK for you actual Android project. Certain external libraries require additional software to be installed. Check this [WIKI page](https://github.com/Javernaut/ffmpeg-android-maker/wiki/Supported-external-libraries) out for more info. Note that if you don't need these external libraries then you also don't need to install the additional software. These external libraries are not built by default.