summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 7512c9f65761903d760dec2badf6b533ff03c4ee (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
# Maintainer: mario.valderrama <mv-aur@ransomware.download>
# Maintainer: matthias.lisin <ml-aur@ransomware.download>
pkgname=ionosctl
pkgver=6.7.8
pkgrel=1
pkgdesc='IONOS Cloud CLI'
arch=('x86_64' 'i686' 'aarch64' 'arm' 'armv6h' 'armv7h')
url='https://github.com/ionos-cloud/ionosctl'
license=('Apache-2.0')
depends=('glibc')
makedepends=('go' 'git')
source=("$url/archive/v$pkgver/$pkgname-$pkgver.tar.gz")
sha256sums=('c1df1c8f92ea372887aa6ed04dfd4cc9ba969e7305715ec01a6b3b2d54e9b8c7')

build() {
    _commit=$(bsdcat "$pkgname-$pkgver.tar.gz" | git get-tar-commit-id)
    cd "$pkgname-$pkgver"
    export CGO_ENABLED=1
    export CGO_CFLAGS="$CFLAGS"
    export CGO_CPPFLAGS="$CPPFLAGS"
    export CGO_CXXFLAGS="$CXXFLAGS"
    export CGO_LDFLAGS="$LDFLAGS"
    export GOFLAGS='-buildmode=pie -modcacherw -trimpath'
    go build -o "$pkgname" -ldflags "-linkmode=external \
    -X=github.com/ionos-cloud/ionosctl/v6/internal/version.Version=$pkgver
    -X=github.com/ionos-cloud/ionosctl/v6/internal/version.Label=release
    -X=github.com/ionos-cloud/ionosctl/v6/internal/version.GitCommit=${_commit:?}" main.go

    for i in bash zsh fish; do
        ./"$pkgname" completion "$i" >completion."$i"
    done
    # -f to avoid prompt if target-dir exists
    ./"$pkgname" man -f --skip-compression --target-dir "$srcdir"/man1
}

package() {
    cd "$pkgname-$pkgver"
    install -Dm755 "$pkgname" -t "$pkgdir"/usr/bin
    install -Dm644 completion.bash "$pkgdir"/usr/share/bash-completion/completions/"$pkgname"
    install -Dm644 completion.zsh "$pkgdir"/usr/share/zsh/site-functions/_"$pkgname"
    install -Dm644 completion.fish "$pkgdir"/usr/share/fish/vendor_completions.d/"$pkgname".fish
    install -dm755 "$pkgdir"/usr/share/doc/"$pkgname" "$pkgdir"/usr/share/man/man1
    cp -a docs -T "$pkgdir"/usr/share/doc/"$pkgname"
    cp -rvfT "$srcdir"/man1 "$pkgdir"/usr/share/man/man1
}