summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9142b605e4d95550c0fd2214f1086abee2131c36 (plain)
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# Maintainer: Gonzalo Exequiel Pedone <hipersayan DOT x AT gmail DOT com>

_android_arch=x86

pkgname=android-${_android_arch}-ffmpeg
pkgver=7.1
pkgrel=1
arch=('any')
pkgdesc="Complete solution to record, convert and stream audio and video (Android ${_android_arch})"
url="http://ffmpeg.org/"
license=('GPL3')
groups=('android-ffmpeg')
depends=("android-${_android_arch}-alsa-lib"
         "android-${_android_arch}-aom"
         "android-${_android_arch}-bzip2"
         "android-${_android_arch}-cairo"
         "android-${_android_arch}-dav1d"
         "android-${_android_arch}-fontconfig"
         "android-${_android_arch}-freetype2"
         "android-${_android_arch}-fribidi"
         "android-${_android_arch}-glib2"
         "android-${_android_arch}-gmp"
         "android-${_android_arch}-gnutls"
         "android-${_android_arch}-gsm"
         "android-${_android_arch}-harfbuzz"
         "android-${_android_arch}-lame"
         "android-${_android_arch}-libass"
         "android-${_android_arch}-libavc1394"
         "android-${_android_arch}-libbluray"
         "android-${_android_arch}-libbs2b"
         "android-${_android_arch}-libdrm"
         "android-${_android_arch}-libiec61883"
         "android-${_android_arch}-libjxl"
         "android-${_android_arch}-libmodplug"
         "android-${_android_arch}-libopenmpt"
         "android-${_android_arch}-libraw1394"
         "android-${_android_arch}-librsvg"
         "android-${_android_arch}-libsoxr"
         "android-${_android_arch}-libssh"
         "android-${_android_arch}-libtheora"
         "android-${_android_arch}-libva"
         "android-${_android_arch}-libvdpau"
         "android-${_android_arch}-libvorbis"
         "android-${_android_arch}-libvpl"
         "android-${_android_arch}-libvpx"
         "android-${_android_arch}-libwebp"
         "android-${_android_arch}-libx11"
         "android-${_android_arch}-libxcb"
         "android-${_android_arch}-libxext"
         "android-${_android_arch}-libxml2"
         "android-${_android_arch}-libxv"
         "android-${_android_arch}-ocl-icd"
         "android-${_android_arch}-opencore-amr"
         "android-${_android_arch}-openjpeg2"
         "android-${_android_arch}-opus"
         "android-${_android_arch}-rav1e"
         "android-${_android_arch}-rubberband"
         "android-${_android_arch}-sdl2"
         "android-${_android_arch}-snappy"
         "android-${_android_arch}-speex"
         "android-${_android_arch}-srt"
         "android-${_android_arch}-svt-av1"
         "android-${_android_arch}-vid.stab"
         "android-${_android_arch}-vmaf"
         "android-${_android_arch}-x264"
         "android-${_android_arch}-x265"
         "android-${_android_arch}-xvidcore"
         "android-${_android_arch}-xz"
         "android-${_android_arch}-zlib")
makedepends=('android-configure'
             "android-${_android_arch}-avisynthplus"
             "android-${_android_arch}-ladspa"
             "android-${_android_arch}-opencl-headers"
             'nasm')
#makedepends+=("android-${_android_arch}-frei0r-plugins")
optdepends=("android-${_android_arch}-avisynthplus: AviSynthPlus support"
            "android-${_android_arch}-ladspa: LADSPA filters")
#optdepends+=("android-${_android_arch}-frei0r-plugins: Frei0r video effects support")
options=(!strip !buildflags staticlibs !emptydirs)
source=("http://ffmpeg.org/releases/ffmpeg-${pkgver}.tar.xz"
        'configure.patch')
md5sums=('623aa63a72139a82ccb99cd6ee477b94'
         'c1851376794c16bcb37cfa8918e10cba')

prepare() {
    cd "${srcdir}/ffmpeg-${pkgver}"
    source android-env ${_android_arch}

    check_ndk_version_ge_than 18.0
    patch -Np1 -i ../configure.patch
}

