summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 9483aaa276ae59418f287fe475c6c18375fd7449 (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
# Maintainer: Moritz 'e1mo' Fromm <git@e1mo.de>

_pkgname=dashie-telegraf-plugins
pkgname=$_pkgname-git
pkgver=master.r0.g071e959
pkgrel=1
pkgdesc='Various plugins for telegraf such as battery'
arch=('x86_64')
url='https://dev.sigpipe.me/dashie/telegraf-plugins'
provides=("${_pkgname}")
license=('MIT')
conflicts=("${_pkgname}")
depends=("glibc")
makedepends=('go' 'git')
options=('!emptydirs')
source=("$pkgname::git+https://dev.sigpipe.me/dashie/telegraf-plugins")
sha256sums=('SKIP')

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

build() {
	cd "$srcdir/$pkgname/"
  mkdir "build";
  for d in *; do
    if [[ -f $d ]]; then
      continue
    fi
    if [[ $d == "build" ]]; then
      continue
    fi
    filename="${d}/${d}.go"
    go build \
		    -trimpath \
		    -buildmode=pie \
		    -mod=readonly \
		    -modcacherw \
		    -ldflags "-X main.Version=$pkgver -linkmode external -extldflags $LDFLAGS" \
		    -o "build/dashie_telegraf_${d}" \
        "${filename}"
  done
	}

package() {
	cd "$srcdir/$pkgname"
	install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
  cd build
  for f in *; do
	  install -Dm755 "$f" "$pkgdir/usr/bin/$f";
  done
}