-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild-ios.sh
executable file
·69 lines (58 loc) · 1.73 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
58
59
60
61
62
63
64
65
66
67
68
69
#!/bin/bash
set -e
set -x
SCRIPTPATH="$(
cd "$(dirname "$0")"
pwd -P
)"
cd $SCRIPTPATH
INSTALLPATH="${SCRIPTPATH}"
if [[ ! -z "${PODS_ROOT}" ]]; then
INSTALLPATH="${PODS_ROOT}/EJDB2"
fi
OWNSRC=""
if [[ -z "${EJDB_ROOT}" ]]; then
OWNSRC="yes"
EJDB_ROOT=`mktemp -d`
echo "Source root: ${EJDB_ROOT}"
echo "Checkout https://github.com/Softmotions/ejdb"
git clone "https://github.com/Softmotions/ejdb" "${EJDB_ROOT}"
(cd "${EJDB_ROOT}" && git submodule update --init)
else
echo "Source root: ${EJDB_ROOT}"
fi
LIBDIR="${INSTALLPATH}/lib"
INCDIR="${INSTALLPATH}/include"
PLATFORMS="SIMULATOR64 OS64"
BUILD_ROOT="${EJDB_ROOT}/build-xcode"
INSTALL_ROOT="${EJDB_ROOT}/install-xcode"
for PLATFORM in ${PLATFORMS}; do
rm -rf "${BUILD_ROOT}"
mkdir -p "${BUILD_ROOT}"
INSTALL_PREFIX="${INSTALL_ROOT}/${PLATFORM}"
rm -rf "${INSTALL_PREFIX}"
cd "${BUILD_ROOT}"
cmake .. \
-G "Unix Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \
-DENABLE_HTTP=OFF \
-DCMAKE_TOOLCHAIN_FILE="${EJDB_ROOT}/ios-tc.cmake" \
-DPLATFORM="${PLATFORM}" \
-DCMAKE_INSTALL_PREFIX="${INSTALL_PREFIX}"
cmake --build . --target install;
done
rm -rf "${LIBDIR}"
rm -rf "${INCDIR}"
mkdir -p "${INCDIR}"
mkdir -p "${LIBDIR}/IOS"
lipo -create "${INSTALL_ROOT}/SIMULATOR64/lib/libejdb2-2.a" \
"${INSTALL_ROOT}/OS64/lib/libejdb2-2.a" \
-o "${LIBDIR}/IOS/libejdb2-2.a"
lipo -create "${INSTALL_ROOT}/SIMULATOR64/lib/libiowow-1.a" \
"${INSTALL_ROOT}/OS64/lib/libiowow-1.a" \
-o "${LIBDIR}/IOS/libiowow-1.a"
cp -R "${INSTALL_ROOT}/OS64/include" "${INSTALLPATH}"
rm -rf "${BUILD_ROOT}"
rm -rf "${INSTALL_ROOT}"
test -z "${OWNSRC}" || rm -rf "${EJDB_ROOT}"