build() {
    cd "${srcdir}/ffmpeg-${pkgver}"
    source android-env ${_android_arch}

    unset CC
    unset CXX
    unset AR
    unset RANLIB
    unset STRIP
    unset NM

    case "$_android_arch" in
        aarch64)
            target_arch=aarch64
            export LDFLAGS="${LDFLAGS} -lm -logg -lvorbis -lcrypto -lssl"
            # export LDFLAGS="${LDFLAGS} -lssh"
            ;;
        armv7a-eabi)
            target_arch=arm
            export LDFLAGS="${LDFLAGS} -ltheoraenc -ltheoradec -logg"
            ;;
        x86)
            target_arch=x86_32
            export LDFLAGS="${LDFLAGS} -ltheoraenc -ltheoradec -logg"
            ;;
        x86-64)
            target_arch=x86_64
            export LDFLAGS="${LDFLAGS} -ltheoraenc -ltheoradec -logg"
            ;;
    esac

    extra_options=

    # Platform specific patches
    case "$_android_arch" in
        x86)
             extra_options="${extra_options} --disable-asm"
            ;;
        *)
            ;;
    esac

    if [ "${ANDROID_MINIMUM_PLATFORM}" -lt 26 ]; then
        extra_options="${extra_options} --disable-libxcb --disable-xlib"

    else
        extra_options="${extra_options} --enable-libxcb"
    fi

    # Not yet available.
    # extra_options="${extra_options} --enable-frei0r"

    ./configure \
        --prefix=${ANDROID_PREFIX} \
        --enable-shared \
        --enable-static \
        --enable-cross-compile \
        --cross-prefix="${ANDROID_CROSS_PREFIX}" \
        --target-os=android \
        --arch=${target_arch} \
        --sysroot="${ANDROID_SYSROOT}" \
        --pkg-config=${ANDROID_PKGCONFIG} \
        --cc=${ANDROID_CC} \
        --cxx=${ANDROID_CXX} \
        --ar=${ANDROID_AR} \
        --ranlib=${ANDROID_RANLIB} \
        --strip=${ANDROID_STRIP} \
        --nm=${ANDROID_NM} \
        --disable-debug \
        --disable-stripping \
        --enable-gpl \
        --enable-version3 \
        --enable-pic \
        --disable-doc \
        --disable-ffmpeg \
        --disable-ffplay \
        --disable-ffprobe \
        --disable-libv4l2 \
        --disable-v4l2-m2m \
        --disable-indev=v4l2 \
        --disable-outdev=v4l2 \
        --enable-lto \
        --enable-avisynth \
        --enable-fontconfig \
        --enable-gmp \
        --enable-gnutls \
        --enable-ladspa \
        --enable-libaom \
        --enable-libass \
        --enable-libbluray \
        --enable-libbs2b \
        --enable-libdav1d \
        --enable-libdrm \
        --enable-libfreetype \
        --enable-libfribidi \
        --enable-libgsm \
        --enable-libharfbuzz \
        --enable-libiec61883 \
        --enable-libjxl \
        --enable-libmodplug \
        --enable-libmp3lame \
        --enable-libopencore_amrnb \
        --enable-libopencore_amrwb \
        --enable-libopenjpeg \
        --enable-libopenmpt \
        --enable-libopus \
        --enable-librav1e \
        --enable-librsvg \
        --enable-librubberband \
        --enable-libsnappy \
        --enable-libsoxr \
        --enable-libspeex \
        --enable-libsrt \
        --enable-libssh \
        --enable-libsvtav1 \
        --enable-libtheora \
        --enable-libvidstab \
        --enable-libvmaf \
        --enable-libvorbis \
        --enable-libvpl \
        --enable-libvpx \
        --enable-libwebp \
        --enable-libx264 \
        --enable-libx265 \
        --enable-libxml2 \
        --enable-libxvid \
        --enable-opencl \
        ${extra_options}
    make $MAKEFLAGS
}

package() {
    cd "${srcdir}/ffmpeg-${pkgver}"
    source android-env ${_android_arch}

    make DESTDIR="${pkgdir}" install
    rm -r "${pkgdir}/${ANDROID_PREFIX_SHARE}"
    ${ANDROID_STRIP} -g --strip-unneeded "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.so
    ${ANDROID_STRIP} -g "${pkgdir}/${ANDROID_PREFIX_LIB}"/*.a || true
}