archrelease: copy trunk to extra-x86_64
[arch-packages.git] / prometheus / repos / extra-x86_64 / PKGBUILD
blobb8dcb7d41d5415166fc5ebad86e0d12a81dd1e0e
1 # Maintainer: Johannes Löthberg <johannes@kyriasis.com>
3 pkgname=prometheus
4 pkgver=2.33.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')
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=('94f16f724f032589072d8165710aa5027ae1bdb665614b4660e49bb802b3d27b'
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   # The makefile seems to not be able to execute npm properly, so run the make assets target manually
39   cd web/ui/module/codemirror-promql
40   npm install
41   npm run build
43   cd $srcdir/prometheus-$pkgver/web/ui
44   GOOS= GOARCH= go generate -x -v
46   cd $srcdir/prometheus-$pkgver
47   # Build the react app, normally a part of the assets target
48 #make web/ui/static/react
49   make ui-install
50   make ui-build
52   go build \
53     -trimpath \
54     -buildmode=pie \
55     -mod=readonly \
56     -modcacherw \
57     -ldflags "-linkmode external $LDFLAGS" \
58     ./cmd/prometheus
59   go build \
60     -trimpath \
61     -buildmode=pie \
62     -mod=readonly \
63     -modcacherw \
64     -ldflags "-linkmode external $LDFLAGS" \
65     ./cmd/promtool
68 check() {
69   cd prometheus-$pkgver
71   go test -short ./...
74 package() {
75   install -Dm644 prometheus.service "$pkgdir"/usr/lib/systemd/system/prometheus.service
76   install -Dm644 prometheus.sysusers "$pkgdir"/usr/lib/sysusers.d/prometheus.conf
77   install -Dm644 prometheus.conf "${pkgdir}"/etc/conf.d/prometheus
79   cd prometheus-$pkgver
81   install -Dm755 -t "$pkgdir"/usr/bin prometheus promtool
82   install -Dm640 -g210 -t "$pkgdir"/etc/prometheus documentation/examples/prometheus.yml
83   install -dm750 -o210 -g210 "$pkgdir"/var/lib/prometheus
85   # Web
86   install -dm755 "$pkgdir"/usr/share/prometheus/web/ui
87   cp -R web/ui/{static,templates} "$pkgdir"/usr/share/prometheus/web/ui/
89   # Examples
90   install -Dm644 -t "$pkgdir"/usr/share/doc/prometheus/examples documentation/examples/prometheus*.yml
91   cp -R consoles console_libraries "$pkgdir"/usr/share/doc/prometheus/examples