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