# Maintainer: João Vitor S. Anjos # Contributor: Dmitri Goutnik pkgname=trdsql pkgver=0.10.0 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='12813ab5353c98c99088756bafbfe8386a017c54' 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: