This repository has been archived by the owner on Oct 26, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 32
/
build_sqlcipher
executable file
·31 lines (24 loc) · 3.08 KB
/
build_sqlcipher
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
#!/bin/bash
# Make temp directory
export TEMPDIR=/tmp/sqlcipher
rm -rf $TEMPDIR && mkdir $TEMPDIR
# Clone the sqlcipher repo
cd $TEMPDIR && git clone https://github.com/sqlcipher/sqlcipher.git && cd $TEMPDIR/sqlcipher && git checkout v3.4.1
# Build macOS version
./configure --enable-tempstore=yes --with-crypto-lib=commoncrypto CFLAGS="-fembed-bitcode -mmacosx-version-min=10.11 -arch x86_64 -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_API_ARMOR=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_LOCKING_STYLE=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_OMIT_AUTORESET=1 -DSQLITE_OMIT_BUILTIN_TEST=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_SYSTEM_MALLOC=1 -DSQLITE_THREADSAFE=2" LDFLAGS="-framework Security -framework CoreFoundation" && make ; mv ./.libs/libsqlcipher.a $TEMPDIR/libsqlcipher-mac.a && make clean
# Build iOS device version
./configure --enable-tempstore=yes --with-crypto-lib=commoncrypto --host=arm-apple-darwin --enable-shared=no CFLAGS="-arch armv7 -arch arm64 -fembed-bitcode -isysroot /Applications/XCode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -mios-version-min=10.0 -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_API_ARMOR=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_LOCKING_STYLE=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_OMIT_AUTORESET=1 -DSQLITE_OMIT_BUILTIN_TEST=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_SYSTEM_MALLOC=1 -DSQLITE_THREADSAFE=2" LDFLAGS="-framework Security -framework CoreFoundation" && make ; mv ./.libs/libsqlcipher.a $TEMPDIR/libsqlcipher-ios.a && make clean
# Build iOS simulator version
./configure --enable-tempstore=yes --with-crypto-lib=commoncrypto --host=arm-apple-darwin --enable-shared=no CFLAGS="-arch i386 -arch x86_64 -fembed-bitcode -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -mios-version-min=10.3 -DSQLITE_HAS_CODEC -DSQLITE_TEMP_STORE=2 -DSQLITE_SOUNDEX=1 -DSQLITE_ENABLE_API_ARMOR=1 -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1 -DSQLITE_ENABLE_LOCKING_STYLE=1 -DSQLITE_ENABLE_RTREE=1 -DSQLITE_ENABLE_UPDATE_DELETE_LIMIT=1 -DSQLITE_OMIT_AUTORESET=1 -DSQLITE_OMIT_BUILTIN_TEST=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_SYSTEM_MALLOC=1 -DSQLITE_THREADSAFE=2" LDFLAGS="-framework Security -framework CoreFoundation" && make ; mv ./.libs/libsqlcipher.a $TEMPDIR/libsqlcipher-iossim.a && make clean
# Combine them into a fat binary
lipo -create $TEMPDIR/libsqlcipher-ios.a $TEMPDIR/libsqlcipher-iossim.a -output ~/Desktop/libsqlcipher-ios.a
cp $TEMPDIR/libsqlcipher-mac.a ~/Desktop/libsqlcipher-mac.a
# Done!
echo " "
echo " "
echo "-----------------------------------"
echo " "
lipo -info ~/Desktop/libsqlcipher-ios.a
lipo -info ~/Desktop/libsqlcipher-mac.a
echo " "
echo "The binaries for iOS (device and simulator) and macOS have been built and placed on your Desktop. Move them to the Balance repository in ./Balance/iOS/Frameworks and ./Balance/macOS/Frameworks respectively."