This repository has been archived by the owner on Dec 20, 2018. It is now read-only.
/
compile.sh
executable file
·71 lines (55 loc) · 1.68 KB
/
compile.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
#!/usr/bin/env bash
RED='\033[0;31m'
CYAN='\033[0;36m'
GREEN='\033[0;32m'
NC='\033[0m'
log() {
printf "${CYAN}info : $@ ${NC}\n"
}
set -e
_clean() {
log "Clean $(pwd)/artifacts/"
rm -rf artifacts
mkdir -p artifacts
}
_compile() {
sqliteVersion="$(cat .sqlite-version)"
log "Compiling sqlite v$sqliteVersion"
sqliteSrc="https://sqlite.org/2016/sqlite-autoconf-${sqliteVersion}.tar.gz"
log "Clean obj/build/"
rm -rf obj/build/
mkdir -p obj/build/
curl -sSL $sqliteSrc | tar zvx -C obj/build/
if [[ "$(uname)" == "Darwin" ]]; then
rid="osx-x64"
else
rid="linux-x64"
fi
artifactsDir="$(pwd)/artifacts/$rid"
mkdir -p $artifactsDir
srcDir="obj/build/sqlite-autoconf-${sqliteVersion}"
log "cwd = $srcDir"
pushd $srcDir
export CPPFLAGS="$CPPFLAGS -DSQLITE_ENABLE_COLUMN_METADATA=1 -DSQLITE_ENABLE_JSON1 -DSQLITE_ENABLE_FTS4"
if [[ "$(uname)" == "Darwin" ]]; then
export CPPFLAGS="$CPPFLAGS -DSQLITE_ENABLE_FTS5"
fi
./configure --prefix=$(pwd) --disable-dependency-tracking --enable-dynamic-extensions
make install
if [[ "$(uname)" == "Darwin" ]]; then
dest="$artifactsDir/libsqlite3.dylib"
log "Copy libsqlite3.0.dylib to $dest"
cp lib/libsqlite3.0.dylib $dest
else
dest="$artifactsDir/libsqlite3.so"
log "Copy libsqlite3.so.0.8.6 to $dest"
cp lib/libsqlite3.so.0.8.6 $dest
fi
popd
zip -j artifacts/$rid.zip $artifactsDir/libsqlite3*
}
# main
log "Build target = $buildTarget"
_clean
_compile
printf "${GREEN}Done${NC}\n"