Name:           graphviz
Summary:        Graph Visualization Tools
Version:        2.26.3
Release:        2%{?_dist_release}
Group:          Applications/Graphics
License:        CPL
URL:            http://www.graphviz.org/

Source:         http://www.graphviz.org/pub/%{name}/stable/SOURCES/%{name}-%{version}.tar.gz
Patch10:        %{name}-%{version}_dont_regard_tiger_as_the_only_ppc.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-root

BuildRequires:  bison
BuildRequires:  cairo-devel
BuildRequires:  expat-devel
BuildRequires:  flex
BuildRequires:  fontconfig-devel
BuildRequires:  freetype2-devel
BuildRequires:  gd-devel
BuildRequires:  gtk2-devel
BuildRequires:  guile-devel
BuildRequires:  libjpeg-turbo-devel
BuildRequires:  libpng-devel 
BuildRequires:  libSM-devel
BuildRequires:  libtool-ltdl-devel >= 2.2.6a
BuildRequires:	libXaw-devel
BuildRequires:  libXext-devel
BuildRequires:  m4
BuildRequires:  perl
BuildRequires:  python-devel
BuildRequires:  ruby-devel
BuildRequires:  swig
BuildRequires:  tcl >= 8.4
BuildRequires:  tk >= 8.4
BuildRequires:  zlib-devel
Requires:	urw-fonts

# only for this release
BuildConflicts: graphviz-devel

%description
A collection of tools and tcl packages for the manipulation and layout
of graphs (as in nodes and edges, not as in barcharts).

%package devel
Group:          Development/Libraries
Summary:        Development tools for version %{version} of %{name}
Requires:       %{name} = %{version}

%description devel
The %{name}-devel package contains the header files
and man3 pages necessary for developing programs
using version %{version} of the %{name} libraries.

%package doc
Summary: PDF and HTML documents for graphviz
Group:	 Applications/Documentation

%description doc
Provides some additional PDF and HTML documentation for graphviz.

%package guile
Group:          Applications/Graphics
Summary:	Guile extension for graphviz
Requires:	%{name} = %{version}-%{release}, guile

%description guile
Guile extension for graphviz.

%package perl
Group:    Applications/Graphics
Summary:  Perl extension for graphviz
Requires: %{name} = %{version}-%{release}
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description perl
Perl extension for graphviz.

%package python
Group:    Applications/Graphics
Summary:  Python extension for graphviz
Requires: %{name} = %{version}-%{release}
Requires: python

%description python
Python extension for graphviz.

%package ruby
Group:	  Applications/Multimedia
Summary:  Ruby extension for graphviz
Requires: %{name} = %{version}-%{release}
Requires: ruby

%description ruby
Ruby extension for graphviz.

%package tcl
Group:    Applications/Graphics
Summary:  Tcl extension & tools for graphviz
Requires: tcl >= 8.4, tk >= 8.4
Requires: %{name} = %{version}

%description tcl
Various tcl packages (extensions) for the graphviz tools.


%prep
%setup -q
%patch10 -p1

# using archdir instead of sitearchdir for Vine
sed -i -e "s|sitearchdir|archdir|g" config/config_ruby.rb

autoreconf -f -i

%build
# XXX ix86 only used to have -ffast-math, let's use everywhere
%{expand: %%define optflags %{optflags} -ffast-math}

%configure \
    --with-x \
    --disable-static \
    --with-mylibgd \
    --with-ipsepcola \
    --with-pangocairo \
    --with-gdk-pixbuf \
    --without-mylibgd \
    --without-ming \
    --disable-sharp \
    --enable-guile \
    --enable-io \
    --disable-java \
    --disable-lua \
    --disable-ocaml \
    --enable-perl \
    --disable-php \
    --enable-python \
    --disable-r \
    --enable-ruby \
    --enable-tcl

make %{?_smp_mflags} 

%install
rm -rf $RPM_BUILD_ROOT __doc
make DESTDIR=$RPM_BUILD_ROOT \
    docdir=$RPM_BUILD_ROOT%{_docdir}/%{name} \
    pkgconfigdir=%{_libdir}/pkgconfig \
    install

find ${RPM_BUILD_ROOT} -type f -name "*.la" -exec rm -f {} ';'
chmod -x $RPM_BUILD_ROOT%{_datadir}/%{name}/lefty/*
cp -a $RPM_BUILD_ROOT%{_datadir}/%{name}/doc __doc
rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/doc

%clean
rm -rf $RPM_BUILD_ROOT

# run "dot -c" to generate plugin config in %{_libdir}/%{name}/config
%post
/sbin/ldconfig
%{_bindir}/dot -c

# if there is no dot after everything else is done, then remove config
%postun
if [ $1 -eq 0 ]; then
    rm -f %{_libdir}/graphviz/config || :
fi
/sbin/ldconfig


%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog NEWS README
%{_bindir}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/lefty
%{_mandir}/man1/*
%{_mandir}/man7/*
%dir %{_libdir}/%{name}
%{_libdir}/*.so.*
%{_libdir}/%{name}/*.so.*
%exclude %{_libdir}/graphviz/*/*

