forked from hrydgard/ppsspp-ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 0
/
windows_x86-build.sh
314 lines (278 loc) · 7.29 KB
/
windows_x86-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
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
#!/bin/bash
#ffmpeg for windows x86
#windows_x86-build.sh requements.
# MinGW
# MSYS
# 1. open command-prompt of Visual Studio
# 2. run msys.bat on the command-line.
# 3. $ cd /PathTo/ppsspp/ffmpeg
# 4. $ windows_x86-build.sh
#build requements.
# use toolchain=msvc
# http://ffmpeg.org/platform.html#Windows
#///////////////////////////////////////////////////////////////////////////////
ARCH=x86
PREFIX="./Windows/${ARCH}"
mkdir -p ${PREFIX}
IS_STATIC_LIB=TRUE
IS_SHARED_LIB_INTO_BIN_DIR=FALSE
GENERAL="
--toolchain=msvc
--prefix=$PREFIX
--arch=${ARCH}
# --march=pentium4
# --cpu=opteron-sse3
# --extra-ldflags="-lz"
# --optflags=""
--disable-programs
--disable-avfilter
--disable-postproc
--disable-doc
# --enable-zlib
--disable-pthreads
--enable-w32threads
--disable-network
--disable-everything
--enable-dxva2
# --enable-libmp3lame
# --enable-vaapi
# --enable-vda
# --enable-vdpau
"
AUDIO_DECODERS="
--enable-decoder=aac
# --enable-decoder=aac_latm
--enable-decoder=atrac1
--enable-decoder=atrac3
--enable-decoder=mp3
# --enable-decoder=mp3adu
# --enable-decoder=mp3adufloat
# --enable-decoder=mp3float
# --enable-decoder=mp3on4
# --enable-decoder=mp3on4float
# --enable-decoder=libmp3lame
# --enable-decoder=wmav1
# --enable-decoder=wmav2
# --enable-decoder=wmavoice
--enable-decoder=pcm_s16le
--enable-decoder=pcm_s8
"
VIDEO_DECODERS="
--enable-decoder=h264
# --enable-decoder=h264_crystalhd
# --enable-decoder=h264_vda
# --enable-decoder=h264_vdpau
# --enable-decoder=mpeg4
# --enable-decoder=mpeg4_crystalhd
# --enable-decoder=mpeg4_vdpau
--enable-decoder=mpeg2video
# --enable-decoder=mpeg2_crystalhd
# --enable-decoder=mjpeg
# --enable-decoder=mjpegb
"
AUDIO_ENCODERS="
--enable-encoder=aac
# --enable-encoder=libfdk_aac
# --enable-encoder=libfaac
# --enable-encoder=libmp3lame
# --enable-encoder=wmav1
# --enable-encoder=wmav2
--enable-encoder=pcm_s16le
--enable-encoder=pcm_s8
"
VIDEO_ENCODERS="
# --enable-encoder=libx264
# --enable-encoder=libx264rgb
--enable-encoder=mpeg4
# --enable-encoder=msmpeg4v2
# --enable-encoder=msmpeg4v3
# --enable-encoder=libxvid
--enable-encoder=mpeg2video
# --enable-encoder=mjpeg
"
HARDWARE_ACCELS="
--enable-hwaccel=h264_dxva2
# --enable-hwaccel=h264_vaapi
# --enable-hwaccel=h264_vda
# --enable-hwaccel=h264_vdpau
# --enable-hwaccel=mpeg4_vaapi
# --enable-hwaccel=mpeg4_vdpau
"
MUXERS="
--enable-muxer=h264
--enable-muxer=mp4
# --enable-muxer=m4v
# --enable-muxer=asf
# --enable-muxer=asf_stream
--enable-muxer=avi
# --enable-muxer=mpjpeg
# --enable-muxer=mjpeg
# --enable-muxer=adts
# --enable-muxer=latm
--enable-muxer=mp3
--enable-muxer=psp
--enable-muxer=oma
--enable-muxer=wav
--enable-muxer=pcm_s16le
--enable-muxer=pcm_s8
"
DEMUXERS="
--enable-demuxer=h264
# --enable-demuxer=m4v
--enable-demuxer=mpegvideo
# --enable-demuxer=mjpeg
# --enable-demuxer=asf
--enable-demuxer=avi
--enable-demuxer=aac
# --enable-demuxer=latm
--enable-demuxer=oma
# --enable-demuxer=xwma
--enable-demuxer=pcm_s16le
--enable-demuxer=pcm_s8
--enable-demuxer=wav
"
PARSERS="
--enable-parser=h264
--enable-parser=mpeg4video
--enable-parser=mpegvideo
# --enable-parser=mjpeg
--enable-parser=aac
# --enable-parser=aac_latm
--enable-parser=mpegaudio
"
PROTOCOLS=""
BSFS="
# --enable-bsf=aac_adtstoasc
# --enable-bsf=chomp
# --enable-bsf=dump_extradata
# --enable-bsf=h264_mp4toannexb
# --enable-bsf=mjpeg2jpeg
# --enable-bsf=mjpega_dump_header
# --enable-bsf=mp3_header_compress
# --enable-bsf=mp3_header_decompress
# --enable-bsf=remove_extradata
"
INPUT_DEVICES="
--enable-indev=dshow
# --enable-indev=lavfi
# --enable-indev=vfwcap
# --enable-indev=alsa
# --enable-indev=fbdev
# --enable-indev=libcdio
# --enable-indev=libdc1394
# --enable-indev=oss
# --enable-indev=pulse
# --enable-indev=sndio
# --enable-indev=v4l2
# --enable-indev=x11grab
# --enable-indev=openal
"
OUTPUT_DEVICES="
# --enable-outdev=sdl
"
FILTERS=""
#///////////////////////////////////////////////////////////////////////////////
append() {
var=$1
shift
eval "$var=\"\$$var $*\""
}
isstaticlib() {
case "$IS_STATIC_LIB" in
"TRUE" | "true" | "1" ) return 0 ;;
*) return 1 ;;
esac
}
isintobin() {
case "$IS_SHARED_LIB_INTO_BIN_DIR" in
"TRUE" | "true" | "1" ) return 0 ;;
*) return 1 ;;
esac
}
genelatelibparams() {
ret=""
if (isstaticlib) then
ret=" --enable-static --disable-shared"
else
ret=" --enable-shared --disable-static"
fi
echo "$ret"
}
genelateparams() {
eval "value=\"\$$1\""
ret=""
value=$(echo "$value" | sed "s/ //g")
for var in $value ; do
if [ ! `echo "$var" | fgrep -o "#"` ]; then
ret="$ret $var"
fi
done
echo "$ret"
}
params_dump() {
eval "value=\"\$$1\""
echo "---- dump configure params ----"
IFS=" "
for var in $value ; do
echo "$var"
done
echo "---- end dump ----"
}
function build_ffmpeg
{
echo "Converting From CRLF To LF."
find ./ -regex "\(.*\.mak\|.*Makefile\)" | xargs dos2unix
echo "Generate configure params."
PARAMS="$(genelateparams GENERAL)\
$(genelatelibparams)\
$(echo -e "$(genelateparams AUDIO_DECODERS)")\
$(echo -e "$(genelateparams VIDEO_DECODERS)")\
$(echo -e "$(genelateparams BSFS)")\
$(echo -e "$(genelateparams PARSERS)")\
$(echo -e "$(genelateparams DEMUXERS)")\
$(echo -e "$(genelateparams HARDWARE_ACCELS)")\
$(echo -e "$(genelateparams INPUT_DEVICES)")\
"
params_dump PARAMS
# these are not necessary
# $(echo -e "$(genelateparams MUXERS)")
# $(echo -e "$(genelateparams AUDIO_ENCODERS)")\
# $(echo -e "$(genelateparams VIDEO_ENCODERS)")\
echo "---- configure ----"
./configure --extra-cflags="-MD -IWindowsInclude" $PARAMS
echo "---- make clean ----"
make clean
echo "---- make install ----"
make install 2>&1 | tee build.log
echo "---- rename and copy for ppsspp ----"
if (isstaticlib) then
pushd $PREFIX/lib
echo "Renaming "foo.a" to "foo.lib" in the build-directory."
for fname in *.a; do
mv -fv $fname $(echo "$fname" | sed -e "s/lib\(.*\)\.a/\1/").lib
done
popd
else
binpath=$PREFIX/bin
libpath=$PREFIX/lib
absbin=$(cd $(dirname "$binpath/*") && pwd)
absbin=$(echo "${absbin//\//\\}" | sed -e "s/\\\\\(.\)/\1:/")
pushd $libpath
for fname in *.def; do
outname=${fname%%-*}
if (isintobin) then
abspath="$absbin\\$outname.lib"
lib \/machine:i386 \/def:$fname \/out:$abspath
popd
rm -fv $binpath/$outname.exp
pushd $libpath
else
lib \/machine:i386 \/def:$fname \/out:$outname.lib
rm -fv $outname.exp
fi
done
popd
fi
echo "---- windows_x86-build.sh finished ----"
}
build_ffmpeg