termux-packages/packages/ffmpeg/build.sh

78 lines
2.3 KiB
Bash

TERMUX_PKG_HOMEPAGE=https://ffmpeg.org
TERMUX_PKG_DESCRIPTION="Tools and libraries to manipulate a wide range of multimedia formats and protocols"
TERMUX_PKG_LICENSE="GPL-3.0"
TERMUX_PKG_MAINTAINER="@termux"
# NOTE: mpv has to be rebuilt and version bumped after updating ffmpeg.
TERMUX_PKG_VERSION=5.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://www.ffmpeg.org/releases/ffmpeg-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=51e919f7d205062c0fd4fae6243a84850391115104ccf1efc451733bc0ac7298
TERMUX_PKG_DEPENDS="libaom, libass, libbz2, libdav1d, libiconv, librav1e, libsoxr, libx264, libx265, xvidcore, libvorbis, libmp3lame, libopus, libvpx, libgnutls, libandroid-glob, freetype, zlib, liblzma, libvidstab, libwebp, libxml2"
TERMUX_PKG_CONFLICTS="libav"
TERMUX_PKG_BREAKS="ffmpeg-dev"
TERMUX_PKG_REPLACES="ffmpeg-dev"
termux_step_configure() {
cd $TERMUX_PKG_BUILDDIR
export ASFLAGS="-no-integrated-as"
local _EXTRA_CONFIGURE_FLAGS=""
if [ $TERMUX_ARCH = "arm" ]; then
_ARCH="armeabi-v7a"
_EXTRA_CONFIGURE_FLAGS="--enable-neon"
elif [ $TERMUX_ARCH = "i686" ]; then
_ARCH="x86"
# Specify --disable-asm to prevent text relocations on i686,
# see https://trac.ffmpeg.org/ticket/4928
_EXTRA_CONFIGURE_FLAGS="--disable-asm"
elif [ $TERMUX_ARCH = "x86_64" ]; then
_ARCH="x86_64"
elif [ $TERMUX_ARCH = "aarch64" ]; then
_ARCH=$TERMUX_ARCH
_EXTRA_CONFIGURE_FLAGS="--enable-neon"
else
termux_error_exit "Unsupported arch: $TERMUX_ARCH"
fi
$TERMUX_PKG_SRCDIR/configure \
--arch="${_ARCH}" \
--as="$AS" \
--cc="$CC" \
--cxx="$CXX" \
--nm="$NM" \
--pkg-config="$PKG_CONFIG" \
--strip="$STRIP" \
--cross-prefix="${TERMUX_HOST_PLATFORM}-" \
--disable-indevs \
--disable-outdevs \
--enable-indev=lavfi \
--disable-static \
--disable-symver \
--enable-cross-compile \
--enable-gnutls \
--enable-gpl \
--enable-libaom \
--enable-libass \
--enable-libdav1d \
--enable-libmp3lame \
--enable-libfreetype \
--enable-libvorbis \
--enable-libopus \
--enable-librav1e \
--enable-libsoxr \
--enable-libx264 \
--enable-libx265 \
--enable-libxvid \
--enable-libvidstab \
--enable-libvpx \
--enable-libwebp \
--enable-libxml2 \
--enable-shared \
--prefix="$TERMUX_PREFIX" \
--target-os=android \
--extra-libs="-landroid-glob" \
$_EXTRA_CONFIGURE_FLAGS
}