forked from firebase/geofire-objc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·70 lines (61 loc) · 2.05 KB
/
build.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
#!/bin/bash
set -e # Exit sub shell if anything erro
DIR="$(cd "$(dirname "$0")"; pwd)"
OUTPUT_DIR="${DIR}/target/"
XCODE_PROJECT="${DIR}/GeoFire.xcodeproj"
XCODEBUILD=xcodebuild
echo "===> Cleaning target directory"
rm -rf $OUTPUT_DIR
echo "===> Building iOS binary"
${XCODEBUILD} \
-project ${XCODE_PROJECT} \
-target GeoFire \
-configuration Release \
-sdk iphoneos \
BUILD_DIR=${OUTPUT_DIR}/Products \
OBJROOT=${OUTPUT_DIR}/Intermediates \
BUILD_ROOT=${OUTPUT_DIR} \
SYMROOT=${OUTPUT_DIR} \
IPHONEOS_DEPLOYMENT_TARGET=7.0 \
ONLY_ACTIVE_ARCH=NO \
ARCHS="armv7 armv7s arm64" \
build
echo "===> Building simulator binary"
${XCODEBUILD} \
-project ${XCODE_PROJECT} \
-target GeoFire \
-configuration Release \
-sdk iphonesimulator \
BUILD_DIR=${OUTPUT_DIR}/Products \
OBJROOT=${OUTPUT_DIR}/Intermediates \
BUILD_ROOT=${OUTPUT_DIR} \
SYMROOT=${OUTPUT_DIR} \
IPHONEOS_DEPLOYMENT_TARGET=7.0 \
ONLY_ACTIVE_ARCH=NO \
ARCHS="i386 x86_64" \
build
echo "===> Using simulator binary as base project for headers and directory structure"
cp -a ${OUTPUT_DIR}/Products/Release-iphonesimulator ${OUTPUT_DIR}/Products/Release-combined
echo -n "===> Combining all binaries into one ..."
lipo \
-create \
${OUTPUT_DIR}/Products/Release-iphoneos/libGeoFire.a \
${OUTPUT_DIR}/Products/Release-iphonesimulator/libGeoFire.a \
-output ${OUTPUT_DIR}/Products/Release-combined/GeoFire.framework/Versions/A/GeoFire
echo " done."
echo -n "===> Checking how the final binary looks ..."
EXPECTEDCOUNT=6
ARCHCOUNT=$(file ${OUTPUT_DIR}/Products/Release-combined/GeoFire.framework/Versions/A/GeoFire | wc -l)
if [[ $ARCHCOUNT -ne $EXPECTEDCOUNT ]]; then
echo " bad."
file ${OUTPUT_DIR}/Products/Release-combined/GeoFire.framework/Versions/A/GeoFire
echo "===> The architecture count ($ARCHCOUNT) looks wrong. It should be $EXPECTEDCOUNT.";
exit 1
else
echo " good."
fi
echo "===> Creating zip of final framework"
pushd ${OUTPUT_DIR}/Products/Release-combined
zip -ry ../../GeoFire.framework.zip GeoFire.framework
popd
ls -l target/GeoFire.framework.zip