%files devel
%defattr(-,root,root)
%{_includedir}/%{name}
%{_libdir}/*.so
%{_libdir}/%{name}/*.so
%{_libdir}/pkgconfig/*.pc
%{_datadir}/%{name}/graphs
%{_mandir}/man3/*.3.gz

%files doc
%defattr(-,root,root,-)
%doc __doc/*

%files guile
%defattr(-,root,root,-)
%{_libdir}/graphviz/guile/
%{_mandir}/man3/gv.3guile*

%files perl
%defattr(-,root,root,-)
%{_libdir}/graphviz/perl/
%{perl_vendorarch}/*
%{_mandir}/man3/gv.3perl*

%files python
%defattr(-,root,root,-)
%{_libdir}/graphviz/python/
%{_libdir}/python*/*
%{_mandir}/man3/gv.3python*

%files ruby
%defattr(-,root,root,-)
%{_libdir}/graphviz/ruby/
%{rarchdir}/*
%{_mandir}/man3/gv.3ruby*

%files tcl
%defattr(-,root,root)
%{_libdir}/%{name}/tcl/*
%{_libdir}/tcl*/*
%{_datadir}/%{name}/demo
# hack to include gv.3tcl only if available
#  always includes tcldot.3tcl, gdtclft.3tcl
%{_mandir}/man3/*.3tcl*
%{_mandir}/man3/tkspline.3tk*


%changelog
* Sun Oct 10 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.26.3-2
- add Patch10 to avoid build failure on ppc

* Sat Oct  9 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.26.3-1
- new upstream release
- built with rpm-4.8.1
- split doc, guile, perl, python, ruby subpackage

* Thu Apr 16 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 2.20.3-3
- rebuild with libtool-2.2.6a

* Sun Nov 09 2008 Shu KONNO <owa@bg.wakwak.com> 2.20.3-1
- new upstream release

* Sun Nov 09 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.20.2-2
- rebuild with libXaw.so.7 (libXaw-1.0.5)

* Wed Jul 16 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.20.2-1
- new upstream release

* Wed Feb 20 2008 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.16.1-0vl1
- new upstream release
- build with expat-2.0.1
- add man7

* Tue Oct 09 2007 Shu KONNO <owa@bg.wakwak.com> 2.12-0vl2
- rebuild with tcl/tk-8.4.16

* Sun May 13 2007 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.12-0vl1
- new upstream release
- add BuildPrereq: swig
- delete BuildPrereq: gd-progs gd-devel
- add --with-mylibgd and --disable-FEATURE to configure option
- update %%files

* Sun Jul 30 2006 NAKAMURA Kenta <kenta@vinelinux.org> 2.6-0vl2
- added BuildPrereq: ruby-devel

* Tue Oct 11 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.6-0vl1
- new upstream release
- add BuildPrereq: libtool-ltdl-devel
- move pkgconfig files to %%{_libdir}/pkgconfig
- add --disable-rpath --disable-static to configure option
- add %%post to every package

* Mon Jan 24 2005 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 2.2-0vl1
- new upstream release
- BuildPrereq: tcl >= 8.4, tk >= 8.4
- add BuildPrereq: gd-progs gd-devel flex bison pkgconfig
- update %%files
- remove lines about Vine2.6
- change License to CPL

* Sun May 16 2004 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.12-0vl1
- source upgrade
- remove patch0 and commented lines

* Tue Dec 16 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.10-0vl2
- build for VineSeed

* Tue Dec 16 2003 AKIYAMA Kazuhito <akiyama@yb3.so-net.ne.jp> 1.10-0vl1
- source upgrade
- change spec to build both VineSeed and Vine2.5/2.6
- add BuildPrereq: expat-devel and Requires: libexpat
- add patch0 to build against freetype2-2.1.7
- stop using autogen.sh script
- add BuildPrereq: tcl >= 8.3 tk >= 8.3 (VineSeed)
- add graphviz-tcl package (VineSeed)

* Thu Aug  7 2003 USAMI Kosuke <usami-k@yc5.so-net.ne.jp> - 1.9-0vl2
- rebuild for new Vine

* Wed Mar 05 2003 Kunio Murasawa <murasawa@fa2.so-net.ne.jp> 1.9-0vl1
- import from offical site (src.rpm)