forked from libretro-mirrors/ppsspp-ffmpeg
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ios-build.sh
executable file
·151 lines (125 loc) · 3.91 KB
/
ios-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
#!/bin/bash
#build ffmpeg for armv7,armv7s and uses lipo to create fat libraries and deletes the originals
PLATFORM=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/
GENERAL="\
--enable-cross-compile \
--arch=arm \
--cc=clang"
MODULES="\
--disable-filters \
--disable-programs \
--disable-network \
--disable-avfilter \
--disable-postproc \
--disable-encoders \
--disable-protocols \
--disable-hwaccels \
--disable-doc"
VIDEO_DECODERS="\
--enable-decoder=h264 \
--enable-decoder=mpeg4 \
--enable-decoder=mpeg2video \
--enable-decoder=mjpeg \
--enable-decoder=mjpegb"
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"
DEMUXERS="\
--enable-demuxer=h264 \
--enable-demuxer=m4v \
--enable-demuxer=mpegvideo \
--enable-demuxer=mpegps \
--enable-demuxer=mp3 \
--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=aac \
--enable-parser=aac_latm"
VIDEO_ENCODERS="\
--enable-encoder=mjpeg"
AUDIO_ENCODERS="\
--enable-encoder=pcm_s16le"
MUXERS="\
--enable-muxer=avi"
./configure \
--prefix=ios/armv7 \
$GENERAL \
--sysroot="$(xcrun -sdk iphoneos -show-sdk-path)" \
--extra-cflags="-arch armv7 -mfpu=neon -miphoneos-version-min=5.0" \
--disable-shared \
--enable-static \
--extra-ldflags="-arch armv7 -isysroot $(xcrun -sdk iphoneos -show-sdk-path) -miphoneos-version-min=5.0" \
--enable-zlib \
--enable-pic \
--disable-everything \
${MODULES} \
${VIDEO_DECODERS} \
${AUDIO_DECODERS} \
${VIDEO_ENCODERS} \
${AUDIO_ENCODERS} \
${DEMUXERS} \
${MUXERS} \
${PARSERS} \
--target-os=darwin \
--enable-vfp \
--enable-neon \
--cpu=cortex-a8 \
--enable-pic
make clean
make && make install
if [ "$?" != "0" ]; then
exit 1;
fi
./configure \
--prefix=ios/armv7s \
$GENERAL \
--sysroot="$(xcrun -sdk iphoneos -show-sdk-path)" \
--extra-cflags="-arch armv7s -mfpu=neon -miphoneos-version-min=5.0" \
--disable-shared \
--enable-static \
--extra-ldflags="-arch armv7s -isysroot $(xcrun -sdk iphoneos -show-sdk-path)" -miphoneos-version-min=5.0" \
--enable-zlib \
--enable-pic \
--disable-everything \
${MODULES} \
${VIDEO_DECODERS} \
${AUDIO_DECODERS} \
${VIDEO_ENCODERS} \
${AUDIO_ENCODERS} \
${DEMUXERS} \
${MUXERS} \
${PARSERS} \
--target-os=darwin \
--enable-vfp \
--enable-neon \
--cpu=cortex-a9 \
--enable-pic
make clean
make && make install
if [ "$?" != "0" ]; then
exit 1;
fi
cd ios
mkdir -p universal/lib
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/lib/libavformat.a -arch armv7s armv7s/lib/libavformat.a -output universal/lib/libavformat.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/lib/libavutil.a -arch armv7s armv7s/lib/libavutil.a -output universal/lib/libavutil.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/lib/libswresample.a -arch armv7s armv7s/lib/libswresample.a -output universal/lib/libswresample.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/lib/libavcodec.a -arch armv7s armv7s/lib/libavcodec.a -output universal/lib/libavcodec.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/lib/libswscale.a -arch armv7s armv7s/lib/libswscale.a -output universal/lib/libswscale.a
xcrun -sdk iphoneos lipo -create -arch armv7 armv7/lib/libavdevice.a -arch armv7s armv7s/lib/libavdevice.a -output universal/lib/libavdevice.a
cp -r armv7/include universal/
rm -rf armv7 armv7s