-
Notifications
You must be signed in to change notification settings - Fork 72
/
build_ios.sh
57 lines (45 loc) · 1.55 KB
/
build_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
#!/bin/bash
for var in $@
do
if [ "$var" == "--phone" ]; then
PLATFORM="OS"
elif [ "$var" == "--simulator" ]; then
PLATFORM="Simulator"
fi
done
if [ -z "$PLATFORM" ]; then
PLATFORM="Simulator"
echo "WARNING: Using Simulator for the platform since it was unspecified"
fi
if [ -z "$DEVELOPER_HOME" ]; then
DEVELOPER_HOME="/Applications/Xcode.app/Contents/Developer"
echo "WARNING: Using Xcode home of /Applications/Xcode.app/Contents/Developer"
fi
if [ -z "$SDKVER" ]; then
SDKVER="7.0"
echo "WARNING: Using default SDK version 7.0"
fi
if [ -z "$SDKMIN" ]; then
SDKMIN="7.0"
echo "WARNING: Using default SDK min version of 7.0"
fi
PLATFORMPATH="$DEVELOPER_HOME/Platforms/iPhone$PLATFORM.platform"
SDK="$PLATFORMPATH/Developer/SDKs/iPhone$PLATFORM$SDKVER.sdk"
if [ "$PLATFORM" == "Simulator" ]; then
CPPFLAGS="-arch i386 -arch x86_64 -isysroot $SDK -miphoneos-version-min=$SDKMIN"
elif [ "$PLATFORM" == "OS" ]; then
CPPFLAGS="-arch arm64 -arch armv7 -arch armv7s -isysroot $SDK -miphoneos-version-min=$SDKMIN -D__LLP64__ -DIPHONE_SDK"
fi
LINKFLAGS="$CPPFLAGS"
command -v ccache >/dev/null
if [ $? -eq 0 ]; then
CC="ccache"
CXX="ccache"
fi
CC="$CC clang -Qunused-arguments"
CXX="$CXX clang++ -Qunused-arguments"
if [ "$PLATFORM" == "Simulator" ]; then
scons --cc="$CC" --cxx="$CXX" --lnflags="$LINKFLAGS" --cflags="$CPPFLAGS" --out="out-simulator" --build="build-simulator" --static kernel
elif [ "$PLATFORM" == "OS" ]; then
scons --cc="$CC" --cxx="$CXX" --lnflags="$LINKFLAGS" --cflags="$CPPFLAGS" --out="out-iphone" --build="build-iphone" --static kernel
fi