1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_{6,7,8} )
7 inherit autotools flag-o-matic java-pkg-opt-2 python-single-r1 qmake-utils
9 DESCRIPTION="Open Source Graph Visualization Software"
10 HOMEPAGE="https://www.graphviz.org/ https://gitlab.com/graphviz/graphviz/"
11 SRC_URI="https://www2.graphviz.org/Packages/stable/portable_source/${P}.tar.gz"
15 KEYWORDS="alpha amd64 arm arm64 hppa ia64 ~mips ppc ppc64 s390 ~sh sparc x86 ~amd64-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"
19 !cairo? ( !X !gtk !postscript !lasi )
20 python? ( ${PYTHON_REQUIRED_USE} )"
22 # Requires ksh, tests against installed package, missing files and directory
29 nls? ( >=sys-devel/gettext-0.14.5 )
30 perl? ( dev-lang/swig )
31 python? ( dev-lang/swig )
32 ruby? ( dev-lang/swig )
33 tcl? ( dev-lang/swig )
37 >=dev-libs/glib-2.11.1:2
39 >=media-libs/fontconfig-2.3.95
40 >=media-libs/freetype-2.1.10
41 >=media-libs/gd-2.0.34:=[fontconfig,jpeg,png,truetype,zlib]
42 >=media-libs/libpng-1.2:0=
47 >=x11-libs/cairo-1.1.10[svg]
50 devil? ( media-libs/devil[png,jpeg] )
51 gtk? ( x11-libs/gtk+:2 )
53 lasi? ( media-libs/lasi )
54 pdf? ( app-text/poppler )
55 perl? ( dev-lang/perl:= )
56 postscript? ( app-text/ghostscript-gpl )
57 python? ( ${PYTHON_DEPS} )
61 dev-qt/qtprintsupport:5
64 ruby? ( dev-lang/ruby:* )
65 svg? ( gnome-base/librsvg )
66 tcl? ( >=dev-lang/tcl-8.3:0= )
86 # Dependency description / Maintainer-Info:
88 # Rendering is done via the following plugins (/plugins):
89 # - core, dot_layout, neato_layout, gd , dot
90 # the ones which are always compiled in, depend on zlib, gd
92 # Directly depends on gtk-2.
93 # needs 'pangocairo' enabled in graphviz configuration
94 # gtk-2 depends on pango, cairo and libX11 directly.
96 # Disabled, GTK-1 junk.
98 # Disabled, no particular reason
99 # needs 'pangocairo' enabled in graphviz configuration
101 # flash plugin via -Tswf requires media-libs/ming-0.4. Disabled as it's
104 # Needs pango for text layout, uses cairo methods to draw stuff
107 # can make use of gnomeui and inotify support (??? unsure),
108 # needs libXaw for UI
109 # UI also links directly against libX11, libXmu, and libXt
110 # and uses libXpm if available so we make sure it always is
112 # There can be swig-generated bindings for the following languages (/tclpkg/gv):
113 # - c-sharp (disabled)
114 # - scheme (enabled via guile) ... no longer broken on ~x86
117 # - java (enabled via java) *2
118 # - lua (enabled via lua)
119 # - ocaml (enabled via ocaml)
120 # - perl (enabled via perl) *1
121 # - php (enabled via php) *2
122 # - python (enabled via python) *1
123 # - ruby (enabled via ruby) *1
124 # - tcl (enabled via tcl)
125 # *1 = The ${P}-bindings.patch takes care that those bindings are installed to the right location
126 # *2 = Those bindings don't build because the paths for the headers/libs aren't
127 # detected correctly and/or the options passed to swig are wrong (-php instead of -php4/5)
129 # There are several other tools in /tclpkg:
130 # gdtclft, tcldot, tclhandle, tclpathplan, tclstubs ; enabled with: --with-tcl
131 # tkspline, tkstubs ; enabled with: --with-tk
133 # And the commands (/cmd):
134 # - dot, dotty, gvedit, gvpr, lefty, lneato, smyrna, tools/* :)
135 # sci-libs/gts can be used for some of these
137 # needs Xaw and X to build
138 # - gvedit (via 'qt5'):
139 # based on ./configure it needs qt-core and qt-gui only
140 # - smyrna : experimental opengl front-end (via 'smyrna')
141 # currently disabled -- it segfaults a lot
142 # needs x11-libs/gtkglext, gnome-base/libglade, media-libs/freeglut
143 # sci-libs/gts, x11-libs/gtk. Also needs 'gtk','glade','glut','gts' and 'png'
144 # with flags enabled at configure time
146 PATCHES=( "${FILESDIR}"/${PN}-2.34.0-Xaw-configure.patch )
149 use python && python-single-r1_pkg_setup
151 java-pkg-opt-2_pkg_setup
157 # ToDo: Do the same thing for examples and/or
158 # write a patch for a configuration-option
159 # and send it to upstream
160 # note - the longer sed expression removes multi-line assignments that are extended via '\'
162 find . -iname Makefile.am \
163 | xargs sed -i -e '/^\(html\|pdf\)_DATA.*\\[[:space:]]*$/{:m;N;s/\\\n//;tm;d}' \
164 -e '/^\(html\|pdf\)_DATA/d' || die
167 # This is an old version of libtool
168 # use the ./configure option to exclude its use, and
169 # delete the dir since we don't need to eautoreconf it
172 # Nuke the dead symlinks for the bindings
173 sed -i -e '/$(pkgluadir)/d' tclpkg/gv/Makefile.am || die
175 # replace the whitespace with tabs
176 sed -i -e 's: :\t:g' doc/info/Makefile.am || die
178 # use correct version of qmake. bug #567236
179 sed -i -e "/AC_CHECK_PROGS(QMAKE/a AC_SUBST(QMAKE,$(qt5_get_bindir)/qmake)" configure.ac || die
181 # workaround for http://www.graphviz.org/mantisbt/view.php?id=1895
182 use elibc_FreeBSD && append-flags $(test-flags -fno-builtin-sincos)
184 use java && append-cppflags $(java-pkg_get-jni-cflags)
192 $(use_with cairo pangocairo)
194 $(use_enable gdk-pixbuf)
199 $(use_with pdf poppler)
200 $(use_with postscript ghostscript)
201 $(use_enable static-libs static)
213 # new/experimental features, to be tested, disable for now
223 $(use_enable python python2)
224 $(use_enable python python3)
235 # libtool file collision, bug #276609
236 --without-included-ltdl
237 --disable-ltdl-install
243 sed -i -e "s:htmldir:htmlinfodir:g" doc/info/Makefile || die
245 emake DESTDIR="${D}" \
246 txtdir="${EPREFIX}"/usr/share/doc/${PF} \
247 htmldir="${EPREFIX}"/usr/share/doc/${PF}/html \
248 htmlinfodir="${EPREFIX}"/usr/share/doc/${PF}/html/info \
249 pdfdir="${EPREFIX}"/usr/share/doc/${PF}/pdf \
250 pkgconfigdir="${EPREFIX}"/usr/$(get_libdir)/pkgconfig \
253 if ! use examples; then
254 rm -rf "${ED}"/usr/share/graphviz/demo || die
257 if ! use static-libs; then
258 find "${ED}" -name '*.la' -delete || die
263 use python && python_optimize \
264 "${D}$(python_get_sitedir)" \
265 "${D}/usr/$(get_libdir)/graphviz/python2" \
266 "${D}/usr/$(get_libdir)/graphviz/python3"
270 # This actually works if --enable-ltdl is passed
276 # Remove cruft, bug #547344
277 rm -rf "${EROOT}"/usr/$(get_libdir)/graphviz/config{,6} || die