File rrdtool.spec of Package rrdtool.import4564

#
# spec file for package rrdtool
#
# Copyright (c) 2011 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:           rrdtool
BuildRequires:  cairo-devel freetype2-devel glib2-devel intltool libart_lgpl-devel libpng-devel libxml2-devel pango-devel python-devel tcl-devel
%if 0%{?suse_version} >= 1100
BuildRequires:  gettext-tools
%else
BuildRequires:  gettext
%endif
BuildRequires:  ruby-devel
%if 0%{?suse_version} >= 920
%define has_lua 1
BuildRequires:  lua-devel
%endif
BuildRequires:  autoconf automake libtool
BuildRequires:  tcpd-devel
License:        GPLv2+
Group:          Productivity/Scientific/Math
Requires:       perl = %{perl_version}
Version:        1.4.5
Release:        4.<RELEASE5>
%define cgilib_version 0.7
# http://oss.oetiker.ch/rrdtool/pub/rrdtool-%{version}.tar.gz
Source:         %{name}-%{version}.tar.bz2
Patch1:         rrdtool-lua_lib64.patch
Patch2:         rrdtool-tclversion.patch
Patch3:         rrdtool-tclsegfault.patch
# http://www.infodrom.org/projects/cgilib/download/cgilib-%{cgilib_version}.tar.gz
Source1:        cgilib-%{cgilib_version}.tar.bz2
Patch11:        cgilib-fix_automake.patch
Url:            http://oss.oetiker.ch/rrdtool/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary:        A tool for data logging and analysis
Requires:       dejavu

%description
A tool to log and analyze data gathered from all kinds of data sources.
The data analysis part of RRDtool is based on the ability to quickly
generate graphical representations of the data values collected over a
definable time period.

%prep
%setup -q -a1
%if %{_lib}==lib64
%patch1
%endif
%patch2
%patch3
pushd "cgilib-%{cgilib_version}"
%patch11
popd #cgilib

%build
# first prepare cgilib
pushd cgilib-%{cgilib_version}
echo -n > NEWS
aclocal --force
autoreconf -fiv
CGILIB_CFLAGS="%{optflags} -fPIC -I."
%if 0%{?suse_version} >= 1130
CGILIB_CFLAGS="$CGILIB_CFLAGS -fexcess-precision=fast"
%endif
CFLAGS="$CGILIB_CFLAGS" \
%configure
make %{?jobs:-j %jobs}
%__mkdir_p ../lb/include
%__cp *.h ../lb/include/
%__mkdir_p ../lb/lib/
%__cp -a .libs/libcgi.so* ../lb/lib/
popd #cgilib

# build rrdtool
%{suse_update_config}
if [ ! -d m4 ]; then mkdir m4; fi
# we need getext 0.18
#autoreconf -i -f
%if %{_lib}==lib64
# don't pass -i to autoreconf, that'll run autopoint which will go
# nuts because of the supposedly outdated gettext version:
autoreconf -fv
%endif
export LDFLAGS="-L`pwd`/lb/lib" CPPFLAGS="-I`pwd`/lb/include" \
%configure --disable-static --with-pic --enable-shared \
            --with-tcllib=%{_libdir} \
            --with-gnu-ld \
            --disable-rpath \
            --with-rrd-default-font="monospace" 
make %{?jobs:-j %jobs} V=1

%install
#eval `perl -V:installarchlib`
make \
    DESTDIR=$RPM_BUILD_ROOT \
    idocdir=%{_docdir}/%{name}/txt/ \
    ihtmldir=%{_docdir}/%{name}/html/ \
    examplesdir=%{_docdir}/%{name}/examples/ \
    libdir=%{_libdir} \
    pkglibdir=%_datadir/tcl/tclrrd%version \
    TCL_PACKAGE_DIR=%_datadir/tcl/tclrrd%version \
    TCL_PACKAGE_PATH=%_datadir/tcl \
    install
