forked from ilin-in/OPiOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare.sh
executable file
·177 lines (157 loc) · 4.91 KB
/
prepare.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
#!/bin/bash
: ${CURL_SCRIPT_PATH:=./libs/op/libs/ortc-lib/libs/curl-build-scripts}
: ${BOOST_SCRIPT_PATH:=./libs/op/libs/ortc-lib/libs/boost}
: ${TEMPLATES_PATH:=./templates}
: ${DESTINATION_PATH:=./Samples/OpenPeerSampleApp/OpenPeerSampleApp}
: ${CUSTOMER_SPECIFIC_TEMPLATE:=Template_CustomerSpecific.plist}
: ${CUSTOMER_SPECIFIC:=CustomerSpecific.plist}
: ${CUSTOMER_SPECIFIC_RELEASE_TEMPLATE:=Template_CustomerSpecific_Release.plist}
: ${CUSTOMER_SPECIFIC_RELEASE:=CustomerSpecific_Release.plist}
sdkpath() {
echo Discovering SDK...
platform=$1
SDKCheck[0]="9.1"
SDKCheck[1]="9.0.1"
SDKCheck[2]="9.0"
SDKCheck[3]="8.3.1"
SDKCheck[4]="8.3"
SDKCheck[5]="8.2.1"
SDKCheck[6]="8.2"
SDKCheck[7]="8.1.1"
SDKCheck[8]="8.1"
SDKCheck[9]="8.0"
SDKCheck[10]="7.2"
SDKCheck[11]="7.1"
SDKCheck[12]="7.0"
SDKCheck[13]="6.1"
SDKCheck[14]="6.0"
SDKCheck[15]="5.1"
SDKCheck[16]="5.0.1"
SDKCheck[17]="5.0"
SDKCheck[18]="4.3"
SDKCheck[19]="4.2"
SDKCheck[20]="4.1"
SDKCheck[21]="4.0"
root="/Applications/Xcode.app/Contents/Developer/Platforms/${platform}.platform/Developer"
oldRoot="/Developer/Platforms/${platform}.platform/Developer"
if [ ! -d "${root}" ]
then
root="${oldRoot}"
fi
if [ ! -d "${root}" ]
then
echo " "
echo "Oopsie. You don't have an iOS SDK root in either of these locations: "
echo " ${root} "
echo " ${oldRoot}"
echo " "
echo "If you have 'locate' enabled, you might find where you have it installed with:"
echo " locate iPhoneOS.platform | grep -v 'iPhoneOS.platform/'"
echo " "
echo "and alter the 'root' variable in the script -- or install XCode if you can't find it... "
echo " "
exit 1
fi
SDK="unknown"
for value in "${SDKCheck[@]}"
do
if [ -d "${root}/SDKs/${platform}${value}.sdk" ]
then
SDK="${value}"
break
fi
done
if [ "${SDK}" == "unknown" ]
then
echo " "
echo "Unable to determine the SDK version to use."
echo " "
echo "If you have 'locate' enabled, you might find where you have it installed with:"
echo " locate iPhoneOS.platform | grep -v 'iPhoneOS.platform/'"
echo " "
echo "and alter the SDKCheck variables in the script -- or install XCode if you can't find it... "
echo " "
exit 1
fi
echo Found SDK in location "${root}/SDKs/${platform}${value}.sdk"
}
buildcurl() {
#Runs curl build script
if [ -f "$CURL_SCRIPT_PATH/build_curl" ]; then
pushd $CURL_SCRIPT_PATH
echo Building curl ...
chmod a+x build_curl
./build_curl --sdk-version ${SDK} --libcurl-version 7.38.0 --log info
status=$?
if [ $status != 0 ]; then
echo $status
echo "Curl build failed!"
exit 1
else
if [ ! -f "curl/curl" ]; then
ln -s ios-appstore/include curl/curl
ln -s ios-appstore/lib curl/lib
fi
echo "Curl build succeeded!"
fi
popd
else
echo ERROR. Curl build failed. No such a file or directory.
fi
}
buildboost() {
#Runs boost build script
if [ -f "$BOOST_SCRIPT_PATH/boost.sh" ]; then
pushd $BOOST_SCRIPT_PATH
echo Building boost ...
chmod a+x boost.sh
sh boost.sh
status=$?
if [ $status != 0 ]; then
echo $status
echo "Boost build failed!"
exit 1
else
echo "Boost build succeeded!"
fi
popd
else
echo ERROR. Boost build failed. No such a file or directory.
fi
}
customertemplates() {
#Checks if common settings file already exists in the destination folder. If doesn't exist, copies the template cource in the destiantion folder, renames it and update name of the imported header.
if [ ! -f "$DESTINATION_PATH/$CUSTOMER_SPECIFIC" ]; then
if [ -d $TEMPLATES_PATH ]; then
if [ -f "$TEMPLATES_PATH/$CUSTOMER_SPECIFIC_TEMPLATE" ]; then
cp -r "$TEMPLATES_PATH/$CUSTOMER_SPECIFIC_TEMPLATE" "$DESTINATION_PATH/$CUSTOMER_SPECIFIC"
echo Created $CUSTOMER_SPECIFIC
else
echo "Error. Template $CUSTOMER_SPECIFIC_TEMPLATE doesnt exist!"
fi
else
echo Error. Invalid template directory!
fi
else
echo Using existing $CUSTOMER_SPECIFIC...
fi
#Checks if releas settings file already exists in the destination folder. If doesn't exist, copies the template cource in the destiantion folder, renames it and update name of the imported header.
if [ ! -f "$DESTINATION_PATH/$CUSTOMER_SPECIFIC_RELEASE" ]; then
if [ -d $TEMPLATES_PATH ]; then
if [ -f "$TEMPLATES_PATH/$CUSTOMER_SPECIFIC_RELEASE_TEMPLATE" ]; then
cp -r "$TEMPLATES_PATH/$CUSTOMER_SPECIFIC_RELEASE_TEMPLATE" "$DESTINATION_PATH/$CUSTOMER_SPECIFIC_RELEASE"
echo Created $CUSTOMER_SPECIFIC_RELEASE
else
echo "Error. Template $CUSTOMER_SPECIFIC_RELEASE_TEMPLATE doesnt exist!"
fi
else
echo Error. Invalid template directory!
fi
else
echo Using existing $CUSTOMER_SPECIFIC_RELEASE...
fi
}
sdkpath iPhoneOS
buildcurl
buildboost
customertemplates