75 lines
1.6 KiB
Bash
75 lines
1.6 KiB
Bash
# Maintainer: João Vitor S. Anjos <jvanjos at protonmail dot com>
|
|
# Contributor: Dmitri Goutnik <dg@syrec.org>
|
|
|
|
pkgname=trdsql
|
|
pkgver=0.10.1
|
|
pkgrel=1
|
|
pkgdesc='Tool that can execute SQL queries on CSV, LTSV and JSON'
|
|
arch=('x86_64')
|
|
url='https://github.com/noborus/trdsql'
|
|
license=('MIT')
|
|
depends=('glibc')
|
|
makedepends=('git' 'go')
|
|
options=('!lto')
|
|
_commit='3f6ecac8bfe2897c00006b2d45599267987286f4'
|
|
source=("$pkgname::git+$url.git#commit=$_commit")
|
|
sha512sums=('SKIP')
|
|
|
|
pkgver() {
|
|
cd "$pkgname"
|
|
git describe --tags | sed "s/^v//"
|
|
}
|
|
|
|
prepare() {
|
|
cd "$pkgname"
|
|
|
|
# create directory for build output
|
|
mkdir build
|
|
|
|
# download dependencies
|
|
go mod download
|
|
}
|
|
|
|
build() {
|
|
cd "$pkgname"
|
|
|
|
# set Go flags
|
|
export CGO_CPPFLAGS="${CPPFLAGS}"
|
|
export CGO_CFLAGS="${CFLAGS}"
|
|
export CGO_CXXFLAGS="${CXXFLAGS}"
|
|
|
|
# binary
|
|
go build -v \
|
|
-trimpath \
|
|
-buildmode=pie \
|
|
-mod=readonly \
|
|
-modcacherw \
|
|
-ldflags "-linkmode external -extldflags ${LDFLAGS} \
|
|
-X github.com/noborus/trdsql.Version=$pkgver" \
|
|
-tags "sqlite_json" \
|
|
-o build \
|
|
./cmd/...
|
|
}
|
|
|
|
check() {
|
|
cd "$pkgname"
|
|
go test -v -tags "sqlite_json" ./...
|
|
}
|
|
|
|
package() {
|
|
cd "$pkgname"
|
|
|
|
install -vDm755 -t "$pkgdir/usr/bin" build/trdsql
|
|
|
|
# documentation
|
|
install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
|
|
cp -vr _example "$pkgdir/usr/share/doc/$pkgname"
|
|
|
|
# shell completion
|
|
install -Dm 644 completion/trdsql-completion.zsh "$pkgdir/usr/share/zsh/site-functions/_$pkgname"
|
|
|
|
# license
|
|
install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
|
|
}
|
|
|
|
# vim: ts=2 sw=2 et:
|