addpkg: trdsql 0.9.1-1

This commit is contained in:
George Rawlinson 2022-01-13 07:42:11 +00:00
parent 14084c1d48
commit 4081dae1be
Signed by: grawlinson
GPG key ID: E0959FEA8B550539

75
trdsql/PKGBUILD Normal file
View file

@ -0,0 +1,75 @@
# Maintainer: João Vitor S. Anjos <jvanjos at protonmail dot com>
# Contributor: Dmitri Goutnik <dg@syrec.org>
pkgname=trdsql
pkgver=0.9.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='34be5949b4deffbc3f1b07a9efa9da9a40b7f2bd'
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: