summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0524ab7cc57811daabe26640aeae4ce776d1c363 (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
# Maintainer: Hristo Voyvodov <hristo.voyvodov@hotmail.com>

pkgname=subctl
pkgver=0.14.3
pkgrel=2
pkgdesc='The subctl command-line utility simplifies the deployment and maintenance of Submariner by automating interactions with the Submariner Operator and providing diagnostic features.'
arch=(x86_64)
url='https://github.com/submariner-io/subctl'
license=(Apache)
depends=()
makedepends=('go')
source=("$pkgname-$pkgver.tar.gz::https://github.com/submariner-io/subctl/archive/refs/tags/v${pkgver}.tar.gz")
sha256sums=('SKIP')

prepare() {
  cd "${pkgname}-${pkgver}"
  go mod download
}

build() {

    local -a x=(
        github.com/submariner-io/subctl/pkg/version.Version=v${pkgver}
    )
    cd "${pkgname}-${pkgver}"
    export CGO_LDFLAGS="$LDFLAGS"
    export CGO_CFLAGS="$CFLAGS -fno-lto"
    export CGO_CPPFLAGS="$CPPFLAGS"
    export CGO_CXXFLAGS="$CXXFLAGS"
    export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"

    go build -o ./subctl -ldflags "${x[*]/#/-X=} -linkmode=external" ./cmd/
}

package() {
    cd "${pkgname}-${pkgver}"
    install -Dm755 subctl "$pkgdir/usr/bin/subctl"

    install -Dm755 README.md -t "${pkgdir}/usr/share/doc/${pkgname}"

    install -Dm644 LICENSE -t "$pkgdir/usr/share/licenses/${pkgname}/LICENSE"
}