File mrtg.spec of Package mrtg

#
# spec file for package mrtg (Version 2.17.0)
#
# 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/
#

# norootforbuild


Name:           mrtg
BuildRequires:  dos2unix gd-devel libjpeg-devel libpng-devel xorg-x11 xorg-x11-devel
Version:        2.17.0
Release:        1
Requires:       perl = %{perl_version}
AutoReqProv:    on
Group:          Productivity/Networking/Diagnostic
License:        GPLv2+
Url:            http://www.mrtg.org
Summary:        The Multirouter Traffic Grapher
Source:         %{name}-%{version}.tar.bz2
Patch0:         %{name}-%{version}-icons.diff
Patch1:         %{name}-%{version}-pod.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
A tool to visualize network traffic via a Web page.



Authors:
--------
    Tobias Oetiker <oetiker@ee.ethz.ch>
    Dave Rand <dlr@bungi.com>

%prep
%setup -q
%patch0
%patch1
rm -rf contrib/mrtgindex.cgi
grep -rl "/usr/local/bin/perl" contrib | xargs sed -i -e "s@/usr/local/bin/perl@/usr/bin/perl@"
#contrib contains binaries (ie. zipfile) which we cannot convert,
#hopefully file utility seems to mark all the text files clearly
find contrib -type f | xargs file | grep -i text | cut -d: -f1 | xargs dos2unix
find contrib -type f | xargs chmod 644

%build
%define iconsdir /srv/www/icons
%{suse_update_config}
aclocal
autoconf
CFLAGS="$RPM_OPT_FLAGS -Wall -pipe" \
CXXFLAGS="$RPM_OPT_FLAGS -Wall -fmessage-length=0" \
	./configure \
	--prefix=%{_prefix} \
	--sysconfdir=%{_sysconfdir} \
	--infodir=%{_infodir} \
	--datadir=%{_datadir} \
	--mandir=%{_mandir} \
	--with-rrd \
	--with-gd-inc=/usr/include/gd
make

%install
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{iconsdir}
install -m 644 doc/mrtg-[lmr].png $RPM_BUILD_ROOT%{iconsdir}
install -d -m 755 $RPM_BUILD_ROOT%{_datadir}/apache2/icons
install -m 644 doc/mrtg-[lmr].png $RPM_BUILD_ROOT%{_datadir}/apache2/icons
rm -rf $RPM_BUILD_ROOT/usr/share/doc
rm -rf $RPM_BUILD_ROOT/usr/share/mrtg2

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-, root, root)
%doc CHANGES COPYING COPYRIGHT README THANKS contrib doc/*.{pod,txt,png}
%doc %{_mandir}/man?/*
%{_bindir}/*
%{iconsdir}
%{_prefix}/lib/mrtg2
%{_datadir}/apache2

%changelog
openSUSE Build Service is sponsored by