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 diff --git a/.github/workflows/compilability_check.yml b/.github/workflows/compilability_check.yml index e522335..54b1e3a 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 - ./ffmpeg-android-maker.sh -dav1d -abis=${{ matrix.abi }} \ No newline at end of file + export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME + ./ffmpeg-android-maker.sh -dav1d -android=16 -abis=${{ matrix.abi }} \ No newline at end of file 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. diff --git a/scripts/export-build-variables.sh b/scripts/export-build-variables.sh index 7f69983..13ae035 100755 --- a/scripts/export-build-variables.sh +++ b/scripts/export-build-variables.sh @@ -23,49 +23,37 @@ 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. -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 @@ -77,10 +65,11 @@ 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} +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/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 diff --git a/scripts/ffmpeg/build.sh b/scripts/ffmpeg/build.sh index efff39d..bc7aee2 100755 --- a/scripts/ffmpeg/build.sh +++ b/scripts/ffmpeg/build.sh @@ -35,7 +35,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] diff --git a/scripts/libvpx/build.sh b/scripts/libvpx/build.sh index 566c594..4a39815 100755 --- a/scripts/libvpx/build.sh +++ b/scripts/libvpx/build.sh @@ -12,7 +12,7 @@ case $ANDROID_ABI in VPX_AS=${FAM_YASM} ;; armeabi-v7a) - EXTRA_BUILD_FLAGS="--target=armv7-android-gcc --enable-thumb" + 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/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" \ diff --git a/scripts/parse-arguments.sh b/scripts/parse-arguments.sh index 9a73929..f818a2b 100755 --- a/scripts/parse-arguments.sh +++ b/scripts/parse-arguments.sh @@ -7,10 +7,9 @@ # 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 -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}