diff --git a/trdsql/PKGBUILD b/trdsql/PKGBUILD new file mode 100644 index 0000000..c9b6926 --- /dev/null +++ b/trdsql/PKGBUILD @@ -0,0 +1,75 @@ +# Maintainer: João Vitor S. Anjos +# Contributor: Dmitri Goutnik + +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: