summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1ea2f8915c101a2deb2076db99fc5f0b7fb98dc4 (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
47
48
49
# Maintainer: Filipe Nascimento <flipee at tuta dot io>

pkgname=velero
pkgver=1.14.0
pkgrel=1
pkgdesc="Backup and migrate Kubernetes applications and their persistent volumes"
arch=('x86_64' 'armv6h' 'armv7h' 'aarch64')
url="https://velero.io"
license=('Apache-2.0')
depends=('glibc' 'kubectl')
makedepends=('git' 'go')
source=("git+https://github.com/vmware-tanzu/velero#tag=v$pkgver"
        "build.patch")
sha256sums=('03e47dae68e0b6615091a1e58175b839da512867c206c474b73b9ca25c31bf69'
            '8fab0a9386152f94dafaf07aa3d4e23d43924fb279671f0e1988d5b35b20df0d')

prepare() {
    cd $pkgname
    patch -Np1 < ../build.patch
    sed -E 's#(OUTPUT_DIR)=\$\$\(pwd\)/_output/bin/\$\(GOOS\)/\$\(GOARCH\)#\1=.#g' -i Makefile
}

build() {
    cd $pkgname

    export CGO_CPPFLAGS="${CPPFLAGS}"
    export CGO_CFLAGS="${CFLAGS}"
    export CGO_CXXFLAGS="${CXXFLAGS}"
    export CGO_LDFLAGS="${LDFLAGS}"
    export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
    export GOLDFLAGS="-linkmode=external"

    make GIT_TREE_STATE=clean VERSION=v$pkgver local

    ./velero completion bash | install -Dm644 /dev/stdin share/bash-completion/completions/velero
    ./velero completion zsh | install -Dm644 /dev/stdin share/zsh/site-functions/_velero
    ./velero completion fish | install -Dm644 /dev/stdin share/fish/vendor_completions.d/velero.fish
}

package() {
    cd $pkgname

    install -Dm755 $pkgname -t "$pkgdir/usr/bin"

    cp -r share/ "$pkgdir/usr"

    install -Dm644 README.md -t "$pkgdir/usr/share/doc/$pkgname"
    find examples/ -type f -exec install -Dm644 "{}" "$pkgdir/usr/share/doc/$pkgname/{}" \;
}