upgpkg: wordpress 6.2.1-1
[ArchLinux/community.git] / sqlc / trunk / PKGBUILD
bloba60febba04584740ca015616065176b7aa755eff
1 # Maintainer: George Rawlinson <grawlinson@archlinux.org>
2 # Contributor: Alkindi42
4 pkgname=sqlc
5 pkgver=1.18.0
6 pkgrel=1
7 pkgdesc='Compile SQL to type-safe Go'
8 arch=('x86_64')
9 url='https://sqlc.dev'
10 license=('MIT')
11 depends=('glibc' 'gcc-libs')
12 makedepends=('git' 'go')
13 options=('!lto')
14 _commit='e4b1c1873690a5b1006436024f0e6c25166bed76'
15 source=("$pkgname::git+https://github.com/kyleconroy/sqlc.git#commit=$_commit")
16 b2sums=('SKIP')
18 pkgver() {
19   cd "$pkgname"
21   git describe --tags | sed 's/^v//'
24 prepare() {
25   cd "$pkgname"
27   # create folder for build output
28   mkdir -p build
30   # download dependencies
31   export GOPATH="${srcdir}"
32   go mod download
35 build() {
36   cd "$pkgname"
38   # set Go flags
39   export CGO_CPPFLAGS="${CPPFLAGS}"
40   export CGO_CFLAGS="${CFLAGS}"
41   export CGO_CXXFLAGS="${CXXFLAGS}"
42   export GOPATH="${srcdir}"
44   # build binary
45   go build -v \
46     -buildmode=pie \
47     -mod=readonly \
48     -modcacherw \
49     -ldflags "-compressdwarf=false \
50     -linkmode external \
51     -extldflags ${LDFLAGS}" \
52     -o build \
53     ./cmd/...
55   # generate shell completions
56   for sh in bash fish zsh; do
57     ./build/sqlc completion "$sh" > "build/$sh"
58   done
61 check() {
62   cd "$pkgname"
64   # skip internal/endtoend
65   rm -f internal/endtoend/endtoend_test.go
67   go test -v ./...
70 package() {
71   cd "$pkgname"
73   # binary
74   install -vDm755 -t "$pkgdir/usr/bin" build/sqlc
76   # license
77   install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE
79   # shell completions
80   install -vDm644 build/bash "$pkgdir/usr/share/bash-completion/completions/sqlc"
81   install -vDm644 build/fish "$pkgdir/usr/share/fish/vendor_completions.d/sqlc.fish"
82   install -vDm644 build/zsh "$pkgdir/usr/share/zsh/site-functions/_sqlc"