[arch-commits] Commit in (sqlc sqlc/repos sqlc/trunk sqlc/trunk/PKGBUILD)

George Rawlinson grawlinson at gemini.archlinux.org
Thu Nov 25 01:05:57 UTC 2021


    Date: Thursday, November 25, 2021 @ 01:05:57
  Author: grawlinson
Revision: 1054748

addpkg: sqlc 1.11.0-1

Added:
  sqlc/
  sqlc/repos/
  sqlc/trunk/
  sqlc/trunk/PKGBUILD

----------+
 PKGBUILD |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

Added: sqlc/trunk/PKGBUILD
===================================================================
--- sqlc/trunk/PKGBUILD	                        (rev 0)
+++ sqlc/trunk/PKGBUILD	2021-11-25 01:05:57 UTC (rev 1054748)
@@ -0,0 +1,68 @@
+# Maintainer: George Rawlinson <grawlinson at archlinux.org>
+# Contributor: Alkindi42
+
+pkgname=sqlc
+pkgver=1.11.0
+pkgrel=1
+pkgdesc="Compile SQL to type-safe Go"
+arch=('x86_64')
+url="https://sqlc.dev"
+license=('MIT')
+depends=('glibc')
+makedepends=('go' 'git')
+source=("$pkgname-$pkgver.tar.gz::https://github.com/kyleconroy/sqlc/archive/v$pkgver.tar.gz")
+sha512sums=('1ae7476b456675613277efbc22ce0215bd3933f32f112501e737a8cba559a7c8058f8cd9cde47c08bab99b896fcc49908a2a9648c12660de72ee3269eb975164')
+b2sums=('02a094731b55608824d31df3533b8b4c287407650d1c2d90eb6df848d50389d0c520970b31d9181e0955b0e398f64350fcb9fbd415d4f117d61bf64c92bd171d')
+
+prepare() {
+  cd "$pkgname-$pkgver"
+
+  # create folder for build output
+  mkdir -p build
+
+  # download dependencies
+  go mod download
+}
+build() {
+  cd "$pkgname-$pkgver"
+
+  # set Go flags
+  export CGO_CPPFLAGS="${CPPFLAGS}"
+  export CGO_CFLAGS="${CFLAGS}"
+  export CGO_CXXFLAGS="${CXXFLAGS}"
+
+  # build binary
+  go build -v \
+    -trimpath \
+    -buildmode=pie \
+    -mod=readonly \
+    -modcacherw \
+    -ldflags "-linkmode external -extldflags ${LDFLAGS}" \
+    -o build \
+    ./cmd/...
+
+  # generate shell completions
+  for sh in bash fish zsh; do
+    ./build/sqlc completion "$sh" > "build/$sh"
+  done
+}
+
+check() {
+  cd "$pkgname-$pkgver"
+  go test -v ./...
+}
+
+package() {
+  cd "$pkgname-$pkgver"
+
+  # binary
+  install -vDm755 -t "$pkgdir/usr/bin" build/sqlc
+
+  # license
+  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
+
+  # shell completions
+  install -vDm644 build/bash "$pkgdir/usr/share/bash-completion/completions/sqlc"
+  install -vDm644 build/fish "$pkgdir/usr/share/fish/vendor_completions.d/sqlc.fish"
+  install -vDm644 build/zsh "$pkgdir/usr/share/zsh/site-functions/_sqlc"
+}



More information about the arch-commits mailing list