summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 768ebe2acfda0ef36120793c9d49d7a73a8faae3 (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
# Maintainer: Evine Deng <evinedeng@hotmail.com>

pkgname="backrest"
pkgver=0.15.1
pkgrel=1
pkgdesc="A web UI and orchestrator for restic backup."
arch=('i686' 'pentium4' 'x86_64' 'arm' 'armv7h' 'armv6h' 'aarch64' 'riscv64')
url="https://github.com/garethgeorge/${pkgname}"
license=("GPL3")
depends=("glibc" "restic")
makedepends=("npm" "git" "go" "go.rice")
source=("${pkgname}::git+${url}.git#tag=v${pkgver}"
        "${pkgname}@.service")
sha256sums=('7dc8d7e3c2add0e1395d74b17fdd743cf8302f5ff24010b89b0b4b8b6f77f4ef'
            '54d7ceddc2d3abb1c00a3f45ff7dd43b5fdc05c6be1019ead7f7cbf4a40ab926')
options=(!strip)

build() {
    local ldflags="-s -w -extldflags '${LDFLAGS}'"

    cd "${pkgname}"
    npm --prefix webui install
    npm --prefix webui run build
    find webui/dist -name '*.map' -exec rm ./{} \;
    go build -trimpath -ldflags="$ldflags" -o "${pkgname}" .
    strip "${pkgname}"
    rice append --exec "${pkgname}"
}

package() {
    install -Dm644 "${pkgname}@.service" "${pkgdir}/usr/lib/systemd/system/${pkgname}@.service"

    cd "${pkgname}"
    install -Dm755 "${pkgname}" "${pkgdir}/usr/bin/${pkgname}"
    install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
    install -Dm644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
}