makedeb


buf-git 1.746.c8b6c166-1


A new way of working with Protocol Buffers

Viewing /PKGBUILD.

View raw.

Click here to go back to the Git tree for buf-git.

# Maintainer: hiddeninthesand <hiddeninthesand at pm dot me>

# AUR Maintainer: Buf <bot@buf.build>
# AUR Contributor: Alexander Menzhinsky <amenzhinsky@gmail.com>
pkgname="buf-git"
_gitname="buf"
pkgver=1.746.c8b6c166
pkgrel=1
pkgdesc="A new way of working with Protocol Buffers"
arch=("any")
url="https://buf.build"
license=('Apache')
makedepends=('golang-go')
sha256sums=('SKIP')
source=("git+https://github.com/bufbuild/buf.git")
conflicts=("${_gitname}" "${_gitname}-bin")

pkgver() {
  cd "${_gitname}"

  printf "1.%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" | sed 's|^v||'
}

build() {
	cd ${_gitname}
	go build -trimpath -buildmode=pie -mod=readonly -modcacherw -o . ./cmd/{buf,protoc-gen-buf-lint,protoc-gen-buf-breaking}
	./buf completion bash >completion.bash
	./buf completion zsh >completion.zsh
	./buf completion fish >completion.fish
	mkdir -p manpages
	./buf manpages manpages
}

package() {
    cd ${_gitname}
	install -Dm755 "${_gitname}" "${pkgdir}/usr/bin/buf"
	install -Dm755 "protoc-gen-buf-lint" "${pkgdir}/usr/bin/protoc-gen-buf-lint"
	install -Dm755 "protoc-gen-buf-breaking" "${pkgdir}/usr/bin/protoc-gen-buf-breaking"
	install -Dm644 "completion.bash" "${pkgdir}/etc/bash_completion.d/buf"
	install -Dm644 "completion.zsh" "${pkgdir}/usr/share/zsh/site-functions/_buf"
	install -Dm644 "completion.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/buf.fish"
	install -Dm644 "manpages/${_gitname}"* -t "${pkgdir}/usr/share/man/man1/"
}