blob: ae53eccbcad97d48fa8379177297e9132614b5de (
plain)
1 # Description: an open-source systems monitoring and alerting toolkit
2 # URL: https://prometheus.io
3 # Maintainer: Tim Biermann, tbier at posteo dot de
4 # Depends on: go yarn
5
6 name=prometheus
7 version=2.28.1
8 release=1
9 source=(https://github.com/prometheus/prometheus/archive/v$version/$name-$version.tar.gz
10 prometheus.conf prometheus.service)
11
12 build() {
13 cd $name-$version
14
15 cd web/ui/react-app
16 yarn --frozen-lockfile
17 yarn lint
18 cd ../../../
19 ./scripts/build_react_app.sh
20 cd web/ui
21 CGO_ENABLED=0 GOARCH= go generate -x -v
22
23 cd ../../
24 gofmt -w ./web/ui
25
26 GOLDFLAGS="-X github.com/prometheus/common/version.Version=$version
27 -X github.com/prometheus/common/version.Revision=CRUX
28 -X github.com/prometheus/common/version.Branch=master
29 -X github.com/prometheus/common/version.BuildUser=$USER@$HOSTNAME
30 -X github.com/prometheus/common/version.BuildDate=$(date -u +%Y%m%d-%H:%M:%S ${SOURCE_DATE_EPOCH:+-d @$SOURCE_DATE_EPOCH})
31 "
32
33 if [ -n $LDFLAGS ]; then
34 # LDFLAGS (and only LDFLAGS) should be passed to -extldflags.
35 GOLDFLAGS="$GOLDFLAGS -extldflags $LDFLAGS"
36 fi
37
38 go mod vendor
39 go build \
40 -trimpath \
41 -mod=vendor \
42 -ldflags "$GOLDFLAGS" \
43 -tags netgo,builtinassets \
44 ./cmd/prometheus
45 go build \
46 -trimpath \
47 -mod=vendor \
48 -ldflags "$GOLDFLAGS" \
49 ./cmd/promtool
50
51 install -Dm755 -t $PKG/usr/bin prometheus promtool
52
53 install -Dm644 $SRC/prometheus.conf \
54 $PKG/etc/conf.d/prometheus
55 install -dm644 $PKG/var/lib/prometheus/data
56
57 install -Dm644 -t $PKG/etc/prometheus \
58 documentation/examples/prometheus.yml
59
60 mkdir -p $PKG/etc/prometheus/console_libraries
61 for file in console_libraries/*
62 do
63 install -Dm644 -t $PKG/etc/prometheus/console_libraries/ $file
64 done
65
66 mkdir -p $PKG/etc/prometheus/consoles
67 for file in consoles/*
68 do
69 install -Dm644 -t $PKG/etc/prometheus/consoles/ $file
70 done
71
72 ## web
73 install -dm755 $PKG/usr/share/prometheus/web/ui
74 cp -R web/ui/{static,templates} $PKG/usr/share/prometheus/web/ui/
75 install -Dm644 $SRC/prometheus.conf $PKG/etc/conf.d/prometheus
76
77 ## install rc file
78 install -Dm 755 $SRC/prometheus.service $PKG/etc/rc.d/prometheus
79 }
|