dev-cpp/pangomm: stable 2.42.1 for hppa, bug #717144
[gentoo.git] / net-analyzer / netdata / netdata-9999.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python{3_6,3_7,3_8} )
6
7 inherit autotools fcaps linux-info python-single-r1 systemd
8
9 if [[ ${PV} == *9999 ]] ; then
10         EGIT_REPO_URI="https://github.com/netdata/${PN}.git"
11         inherit git-r3
12 else
13         SRC_URI="https://github.com/netdata/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
14         KEYWORDS="~amd64 ~x86"
15 fi
16
17 DESCRIPTION="Linux real time system monitoring, done right!"
18 HOMEPAGE="https://github.com/netdata/netdata https://my-netdata.io/"
19
20 LICENSE="GPL-3+ MIT BSD"
21 SLOT="0"
22 IUSE="caps +compression cpu_flags_x86_sse2 cups +dbengine ipmi +jsonc kinesis mongodb mysql nfacct nodejs postgres prometheus +python tor xen"
23 REQUIRED_USE="
24         mysql? ( python )
25         python? ( ${PYTHON_REQUIRED_USE} )
26         tor? ( python )"
27
28 # most unconditional dependencies are for plugins.d/charts.d.plugin:
29 RDEPEND="
30         acct-group/netdata
31         acct-user/netdata
32         app-misc/jq
33         >=app-shells/bash-4:0
34         || (
35                 net-analyzer/openbsd-netcat
36                 net-analyzer/netcat
37         )
38         net-misc/curl
39         net-misc/wget
40         sys-apps/util-linux
41         virtual/awk
42         caps? ( sys-libs/libcap )
43         cups? ( net-print/cups )
44         dbengine? (
45                 app-arch/lz4
46                 dev-libs/judy
47                 dev-libs/openssl:=
48         )
49         dev-libs/libuv
50         compression? ( sys-libs/zlib )
51         ipmi? ( sys-libs/freeipmi )
52         jsonc? ( dev-libs/json-c )
53         kinesis? ( dev-libs/aws-sdk-cpp[kinesis] )
54         mongodb? ( dev-libs/mongo-c-driver )
55         nfacct? (
56                 net-firewall/nfacct
57                 net-libs/libmnl
58         )
59         nodejs? ( net-libs/nodejs )
60         prometheus? (
61                 dev-libs/protobuf:=
62                 app-arch/snappy
63         )
64         python? (
65                 ${PYTHON_DEPS}
66                 $(python_gen_cond_dep 'dev-python/pyyaml[${PYTHON_MULTI_USEDEP}]')
67                 mysql? (
68                         || (
69                                 $(python_gen_cond_dep 'dev-python/mysqlclient[${PYTHON_MULTI_USEDEP}]')
70                                 $(python_gen_cond_dep 'dev-python/mysql-python[${PYTHON_MULTI_USEDEP}]')
71                         )
72                 )
73                 postgres? ( $(python_gen_cond_dep 'dev-python/psycopg:2[${PYTHON_MULTI_USEDEP}]') )
74                 tor? ( $(python_gen_cond_dep 'net-libs/stem[${PYTHON_MULTI_USEDEP}]') )
75         )
76         xen? (
77                 app-emulation/xen-tools
78                 dev-libs/yajl
79         )"
80 DEPEND="${RDEPEND}
81         virtual/pkgconfig"
82
83 FILECAPS=(
84         'cap_dac_read_search,cap_sys_ptrace+ep' 'usr/libexec/netdata/plugins.d/apps.plugin'
85 )
86
87 pkg_setup() {
88         use python && python-single-r1_pkg_setup
89         linux-info_pkg_setup
90 }
91
92 src_prepare() {
93         default
94         eautoreconf
95 }
96
97 src_configure() {
98         # --disable-cloud: https://github.com/netdata/netdata/issues/8961
99         econf \
100                 --localstatedir="${EPREFIX}"/var \
101                 --with-user=netdata \
102                 --disable-cloud \
103                 $(use_enable jsonc) \
104                 $(use_enable cups plugin-cups) \
105                 $(use_enable dbengine) \
106                 $(use_enable nfacct plugin-nfacct) \
107                 $(use_enable ipmi plugin-freeipmi) \
108                 $(use_enable kinesis backend-kinesis) \
109                 $(use_enable mongodb backend-mongodb) \
110                 $(use_enable prometheus backend-prometheus-remote-write) \
111                 $(use_enable xen plugin-xenstat) \
112                 $(use_enable cpu_flags_x86_sse2 x86-sse) \
113                 $(use_with compression zlib)
114 }
115
116 src_install() {
117         default
118
119         rm -rf "${D}/var/cache" || die
120
121         keepdir /var/log/netdata
122         fowners -Rc netdata:netdata /var/log/netdata
123         keepdir /var/lib/netdata
124         keepdir /var/lib/netdata/registry
125         fowners -Rc netdata:netdata /var/lib/netdata
126
127         fowners -Rc root:netdata /usr/share/${PN}
128
129         newinitd system/netdata-openrc ${PN}
130         systemd_dounit system/netdata.service
131         insinto /etc/netdata
132         doins system/netdata.conf
133 }
134
135 pkg_postinst() {
136         fcaps_pkg_postinst
137
138         if use xen ; then
139                 fcaps 'cap_dac_override' 'usr/libexec/netdata/plugins.d/xenstat.plugin'
140         fi
141 }