summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: f386b47997ed997561e403f7210b7b18ef59d808 (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
43
44
45
46
# Maintainer: devome <evinedeng@hotmail.com>

pkgname="webhookd"
pkgver=1.19.0
pkgrel=1
pkgdesc="A very simple webhook server launching scripts."
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')
url="https://github.com/ncarlier/${pkgname}"
license=("MIT")
makedepends=("git" "go")
backup=("etc/default/${pkgname}")
source=("${pkgname}::git+${url}.git#tag=v${pkgver}"
        "${pkgname}.service"
        "${pkgname}.user.service")
sha256sums=('SKIP'
            'b24d5dfc84bf7b1cceea963b96de3085b6ed079c8f99c56225d8125c791d3543'
            '714e9e219b51af192208500b6936f748ad86a5ec79d5e5683cab1e81fbeae09c')

build() {
    cd "${pkgname}"

    local git_commit=$(git rev-list -1 HEAD --abbrev-commit)
    local build_time="$(date -u +'%Y-%m-%dT%H:%M:%SZ')"
    local ldflags=" \
        -s -w \
        -X github.com/ncarlier/${pkgname}/pkg/version.Version=v${pkgver} \
        -X github.com/ncarlier/${pkgname}/pkg/version.GitCommit=${git_commit} \
        -X github.com/ncarlier/${pkgname}/pkg/version.Built=${build_time} \
        -buildid= \
        -extldflags '${LDFLAGS}'
    "
    go build \
        -tags osusergo,netgo \
        -trimpath \
        -ldflags="$ldflags" \
        -o "${pkgname}"
}

package() {
    install -Dm755 "${pkgname}/${pkgname}"                 "${pkgdir}/usr/bin/${pkgname}"
    install -Dm644 "${pkgname}/LICENSE"                    "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -Dm644 "${pkgname}.service"                    "${pkgdir}/usr/lib/systemd/system/${pkgname}.service"
    install -Dm644 "${pkgname}.user.service"               "${pkgdir}/usr/lib/systemd/user/${pkgname}.service"
    install -Dm644 "${pkgname}/etc/default/${pkgname}.env" "${pkgdir}/etc/default/${pkgname}"
    install -Dm644 "${pkgname}"/{README.md,scripts/*.sh,scripts/examples/*} -t "${pkgdir}/usr/share/doc/${pkgname}"
}