-
Notifications
You must be signed in to change notification settings - Fork 0
/
most.sh
executable file
·67 lines (59 loc) · 1.31 KB
/
most.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
#!/bin/bash
# most.sh builds a development version of usql with "most" drivers.
#
# Options:
# -i go install instead of go build
# -m disable sqlite3 driver (no_sqlite3) and diasble CGO.
# causes moderncsqlite to register aliases for sqlite3.
# -v add -v to go build/install
# -x add -x to go build/install
# -t <TAG> add build tag
#
# Usage: ./most.sh -i -t godror -v
NAME=usql
VER="$(date +%y.%m.%d)-dev"
PLATFORM=$(uname|sed -e 's/_.*//'|tr '[:upper:]' '[:lower:]'|sed -e 's/^\(msys\|mingw\).*/windows/')
CGO_ENABLED=1
BUILDVERB=build
TAGS=()
SQLITE_TAGS=(
sqlite_app_armor
sqlite_fts5
sqlite_introspect
sqlite_json1
sqlite_stat4
sqlite_userauth
sqlite_vtable
)
EXTRA=()
case $PLATFORM in
darwin|linux)
TAGS+=(no_adodb)
SQLITE_TAGS+=(sqlite_icu)
;;
esac
OPTIND=1
while getopts "imvxt:" opt; do
case "$opt" in
i) BUILDVERB=install ;;
m) CGO_ENABLED=0 SQLITE_TAGS=(no_sqlite3) ;;
v) EXTRA+=(-v) ;;
x) EXTRA+=(-x) ;;
t) TAGS+=($OPTARG) ;;
esac
done
TAGS="most ${SQLITE_TAGS[@]} ${TAGS[@]}"
LDFLAGS=(
-s
-w
-X github.com/xo/usql/text.CommandName=$NAME
-X github.com/xo/usql/text.CommandVersion=$VER
)
LDFLAGS="${LDFLAGS[@]}"
(set -x;
CGO_ENABLED=$CGO_ENABLED \
go $BUILDVERB \
-tags="$TAGS" \
-ldflags="$LDFLAGS" \
${EXTRA[@]}
)