File graphviz.spec of Package graphviz

# spec file for package graphviz
# Copyright (c) 2014 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

#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:        EPL-1.0
Group:          Productivity/Graphics/Visualization/Graph
Source2:        graphviz-rpmlintrc
Patch1:         graphviz-gd_png_check_sig.patch
Patch2:         graphviz-fix-pkgIndex.patch
Patch3:         graphviz-missing_headers.patch
Patch4:         graphviz-aarch64_lib64_support.patch
Patch5:         graphviz-type_punning.patch
BuildRequires:  bison
BuildRequires:  fdupes
BuildRequires:  flex
BuildRequires:  freetype2-devel >= 2
BuildRequires:  gcc-c++
BuildRequires:  libXaw-devel
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

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

%setup -q
%patch3 -p1

# Fix path in generated man pages
sed -e 's$@LIB_DIR@$%{_libdir}$g' tclpkg/gv/gv_doc_langs.tcl >tclpkg/gv/ && mv tclpkg/gv/ tclpkg/gv/gv_doc_langs.tcl

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"

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 \
make %{?_smp_mflags} DESTDIR=%{buildroot}

make install \
	DESTDIR=%{buildroot} \
	docdir=%{buildroot}%{_docdir}/%{name} \

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}/
cat <<EOF >%{buildroot}%{_sysconfdir}/{name}.conf

#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}
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*

# 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."

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

%attr(755,root,root) %{_bindir}/*
%dir %{_datadir}/%{name}
%doc %{_mandir}/man1/*.1*
%doc %{_mandir}/man7/*.7*
%dir %{_libdir}/%{name}
%ghost %{_libdir}/graphviz/config

%files devel

openSUSE Build Service is sponsored by