-
Notifications
You must be signed in to change notification settings - Fork 2
/
build-lame.sh
executable file
·66 lines (49 loc) · 1.32 KB
/
build-lame.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
#!/bin/bash
## Mini-Xcode: XCode 5
MIN_VERSION="6.0"
# set default output folder is build
OUTPUT_FOLDER=${PREFIX-build}
# set default compiler
CC=${CC-$(xcrun --find gcc)}
LIPO=${LIPO-$(xcrun --find lipo)}
XCODE_PATH=$(xcode-select -print-path)
# make output folder
mkdir -p $OUTPUT_FOLDER
function build_lame()
{
make distclean
# SDK must lower case
SDK_ROOT=$(xcrun --sdk $(echo ${SDK} | tr '[:upper:]' '[:lower:]') --show-sdk-path)
./configure \
CFLAGS="-arch ${PLATFORM} -pipe -std=c99 -isysroot ${SDK_ROOT} -miphoneos-version-min=${MIN_VERSION} -fembed-bitcode" \
--host="$HOST" \
--enable-static \
--disable-decoder \
--disable-frontend \
--disable-debug \
--disable-dependency-tracking
make
cp "libmp3lame/.libs/libmp3lame.a" "${OUTPUT_FOLDER}/libmp3lame-${PLATFORM}.a"
}
# build simulator version
SDK="iPhoneSimulator"
PLATFORM="i686"
build_lame
HOST="i686-apple-darwin13.1.0"
SDK="iPhoneSimulator"
PLATFORM="x86_64"
build_lame
# build device version
SDK="iPhoneOS"
PLATFORM="armv7"
build_lame
PLATFORM="armv7s"
build_lame
PLATFORM="arm64"
build_lame
# remove old libmp3lame.a or lipo will failed
OUTPUT_LIB=${OUTPUT_FOLDER}/libmp3lame.a
if [ -f $OUTPUT_LIB ]; then
rm $OUTPUT_LIB
fi
${LIPO} -create ${OUTPUT_FOLDER}/* -output ${OUTPUT_LIB}