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