summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: e98cb4e5aaa49fef58d7c687dedd2bf237d5392c (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: noodle <silentnoodle@cock.li>
pkgname=passbolt-cli
_pkgname=go-passbolt-cli
pkgver=0.3.1
pkgrel=1
pkgdesc='Passbolt CLI tool'
arch=('x86_64')
url="https://passbolt.com"
license=('MIT')
makedepends=('go')
source=("https://github.com/passbolt/$_pkgname/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('15c7c0141ae1fd9cb304dd4c1747c8c2f1fe2c9555f04f69d31f3c3ec9547686')

prepare(){
  cd "$srcdir/$_pkgname-$pkgver"
  mkdir -p build/
  mkdir -p completion
  mkdir -p man/
  go run . completion bash > completion/bash
  go run . completion zsh > completion/zsh
  go run . completion fish > completion/fish
  go run . completion powershell > completion/powershell
  go run . gendoc --type man
}

build() {
  cd "$srcdir/$_pkgname-$pkgver"
  export CGO_CPPFLAGS="${CPPFLAGS}"
  export CGO_CFLAGS="${CFLAGS}"
  export CGO_CXXFLAGS="${CXXFLAGS}"
  export CGO_LDFLAGS="${LDFLAGS}"
  export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw"
  go build -o build .
}

package() {
  cd "$srcdir/$_pkgname-$pkgver"
  install -Dm755 build/$_pkgname "$pkgdir"/usr/bin/passbolt
  # Completions
  install -Dm644 completion/bash "$pkgdir"/usr/share/bash-completion/completions/passbolt
  install -Dm644 completion/zsh "$pkgdir"/usr/share/zsh/site-functions/_passbolt
  install -Dm644 completion/fish "$pkgdir"/usr/share/fish/vendor_completions.d/passbolt.fish
  install -Dm644 completion/powershell "$pkgdir"/usr/share/powershell/Modules/passbolt/Completion/Passbolt.ps1
  # Man pages
  for manpage in man/*; do
    section=$(echo $manpage | rev | cut -d. -f1 | rev)
    install -Dm644 $manpage "$pkgdir/usr/share/man/man$section/$(basename $manpage)"
  done
}