media-gfx/graphviz: Drop unused {eutils,multilib}.eclass
[gentoo.git] / media-gfx / graphviz / graphviz-2.40.1-r1.ebuild
1 # Copyright 1999-2018 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5 PYTHON_COMPAT=( python2_7 )
6
7 inherit autotools flag-o-matic java-pkg-opt-2 python-single-r1 qmake-utils
8
9 DESCRIPTION="Open Source Graph Visualization Software"
10 HOMEPAGE="http://www.graphviz.org/ https://gitlab.com/graphviz/graphviz/"
11 SRC_URI="http://www.graphviz.org/pub/graphviz/stable/SOURCES/${P}.tar.gz"
12
13 LICENSE="CPL-1.0"
14 SLOT="0"
15 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~x64-solaris"
16 IUSE="+cairo devil doc examples gdk-pixbuf gtk gts guile java lasi nls pdf perl postscript python qt5 ruby static-libs svg tcl X elibc_FreeBSD"
17
18 REQUIRED_USE="
19         !cairo? ( !X !gtk !postscript !lasi )
20         python? ( ${PYTHON_REQUIRED_USE} )"
21
22 # Requires ksh
23 RESTRICT="test"
24
25 COMMON_DEPEND="
26         >=dev-libs/expat-2
27         >=dev-libs/glib-2.11.1:2
28         dev-libs/libltdl:0
29         >=media-libs/fontconfig-2.3.95
30         >=media-libs/freetype-2.1.10
31         >=media-libs/gd-2.0.34:=[fontconfig,jpeg,png,truetype,zlib]
32         >=media-libs/libpng-1.2:0
33         sys-libs/zlib
34         virtual/jpeg:0
35         virtual/libiconv
36         cairo?  (
37                 >=x11-libs/cairo-1.1.10[svg]
38                 >=x11-libs/pango-1.12
39         )
40         devil?  ( media-libs/devil[png,jpeg] )
41         gtk?    ( x11-libs/gtk+:2 )
42         gts?    ( sci-libs/gts )
43         lasi?   ( media-libs/lasi )
44         pdf?    ( app-text/poppler )
45         perl?   ( dev-lang/perl:= )
46         postscript? ( app-text/ghostscript-gpl )
47         python? ( ${PYTHON_DEPS} )
48         qt5?    (
49                 dev-qt/qtcore:5
50                 dev-qt/qtgui:5
51                 dev-qt/qtprintsupport:5
52                 dev-qt/qtwidgets:5
53         )
54         ruby?   ( dev-lang/ruby:* )
55         svg?    ( gnome-base/librsvg )
56         tcl?    ( >=dev-lang/tcl-8.3:0= )
57         X? (
58                 x11-libs/libX11
59                 x11-libs/libXaw
60                 x11-libs/libXmu
61                 x11-libs/libXpm
62                 x11-libs/libXt
63         )"
64 DEPEND="${COMMON_DEPEND}
65         sys-devel/flex
66         sys-devel/libtool
67         virtual/pkgconfig
68         guile?  ( dev-lang/swig dev-scheme/guile )
69         java?   ( dev-lang/swig >=virtual/jdk-1.5 )
70         nls?    ( >=sys-devel/gettext-0.14.5 )
71         perl?   ( dev-lang/swig )
72         python? ( dev-lang/swig )
73         ruby?   ( dev-lang/swig )
74         tcl?    ( dev-lang/swig )"
75 RDEPEND="${COMMON_DEPEND}
76         !<=sci-chemistry/cluster-1.3.081231"
77
78 # Dependency description / Maintainer-Info:
79
80 # Rendering is done via the following plugins (/plugins):
81 # - core, dot_layout, neato_layout, gd , dot
82 #   the ones which are always compiled in, depend on zlib, gd
83 # - gtk
84 #   Directly depends on gtk-2.
85 #   needs 'pangocairo' enabled in graphviz configuration
86 #   gtk-2 depends on pango, cairo and libX11 directly.
87 # - gdk-pixbuf
88 #   Disabled, GTK-1 junk.
89 # - glitz
90 #   Disabled, no particular reason
91 #   needs 'pangocairo' enabled in graphviz configuration
92 # - ming
93 #   flash plugin via -Tswf requires media-libs/ming-0.4. Disabled as it's
94 #   incomplete.
95 # - cairo/pango:
96 #   Needs pango for text layout, uses cairo methods to draw stuff
97 # - xlib:
98 #   needs cairo+pango,
99 #   can make use of gnomeui and inotify support (??? unsure),
100 #   needs libXaw for UI
101 #   UI also links directly against libX11, libXmu, and libXt
102 #   and uses libXpm if available so we make sure it always is
103
104 # There can be swig-generated bindings for the following languages (/tclpkg/gv):
105 # - c-sharp (disabled)
106 # - scheme (enabled via guile) ... no longer broken on ~x86
107 # - io (disabled)
108 # - java (enabled via java) *2
109 # - lua (enabled via lua)
110 # - ocaml (enabled via ocaml)
111 # - perl (enabled via perl) *1
112 # - php (enabled via php) *2
113 # - python (enabled via python) *1
114 # - ruby (enabled via ruby) *1
115 # - tcl (enabled via tcl)
116 # *1 = The ${P}-bindings.patch takes care that those bindings are installed to the right location
117 # *2 = Those bindings don't build because the paths for the headers/libs aren't
118 #      detected correctly and/or the options passed to swig are wrong (-php instead of -php4/5)
119
120 # There are several other tools in /tclpkg:
121 # gdtclft, tcldot, tclhandle, tclpathplan, tclstubs ; enabled with: --with-tcl
122 # tkspline, tkstubs ; enabled with: --with-tk
123
124 # And the commands (/cmd):
125 # - dot, dotty, gvedit, gvpr, lefty, lneato, smyrna, tools/* :)
126 #   sci-libs/gts can be used for some of these
127 # - lefty:
128 #   needs Xaw and X to build
129 # - gvedit (via 'qt5'):
130 #   based on ./configure it needs qt-core and qt-gui only
131 # - smyrna : experimental opengl front-end (via 'smyrna')
132 #   currently disabled -- it segfaults a lot
133 #   needs x11-libs/gtkglext, gnome-base/libglade, media-libs/freeglut
134 #   sci-libs/gts, x11-libs/gtk.  Also needs 'gtk','glade','glut','gts' and 'png'
135 #   with flags enabled at configure time
136
137 PATCHES=(
138         "${FILESDIR}"/${PN}-2.34.0-Xaw-configure.patch
139         "${FILESDIR}"/${P}-qt5.patch
140 )
141
142 pkg_setup() {
143         use python && python-single-r1_pkg_setup
144
145         java-pkg-opt-2_pkg_setup
146 }
147
148 src_prepare() {
149         default
150
151         # ToDo: Do the same thing for examples and/or
152         #       write a patch for a configuration-option
153         #       and send it to upstream
154         # note - the longer sed expression removes multi-line assignments that are extended via '\'
155         if ! use doc ; then
156                 find . -iname Makefile.am \
157                         | xargs sed -i -e '/^\(html\|pdf\)_DATA.*\\[[:space:]]*$/{:m;N;s/\\\n//;tm;d}' \
158                                 -e '/^\(html\|pdf\)_DATA/d' || die
159         fi
160
161         # This is an old version of libtool
162         # use the ./configure option to exclude its use, and
163         # delete the dir since we don't need to eautoreconf it
164         rm -r libltdl || die
165
166         # no nls, no gettext, no iconv macro, so disable it
167         if ! use nls ; then
168                 sed -i -e '/^AM_ICONV/d' configure.ac || die
169         fi
170
171         # Nuke the dead symlinks for the bindings
172         sed -i -e '/$(pkgluadir)/d' tclpkg/gv/Makefile.am || die
173
174         # replace the whitespace with tabs
175         sed -i -e 's:  :\t:g' doc/info/Makefile.am || die
176
177         # use correct version of qmake. bug #567236
178         sed -i -e "/AC_CHECK_PROGS(QMAKE/a AC_SUBST(QMAKE,$(qt5_get_bindir)/qmake)" configure.ac || die
179
180         # workaround for http://www.graphviz.org/mantisbt/view.php?id=1895
181         use elibc_FreeBSD && append-flags $(test-flags -fno-builtin-sincos)
182
183         use java && append-cppflags $(java-pkg_get-jni-cflags)
184
185         eautoreconf
186 }
187
188 src_configure() {
189         local myconf=(
190                 --enable-ltdl
191                 --disable-silent-rules
192                 $(use_enable static-libs static)
193         )
194
195         # libtool file collision, bug 276609
196         myconf+=( --without-included-ltdl --disable-ltdl-install )
197
198         myconf+=(
199                 $(use_with cairo pangocairo)
200                 $(use_with devil)
201                 $(use_with gtk)
202                 $(use_with gts)
203                 $(use_with qt5 qt)
204                 $(use_with lasi)
205                 $(use_with pdf poppler)
206                 $(use_with postscript ghostscript)
207                 $(use_with svg rsvg)
208                 $(use_with X x)
209                 $(use_with X xaw)
210                 $(use_with X lefty)
211                 --with-digcola
212                 --with-fontconfig
213                 --with-freetype2
214                 --with-ipsepcola
215                 --with-libgd
216                 --with-sfdp
217                 $(use_enable gdk-pixbuf)
218                 --without-ming
219         )
220
221         # new/experimental features, to be tested, disable for now
222         myconf+=(
223                 --with-cgraph
224                 --without-glitz
225                 --without-ipsepcola
226                 --without-smyrna
227                 --without-visio
228         )
229
230         # Bindings:
231         myconf+=(
232                 $(use_enable guile)
233                 --disable-io
234                 $(use_enable java)
235                 --disable-lua
236                 --disable-ocaml
237                 $(use_enable perl)
238                 --disable-php
239                 $(use_enable python)
240                 --disable-r
241                 $(use_enable ruby)
242                 --disable-sharp
243                 $(use_enable tcl)
244         )
245
246         econf ${myconf[@]}
247 }
248
249 src_install() {
250         sed -i -e "s:htmldir:htmlinfodir:g" doc/info/Makefile || die
251
252         emake DESTDIR="${D}" \
253                 txtdir="${EPREFIX}"/usr/share/doc/${PF} \
254                 htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
255                 htmlinfodir="${EPREFIX}"/usr/share/doc/${PF}/html/info \
256                 pdfdir="${EPREFIX}"/usr/share/doc/${PF}/pdf \
257                 pkgconfigdir="${EPREFIX}"/usr/$(get_libdir)/pkgconfig \
258                 install
259
260         if use !examples; then
261                 rm -r "${ED}"/usr/share/graphviz/demo || die
262         fi
263
264         if use !static-libs; then
265                 find "${ED}" -name '*.la' -delete || die
266         fi
267
268         dodoc AUTHORS ChangeLog NEWS README
269
270         use python && python_optimize \
271                 "${D}$(python_get_sitedir)" \
272                 "${D}/usr/$(get_libdir)/graphviz/python"
273 }
274
275 pkg_postinst() {
276         # This actually works if --enable-ltdl is passed
277         # to configure
278         dot -c || die
279 }
280
281 pkg_postrm() {
282         # Remove cruft, bug #547344
283         rm -rf "${EROOT}"usr/lib/graphviz/config{,6} || die
284 }