summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: fd95b29816259f3488e1dadb91ea94b5dce3422c (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
50
51
52
53
54
55
56
57
58
# Maintainer: Pierre-Yves Ritschard <pyr@spootnik.org>
# Contributor: FabioLolix

pkgname=exoscale-cli-git
pkgver=1.78.1.r1.g4e8f353e
pkgrel=1
pkgdesc="Command-line tool for everything at Exoscale: compute, storage, dns"
arch=('x86_64')
url="https://github.com/exoscale/cli"
license=('Apache')
provides=('exoscale-cli')
conflicts=('exoscale-cli')

makedepends=(git go make)
source=("${pkgname}::git+https://github.com/exoscale/cli.git"
        "git+https://github.com/exoscale/go.mk.git")
sha256sums=('SKIP'
            'SKIP')

pkgver() {
  cd "${srcdir}/${pkgname}"
  git describe --long --tags | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd "${srcdir}/${pkgname}"

  git submodule init
  git config submodule.libs/libdep.url "$srcdir/lib-dependency"
  git -c protocol.file.allow=always submodule update
}

build() {
  cd "${srcdir}/${pkgname}"

  # This package builds the latest commit on the master branch,
  # which may be ahead of the latest release. But `make build`
  # will bake the latest tag into the binary which is not accurate.
  # Thus we set a temporary tag, so that the `exo version` command doesn't mislead.
  git tag v${pkgver}

  make build
  make completions
  make manpages

  # cleanup the tag as it is not an official release
  git tag -d v${pkgver}
}

package() {
  cd "${srcdir}/${pkgname}"

  install -Dm 755 ./bin/exo "${pkgdir}/usr/bin/exo"
  install -Dm 644 ./contrib/completion/bash/exo -t "${pkgdir}/usr/share/bash-completion/completions/"
  install -Dm 644 ./contrib/completion/zsh/_exo -t "${pkgdir}/usr/share/zsh/site-functions/"
  install -dm 755 "${pkgdir}/usr/share/man/man1"
  install -Dm 644 ./manpage/* "${pkgdir}/usr/share/man/man1"
}