Initial support of libdav1d

pull/14/head
Javernaut 5 years ago
parent 421ac45f3a
commit 2ac1d3bc09
  1. 2
      ffmpeg-android-maker.sh
  2. 43
      scripts/export-build-variables.sh
  3. 2
      scripts/export-host-variables.sh
  4. 4
      scripts/ffmpeg/build.sh
  5. 2
      scripts/libaom/build.sh
  6. 2
      scripts/libaom/download.sh
  7. 44
      scripts/libdav1d/build.sh
  8. 17
      scripts/libdav1d/download.sh
  9. 10
      scripts/libmp3lame/build.sh
  10. 8
      scripts/parse-arguments.sh

@ -44,7 +44,7 @@ function prepareOutput() {
# Otherwise the whole script is interrupted
function checkTextRelocations() {
TEXT_REL_STATS_FILE=${STATS_DIR}/text-relocations.txt
${READELF} --dynamic ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so | grep 'TEXTREL\|File' >> ${TEXT_REL_STATS_FILE}
${FAM_READELF} --dynamic ${BUILD_DIR_FFMPEG}/${ANDROID_ABI}/lib/*.so | grep 'TEXTREL\|File' >> ${TEXT_REL_STATS_FILE}
if grep -q TEXTREL ${TEXT_REL_STATS_FILE}; then
echo "There are text relocations in output files:"

@ -15,6 +15,7 @@ export TOOLCHAIN_PATH=${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/${HOST_TAG}
export SYSROOT_PATH=${TOOLCHAIN_PATH}/sysroot
TARGET_TRIPLE_MACHINE_CC=
CPU_FAMILY=
export TARGET_TRIPLE_OS="android"
case $ANDROID_ABI in
@ -34,6 +35,7 @@ case $ANDROID_ABI in
#cc i686-linux-android16-clang
#binutils i686-linux-android -ld
export TARGET_TRIPLE_MACHINE_BINUTILS=i686
CPU_FAMILY=x86
;;
x86_64)
#cc x86_64-linux-android21-clang
@ -46,37 +48,42 @@ esac
[ -z "${TARGET_TRIPLE_MACHINE_CC}" ] && TARGET_TRIPLE_MACHINE_CC=${TARGET_TRIPLE_MACHINE_BINUTILS}
export TARGET_TRIPLE_MACHINE_CC=$TARGET_TRIPLE_MACHINE_CC
[ -z "${CPU_FAMILY}" ] && CPU_FAMILY=${TARGET_TRIPLE_MACHINE_BINUTILS}
export CPU_FAMILY=$CPU_FAMILY
# Common prefix for ld, as, etc.
export CROSS_PREFIX=${TARGET_TRIPLE_MACHINE_BINUTILS}-linux-${TARGET_TRIPLE_OS}-
export CROSS_PREFIX_WITH_PATH=${TOOLCHAIN_PATH}/bin/${CROSS_PREFIX}
# Exporting Binutils paths, if passing just CROSS_PREFIX_WITH_PATH is not enough
export ADDR2LINE=${CROSS_PREFIX_WITH_PATH}addr2line
export AR=${CROSS_PREFIX_WITH_PATH}ar
export AS=${CROSS_PREFIX_WITH_PATH}as
export DWP=${CROSS_PREFIX_WITH_PATH}dwp
export ELFEDIT=${CROSS_PREFIX_WITH_PATH}elfedit
export GPROF=${CROSS_PREFIX_WITH_PATH}gprof
export LD=${CROSS_PREFIX_WITH_PATH}ld
export NM=${CROSS_PREFIX_WITH_PATH}nm
export OBJCOPY=${CROSS_PREFIX_WITH_PATH}objcopy
export OBJDUMP=${CROSS_PREFIX_WITH_PATH}objdump
export RANLIB=${CROSS_PREFIX_WITH_PATH}ranlib
export READELF=${CROSS_PREFIX_WITH_PATH}readelf
export SIZE=${CROSS_PREFIX_WITH_PATH}size
export STRINGS=${CROSS_PREFIX_WITH_PATH}strings
export STRIP=${CROSS_PREFIX_WITH_PATH}strip
export FAM_ADDR2LINE=${CROSS_PREFIX_WITH_PATH}addr2line
export FAM_AR=${CROSS_PREFIX_WITH_PATH}ar
export FAM_AS=${CROSS_PREFIX_WITH_PATH}as
export FAM_DWP=${CROSS_PREFIX_WITH_PATH}dwp
export FAM_ELFEDIT=${CROSS_PREFIX_WITH_PATH}elfedit
export FAM_GPROF=${CROSS_PREFIX_WITH_PATH}gprof
export FAM_LD=${CROSS_PREFIX_WITH_PATH}ld
export FAM_NM=${CROSS_PREFIX_WITH_PATH}nm
export FAM_OBJCOPY=${CROSS_PREFIX_WITH_PATH}objcopy
export FAM_OBJDUMP=${CROSS_PREFIX_WITH_PATH}objdump
export FAM_RANLIB=${CROSS_PREFIX_WITH_PATH}ranlib
export FAM_READELF=${CROSS_PREFIX_WITH_PATH}readelf
export FAM_SIZE=${CROSS_PREFIX_WITH_PATH}size
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.
export CC=${TOOLCHAIN_PATH}/bin/${TARGET}-clang
export CXX=${CC}++
export FAM_CC=${TOOLCHAIN_PATH}/bin/${TARGET}-clang
export FAM_CXX=${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
# ANDROID_ABI and NDK's version
# Special variable for the yasm assembler
export YASM=${TOOLCHAIN_PATH}/bin/yasm
export FAM_YASM=${TOOLCHAIN_PATH}/bin/yasm
# A variable to which certain dependencies can add -l arguments during build.sh
export FFMPEG_EXTRA_LD_FLAGS=
export INSTALL_DIR=${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}

@ -25,5 +25,7 @@ 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 Ninja from the Android SDK
export NINJA_EXECUTABLE=${ANDROID_SDK_HOME}/cmake/3.10.2.4988404/bin/ninja
# Using host Make, because Android NDK's Make (before r21) doesn't work properly on MSYS2 in Windows
export MAKE_EXECUTABLE=make

@ -7,7 +7,7 @@ case $ANDROID_ABI in
EXTRA_BUILD_CONFIGURATION_FLAGS=--disable-asm
;;
x86_64)
EXTRA_BUILD_CONFIGURATION_FLAGS=--x86asmexe=${YASM}
EXTRA_BUILD_CONFIGURATION_FLAGS=--x86asmexe=${FAM_YASM}
;;
esac
@ -32,7 +32,7 @@ DEP_LD_FLAGS="-L${BUILD_DIR_EXTERNAL}/${ANDROID_ABI}/lib $FFMPEG_EXTRA_LD_FLAGS"
--arch=${TARGET_TRIPLE_MACHINE_BINUTILS} \
--sysroot=${SYSROOT_PATH} \
--cross-prefix=${CROSS_PREFIX_WITH_PATH} \
--cc=${CC} \
--cc=${FAM_CC} \
--extra-cflags="-O3 -fPIC $DEP_CFLAGS" \
--extra-ldflags="$DEP_LD_FLAGS" \
--enable-shared \

@ -8,7 +8,7 @@ ${CMAKE_EXECUTABLE} .. \
-DANDROID_PLATFORM=${ANDROID_PLATFORM} \
-DANDROID_ABI=${ANDROID_ABI} \
-DCMAKE_TOOLCHAIN_FILE=${SCRIPTS_DIR}/libaom/android.cmake \
-DCMAKE_INSTALL_PREFIX=${BUILD_DIR_EXTERNAL}/${ANDROID_ABI} \
-DCMAKE_INSTALL_PREFIX=${INSTALL_DIR} \
-DCONFIG_PIC=1 \
-DCONFIG_AV1_ENCODER=0 \
-DCONFIG_RUNTIME_CPU_DETECT=0 \

@ -6,7 +6,7 @@
echo "Using aom master branch"
AOM_SOURCES=aom
if [[ ! -d "$LAME_SOURCES" ]]; then
if [[ ! -d "$AOM_SOURCES" ]]; then
git clone https://aomedia.googlesource.com/aom
fi

@ -0,0 +1,44 @@
CROSS_FILE_NAME=crossfile-${ANDROID_ABI}.meson
rm ${CROSS_FILE_NAME}
cat > "${CROSS_FILE_NAME}" << EOF
[binaries]
c = '${FAM_CC}'
cpp = '${FAM_CXX}'
ar = '${FAM_AR}'
strip = '${FAM_STRIP}'
objcopy = '${FAM_OBJCOPY}'
pkgconfig = '$(which pkg-config)'
[properties]
needs_exe_wrapper = true
sys_root = '${SYSROOT_PATH}'
[host_machine]
system = 'linux'
cpu_family = '${CPU_FAMILY}'
cpu = '${TARGET_TRIPLE_MACHINE_BINUTILS}'
endian = 'little'
[paths]
prefix = '${INSTALL_DIR}'
EOF
BUILD_DIRECTORY=build/${ANDROID_ABI}
rm -rf ${BUILD_DIRECTORY}
meson . ${BUILD_DIRECTORY} \
--cross-file ${CROSS_FILE_NAME} \
--default-library=static \
-Denable_asm=true \
-Denable_tools=false \
-Denable_tests=false \
-Denable_examples=false \
-Dtestdata_tests=false
cd ${BUILD_DIRECTORY}
${NINJA_EXECUTABLE}
${NINJA_EXECUTABLE} install

@ -0,0 +1,17 @@
# Script to download Dav1d's source code
# Exports SOURCES_DIR_libdav1d - path where actual sources are stored
DAV1D_VERSION=0.5.1
echo "Using libdav1d $DAV1D_VERSION"
DAV1D_SOURCES=dav1d-${DAV1D_VERSION}
if [[ ! -d "$DAV1D_SOURCES" ]]; then
TARGET_FILE_NAME=dav1d-${DAV1D_VERSION}.tar.gz
curl https://code.videolan.org/videolan/dav1d/-/archive/${DAV1D_VERSION}/dav1d-${DAV1D_VERSION}.tar.gz --output ${TARGET_FILE_NAME}
tar xf ${TARGET_FILE_NAME} -C .
rm ${TARGET_FILE_NAME}
fi
export SOURCES_DIR_libdav1d=$(pwd)/${DAV1D_SOURCES}

@ -1,5 +1,5 @@
./configure \
--prefix=${BUILD_DIR_EXTERNAL}/${ANDROID_ABI} \
--prefix=${INSTALL_DIR} \
--target=${TARGET} \
--host=${TARGET} \
--with-sysroot=${SYSROOT_PATH} \
@ -10,10 +10,10 @@
--disable-decoder \
--disable-gtktest \
--disable-frontend \
CC=${CC} \
LD=${LD} \
AR=${AR} \
RANLIB=${RANLIB}
CC=${FAM_CC} \
LD=${FAM_LD} \
AR=${FAM_AR} \
RANLIB=${FAM_RANLIB}
export FFMPEG_EXTRA_LD_FLAGS="${FFMPEG_EXTRA_LD_FLAGS} -lmp3lame"

@ -39,10 +39,10 @@ do
EXTERNAL_LIBRARIES+=( "libaom" )
shift
;;
# --enable-libdav1d)
# EXTERNAL_LIBRARIES+=( "libdav1d" )
# shift
# ;;
--enable-libdav1d)
EXTERNAL_LIBRARIES+=( "libdav1d" )
shift
;;
--enable-libmp3lame)
EXTERNAL_LIBRARIES+=( "libmp3lame" )
shift

Loading…
Cancel
Save