net-analyzer: Remove *-fbsd KEYWORDS
[gentoo.git] / net-analyzer / rrdtool / rrdtool-1.7.2.ebuild
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 DISTUTILS_OPTIONAL=true
6 DISTUTILS_SINGLE_IMPL=true
7 GENTOO_DEPEND_ON_PERL=no
8 PYTHON_COMPAT=( python{2_7,3_5,3_6} )
9 inherit autotools perl-module distutils-r1 flag-o-matic multilib
10
11 MY_P=${P/_/-}
12
13 DESCRIPTION="A system to store and display time-series data"
14 HOMEPAGE="https://oss.oetiker.ch/rrdtool/"
15 SRC_URI="${HOMEPAGE}pub/${MY_P}.tar.gz"
16
17 LICENSE="GPL-2"
18 SLOT="0/8.0.0"
19 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-linux ~x86-linux ~x86-macos ~x86-solaris"
20 IUSE="dbi doc graph lua perl python rados rrdcgi ruby static-libs tcl tcpd"
21 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
22
23 CDEPEND="
24         >=dev-libs/glib-2.28.7:2[static-libs(+)?]
25         >=dev-libs/libxml2-2.7.8:2[static-libs(+)?]
26         dbi? ( dev-db/libdbi[static-libs(+)?] )
27         graph? (
28                 >=media-libs/libpng-1.5.10:0=[static-libs(+)?]
29                 >=x11-libs/cairo-1.10.2[svg,static-libs(+)?]
30                 >=x11-libs/pango-1.28
31         )
32         lua? ( dev-lang/lua:*[deprecated] )
33         perl? ( dev-lang/perl:= )
34         python? ( ${PYTHON_DEPS} )
35         rados? ( sys-cluster/ceph )
36         tcl? ( dev-lang/tcl:0= )
37         tcpd? ( sys-apps/tcp-wrappers )
38 "
39
40 DEPEND="
41         ${CDEPEND}
42         sys-apps/groff
43         virtual/pkgconfig
44         virtual/awk
45 "
46 RDEPEND="
47         ${CDEPEND}
48 "
49 PDEPEND="
50         ruby? ( ~dev-ruby/rrdtool-bindings-${PV} )
51 "
52 PATCHES=(
53         "${FILESDIR}"/${PN}-1.4.9-disable-rrd_graph-perl.patch
54         "${FILESDIR}"/${PN}-1.7.0-disable-rrd_graph-cgi.patch
55         "${FILESDIR}"/${PN}-1.7.1-configure.ac.patch
56 )
57 S=${WORKDIR}/${MY_P}
58
59 python_compile() {
60         cd bindings/python || die
61         distutils-r1_python_compile
62 }
63
64 python_install() {
65         cd bindings/python || die
66         distutils-r1_python_install
67 }
68
69 pkg_setup() {
70         use python && python-single-r1_pkg_setup
71 }
72
73 src_prepare() {
74         default
75         # At the next version bump, please see if you actually still need this
76         # before adding versions
77         if ! [ -f doc/rrdrados.pod ]; then
78                 cp "${FILESDIR}"/${PN}-1.5.5-rrdrados.pod doc/rrdrados.pod
79         else
80                 die "File already exists: doc/rrdrados.pod. Remove this code!"
81         fi
82
83         # bug 456810
84         # no time to sleep
85         sed -i \
86                 -e 's|$LUA_CFLAGS|IGNORE_THIS_BAD_TEST|g' \
87                 -e 's|^sleep 1$||g' \
88                 -e '/^dnl.*png/s|^dnl||g' \
89                 configure.ac || die
90
91         # Python bindings are built/installed manually
92         sed -i \
93                 -e '/^all-local:/s| @COMP_PYTHON@||' \
94                 bindings/Makefile.am || die
95
96         if ! use graph; then
97                 sed -i \
98                         -e '2s:rpn1::; 2s:rpn2::; 6s:create-with-source-4::;' \
99                         -e '7s:xport1::; 7s:dcounter1::; 7s:vformatter1::' \
100                         tests/Makefile.am || die
101         fi
102
103         export rd_cv_gcc_flag__Werror=no
104
105         eautoreconf
106 }
107
108 src_configure() {
109         filter-flags -ffast-math
110
111         export RRDDOCDIR=${EPREFIX}/usr/share/doc/${PF}
112
113         # to solve bug #260380
114         [[ ${CHOST} == *-solaris* ]] && append-flags -D__EXTENSIONS__
115
116         # Stub configure.ac
117         local myconf=()
118         if ! use tcpd; then
119                 myconf+=( "--disable-libwrap" )
120         fi
121         if ! use dbi; then
122                 myconf+=( "--disable-libdbi" )
123         fi
124         if ! use rados; then
125                 myconf+=( "--disable-librados" )
126         fi
127
128         econf \
129                 $(use_enable graph rrd_graph) \
130                 $(use_enable lua lua-site-install) \
131                 $(use_enable lua) \
132                 $(use_enable perl perl-site-install) \
133                 $(use_enable perl) \
134                 $(use_enable python) \
135                 $(use_enable rrdcgi) \
136                 $(use_enable static-libs static) \
137                 $(use_enable tcl) \
138                 $(use_with tcl tcllib "${EPREFIX}"/usr/$(get_libdir)) \
139                 --with-perl-options=INSTALLDIRS=vendor \
140                 --disable-ruby-site-install \
141                 --disable-ruby \
142                 ${myconf[@]}
143 }
144
145 src_compile() {
146         default
147
148         use python && distutils-r1_src_compile
149 }
150
151 src_test() {
152         export LC_ALL=C
153         default
154 }
155
156 src_install() {
157         default
158
159         if ! use doc ; then
160                 rm -rf "${ED}"usr/share/doc/${PF}/{html,txt}
161         fi
162
163         if use !rrdcgi ; then
164                 # uses rrdcgi, causes invalid shebang error in Prefix, useless
165                 # without rrdcgi installed
166                 rm -f "${ED}"usr/share/${PN}/examples/cgi-demo.cgi
167         fi
168
169         if use perl ; then
170                 perl_delete_localpod
171                 perl_delete_packlist
172         fi
173
174         dodoc CHANGES CONTRIBUTORS NEWS THREADS TODO
175
176         find "${ED}"usr -name '*.la' -exec rm -f {} +
177
178         keepdir /var/lib/rrdcached/journal/
179         keepdir /var/lib/rrdcached/db/
180
181         newconfd "${FILESDIR}"/rrdcached.confd rrdcached
182         newinitd "${FILESDIR}"/rrdcached.init rrdcached
183
184         use python && distutils-r1_src_install
185 }