# Maintainer: Kemel Zaidan # Maintainer: Deposite Pirate _pkgname='gtrash' pkgname='gtrash-git' pkgver=v0.0.6.r4.ga741836 pkgrel=1 pkgdesc='A Trash CLI manager written in Go' url='https://github.com/umlx5h/gtrash' arch=('aarch64' 'i686' 'x86_64') license=('MIT') conflicts=('gtrash-bin' 'gtrash') provides=('gtrash') depends=('glibc') makedepends=('go') options=("strip" "buildflags") source=("${_pkgname}::git+${url}") sha256sums=('SKIP') pkgver() { cd "${_pkgname}" ( set -o pipefail git describe --long --tags 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' || printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)" ) } prepare(){ cd "${_pkgname}" mkdir -p build } build() { cd "${_pkgname}" export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" export CGO_ENABLED="2" export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" go build -o "build/${_pkgname}" } check() { cd "${_pkgname}" go test } package() { cd "${_pkgname}" install -Dm755 "build/gtrash" "${pkgdir}/usr/bin/gtrash" install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE" install -Dm644 doc/configuration.md "${pkgdir}/usr/share/doc/configuration.md" mkdir -p "${pkgdir}/usr/share/bash-completion/completions/" mkdir -p "${pkgdir}/usr/share/zsh/site-functions/" mkdir -p "${pkgdir}/usr/share/fish/vendor_completions.d/" cd build ./gtrash completion bash | install -Dm644 /dev/stdin "${pkgdir}/usr/share/bash-completion/completions/gtrash" ./gtrash completion zsh | install -Dm644 /dev/stdin "${pkgdir}/usr/share/zsh/site-functions/_gtrash" ./gtrash completion fish | install -Dm644 /dev/stdin "${pkgdir}/usr/share/fish/vendor_completions.d/gtrash.fish" }