-
Notifications
You must be signed in to change notification settings - Fork 35
/
Copy pathbuild-libmp4v2-for-iOS.sh
95 lines (74 loc) · 2.04 KB
/
build-libmp4v2-for-iOS.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
#!/bin/sh
XY_iPhone_SDK_VERSION=`xcrun --sdk iphoneos --show-sdk-version`
IOS_BASE_SDK=$XY_iPhone_SDK_VERSION
SOURCE="mp4v2-2.0.0"
ROOT=`pwd`
FAT="$ROOT/fat"
THIN="$ROOT/thin"
ARCHS="i386 x86_64 armv7 armv7s arm64 "
#ARCHS="i386 x86_64"
CONFIGURE_FLAGS="--disable-gch --disable-debug --disable-util \
--enable-shared=no"
clean()
{
rm -rf $THIN
rm -rf $FAT
}
clean
for ARCH in $ARCHS
do
echo "building $ARCH .."
if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
then
PLATFORM="iPhoneSimulator"
SIMULATOR="-mios-simulator-version-min=7.0"
HOST="--host=i386-apple-darwin"
else
PLATFORM="iPhoneOS"
SIMULATOR="-miphoneos-version-min=7.0"
HOST="--host=arm-apple-darwin"
fi
DEVROOT=`xcode-select -p`/"Platforms/$PLATFORM.platform/Developer"
SDKROOT=$DEVROOT/SDKs/$PLATFORM$IOS_BASE_SDK.sdk
CFLAGS="-arch $ARCH $SIMULATOR -pipe -no-cpp-precomp -isysroot $SDKROOT -I$SDKROOT/usr/include/ -fembed-bitcode"
export CFLAGS="$CFLAGS"
export CXX="llvm-g++"
export CC="llvm-gcc"
if [ "$ARCH" = "i386" -o "$ARCH" = "x86_64" ]
then
export LD=$DEVROOT/usr/bin/ld
export LDFLAGS="-L$SDKROOT/usr/lib/"
else
export LD=$DEVROOT/usr/bin/ld
export AS=$DEVROOT/usr/bin/as
export NM=$DEVROOT/usr/bin/nm
export LDFLAGS="-L$SDKROOT/usr/lib/"
export LIBTOOL=$DEVROOT/usr/bin/libtool
export LIPO=$DEVROOT/usr/bin/lipo
export OTOOL=$DEVROOT/usr/bin/otool
export NMEDIT=$DEVROOT/usr/bin/nmedit
export DSYMUTIL=$DEVROOT/usr/bin/dsymutil
export STRIP=$DEVROOT/usr/bin/strip
fi
export CPPFLAGS=$CFLAGS
export CXXFLAGS=$CFLAGS
make distclean
$ROOT/$SOURCE/configure $CONFIGURE_FLAGS $HOST --prefix="$THIN/$ARCH"
make
make install
echo "build $ARCH done.."
done
echo "building fat .."
mkdir -p "${FAT}/lib"
set - $ARCHS
CWD=`pwd`
cd ${THIN}/$1/lib
for LIB in `ls *.a`
do
echo $LIB
cd $CWD
xcrun -sdk iphoneos lipo -create `find $THIN -name $LIB` -output $FAT/lib/$LIB
done
cd $CWD
cp -rf $THIN/$1/include $FAT
echo "build fat done.."