File graphviz.spec of Package graphviz

#
# spec file for package graphviz (Version 2.26.3)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


#name of the plugin config file that dot creates
%define config_file config6

Name:           graphviz
BuildRequires:  fdupes libexpat-devel libjpeg-devel libpng-devel zlib-devel
BuildRequires:  freetype2-devel >= 2 gcc-c++ libstdc++-devel
BuildRequires:  bison flex glib2-devel xorg-x11-devel
BuildRequires:  xorg-x11-libICE-devel xorg-x11-libSM-devel xorg-x11-libXpm-devel
BuildRequires:  xorg-x11-libX11-devel xorg-x11-libXext-devel xorg-x11-libXmu-devel xorg-x11-libXt-devel
PreReq:         /bin/rm
Version:        2.26.3
Release:        6
AutoReqProv:    on
Summary:        Graph Visualization Tools
Group:          Productivity/Graphics/Visualization/Graph
Source:         http://www.graphviz.org/pub/graphviz/ARCHIVE/%{name}-%{version}.tar.bz2
Source2:        graphviz-rpmlintrc
Patch0:         graphviz-fix-pkgIndex.patch
Patch3:         graphviz-neato_splines.patch
Patch11:        graphviz-2.20.2-interpreter_names.patch
Patch13:        graphviz-stddefs.patch
Patch14:        graphviz-gd_png_check_sig.patch
Patch15:        graphviz-wrong_index.patch
Patch16:        graphviz-sequence_point.patch
Url:            http://www.graphviz.org/
License:        IBM Public License ..
Prefix:         /usr
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
PreReq:         /bin/cat
Recommends:     graphviz-gnome = %{version}
Recommends:     graphviz-gd = %{version}

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



Authors:
--------
    David Dobkin <dpd@cs.princeton.edu>
    John Ellson  <ellson@graphviz.org>
    Emden Gansner <erg@research.att.com>
    Eleftherios Koutsofios <ek@research.att.com>
    Stephen North <north@research.att.com>
    Kiem-Phong Vo <kpv@research.att.com>
    Gordon Woodhull <gmcw@worldnet.att.net>

%package devel
License:        IBM Public License ..
Group:          Development/Libraries/C and C++
Summary:        Graphiviz development package
Requires:       %{name} = %{version}
Requires:       glibc-devel tcl-devel fontconfig-devel expat freetype2-devel 
Requires:       libjpeg-devel libpng-devel zlib-devel libtool perl 
Requires:       libstdc++-devel tk-devel

%description devel
The graphviz-devel package contains all that's necessary for developing
programs that use the graphviz libraries including man3 pages.

Note: If you need output in png format you also need to install
      graphviz-gnome.

Authors:
--------
    David Dobkin <dpd@cs.princeton.edu>
    John Ellson  <ellson@graphviz.org>
    Emden Gansner <erg@research.att.com>
    Eleftherios Koutsofios <ek@research.att.com>
    Stephen North <north@research.att.com>
    Kiem-Phong Vo <kpv@research.att.com>
    Gordon Woodhull <gmcw@worldnet.att.net>

%prep
%setup -q
%patch0
%patch3
%patch11
%patch13
%patch14
%patch15
%patch16
# Fix path in generated man pages
sed -e 's$@LIB_DIR@$%{_libdir}$g' tclpkg/gv/gv_doc_langs.tcl >tclpkg/gv/gv_doc_langs.tcl.new && mv tclpkg/gv/gv_doc_langs.tcl.new tclpkg/gv/gv_doc_langs.tcl
# remove broken macros
rm m4/iconv.m4 m4/lib-*.m4
cp /usr/share/gettext/config.rpath config

%build
./autogen.sh
touch tclpkg/gv/gv.i
WARN_FLAGS="-W -Wall -Wno-unused-parameter -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith"
CFLAGS="$RPM_OPT_FLAGS $WARN_FLAGS"
%ifarch %ix86 x86_64
CFLAGS="$CFLAGS -ffast-math"
%endif
CC=gcc
RANLIB=:
export CC RANLIB
export CFLAGS="$CFLAGS"
export CPPFLAGS="%optflags"
./configure \
      --prefix=%{_prefix} \
      --bindir=%{_bindir} \
      --libdir=%{_libdir} \
      --includedir=%{_includedir} \
      --datadir=%{_datadir} \
      --mandir=%{_mandir} \
      --with-x \
      --with-mylibgd \
      --disable-static \
      --disable-dependency-tracking \
      --enable-ltdl-install=no \
      --with-ipsepcola \
      --without-ming \
      --disable-io
