This repository has been archived by the owner on Nov 26, 2022. It is now read-only.
forked from king2k/FFmpeg-for-iOS
-
Notifications
You must be signed in to change notification settings - Fork 12
/
build-ffmpeg-only.sh
executable file
·126 lines (108 loc) · 3.74 KB
/
build-ffmpeg-only.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
#!/bin/sh
# Automatic build script for ffmpeg
# for iPhoneOS and iPhoneSimulator
###########################################################################
# Change values here #
# #
VERSION="1.0.1" #
SDKVERSION="6.0" #
# #
###########################################################################
# #
# Don't change anything under this line! #
# #
###########################################################################
CURRENTPATH=`pwd`
ARCHS="i386 armv7 armv7s"
DEVELOPER=`xcode-select -print-path`
if [ ! -d "$DEVELOPER" ]; then
echo "xcode path is not set correctly $DEVELOPER does not exist (most likely because of xcode > 4.3)"
echo "run"
echo "sudo xcode-select -switch <xcode path>"
echo "for default installation:"
echo "sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer"
exit 1
fi
set -e
if [ ! -e ffmpeg-${VERSION}.tar.bz2 ]; then
echo "Downloading ffmpeg-${VERSION}.tar.bz2"
curl -O http://ffmpeg.org/releases/ffmpeg-${VERSION}.tar.bz2
else
echo "Using ffmpeg-${VERSION}.tar.bz2"
fi
mkdir -p "${CURRENTPATH}/src"
mkdir -p "${CURRENTPATH}/bin"
mkdir -p "${CURRENTPATH}/lib"
tar jxvf ffmpeg-${VERSION}.tar.bz2 -C "${CURRENTPATH}/src"
cd "${CURRENTPATH}/src/ffmpeg-${VERSION}"
for ARCH in ${ARCHS}
do
if [ "${ARCH}" == "i386" ];
then
PLATFORM="iPhoneSimulator"
EXTRA_FLAGS="--cpu=i386 --enable-pic --disable-yasm --disable-asm --disable-armv5te"
EXTRA_CFLAGS=""
FFARCH=i386
else
#sed -ie "s!static volatile sig_atomic_t intr_signal;!static volatile intr_signal;!" "crypto/ui/ui_openssl.c"
PLATFORM="iPhoneOS"
EXTRA_FLAGS="--cpu=cortex-a8 --enable-pic"
EXTRA_CFLAGS="-mfpu=neon"
FFARCH=arm
fi
export CROSS_TOP="${DEVELOPER}/Platforms/${PLATFORM}.platform/Developer"
export CROSS_SDK="${PLATFORM}${SDKVERSION}.sdk"
export RANLIB=${CROSS_TOP}/usr/bin/ranlib
echo "Building ffmpeg-${VERSION} for ${PLATFORM} ${SDKVERSION} ${ARCH}"
echo "Please stand by..."
mkdir -p "${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk"
LOG="${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk/build-ffmpeg-${VERSION}.log"
./configure \
--cc=${CROSS_TOP}/usr/bin/gcc \
--as="gas-preprocessor.pl ${CROSS_TOP}/usr/bin/gcc" \
--prefix=${CURRENTPATH}/bin/${PLATFORM}${SDKVERSION}-${ARCH}.sdk \
--sysroot=${CROSS_TOP}/SDKs/${CROSS_SDK} \
--extra-cflags="-I../../include" \
--extra-cflags="-I../../include/x264" \
--extra-ldflags="-L../../lib" \
--extra-ldflags="-L${CROSS_TOP}/SDKs/${CROSS_SDK}/usr/lib/system" \
--target-os=darwin \
--arch=${FFARCH} \
--extra-cflags="-arch ${ARCH}" \
--extra-ldflags="-arch ${ARCH}" \
${EXTRA_FLAGS} \
--enable-gpl \
--enable-cross-compile \
--disable-ffmpeg \
--disable-ffplay \
--disable-ffserver \
--disable-doc \
--disable-encoders \
--disable-decoders \
--disable-demuxers \
--disable-muxers \
--enable-demuxer=flv \
--enable-demuxer=mov \
--enable-muxer=flv \
--enable-muxer=mov \
--enable-decoder=mp3 \
--enable-decoder=aac \
make >> "${LOG}" 2>&1
make install >> "${LOG}" 2>&1
make clean >> "${LOG}" 2>&1
done
echo "Build library..."
FFMPEG_LIBS="libavcodec libavdevice libavformat libavutil libswscale"
for i in ${FFMPEG_LIBS}
do
lipo -create ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/lib/$i.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7.sdk/lib/$i.a ${CURRENTPATH}/bin/iPhoneOS${SDKVERSION}-armv7s.sdk/lib/$i.a -output ${CURRENTPATH}/lib/$i.a
done
mkdir -p ${CURRENTPATH}/include
for i in ${FFMPEG_LIBS}
do
cp -R ${CURRENTPATH}/bin/iPhoneSimulator${SDKVERSION}-i386.sdk/include/$i ${CURRENTPATH}/include/
done
echo "Building done."
echo "Cleaning up..."
rm -rf ${CURRENTPATH}/src/ffmpeg-${VERSION}
echo "Done."