summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 1b5198232696852e85959ba08d03de4b56a996e5 (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.13.2
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=('fb97c1e503c7155e770cda3ef4578e315c8d63d45e7aa8fe37c3a21411d9d52e'
            '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/{}" \;
}