make %{?jobs:-j%jobs} DESTDIR=%buildroot

%install
make install \
	DESTDIR=%{buildroot} \
	docdir=%{buildroot}%{_docdir}/%{name} \
	pkgconfigdir=%{_libdir}/pkgconfig
find %{buildroot} -type f -name "*.la" -print0 | xargs -0 rm -f
mkdir -p %{buildroot}/%{_docdir}
mkdir -p %{buildroot}%{_datadir}/%{name}
rm -f %buildroot/%{_libdir}/%{name}/pkgIndex.tcl
chmod -x %{buildroot}%{_datadir}/%{name}/lefty/*
cp -a %{buildroot}%{_datadir}/%{name}/doc __doc
rm -rf %{buildroot}%{_datadir}/%{name}/doc
mkdir -p %{buildroot}%{_libdir}/graphviz
touch %{buildroot}%{_libdir}/graphviz/config
mkdir -p %{buildroot}/etc/ld.so.conf.d/
cat <<EOF >%{buildroot}/etc/ld.so.conf.d/%{name}.conf
%{_libdir}/%{name}
%{_libdir}/%{name}/sharp
%{_libdir}/%{name}/java
%{_libdir}/%{name}/perl
%{_libdir}/%{name}/php
%{_libdir}/%{name}/ocaml
%{_libdir}/%{name}/python
%{_libdir}/%{name}/lua
%{_libdir}/%{name}/tcl
%{_libdir}/%{name}/guile
%{_libdir}/%{name}/ruby
EOF
#Correct the path to the shared library
for manfile in $(find %{buildroot} -name \*.man); do
    sed -e 's$/usr/lib/graphviz$%{_libdir}/%{name}$g' $manfile > ${manfile}.new && mv ${manfile}.new ${manfile}
done
rm -f %{buildroot}%{_libdir}/graphviz/libgvplugin_gd.*
rm -f %{_libdir}/graphviz/libgvplugin_pango*
rm -f %{_libdir}/graphviz/libgvplugin_gdk_pixbuf*
rm -f %{_libdir}/graphviz/libgvplugin_gtk*
#%clean
#rm -rf %buildroot

%post
/sbin/ldconfig
# run "dot -c" to generate plugin config %_libdir/graphviz/config
dot -c
test -s %{_libdir}/graphviz/%{config_file} || echo "%{_libdir}/graphviz/%{config_file} doesn't exist! Check installation."

%postun
/sbin/ldconfig
if ! test -x $RPM_INSTALL_PREFIX0/bin/dot; then rm -f $RPM_INSTALL_PREFIX0/%{_lib}/graphviz/%{config_file}; fi

%files
%defattr(-,root,root)
%doc doc/FAQ.html AUTHORS COPYING README NEWS ChangeLog
%attr(755,root,root) %{_bindir}/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/lefty
%{_datadir}/%{name}/graphs
%doc %{_mandir}/man1/*.1*
%doc %{_mandir}/man7/*.7*
%dir %{_libdir}/%{name}
%{_libdir}/*.so.*
%{_libdir}/graphviz/*.so*
#%{_libdir}/graphviz/libgvplugin_core*
#%{_libdir}/graphviz/libgvplugin_dot_layout*
#%{_libdir}/graphviz/libgvplugin_neato_layout*
#%{_libdir}/graphviz/libgvplugin_xlib*
/etc/ld.so.conf.d/graphviz.conf
%ghost %{_libdir}/graphviz/config
#%exclude %{_libdir}/graphviz/libgvplugin_pango*
#%exclude %{_libdir}/graphviz/libgvplugin_gdk_pixbuf*
#%exclude %{_libdir}/graphviz/libgvplugin_gtk*

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

%changelog
openSUSE Build Service is sponsored by