summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b1a1e6c8128819f6fd38440b500fdddbad554301 (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Maintainer: George Rawlinson <george@rawlinson.net.nz>

pkgname=prometheus-ipmi-exporter
pkgver=1.5.2
pkgrel=1
pkgdesc="Prometheus exporter for IPMI metrics"
arch=(x86_64)
url="https://github.com/prometheus-community/ipmi_exporter"
license=('MIT')
depends=('glibc' 'freeipmi')
makedepends=('git' 'go')
options=('!lto')
_commit='8ba1509883cd549fc0e56ef6710f3c36e0a601db'
source=(
  "$pkgname::git+$url.git#commit=$_commit"
  'systemd.service'
  'sysusers.conf'
)
sha512sums=('SKIP'
            'fb373d8884167f1eea3efff0a1dd5518bf9033e9653c76fc551c2295348a5681871e545672771ffbd571190869097696f74cc6ce5439820aec1b1785f1c65cc3'
            '6a054c496a7cbfe1946713001d8fe460360bd42a473aa7cc0aed0fbfd4d989e67a62d4b4be7e9d828b4572dc06d6afedf16797ce58279b2d4b1c9343b5088feb')
b2sums=('SKIP'
        'adae5f80306c13ef619c47a732eab9067c9f11ec025e7e46abb200f1c122d4cccd1c55cec99120e373022e1f798f4623bb93c9e8ff6801e6915a9d385a4ed8bd'
        '93e62d3bacccb26e808271fa4f576dc5e67cb5111f7d0c744a4f029aa3974de29742b4301f4058db38884de1cb049969c533291daf0fa6a9f3175a77c72b0001')

pkgver() {
  cd "$pkgname"

  git describe --tags | sed 's/^v//'
}

prepare() {
  cd "$pkgname"

  # create directory for build output
  mkdir build

  # download dependencies
  go mod download
}

build() {
  cd "$pkgname"

  go build -v \
    -buildmode=pie \
    -trimpath \
    -mod=readonly \
    -modcacherw \
    -ldflags "-linkmode external -extldflags ${LDFLAGS} \
    -X github.com/prometheus/common/version.Version=$pkgver \
    -X github.com/prometheus/common/version.Revision=$pkgver \
    -X github.com/prometheus/common/version.Branch=tarball \
    -X github.com/prometheus/common/version.BuildUser=someone@builder \
    -X github.com/prometheus/common/version.BuildDate=$(date -d@"$SOURCE_DATE_EPOCH" +%Y%m%d-%H:%M:%S)" \
    -o build \
    .
}

package() {
  # systemd integration
  install -vDm644 systemd.service "$pkgdir/usr/lib/systemd/system/$pkgname.service"
  install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/$pkgname.conf"

  cd "$pkgname"

  # binary
  install -vDm755 -t "$pkgdir/usr/bin" build/ipmi_exporter

  # license
  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE

  # documentation
  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" \
    ipmi*.yml docs/*.md README.md
}