arch-pkgs/trdsql/PKGBUILD

76 lines
1.6 KiB
Text
Raw Permalink Normal View History

2022-01-13 07:42:11 +00:00
# Maintainer: João Vitor S. Anjos <jvanjos at protonmail dot com>
# Contributor: Dmitri Goutnik <dg@syrec.org>
pkgname=trdsql
2022-10-30 02:13:35 +00:00
pkgver=0.10.1
2022-01-13 07:42:11 +00:00
pkgrel=1
2022-10-30 02:13:35 +00:00
pkgdesc='Tool that can execute SQL queries on CSV, LTSV and JSON'
2022-01-13 07:42:11 +00:00
arch=('x86_64')
2022-10-30 02:13:35 +00:00
url='https://github.com/noborus/trdsql'
2022-01-13 07:42:11 +00:00
license=('MIT')
depends=('glibc')
makedepends=('git' 'go')
options=('!lto')
2022-10-30 02:13:35 +00:00
_commit='3f6ecac8bfe2897c00006b2d45599267987286f4'
2022-01-13 07:42:11 +00:00
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: