-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuilder.sh
734 lines (570 loc) · 19.8 KB
/
builder.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
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
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
#!/bin/bash
## $1: target
## $2: platform
## $3: prefix
# Support targets: "arm" "armv7-a", "armv7-n", "armv8-a", "x86", "x86_64"
set -e
set -x
export NDK=/home/rafa/Desktop/m4/ndk
## Check $NDK exists
if [ "$NDK" = "" ] || [ ! -d $NDK ]; then
echo "NDK variable not set or path to NDK is invalid, exiting..."
exit 1
fi
export TARGET=$1
export API_LVL=$2
export PREFIX=$(pwd)/$3
FINAL_DIR=$(pwd)/final/${API_LVL}/${TARGET}
sudo apt-get update
sudo apt-get -y install automake autopoint libtool gperf libssl-dev clang
LIB=none
VERSION=0
LIBFREETYPE_VERSION="2.9"
LIBEXPAT_VERSION="2.2.5"
LIBFONTCONFIG_VERSION="2.13.0"
LIBUUID_VERSION="1.0.3"
FFMPEG_VERSION="4.0"
LIBX264_VERSION="snapshot-20180601-2245-stable"
FDK_AAC_VERSION="0.1.6"
LAME_VERSION="3.100"
OPUS_VERSION="1.1.5"
LIBOGG_VERSION="1.3.2"
LIBVORBIS_VERSION="1.3.4"
ZLIB_VERSION="1.2.11"
LIBPNG12_VERSION="1.2.59"
LIBOPENSSL_VERSION="1.0.2o"
LIBTRMP_VERSION="2.3"
LIB="ffmpeg"
VERSION=${FFMPEG_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://www.ffmpeg.org/releases/${LIB}-${FFMPEG_VERSION}.tar.gz
echo "extracting ${LIB}-${VERSION}.tar.gz"
tar -zxf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="x264"
VERSION=${LIBX264_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -O "ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-$LIBX264_VERSION.tar.bz2"
tar -xf ${LIB}-${VERSION}.tar.bz2
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/{$LIB}"
fi
LIB="opus"
VERSION=${OPUS_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://archive.mozilla.org/pub/opus/opus-${OPUS_VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/opus-${OPUS_VERSION}"
fi
LIB="fdk-aac"
VERSION=${FDK_AAC_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO http://downloads.sourceforge.net/opencore-amr/fdk-aac-${FDK_AAC_VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="lame"
LAME_MAJOR="3.100"
VERSION=${LAME_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO http://downloads.sourceforge.net/project/lame/lame/${LAME_MAJOR}/lame-${LAME_VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
curl -L -o ${LIB}-${VERSION}/config.guess "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD"
curl -L -o ${LIB}-${VERSION}/config.sub "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD"
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="libogg"
VERSION=${LIBOGG_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO http://downloads.xiph.org/releases/ogg/libogg-${LIBOGG_VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="libvorbis"
VERSION=${LIBVORBIS_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO http://downloads.xiph.org/releases/vorbis/libvorbis-${LIBVORBIS_VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="freetype"
VERSION=${LIBFREETYPE_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://download.savannah.gnu.org/releases/freetype/freetype-${LIBFREETYPE_VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="expat"
VERSION=${LIBEXPAT_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO http://downloads.sourceforge.net/project/expat/expat/${LIBEXPAT_VERSION}/expat-${LIBEXPAT_VERSION}.tar.bz2
tar -xjf ${LIB}-${VERSION}.tar.bz2
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="fontconfig"
VERSION=${LIBFONTCONFIG_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://www.freedesktop.org/software/fontconfig/release/fontconfig-${LIBFONTCONFIG_VERSION}.tar.gz
tar -xzf ${LIB}-${LIBFONTCONFIG_VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="libuuid"
VERSION=${LIBUUID_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://ufpr.dl.sourceforge.net/project/libuuid/libuuid-${LIBUUID_VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="libpng"
VERSION=${LIBPNG12_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://ufpr.dl.sourceforge.net/project/libpng/libpng12/${VERSION}/libpng-${VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="zlib"
VERSION=${ZLIB_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://zlib.net/zlib-${VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="openssl"
VERSION=${LIBOPENSSL_VERSION}
if [ ! -d ${LIB} ]; then
echo "Downloading ${LIB}-${VERSION}"
curl -LO https://www.openssl.org/source/openssl-${VERSION}.tar.gz
tar -xzf ${LIB}-${VERSION}.tar.gz
mv ${LIB}-${VERSION} ${LIB}
else
echo "Using existing `pwd`/${LIB}"
fi
LIB="rtmpdump"
VERSION=${LIBTRMP_VERSION}
if [ ! -d ${LIB} ]; then
git clone git://git.ffmpeg.org/rtmpdump
fi
if [ ! -e "libunistring2_0.9.9-0ubuntu1_amd64.deb" ]; then
curl -LO http://mirrors.kernel.org/ubuntu/pool/main/libu/libunistring/libunistring2_0.9.9-0ubuntu1_amd64.deb
sudo apt install ./libunistring2_0.9.9-0ubuntu1_amd64.deb
fi
if [ ! -e "gettext_0.19.8.1-6_amd64.deb" ]; then
curl -LO http://mirrors.kernel.org/ubuntu/pool/main/g/gettext/gettext_0.19.8.1-6_amd64.deb
sudo apt install ./gettext_0.19.8.1-6_amd64.deb
fi
if [ ! -e "gettext-base_0.19.8.1-6_amd64.deb" ]; then
curl -LO http://mirrors.kernel.org/ubuntu/pool/main/g/gettext/gettext-base_0.19.8.1-6_amd64.deb
sudo apt install ./gettext-base_0.19.8.1-6_amd64.deb
fi
if [ ! -e "autopoint_0.19.8.1-6_all.deb" ]; then
curl -LO http://mirrors.kernel.org/ubuntu/pool/main/g/gettext/autopoint_0.19.8.1-6_all.deb
sudo apt install ./autopoint_0.19.8.1-6_all.deb
fi
if [ ! -e "libpng12-0_1.2.54-1ubuntu1_amd64.deb" ]; then
curl -LO http://mirrors.kernel.org/ubuntu/pool/main/libp/libpng/libpng12-0_1.2.54-1ubuntu1_amd64.deb
sudo apt install ./libpng12-0_1.2.54-1ubuntu1_amd64.deb
fi
function build_one
{
TOOLCHAIN=${NDK}/toolchain/${ARCH}
SYSROOT=${TOOLCHAIN}/sysroot
CROSS_PREFIX=${TOOLCHAIN}/bin/${HOST}-
if [ $ARCH == "i686" ]; then
$NDK/build/tools/make-standalone-toolchain.sh --use-llvm --platform=android-${API_LVL} --install-dir=${TOOLCHAIN} --arch=x86 --stl=libc++ || true
elif [ $ARCH == "native" ]; then
NDK=
TOOLCHAIN=/usr
SYSROOT=
CROSS_PREFIX=${TOOLCHAIN}/bin/
else
$NDK/build/tools/make-standalone-toolchain.sh --use-llvm --platform=android-${API_LVL} --install-dir=${TOOLCHAIN} --arch=${ARCH} --stl=libc++ || true
fi
#sed -i.bak "s;#define __ANDROID_API__ __ANDROID_API_FUTURE__;#define __ANDROID_API__ ${API_LVL};" ${SYSROOT}/usr/include/android/api-level.h
if [ $ARCH == "x86_64" ]; then
rm -R ${SYSROOT}/usr/lib
ln -s ${SYSROOT}/usr/lib64 ${SYSROOT}/usr/lib
fi
export PKG_CONFIG="$(which pkg-config)"
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
export CC="${TOOLCHAIN}/bin/clang"
export CXX="${TOOLCHAIN}/bin/clang++"
export CPP="${CROSS_PREFIX}cpp"
export AR="${CROSS_PREFIX}ar"
export LD="${CROSS_PREFIX}ld"
export NM="${CROSS_PREFIX}nm"
export RANLIB="${CROSS_PREFIX}ranlib"
export STRIP="${CROSS_PREFIX}strip"
export LDFLAGS="-L${PREFIX}/lib -L${TOOLCHAIN}/lib -L${SYSROOT}/usr/lib -fPIE -pie "
export CFLAGS="${OPTIMIZE_CFLAGS} -I${PREFIX}/include -I${SYSROOT}/usr/include -fPIE "
export CXXFLAGS="${CFLAGS} "
export CPPFLAGS="${CFLAGS} "
export PATH="$PATH:$PREFIX/bin:$NDK/build"
export CROSS_SYSROOT="${SYSROOT}"
export __ANDROID_API__=${API_LVL}
mkdir -p ${PREFIX}
mkdir -p ${PREFIX}/lib
mkdir -p ${PREFIX}/include
cp -p $SYSROOT/usr/lib/libz.a $PREFIX/lib/libz.a || true
cp -p $SYSROOT/usr/include/zlib.h $PREFIX/include/zlib.h || true
pushd x264
./configure \
--cross-prefix=$CROSS_PREFIX \
--sysroot=$SYSROOT \
--host=$HOST \
--enable-pic \
--enable-static \
--disable-shared \
--disable-cli \
--disable-opencl \
--prefix=$PREFIX \
$LIBX264_FLAGS
make clean
make -j8
make install
popd
# Non-free
pushd fdk-aac
./configure \
--prefix=$PREFIX \
--host=$HOST \
--enable-static \
--disable-shared \
--with-sysroot=$SYSROOT
make clean
make -j8
make install
popd
pushd lame
./configure \
--prefix=$PREFIX \
--host=$HOST \
--enable-static \
--disable-shared \
--disable-frontend \
--with-sysroot=$SYSROOT
make clean
make -j8
make install
popd
pushd libogg
./configure \
--prefix=$PREFIX \
--host=$HOST \
--enable-static \
--disable-shared \
--with-sysroot=$SYSROOT
make clean
make -j8
make install
popd
pushd libvorbis
sed -ia.bak "s;-mno-ieee-fp;;g" configure
./configure \
--prefix=$PREFIX \
--host=$HOST \
--enable-static \
--disable-shared \
--with-sysroot=$SYSROOT \
--with-ogg=$PREFIX
make clean
make -j8
make install
popd
pushd opus
./configure \
--prefix=$PREFIX \
--host=$HOST \
--enable-static \
--disable-shared \
--disable-doc \
--disable-extra-programs
make clean
make -j8
make install V=1
popd
pushd libpng
./configure \
--prefix=$PREFIX \
--host=$HOST \
--with-arch=$ARCH\
--with-sysroot=$SYSROOT \
--disable-shared \
--enable-static \
--with-pic
make clean
make -j8
make install
popd
# required by fontconfig
pushd libuuid
./configure \
--prefix=$PREFIX \
--host=$HOST \
--enable-static \
--with-sysroot=$SYSROOT \
--disable-shared
make clean
make -j8
make install
popd
# required by fontconfig
pushd expat
./configure \
--prefix=$PREFIX \
--host=$HOST \
--with-pic \
--enable-static \
--with-sysroot=$SYSROOT \
--without-docbook \
--disable-docs \
--without-xmlwf \
--disable-shared
make clean
make -j8
make install
popd
pushd freetype
./configure \
--prefix=$PREFIX \
--host=$HOST \
--with-pic \
--with-zlib=yes \
--enable-static \
--with-sysroot=$SYSROOT \
--without-old-mac-fonts \
--without-fsspec \
--without-fsref \
--without-quickdraw-toolbox \
--without-quickdraw-carbon \
--without-ats \
--with-png=no \
--disable-shared
make clean
make -j8
make install
popd
pushd fontconfig
./configure \
--prefix=$PREFIX \
--host=$HOST \
--with-arch=$ARCH\
--with-sysroot=$SYSROOT \
--with-pic \
--disable-libxml2 \
--disable-iconv \
--enable-static \
--disable-shared \
--disable-docs \
--disable-rpath
make clean
make -j8
make install
popd
pushd openssl
#-D__ANDROID_API__=N
./Configure ${OPENSSL_ARCH} \
--prefix=${PREFIX} \
--with-zlib-include=${SYSROOT}/usr/include \
--with-zlib-lib=${SYSROOT}/usr/lib \
zlib \
no-hw \
no-asm \
no-shared \
no-unit-test \
-I${TOOLCHAIN} \
-fPIE
sed -i.bak "s;-mandroid;;g" Makefile
make clean
make -j8
make install_sw
#make install_ssldirs
popd
pushd rtmpdump
pushd librtmp
set -e
make clean
make SYS=android prefix=${PREFIX} CROSS_COMPILE=${CROSS_PREFIX} CC=${CC} SHARED=
make SYS=android prefix=${PREFIX} CROSS_COMPILE=${CROSS_PREFIX} CC=${CC} SHARED= install
popd
popd
if [$ARCH != "native" ];then
#the file /home/rafa/Desktop/m4/ndk/toolchain/arm/sysroot/usr/include/asm-generic/termbits.h has a definition also defined on lavcoded/aac.c, so we need to comment it otherwise ffmpeg wont compile
BADFILE=${SYSROOT}/usr/include/asm-generic/termbits.h
sed -e "s;#define B0 0000000;//#define B0 0000000;" ${BADFILE} > ${BADFILE}n
mv ${BADFILE} ${BADFILE}.bak
mv ${BADFILE}n ${BADFILE}
fi
pushd ffmpeg
OS=android
if [ $ARCH == "native" ]; then
OS=linux
fi
CROSS_COMPILE_FLAGS="--target-os=${OS} \
--arch=${ARCH} \
--cpu=${CPU} \
--cross-prefix=${CROSS_PREFIX} \
--enable-cross-compile \
--cc=${CC} \
--cxx=${CXX} "
./configure --prefix=$PREFIX \
$CROSS_COMPILE_FLAGS \
--pkg-config=${PKG_CONFIG} \
--pkg-config-flags="--static" \
--enable-pic \
--enable-gpl \
--enable-nonfree \
\
--enable-static \
--disable-shared \
--enable-ffmpeg \
--disable-ffplay \
--disable-ffprobe \
--disable-doc \
--disable-devices \
\
--enable-libmp3lame \
--enable-libopus \
--enable-libvorbis \
--enable-libx264 \
--enable-libfdk-aac \
--enable-librtmp \
--enable-zlib \
--enable-libfreetype \
--enable-openssl \
--enable-libfontconfig \
--disable-protocols \
--enable-protocol="crypto,librtmp,librtmpe,librtmps,data,file,librtmpt,librtmpte,tcp,rtp,prompeg,udp,udplite,srtp" \
--disable-filters \
--enable-filter="transpose,abitscope,acompressor,acontrast,acopy,acrossfade,acrusher,atrim,astreamselect,atadenoise,atempo,bbox,avectorscope,avgblur,deshake,displace,drawbox,hwmap,hwupload,pp,pixdesctest,pixscope,interlace,interleave,join,qp,random,psnr,inflate,drawtext,smptehdbars,pp7,pullup,split,spp" \
--disable-parsers \
--enable-parser="aac,aac_latm,ac3,bmp,cavsvideo,cook,dirac,flac,gsm,h261,h263,h264,hevc,mjpeg,pnm,mpeg4video,mpegaudio,mpegvideo,opus,vp3,vorbis,vp8,vp9,vc1,xma,png,rv30,rv40" \
--disable-muxers \
--enable-muxer="3gp,dnxhd,ac3,adts,aiff,amr,apng,ass,webm,ast,avi,webvtt,avm2,bit,null,gxf,gif,h261,h263,h264,hevc,eac3,f4v,flac,flv,gsm,hls,ico,mpeg2vob,image2,image2pipe,ipod,mjpeg,ismv,latm,m4v,matroska,mkvtimestamp_v2,matroska_audio,mmf,mov,mp2,mp3,mp4,mpjpeg,ogg,opus,mpegts,segment,stream_segment" \
--disable-demuxers \
--enable-demuxer="aac,ac3,acm,aiff,amr,amrnb,amrwb,apng,avi,bit,codec2,codec2raw,mkvtimestamp_v2,matroska_audio,mov,mp2,mp3,mp4,mpjpeg,ogg,opus,mpegts,flac,flic,flv,fourxm,gif,gsm,ico,h261,h263,h264,hevc,hls,eac3,ffmetadata,image_pgm_pipe,image_pgmyuv_pipe,image_svg_pipe,image_tiff_pipe,image_webp_pipe,image_psd_pipe,iv8,image_png_pipe,image2pipe,image_bmp_pipe,image2,image_jpeg_pipe,image_jpegls_pipe,m4v,matroska,mgsts,mpegvideo,mpjpeg,ogg,mov,mp3,mpegps,mpegts,mpegtsraw,svag,rawvideo,tta,tty,ty,rsd,rtp,rtsp,v210,v210x,vc1,vc1t,paf,pcm_alaw,pcm_f32be,pcm_f32le,pcm_f64be,pcm_f64le,pcm_mulaw,pcm_s16be,pcm_s16le,pcm_s24be,pcm_s24le,pcm_s32be,pcm_s32le,smjpeg,xmv,wav,webm_dash_manifest,webvtt,yop,yuv4mpegpipe,xvag,xwma,mjpeg,mjpeg_2000,pcm_s8,shorten,swf,thp" \
--disable-encoders \
--enable-encoder="ac3,ac3_fixed,alac,amv,apng,avui,ayuv,bmp,gif,h261,h263,h263_v4l2m2m,h263p,h264_v4l2m2m,huffyuv,jpeg2000,jpegls,mpeg4_v4l2m2m,msmpeg4v2,msmpeg4v3,msvideo1,opus,pcm_alaw,pcm_f32be,pcm_f32le,pcm_s8,pcm_s8_planar,pcm_u16be,pcm_u16le,pcm_u24be,pcm_u24le,pcm_u32be,pcm_u32le,pcm_u8,pcm_mulaw,pcm_s16be,pcm_s16be_planar,pcm_s16le,pcm_s16le_planar,r10k,pcm_s24daud,pcm_s24le,pcm_s24le_planar,pcm_s32be,rv10,pcm_s64be,r210,ra_144,text,tiff,truehd,tta,v308,v408,v410,vc2,vorbis,rawvideo,rv20,wavpack,webvtt,wmav1,wmav2,pcm_s32le,pcm_s32le_planar,mpeg2video,pcm_s64le,libfdk_aac,libmp3lame,libopus,pcm_f64be,pcm_f64le,eac3,flashsv,mpeg4,flv,flac,movtext,mp2,mp2fixed,mpeg1video,libx264,libx264rgb,ljpeg,magicyuv,mjpeg,pcm_s24be,libvorbis,pgmyuv,png,vp8_v4l2m2m,wmv2,wrapped_avframe,xwd,wmv1,yuv4,y41p,zlib" \
--disable-decoders \
--enable-decoder="aac,aac_fixed,aac_latm,aasc,ac3,ac3_fixed,adpcm_4xm,adpcm_adx,adpcm_afc,adpcm_aica,adpcm_ct,adpcm_dtk,adpcm_ea,adpcm_ea_maxis_xa,adpcm_ea_r1,adpcm_ea_r2,adpcm_ea_r3,adpcm_ea_xas,adpcm_g722,adpcm_g726,adpcm_g726le,adpcm_ima_amv,adpcm_ima_apc,adpcm_ima_dat4,adpcm_ima_dk3,adpcm_ima_dk4,adpcm_ima_ea_eacs,adpcm_ima_ea_sead,adpcm_ima_iss,adpcm_ima_oki,adpcm_ima_qt,adpcm_ima_rad,adpcm_ima_smjpeg,adpcm_ima_wav,adpcm_ima_ws,adpcm_ms,adpcm_mtaf,adpcm_psx,adpcm_sbpro_2,adpcm_sbpro_3,adpcm_sbpro_4,adpcm_swf,adpcm_thp,adpcm_thp_le,adpcm_vima,adpcm_xa,adpcm_yamaha,alac,alias_pix,amrnb,amrwb,amv,ansi,apng,vp9_v4l2m2m,vplayer,wavpack,webp,webvtt,wmalossless,atrac3p,atrac3pal,cdgraphics,cdxl,avui,ayuv,bmp,ffvhuff,ffwavesynth,fic,fits,flv,tta,vb,vc1_v4l2m2m,vorbis,vp6,vp6f,vp7,yuv4,zero12v,zerocodec,zlib,smvjpeg,text,theora,thp,vp8,vp3,vp5,pcm_s24le,pcm_s24le_planar,tiff,truehd,vc1,rv10,rv40,pcm_s16le_planar,pcm_s32be,pcm_s32le_planar,pcm_s8,pcm_u24be,pcx,psd,qdraw,qpeg,r10k,r210,ra_144,rv30,vp8_v4l2m2m,vp9,y41p,evrc,flac,flashsv,flashsv2,flic,gif,fourxm,h261,h263,gsm,gsm_ms,h263p,h264_v4l2m2m,h263_v4l2m2m,h263i,h264,wmapro,wmav1,wmav2,wmavoice,wmv1,wmv2,wmv3,eac3,eacmv,eamad,magicyuv,xbin,xma1,xma2,pcm_u24le,pcm_u32be,pcm_u16be,pcm_u8,pcm_s32le,pcm_s24daud,pcm_s64be,pcm_s64le,mp2float,fmvc,mp3adu,mp3float,mp3on4,mp3on4float,mpeg1video,pcm_s24be,mimic,mjpeg,mjpegb,mpeg1_v4l2m2m,mp1,movtext,mp1float,mp2,pcm_u16le,mp3,pcm_s8_planar,mp3adufloat,mpc7,mpc8,pgmyuv,mpeg2_v4l2m2m,mpeg2video,pcm_zork,pcm_u32le,msa1,mpeg4_v4l2m2m,msmpeg4v1,hevc,huffyuv,msmpeg4v2,msmpeg4v3,msrle,mpeg4,png,mpegvideo,mpl2,ra_288,rawvideo,realtext,jpeg2000,jpegls,libfdk_aac,libopus,libvorbis,paf_video,opus,paf_audio,rv20,wmv3image,mlp" \
--enable-bsf="aac_adtstoasc,h264_metadata,h264_mp4toannexb,mpeg4_unpack_bframes,h264_redundant_pps" \
${ADDITIONAL_FFMPEG_CONFIGURATION}
make clean
make -j8
make install V=1
mkdir -p ${FINAL_DIR}/
cp $PREFIX/bin/ffmpeg ${FINAL_DIR}/
popd
cd ${FINAL_DIR}
zip ${TARGET}.zip ffmpeg
rm ${BADFILE}
mv ${BADFILE}.bak ${BADFILE}
}
if [ $TARGET == 'arm' ]; then
#arm
CPU=armv5te
ARCH=arm
OPENSSL_ARCH="android shared no-ssl2 no-ssl3 no-hw "
HOST=arm-linux-androideabi
OPTIMIZE_CFLAGS="-marm -march=$CPU -Os -O3 "
LIBX264_FLAGS="--disable-asm"
ADDITIONAL_FFMPEG_CONFIGURATION="--disable-asm"
elif [ $TARGET == 'armv7-n' ]; then
#arm v7n
CPU=armv7-a
ARCH=arm
HOST=arm-linux-androideabi
OPENSSL_ARCH="android shared no-ssl2 no-ssl3 no-hw "
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -mfpu=neon -marm -mtune=cortex-a8 -march=$CPU -Os -O3"
LIBX264_FLAGS=
ADDITIONAL_FFMPEG_CONFIGURATION="--enable-neon "
elif [ $TARGET == 'armv7-a' ]; then
# armv7-a
CPU=armv7-a
ARCH=arm
OPENSSL_ARCH="android shared no-ssl2 no-ssl3 no-hw "
HOST=arm-linux-androideabi
OPTIMIZE_CFLAGS="-mfloat-abi=softfp -marm -march=$CPU -Os -O3 "
LIBX264_FLAGS=
ADDITIONAL_FFMPEG_CONFIGURATION=
elif [ $TARGET == 'armv8-a' ]; then
#arm64-v8a
CPU=armv8-a
ARCH=arm64
OPENSSL_ARCH="linux-x86_64 shared no-ssl2 no-ssl3 no-hw"
HOST=aarch64-linux-android
OPTIMIZE_CFLAGS="-march=$CPU -Os -O3"
LIBX264_FLAGS=
ADDITIONAL_FFMPEG_CONFIGURATION=
elif [ $TARGET == 'x86_64' ]; then
#x86_64
CPU=x86-64
ARCH=x86_64
OPENSSL_ARCH="linux-x86_64 shared no-ssl2 no-ssl3 no-hw"
HOST=x86_64-linux-android
OPTIMIZE_CFLAGS="-fomit-frame-pointer -march=$CPU -Os -O3"
LIBX264_FLAGS=
ADDITIONAL_FFMPEG_CONFIGURATION=
elif [ $TARGET == 'x86' ]; then
#x86
CPU=i686
ARCH=i686
OPTIMIZE_CFLAGS="-fomit-frame-pointer -march=$CPU -Os -O3"
HOST=i686-linux-android
OPENSSL_ARCH="android shared no-ssl2 no-ssl3 no-hw "
LIBX264_FLAGS="--disable-asm "
#due https://github.com/android-ndk/ndk/issues/693
ADDITIONAL_FFMPEG_CONFIGURATION="--disable-asm "
elif [ $TARGET == 'native' ]; then
HOST=
SYSROOT=/
CROSS_PREFIX=
CPU=x86-64
ARCH=native
OPTIMIZE_CFLAGS="-O2 -pipe -march=native"
ADDITIONAL_CONFIGURE_FLAG=
LIBX264_FLAGS=
OPENSSL_ARCH=linux-x86_64
else
echo "invalid target exiting..."
exit 1
fi
build_one