forked from firebase/FirebaseUI-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_database.sh
executable file
·88 lines (74 loc) · 3.01 KB
/
build_database.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
# Copyright 2016 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/bin/bash
set -e # Exit sub shell if anything errors
DIR="$(cd "$(dirname "$0")"; pwd)"
OUTPUT_DIR="${DIR}/target"
XCODE_PROJECT="${DIR}/FirebaseUI.xcodeproj"
XCODEBUILD=xcodebuild
echo "===> Cleaning target directory"
rm -rf $OUTPUT_DIR
echo "===> Building Database lib"
${XCODEBUILD} \
-project ${XCODE_PROJECT} \
-target Database \
-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" \
GCC_PREPROCESSOR_DEFINITIONS='${inherited}' \
build
echo "===> Building database simulator lib"
${XCODEBUILD} \
-project ${XCODE_PROJECT} \
-target Database \
-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" \
GCC_PREPROCESSOR_DEFINITIONS='${inherited}'\
build
echo "===> Using simulator binary as base project for headers and directory structure"
mkdir -p ${OUTPUT_DIR}/Products/Release-combined/FirebaseDatabaseUI.framework/{Headers,Modules}
echo -n "===> Combining all binaries into one ..."
lipo \
-create \
${OUTPUT_DIR}/Products/Release-iphoneos/libDatabase.a \
${OUTPUT_DIR}/Products/Release-iphonesimulator/libDatabase.a \
-output ${OUTPUT_DIR}/Products/Release-combined/FirebaseDatabaseUI.framework/FirebaseDatabaseUI
echo " done."
echo "===> Copying header files"
cp ${DIR}/FirebaseUI/Database/API/*.h ${OUTPUT_DIR}/Products/Release-combined/FirebaseDatabaseUI.framework/Headers
echo "===> Copying modulemap"
cp ${DIR}/FirebaseUI/Database/API/module.modulemap ${OUTPUT_DIR}/Products/Release-combined/FirebaseDatabaseUI.framework/Modules
echo "===> Copying LICENSE"
cp ${DIR}/LICENSE ${OUTPUT_DIR}/Products/Release-combined/FirebaseDatabaseUI.framework
echo -n "===> Checking how the final binary looks ..."
EXPECTEDCOUNT=6
ARCHCOUNT=$(file ${OUTPUT_DIR}/Products/Release-combined/FirebaseDatabaseUI.framework/FirebaseDatabaseUI | wc -l)
if [[ $ARCHCOUNT -ne $EXPECTEDCOUNT ]]; then
echo " bad."
file ${OUTPUT_DIR}/Products/Release-combined/FirebaseDatabaseUI.framework/FirebaseDatabaseUI
echo "===> The architecture count ($ARCHCOUNT) looks wrong. It should be $EXPECTEDCOUNT.";
exit 1
else
echo " good."
fi