db-move: moved seahorse from [testing] to [extra] (x86_64)
[arch-packages.git] / prometheus / trunk / PKGBUILD
blob1247209c25f531e327118d19e5c492724a42bd69
1 # Maintainer: Johannes Löthberg <johannes@kyriasis.com>
3 pkgname=prometheus
4 pkgver=2.43.0
5 pkgrel=1
7 pkgdesc='An open-source systems monitoring and alerting toolkit'
8 url='https://prometheus.io'
9 arch=('x86_64')
10 license=('Apache')
12 depends=('glibc')
13 makedepends=('go' 'git' 'npm' 'nodejs' 'yamllint' 'typescript' 'yarn')
15 options=(!lto)
16 backup=('etc/prometheus/prometheus.yml' 'etc/conf.d/prometheus')
18 source=("prometheus-v$pkgver.tar.gz::https://github.com/prometheus/prometheus/archive/v$pkgver.tar.gz"
19         prometheus.service
20         prometheus.sysusers
21         prometheus.conf)
23 sha256sums=('0cd8860e5f10d0ecb35d20d23252ddc459e8319882dc163bf71b723e3bcafd71'
24             'f358986865bd3d06dc47a265aeb3b5ef64aa644e831f07731c2fc7af64d9e98f'
25             '2747fabb4e56b808361eb7dd7acf9729ab8973d1ebe2f857dd56f6c71f71e45f'
26             '6d32deb125381cbebac11b6953a7d9a65eb7e50f209dc1e22c63facf678a3070')
28 build() {
29   cd prometheus-$pkgver
31   LDFLAGS="-extldflags $LDFLAGS \
32     -X github.com/prometheus/common/version.Version=$pkgver \
33     -X github.com/prometheus/common/version.Revision=$pkgver \
34     -X github.com/prometheus/common/version.Branch=tarball \
35     -X github.com/prometheus/common/version.BuildUser=someone@builder \
36     -X github.com/prometheus/common/version.BuildDate=$(date -u '+%Y%m%d-%H:%M:%S' --date=@${SOURCE_DATE_EPOCH})"
38   cd $srcdir/prometheus-$pkgver/web/ui
39   GOOS= GOARCH= go generate -x -v
41   cd $srcdir/prometheus-$pkgver
42   # Build the react app
43   make ui-install # run install first as otherwise the makefile has a race condition......
44   make assets
46   go build \
47     -trimpath \
48     -buildmode=pie \
49     -mod=readonly \
50     -modcacherw \
51     -ldflags "-linkmode external $LDFLAGS" \
52     ./cmd/prometheus
53   go build \
54     -trimpath \
55     -buildmode=pie \
56     -mod=readonly \
57     -modcacherw \
58     -ldflags "-linkmode external $LDFLAGS" \
59     ./cmd/promtool
62 check() {
63   cd prometheus-$pkgver
65   GODEBUG=x509sha1=1 go test -short ./...
68 package() {
69   install -Dm644 prometheus.service "$pkgdir"/usr/lib/systemd/system/prometheus.service
70   install -Dm644 prometheus.sysusers "$pkgdir"/usr/lib/sysusers.d/prometheus.conf
71   install -Dm644 prometheus.conf "${pkgdir}"/etc/conf.d/prometheus
73   cd prometheus-$pkgver
75   install -Dm755 -t "$pkgdir"/usr/bin prometheus promtool
76   install -Dm640 -g210 -t "$pkgdir"/etc/prometheus documentation/examples/prometheus.yml
77   install -dm750 -o210 -g210 "$pkgdir"/var/lib/prometheus
79   # Web
80   install -dm755 "$pkgdir"/usr/share/prometheus/web/ui
81   cp -R web/ui/static "$pkgdir"/usr/share/prometheus/web/ui/
83   # Examples
84   install -Dm644 -t "$pkgdir"/usr/share/doc/prometheus/examples documentation/examples/prometheus*.yml
85   cp -R consoles console_libraries "$pkgdir"/usr/share/doc/prometheus/examples