-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.sh
executable file
·44 lines (34 loc) · 1.26 KB
/
build.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
#!/bin/bash
# build into ./release/
set -e
set -v
go test -race -cover ./...
rm -rf release
mkdir -p release
VERSION=$(git describe --tags $(git rev-list --tags --max-count=1))
xgo --targets windows/amd64 --dest release --out SQLiteQueryServer-"${VERSION}" --ldflags "-s -w" .
xgo --targets linux/amd64 --dest release --out SQLiteQueryServer-"${VERSION}" --tags linux --ldflags "-s -w -extldflags -static" .
xgo --targets darwin/amd64 --dest release --out SQLiteQueryServer-"${VERSION}" --tags darwin --ldflags "-s -w" .
(
# zip
cd release
find -type f |
parallel --bar 'zip "$(echo "{}" | sed "s/.exe//").zip" "{}" && rm -f "{}"'
# deb
mkdir -p ./deb/bin
unzip -o -d ./deb/bin *-linux-amd64.zip
mv -f ./deb/bin/*-linux-amd64 ./deb/bin/SQLiteQueryServer
mkdir -p ./deb/DEBIAN
cat > ./deb/DEBIAN/control <<EOF
Package: SQLiteQueryServer
Version: $(echo "${VERSION}" | tr -d v)
Priority: optional
Architecture: amd64
Maintainer: Assaf Morami <[email protected]>
Homepage: https://github.com/assafmo/SQLiteQueryServer
Installed-Size: $(ls -l --block-size=KB ./deb/bin/SQLiteQueryServer | awk '{print $5}' | tr -d 'kB')
Description: Bulk query SQLite database over the network.
EOF
dpkg-deb --build ./deb/ .
rm -rf ./deb/
)