forked from libretro-mirrors/ppsspp-ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
windows_x86-build.sh
executable file
·270 lines (233 loc) · 6.04 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
#!/bin/bash
#ffmpeg for windows x86
#windows_x86-build.sh requements.
# MinGW
#
# WARNING: If cc_check fails, rename MingW/msys/1.0/bin/link.exe as it clashes with
# the MSVC one.
#
# MSYS
# 1. open command-prompt of Visual Studio (IMPORTANT: Correct bit-ness! There are both)
# 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
#///////////////////////////////////////////////////////////////////////////////
rm config.mak
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}
# --cpu=opteron-sse3
# --extra-ldflags="-lz"
# --optflags=""
--disable-avdevice
--disable-programs
--disable-avfilter
--disable-postproc
--disable-doc
--disable-pthreads
--enable-w32threads
--disable-network
--disable-everything
--disable-encoders
--disable-muxers
--disable-hwaccels
--disable-parsers
--disable-protocols
--enable-dxva2
"
AUDIO_DECODERS="
--enable-decoder=aac
--enable-decoder=aac_latm
--enable-decoder=atrac3
--enable-decoder=atrac3p
--enable-decoder=mp3
--enable-decoder=pcm_s16le
--enable-decoder=pcm_s8
"
VIDEO_DECODERS="
--enable-decoder=h264
--enable-decoder=mpeg4
--enable-decoder=mpeg2video
--enable-decoder=mjpeg
--enable-decoder=mjpegb
"
AUDIO_ENCODERS="
--enable-encoder=pcm_s16le
"
VIDEO_ENCODERS="
--enable-encoder=huffyuv
--enable-encoder=ffv1
--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
"
#unused
MUXERS="
--enable-muxer=avi
"
DEMUXERS="
--enable-demuxer=h264
--enable-demuxer=m4v
--enable-demuxer=mp3
--enable-demuxer=mpegvideo
--enable-demuxer=mpegps
--enable-demuxer=mjpeg
--enable-demuxer=avi
--enable-demuxer=aac
--enable-demuxer=pmp
--enable-demuxer=oma
--enable-demuxer=pcm_s16le
--enable-demuxer=pcm_s8
--enable-demuxer=wav
"
PARSERS="
--enable-parser=h264
--enable-parser=mpeg4video
--enable-parser=mpegaudio
--enable-parser=mpegvideo
--enable-parser=mjpeg
--enable-parser=aac
--enable-parser=aac_latm
"
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
"
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 AUDIO_ENCODERS)")\
$(echo -e "$(genelateparams VIDEO_ENCODERS)")\
$(echo -e "$(genelateparams BSFS)")\
$(echo -e "$(genelateparams PARSERS)")\
$(echo -e "$(genelateparams DEMUXERS)")\
$(echo -e "$(genelateparams MUXERS)")\
$(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 -GS-" $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