summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 5f236eec4f3932bd4bd1845a169e956c95ea57e9 (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: NAHFE

pkgname=logcli-git
_pkgname=logcli
pkgver=2.1.0.r1530.gb3f6f6b41
pkgrel=1
pkgdesc="LogCLI allows users to run LogQL queries against a Loki server"
arch=('x86_64')
depends=("glibc")
makedepends=("go" "git")
provides=("logcli")
url="https://github.com/grafana/loki"
license=('AGPL')
source=("loki::git+https://github.com/grafana/loki.git")
sha256sums=('SKIP')

prepare() {
    cd ${srcdir}/loki
    mkdir -p build/
}

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

build() {
    cd ${srcdir}/loki
    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 ./cmd/logcli
}

check() {
    cd ${srcdir}/loki
    go test ./pkg/logcli/...
}

package() {
    install -Dm755 ${srcdir}/loki/build/logcli ${pkgdir}/usr/bin/logcli
}