archrelease: copy trunk to extra-x86_64
[arch-packages.git] / prometheus / repos / extra-x86_64 / PKGBUILD
blobeb65febdb6c880e60aff636a510616fcb5e22012
1 # Maintainer: Johannes Löthberg <johannes@kyriasis.com>
3 pkgname=prometheus
4 pkgver=2.44.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=('cbaaa0e17a355abc4a90d4ead952620aa1bca8fad4a95fd81ac68c0d963add26'
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     -buildmode=pie \
48     -mod=readonly \
49     -modcacherw \
50     -ldflags "-compressdwarf=false -linkmode external $LDFLAGS" \
51     ./cmd/prometheus
52   go build \
53     -buildmode=pie \
54     -mod=readonly \
55     -modcacherw \
56     -ldflags "-compressdwarf=false -linkmode external $LDFLAGS" \
57     ./cmd/promtool
60 check() {
61   cd prometheus-$pkgver
63   GODEBUG=x509sha1=1 go test -short ./...
66 package() {
67   install -Dm644 prometheus.service "$pkgdir"/usr/lib/systemd/system/prometheus.service
68   install -Dm644 prometheus.sysusers "$pkgdir"/usr/lib/sysusers.d/prometheus.conf
69   install -Dm644 prometheus.conf "${pkgdir}"/etc/conf.d/prometheus
71   cd prometheus-$pkgver
73   install -Dm755 -t "$pkgdir"/usr/bin prometheus promtool
74   install -Dm640 -g210 -t "$pkgdir"/etc/prometheus documentation/examples/prometheus.yml
75   install -dm750 -o210 -g210 "$pkgdir"/var/lib/prometheus
77   # Web
78   install -dm755 "$pkgdir"/usr/share/prometheus/web/ui
79   cp -R web/ui/static "$pkgdir"/usr/share/prometheus/web/ui/
81   # Examples
82   install -Dm644 -t "$pkgdir"/usr/share/doc/prometheus/examples documentation/examples/prometheus*.yml
83   cp -R consoles console_libraries "$pkgdir"/usr/share/doc/prometheus/examples