Reworked the graphviz package (#6865)

The url in graphviz has been fixed and its version has been 
updated to the latest available (2.40.1). Added variants for 
expat, qt, gtk+ and ghostscript.
This commit is contained in:
Federico Ficarelli 2018-01-15 15:26:14 +01:00 committed by Massimiliano Culpo
parent 43190a6bf6
commit 6093d6df7d

View File

@ -23,16 +23,17 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
import os
import sys
import shutil
class Graphviz(AutotoolsPackage):
"""Graph Visualization Software"""
homepage = 'http://www.graphviz.org'
url = 'http://www.graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.38.0.tar.gz'
version('2.38.0', '5b6a829b2ac94efcd5fa3c223ed6d3ae')
# This commit hash is tag='stable_release_2.40.1'
version('2.40.1', git='https://gitlab.com/graphviz/graphviz.git',
commit='67cd2e5121379a38e0801cc05cce5033f8a2a609')
# We try to leave language bindings enabled if they don't cause
# build issues or add dependencies.
@ -78,9 +79,16 @@ class Graphviz(AutotoolsPackage):
description='Build with pango+cairo support (more output formats)')
variant('libgd', default=False,
description='Build with libgd support (more output formats)')
variant('gts', default=False,
description='Build with GNU Triangulated Surface Library')
variant('expat', default=False,
description='Build with Expat support (enables HTML-like labels)')
variant('ghostscript', default=False,
description='Build with Ghostscript support')
variant('qt', default=False,
description='Build with Qt support')
variant('gtkplus', default=False,
description='Build with GTK+ support')
parallel = False
@ -96,28 +104,51 @@ class Graphviz(AutotoolsPackage):
'+python', '+r', '+ruby', '+tcl')
for b in tested_bindings + untested_bindings:
depends_on('swig', when=b)
depends_on('cairo', when='+pangocairo')
depends_on('pango', when='+pangocairo')
depends_on('libgd', when='+libgd')
depends_on('gts', when='+gts')
depends_on('ghostscript')
depends_on('freetype')
depends_on('expat')
depends_on('libtool')
depends_on('pkgconfig', type='build')
depends_on('swig', type='build', when=b)
depends_on('java', when='+java')
depends_on('python@2:2.8', when='+python')
def patch(self):
# Fix a few variable names, gs after 9.18 renamed them
# See http://lists.linuxfromscratch.org/pipermail/blfs-book/2015-October/056960.html
if self.spec.satisfies('^ghostscript@9.18:'):
kwargs = {'ignore_absent': False, 'backup': True, 'string': True}
filter_file(' e_', ' gs_error_', 'plugin/gs/gvloadimage_gs.c',
**kwargs)
# +pangocairo
depends_on('cairo', when='+pangocairo')
depends_on('pango', when='+pangocairo')
depends_on('freetype', when='+pangocairo')
depends_on('glib', when='+pangocairo')
depends_on('fontconfig', when='+pangocairo')
depends_on('libpng', when='+pangocairo')
depends_on('zlib', when='+pangocairo')
# +libgd
depends_on('libgd', when='+libgd')
depends_on('fontconfig', when='+libgd')
depends_on('freetype', when='+libgd')
# +gts
depends_on('gts', when='+gts')
# +expat
depends_on('expat', when='+expat')
# +ghostscript
depends_on('ghostscript', when='+ghostscript')
# +qt
depends_on('qt', when='+qt')
# +gtkplus
depends_on('gtkplus', when='+gtkplus')
# Build dependencies
depends_on('pkg-config', type='build')
# The following are needed when building from git
depends_on('automake', type='build')
depends_on('autoconf', type='build')
depends_on('bison', type='build')
depends_on('flex', type='build')
depends_on('libtool', type='build')
def autoreconf(self, spec, prefix):
# We need to generate 'configure' when checking out sources from git
# If configure exists nothing needs to be done
if os.path.exists(self.configure_abs_path):
return
# Else bootstrap (disabling auto-configure with NOCONFIG)
bash = which('bash')
bash('./autogen.sh', 'NOCONFIG')
def configure_args(self):
spec = self.spec
@ -150,11 +181,17 @@ def configure_args(self):
else:
options.append('--enable-swig=no')
for var in ('+pangocairo', '+libgd', '+gts'):
for var in ('+pangocairo', '+libgd', '+gts', '+expat', '+ghostscript',
'+qt', '+gtkplus'):
feature = var[1:]
if feature == 'gtkplus':
# In spack terms, 'gtk+' is 'gtkplus' while
# the relative configure option is 'gtk'
feature = 'gtk'
if var in spec:
options.append('--with-{0}'.format(var[1:]))
options.append('--with-{0}'.format(feature))
else:
options.append('--without-{0}'.format(var[1:]))
options.append('--without-{0}'.format(feature))
# On OSX fix the compiler error:
# In file included from tkStubLib.c:15:
@ -163,7 +200,4 @@ def configure_args(self):
if sys.platform == 'darwin':
options.append('CFLAGS=-I/opt/X11/include')
# A hack to patch config.guess in the libltdl sub directory
shutil.copyfile('./config/config.guess', 'libltdl/config/config.guess')
return options