-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
/
build.sh
132 lines (126 loc) · 4.06 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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"
# Please align version with `ffplay` package.
TERMUX_PKG_VERSION="6.1.1"
TERMUX_PKG_REVISION=5
TERMUX_PKG_SRCURL=https://www.ffmpeg.org/releases/ffmpeg-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=8684f4b00f94b85461884c3719382f1261f0d9eb3d59640a1f4ac0873616f968
TERMUX_PKG_DEPENDS="fontconfig, freetype, fribidi, game-music-emu, harfbuzz, libaom, libandroid-glob, libass, libbluray, libbz2, libdav1d, libgnutls, libiconv, liblzma, libmp3lame, libopencore-amr, libopenmpt, libopus, librav1e, libsoxr, libsrt, libssh, libtheora, libv4l, libvidstab, libvmaf, libvo-amrwbenc, libvorbis, libvpx, libwebp, libx264, libx265, libxml2, libzimg, littlecms, ocl-icd, svt-av1, xvidcore, zlib"
TERMUX_PKG_BUILD_DEPENDS="opencl-headers"
TERMUX_PKG_CONFLICTS="libav"
TERMUX_PKG_BREAKS="ffmpeg-dev"
TERMUX_PKG_REPLACES="ffmpeg-dev"
termux_step_pre_configure() {
# Do not forget to bump revision of reverse dependencies and rebuild them
# after SOVERSION is changed. (These variables are also used afterwards.)
_FFMPEG_SOVER_avutil=58
_FFMPEG_SOVER_avcodec=60
_FFMPEG_SOVER_avformat=60
local f
for f in util codec format; do
local v=$(sh ffbuild/libversion.sh av${f} \
libav${f}/version.h libav${f}/version_major.h \
| sed -En 's/^libav'"${f}"'_VERSION_MAJOR=([0-9]+)$/\1/p')
if [ ! "${v}" ] || [ "$(eval echo \$_FFMPEG_SOVER_av${f})" != "${v}" ]; then
termux_error_exit "SOVERSION guard check failed for libav${f}.so."
fi
done
}
termux_step_configure() {
cd $TERMUX_PKG_BUILDDIR
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-version3 \
--enable-jni \
--enable-lcms2 \
--enable-libaom \
--enable-libass \
--enable-libbluray \
--enable-libdav1d \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libgme \
--enable-libharfbuzz \
--enable-libmp3lame \
--enable-libopencore-amrnb \
--enable-libopencore-amrwb \
--enable-libopenmpt \
--enable-libopus \
--enable-librav1e \
--enable-libsoxr \
--enable-libsrt \
--enable-libssh \
--enable-libsvtav1 \
--enable-libtheora \
--enable-libv4l2 \
--enable-libvidstab \
--enable-libvmaf \
--enable-libvo-amrwbenc \
--enable-libvorbis \
--enable-libvpx \
--enable-libwebp \
--enable-libx264 \
--enable-libx265 \
--enable-libxml2 \
--enable-libxvid \
--enable-libzimg \
--enable-mediacodec \
--enable-opencl \
--enable-shared \
--prefix="$TERMUX_PREFIX" \
--target-os=android \
--extra-libs="-landroid-glob" \
--disable-vulkan \
$_EXTRA_CONFIGURE_FLAGS \
--disable-libfdk-aac
# GPLed FFmpeg binaries linked against fdk-aac are not redistributable.
}
termux_step_post_massage() {
cd ${TERMUX_PKG_MASSAGEDIR}/${TERMUX_PREFIX}/lib || exit 1
local f
for f in util codec format; do
local s=$(eval echo \$_FFMPEG_SOVER_av${f})
if [ ! "${s}" ]; then
termux_error_exit "Empty SOVERSION for libav${f}."
fi
# SOVERSION suffix is expected by some programs, e.g. Firefox.
if [ ! -e "./libav${f}.so.${s}" ]; then
ln -sf libav${f}.so libav${f}.so.${s}
fi
done
}