dev-python/pytest: arm64 stable (bug #723996)
[gentoo.git] / net-analyzer / symon / symon-2.88.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 inherit eutils perl-module toolchain-funcs
6
7 DESCRIPTION="Performance and information monitoring tool"
8 HOMEPAGE="https://wpd.home.xs4all.nl/symon/"
9 SRC_URI="https://wpd.home.xs4all.nl/symon/philes/${P}.tar.gz"
10
11 LICENSE="BSD-2"
12 SLOT="0"
13 KEYWORDS="~amd64 ~sparc ~x86"
14 IUSE="perl +symon symux"
15 REQUIRED_USE="
16         || ( perl symon symux )
17 "
18
19 RDEPEND="
20         perl? ( dev-lang/perl )
21         symux? ( net-analyzer/rrdtool )
22 "
23 DEPEND="
24         ${RDEPEND}
25         sys-devel/pmake
26 "
27
28 S=${WORKDIR}/${PN}
29
30 # Deletes the directory passed as an argument from the internal pmake
31 # variable SUBDIR.
32 zap_subdir() {
33         sed -i "/^SUBDIR/s|$1||" Makefile || die
34 }
35
36 src_prepare() {
37         default
38
39         sed -i \
40                 -e '/^[ \t]*${CC}.*\${LIBS}/s:\${CC}:$(CC) $(LDFLAGS):' \
41                 sym*/Makefile || die
42 }
43
44 src_configure() {
45         use symon && USE_SYMON=1
46         # Do some sed magic in accordance with the USE flags.
47         use perl && [[ -z ${USE_SYMON} ]] && ! use symux && zap_subdir lib
48         ! use perl && zap_subdir client
49         ! use symux && zap_subdir symux
50         [[ -z ${USE_SYMON} ]] && zap_subdir symon
51 }
52
53 src_compile() {
54         pmake CC="$(tc-getCC)" CFLAGS+="${CFLAGS}" STRIP=true || die
55 }
56
57 src_install() {
58         if [[ -n ${USE_SYMON} ]]; then
59                 insinto /etc
60                 doins "${FILESDIR}"/symon.conf
61
62                 newinitd "${FILESDIR}"/symon-init.d symon
63
64                 dodoc CHANGELOG HACKERS TODO
65
66                 doman symon/symon.8
67                 dosbin symon/symon
68         fi
69
70         if use perl; then
71                 dobin client/getsymonitem.pl
72
73                 perl_set_version
74                 insinto ${VENDOR_LIB}
75                 doins client/SymuxClient.pm
76         fi
77
78         if use symux; then
79                 insinto /etc
80                 doins "${FILESDIR}"/symux.conf
81
82                 newinitd "${FILESDIR}"/symux-init.d symux
83
84                 doman symux/symux.8
85                 dosbin symux/symux
86
87                 dodir /usr/share/symon
88                 insinto /usr/share/symon
89                 doins symux/c_smrrds.sh
90                 fperms a+x /usr/share/symon/c_smrrds.sh
91
92                 dodir /var/lib/symon/rrds/localhost
93         fi
94 }
95
96 pkg_postinst() {
97         if use symux; then
98                 elog "The RRDs files can be obtained by running"
99                 elog "/usr/share/symon/c_smrrds.sh all."
100                 elog "For information about migrating RRDs from a previous"
101                 elog "symux version read the LEGACY FORMATS section of symux(8)."
102                 elog "To view the rrdtool pictures of the stored data, emerge"
103                 elog "net-analyzer/syweb."
104         fi
105 }