summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 76d5ddc435013b57299db766276104348f9e77ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Contributor: matthias.lisin
# Maintainer: zxp19821005 <zxp19821005 at 163 dot com>
_pkgname=mockery
pkgname="golang-${_pkgname}"
pkgver=2.33.0
pkgrel=1
pkgdesc='A mock code autogenerator for golang'
arch=('any')
url='https://github.com/vektra/mockery'
license=("BSD")
provides=("${_pkgname}=${pkgver}")
conflicts=("${_pkgname}")
depends=('glibc')
makedepends=('go')
source=("${_pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('ae74014ab6225f36149b7b27f982c4e30d7724a4a1ddcff5c8aab38eaf9a4fa7')
build() {
    cd "${_pkgname}"-"${pkgver}"
    export CGO_ENABLED=1
    export CGO_LDFLAGS="$LDFLAGS"
    export CGO_CFLAGS="$CFLAGS"
    export CGO_CPPFLAGS="$CPPFLAGS"
    export CGO_CXXFLAGS="$CXXFLAGS"
    export GOFLAGS='-buildmode=pie -modcacherw -trimpath'
    # For Chinese Only
    #export GO111MODULE=on
    #export GOPROXY=https://goproxy.cn
    go build -o "${_pkgname}" -ldflags "-linkmode=external -X github.com/vektra/mockery/v2/pkg/config.SemVer=v${pkgver}" main.go

    for _shell in bash zsh fish; do
        # --config=/dev/null to avoid reading .mockery.yaml
        ./mockery --config=/dev/null completion "${_shell}" >completion."${_shell}"
    done
}
package() {
    cd "${srcdir}/${_pkgname}-${pkgver}"
    install -Dm755 "${_pkgname}" -t "${pkgdir}/usr/bin"
    install -Dm644 "LICENSE" -t "${pkgdir}/usr/share/licenses/${pkgname}"
    install -Dm644 "completion.bash" "${pkgdir}/usr/share/bash-completion/completions/${_pkgname}"
    install -Dm644 "completion.zsh" "${pkgdir}/usr/share/zsh/site-functions/_${_pkgname}"
    install -Dm644 "completion.fish" "${pkgdir}/usr/share/fish/vendor_completions.d/${_pkgname}.fish"
}