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