• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# FFmpeg build configure
2
3#!/bin/bash
4
5set -ex
6FFMPEG_PATH=$1
7FFMPEG_OUT_PATH=$2
8
9FF_CONFIG_OPTIONS="
10    --disable-programs
11    --disable-avdevice
12    --disable-postproc
13    --disable-avfilter
14    --disable-network
15    --disable-dwt
16    --disable-lsp
17    --disable-lzo
18    --disable-faan
19    --disable-pixelutils
20    --disable-bsfs
21    --disable-encoders
22    --disable-decoders
23    --disable-hwaccels
24    --disable-muxers
25    --disable-demuxers
26    --disable-parsers
27    --disable-protocols
28    --disable-devices
29    --disable-filters
30    --disable-asm
31    --disable-doc
32    --disable-debug
33    --disable-iconv
34    --disable-stripping
35    --disable-vaapi
36    --disable-vdpau
37    --disable-zlib
38    --disable-xlib
39    --disable-cuvid
40    --disable-cuda
41    --disable-libxcb
42    --disable-libxcb_shm
43    --disable-libxcb_shape
44    --disable-libxcb_xfixes
45    --disable-sdl2
46    --disable-bzlib
47    --disable-lzma
48    --enable-demuxer=mp3,aac,ape,flac,ogg,wav,mov,mpegts
49    --enable-muxer=mp4,h264
50    --enable-parser=h263,mpeg4video,vp8,vp9
51    --enable-parser=mpegaudio,aac,aac_latm,av3a
52    --enable-decoder=h263,h264,mpeg2video,mpeg4,vp8,vp9
53    --enable-decoder=mp3,mp3float,aac,aac_latm,ape,flac,vorbis,opus
54    --enable-encoder=aac,aac_latm,opus
55    --enable-encoder=mpeg4,h263
56    --enable-bsf=h264_mp4toannexb
57"
58
59FF_CONFIG_OPTIONS=`echo $FF_CONFIG_OPTIONS`
60
61${FFMPEG_PATH}/configure ${FF_CONFIG_OPTIONS}
62
63sed -i 's/HAVE_SYSCTL 1/HAVE_SYSCTL 0/g' config.h
64sed -i 's/HAVE_SYSCTL=yes/!HAVE_SYSCTL=yes/g' ./ffbuild/config.mak
65sed -i 's/HAVE_GLOB 1/HAVE_GLOB 0/g' config.h
66sed -i 's/HAVE_GLOB=yes/!HAVE_GLOB=yes/g' config.h
67sed -i 's/HAVE_GMTIME_R 1/HAVE_GMTIME_R 0/g' config.h
68sed -i 's/HAVE_LOCALTIME_R 1/HAVE_LOCALTIME_R 0/g' config.h
69sed -i 's/HAVE_PTHREAD_CANCEL 1/HAVE_PTHREAD_CANCEL 0/g' config.h
70sed -i 's/HAVE_VALGRIND_VALGRIND_H 1/HAVE_VALGRIND_VALGRIND_H 0/g' config.h
71
72tmp_file=".tmpfile"
73## remove invalid restrict define
74sed 's/#define av_restrict restrict/#define av_restrict/' ./config.h >$tmp_file
75mv $tmp_file ./config.h
76
77## replace original FFMPEG_CONFIGURATION define with $FF_CONFIG_OPTIONS
78sed '/^#define FFMPEG_CONFIGURATION/d' ./config.h >$tmp_file
79mv $tmp_file ./config.h
80total_line=`wc -l ./config.h | cut -d' ' -f 1`
81tail_line=`expr $total_line - 3`
82head -3 config.h > $tmp_file
83echo "#define FFMPEG_CONFIGURATION \"${FF_CONFIG_OPTIONS}\"" >> $tmp_file
84tail -$tail_line config.h >> $tmp_file
85mv $tmp_file ./config.h
86
87rm -f config.err
88
89## rm BUILD_ROOT information
90sed '/^BUILD_ROOT=/d' ./ffbuild/config.mak > $tmp_file
91rm -f ./ffbuild/config.mak
92mv $tmp_file ./ffbuild/config.mak
93
94## rm amr-eabi-gcc
95sed '/^CC=arm-eabi-gcc/d' ./ffbuild/config.mak > $tmp_file
96rm -f ./ffbuild/config.mak
97mv $tmp_file ./ffbuild/config.mak
98
99## rm amr-eabi-gcc
100sed '/^AS=arm-eabi-gcc/d' ./ffbuild/config.mak > $tmp_file
101rm -f ./ffbuild/config.mak
102mv $tmp_file ./ffbuild/config.mak
103
104
105## rm amr-eabi-gcc
106sed '/^LD=arm-eabi-gcc/d' ./ffbuild/config.mak > $tmp_file
107rm -f ./ffbuild/config.mak
108mv $tmp_file ./ffbuild/config.mak
109
110## rm amr-eabi-gcc
111sed '/^DEPCC=arm-eabi-gcc/d' ./ffbuild/config.mak > $tmp_file
112rm -f ./ffbuild/config.mak
113mv $tmp_file ./ffbuild/config.mak
114
115sed -i 's/restrict restrict/restrict /g' config.h
116
117sed -i '/getenv(x)/d' config.h
118sed -i 's/HAVE_DOS_PATHS 0/HAVE_DOS_PATHS 1/g' config.h
119
120mv config.h ${FFMPEG_OUT_PATH}/config.h
121mv ./ffbuild/config.mak ${FFMPEG_OUT_PATH}/config.mak
122rm -rf ${FFMPEG_OUT_PATH}/libavcodec
123mv -f libavcodec ${FFMPEG_OUT_PATH}
124rm -rf ${FFMPEG_OUT_PATH}/libavformat
125mv -f libavformat ${FFMPEG_OUT_PATH}
126rm -rf ${FFMPEG_OUT_PATH}/libavutil
127mv -f libavutil ${FFMPEG_OUT_PATH}
128rm -rf ${FFMPEG_OUT_PATH}/libavdevice
129mv -f libavdevice ${FFMPEG_OUT_PATH}
130rm -rf ${FFMPEG_OUT_PATH}/libavfilter
131mv -f libavfilter ${FFMPEG_OUT_PATH}
132rm -rf ./ffbuild
133
134## other work need to be done manually
135cat <<!EOF
136#####################################################
137                    ****NOTICE****
138You need to modify the file config.mak and delete
139all full path string in macro:
140SRC_PATH, SRC_PATH_BARE, BUILD_ROOT, LDFLAGS.
141Please refer to the old version of config.mak to
142check how to modify it.
143#####################################################
144!EOF
145