LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File graphviz.spec of Package graphviz-plugins (Project graphics)

#
# spec file for package graphviz
#
# Copyright (c) 2012 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
Version:        2.28.0
Release:        0
Summary:        Graph Visualization Tools
License:        IPL-1.0
Group:          Productivity/Graphics/Visualization/Graph
Url:            http://www.graphviz.org/
Source:         http://www.graphviz.org/pub/graphviz/ARCHIVE/%{name}-%{version}.tar.gz
Source2:        graphviz-rpmlintrc
Patch1:         graphviz-gd_png_check_sig.patch
Patch2:         graphviz-fix-pkgIndex.patch
Patch3:         graphviz-missing_headers.patch
BuildRequires:  bison
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  freetype2-devel >= 2
BuildRequires:  gcc-c++
BuildRequires:  libexpat-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  libstdc++-devel
BuildRequires:  libtool
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
Requires(pre):  /bin/cat
Requires(pre):  /bin/rm
Recommends:     graphviz-gd = %{version}
Recommends:     graphviz-gnome = %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%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).

%package devel
Summary:        Graphiviz development package
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       expat
Requires:       fontconfig-devel
Requires:       freetype2-devel
Requires:       glibc-devel
Requires:       libjpeg-devel
Requires:       libpng-devel
Requires:       libstdc++-devel
Requires:       libtool
Requires:       perl
Requires:       tcl-devel
Requires:       tk-devel
Requires:       zlib-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.

%prep
%setup -q
%patch1
%patch2
%patch3 -p1

# 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

%build
WARN_FLAGS="-W -Wall -Wno-unused-parameter -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith"
CFLAGS="%{optflags} $WARN_FLAGS"
%ifarch %ix86 x86_64
CFLAGS="$CFLAGS -ffast-math"
%endif

export CFLAGS="$CFLAGS"
export CPPFLAGS="%{optflags}"
%configure \
      --with-x \
      --with-mylibgd \
      --disable-static \
      --enable-ltdl-install=no \
      --with-ipsepcola \
      --without-ming \
      --disable-io \
      --disable-silent-rules \
      --with-mylibgd=no \
      --with-libgd=no
make %{?_smp_mflags} 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}%{_sysconfdir}/ld.so.conf.d/
cat <<EOF >%{buildroot}%{_sysconfdir}/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*

%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*
%{_sysconfdir}/ld.so.conf.d/graphviz.conf
%ghost %{_libdir}/graphviz/config

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

%changelog