# we install this later again
rm -r $RPM_BUILD_ROOT%{_prefix}/lib/perl
# do not install fonts (use system fonts instead)
rm -rf $RPM_BUILD_ROOT%_datadir/rrdtool/fonts
# install correctly perl modules
pushd bindings/perl-piped 
perl Makefile.PL
make DESTDIR=$RPM_BUILD_ROOT install_vendor
popd
pushd bindings/perl-shared 
perl Makefile.PL
make DESTDIR=$RPM_BUILD_ROOT install_vendor
popd
%perl_process_packlist
#fix build (it would be better to split cgilib)
#sed 's/[[:space:]]*-L\/usr\/src\/packages\/BUILD\/%{name}-%{version}\/lb\/lib[[:space:]]*/ /' $RPM_BUILD_ROOT/%{_libdir}/librrd.la > tmp
#mv tmp $RPM_BUILD_ROOT/%{_libdir}/librrd.la
#sed 's/[[:space:]]*-L\/usr\/src\/packages\/BUILD\/%{name}-%{version}\/lb\/lib[[:space:]]*/ /' $RPM_BUILD_ROOT/%{_libdir}/librrd_th.la > tmp
#mv tmp $RPM_BUILD_ROOT/%{_libdir}/librrd_th.la
find "%{buildroot}" -type f -name '*.la' -exec %__rm {} \;
# documentation
install -m 644 CHANGES CONTRIBUTORS COPYING COPYRIGHT README TODO $RPM_BUILD_ROOT/%{_docdir}/%{name}
# Script libraries for Tcl extensions should be in a package-specific
# subdir of /usr/share/tcl
mkdir -p $RPM_BUILD_ROOT/usr/share/tcl/tclrrd%{version}
#mv $RPM_BUILD_ROOT/usr/lib/tclrrd%{version}/pkgIndex.tcl \
#   $RPM_BUILD_ROOT/usr/share/tcl/tclrrd%{version}

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files
%defattr(-, root, root)
%doc %{_docdir}/rrdtool
%doc %{_mandir}/*/*
/usr/bin/*
%{_datadir}/tcl
%{_libdir}/librrd.so.*
%{_libdir}/librrd_th.so.*
%{_libdir}/tclrrd*.so
%{perl_vendorlib}/RRDp.pm
%{perl_vendorarch}/RRDs.pm
#%{perl_vendorarch}/ntmake.pl
%{perl_vendorarch}/auto/*
%if %suse_version < 1140
/var/adm/perl-modules/rrdtool
%endif
#%{_datadir}/%{name}

%package devel
License:        GPLv2+
Summary:        A tool for data logging and analysis - Development files
Group:          Productivity/Scientific/Math
Requires:       %name = %version

%description devel
A tool to log and analyze data gathered from all kinds of data sources.
The data analysis part of RRDtool is based on the ability to quickly
generate graphical representations of the data values collected over a
definable time period.


%files devel
%defattr(-, root, root)
/usr/include/*
%{_libdir}/librrd_th.so
%{_libdir}/librrd.so
%{_libdir}/pkgconfig/librrd.pc

%package -n python-rrdtool
License:        GPLv2+
Summary:        Python bindings for rrdtool
Group:          Productivity/Scientific/Math
Requires:       %name = %version
%py_requires

%description -n python-rrdtool
A tool to log and analyze data gathered from all kinds of data sources.
The data analysis part of RRDtool is based on the ability to quickly
generate graphical representations of the data values collected over a
definable time period.

This package contains the Python bindings

%files -n python-rrdtool
%defattr(-, root, root)
%{py_sitedir}/*

%if 0%{?has_lua}

%package -n lua-rrdtool
License:        GPLv2+
Summary:        Lua bindings for rrdtool
Group:          Productivity/Scientific/Math
Requires:       %name = %version

%description -n lua-rrdtool
A tool to log and analyze data gathered from all kinds of data sources.
The data analysis part of RRDtool is based on the ability to quickly
generate graphical representations of the data values collected over a
definable time period.

This package contains the Lua bindings

%files -n lua-rrdtool
%defattr(-, root, root)
%dir %{_libdir}/lua
%dir %{_libdir}/lua/*
%{_libdir}/lua/*/rrd.so
%{_libdir}/lua/*/rrd.so.*
%endif

%changelog