blob: bc130ab0440bbc4a7ff52970df1ecd58c0b30def (
plain) (
blame)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
# $FreeBSD$
PORTNAME= prometheus
DISTVERSIONPREFIX= v
DISTVERSION= 2.3.2
CATEGORIES= net-mgmt
MAINTAINER= dor.bsd@xm0.uk
COMMENT= Systems monitoring and alerting toolkit
LICENSE= APACHE20
LICENSE_FILE= ${WRKSRC}/LICENSE
USES= go gmake
GO_PKGNAME= github.com/${GH_ACCOUNT}/${GH_PROJECT}
USE_GITHUB= yes
USE_RC_SUBR= prometheus
OPTIONS_DEFINE= USE_SYSLOG
OPTIONS_DEFAULT= USE_SYSLOG
USE_SYSLOG_DESC= Install configuration files for syslog and newsyslog
OPTIONS_SUB= yes
PROMETHEUS_USER?= prometheus
PROMETHEUS_GROUP?= prometheus
USERS= ${PROMETHEUS_USER}
GROUPS= ${PROMETHEUS_GROUP}
PROMETHEUS_BINARIES= prometheus promtool
PROMETHEUS_SHARE_DIR= ${DATADIR}
PROMETHEUS_CONSOLES_DIR= ${PROMETHEUS_SHARE_DIR}/consoles
PROMETHEUS_CONSOLE_LIBRARIES_DIR= ${PROMETHEUS_SHARE_DIR}/console_libraries
PROMETHEUS_DB_DIR= /var/db/${PORTNAME}
PROMETHEUS_LOG_DIR= /var/log/prometheus
PROMETHEUS_LOG_FILE= ${PROMETHEUS_LOG_DIR}/prometheus.log
SUB_FILES= prometheus \
newsyslog.conf \
syslog.d.conf
SUB_LIST+= PROMETHEUS_USER=${PROMETHEUS_USER} \
PROMETHEUS_GROUP=${PROMETHEUS_GROUP} \
PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR} \
PROMETHEUS_LOG_FILE=${PROMETHEUS_LOG_FILE} \
PROMETHEUS_SHARE_DIR=${PROMETHEUS_SHARE_DIR}
PLIST_SUB+= PORTNAME=${PORTNAME} \
PROMETHEUS_CONSOLE_LIBRARIES_DIR=${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
PROMETHEUS_CONSOLES_DIR=${PROMETHEUS_CONSOLES_DIR} \
PROMETHEUS_DB_DIR=${PROMETHEUS_DB_DIR} \
PROMETHEUS_LOG_DIR=${PROMETHEUS_LOG_DIR}
BUILD_USER?= ${USER}
LD_FLAG_X_PREFIX= -X ${GO_PKGNAME}/vendor/${GO_PKGNAME:H}/common/version
LD_FLAG_STRING= -s \
${LD_FLAG_X_PREFIX}.Version=${PORTVERSION} \
${LD_FLAG_X_PREFIX}.Revision=${PORTREVISION} \
${LD_FLAG_X_PREFIX}.Branch=release-${PORTVERSION:R} \
${LD_FLAG_X_PREFIX}.BuildUser=${BUILD_USER}
do-build:
.for bin in ${PROMETHEUS_BINARIES}
( cd ${GO_WRKSRC}/cmd/${bin} ; \
${SETENV} ${MAKE_ENV} ${GO_ENV} \
${GO_CMD} install -v -ldflags "${LD_FLAG_STRING}" )
.endfor
do-install:
.for bin in ${PROMETHEUS_BINARIES}
${INSTALL_PROGRAM} ${GO_WRKDIR_BIN}/${bin} ${STAGEDIR}${PREFIX}/bin
.endfor
${INSTALL_DATA} \
${WRKSRC}/documentation/examples/prometheus.yml \
${STAGEDIR}${LOCALBASE}/etc/prometheus.yml.sample
@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_DB_DIR}
@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLES_DIR}
@${MKDIR} ${STAGEDIR}${DESTDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR}
@${MKDIR} ${STAGEDIR}${PROMETHEUS_LOG_DIR}
( cd ${WRKSRC}/console_libraries \
&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLE_LIBRARIES_DIR} \
)
( cd ${WRKSRC}/consoles \
&& ${COPYTREE_SHARE} . ${STAGEDIR}${PROMETHEUS_CONSOLES_DIR} \
)
post-install-USE_SYSLOG-on:
@${MKDIR} ${STAGEDIR}${ETCDIR}
${INSTALL_DATA} \
${WRKDIR}/syslog.d.conf \
${STAGEDIR}${ETCDIR}/syslog.d.conf.sample
${INSTALL_DATA} \
${WRKDIR}/newsyslog.conf \
${STAGEDIR}${ETCDIR}/newsyslog.conf.sample
.include <bsd.port.mk>
|