File sarg.spec of Package sarg
#
# spec file for package sarg
#
# Copyright (c) 2013 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: sarg
Version: 2.3.6
Release: 0
Summary: Squid Analysis Report Generator
License: GPL-2.0+
Group: Productivity/Networking/Web/Utilities
Url: http://sarg.sourceforge.net/sarg.php
Source0: http://web.onda.com.br/orso/%{name}-%{version}.tar.bz2
Source1: sarg.conf
Source2: http://www.initzero.it/products/opensource/sarg-reports/download/sarg-reports
Source3: sarg.hosts
Source4: sysconfig.sarg
Source5: cron.daily.sarg
Source6: cron.weekly.sarg
Source7: cron.monthly.sarg
Source8: sarg-reports.1.gz
Source9: sarg-apache.conf
Source10: platform_suse.gif
# Patch0: http://sarg.sourceforge.net/sarg-2.0.1-largeurl.patch.gz
# PATCH-FIX-UPSTREAM sarg-2.3.1-config.patch
Patch0: sarg-2.3.1-config.patch
Patch1: sarg-2.3.2-limits_h.diff
# PATCH-FIX-UPSTREAM sarg-reports-english.patch
Patch10: sarg-reports-english.patch
PreReq: %fillup_prereq
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{suse_version}
BuildRequires: apache2
%endif
%if 0%{?suse_version} >= 1010
Recommends: cron
Recommends: http_proxy
%endif
%description
Sarg -- Squid Analysis Report Generator is a tool that allows you to
view "where" your users are going to on the Internet. Sarg generate
reports in html, with fields such as: users, IP Addresses, bytes,
sites, and times.
%prep
%setup -q
%patch0
%patch1
%{__patch} %{SOURCE2} < %{PATCH10}
%build
%{__chmod} a+x configure
%{__chmod} a+x user_limit_block
%configure \
--sysconfdir=%{_datadir}/%{name} \
--mandir=%{_mandir}/ \
--localedir=%{_datadir}/sarg/languages \
--enable-sargphp=/srv/www/htdocs
%if 0%{?suse_version} == 1110 || 0%{?sles_version} == 1000
C_FLAGS=-std=c99
%endif
%{__make}
%install
%{__install} -d %{buildroot}/srv/www/htdocs
%makeinstall
%{__install} -d %{buildroot}%{_sysconfdir}/apache2/conf.d
%{__install} -d %{buildroot}/srv/www/sarg
%{__install} -m 644 %{SOURCE1} %{buildroot}%{_sysconfdir}/sarg.conf
%{__install} -m 644 %{SOURCE9} %{buildroot}%{_sysconfdir}/apache2/conf.d/
%{__install} -m 644 %{SOURCE10} %{buildroot}/srv/www/sarg/
%{__ln_s} -f ../../../etc/sarg.conf %{buildroot}%{_datadir}/%{name}/sarg.conf
%{__install} -d %{buildroot}%{_sbindir}
%{__install} -m 755 %{SOURCE2} %{buildroot}%{_sbindir}
%{__install} -m 644 %{SOURCE3} %{buildroot}%{_datadir}/%{name}/sarg.hosts
%{__install} -d %{buildroot}%{_localstatedir}/adm/fillup-templates
%{__install} -m 644 %{SOURCE4} %{buildroot}%{_localstatedir}/adm/fillup-templates
%{__install} -D -m 755 %{SOURCE5} %{buildroot}%{_sysconfdir}/cron.daily/suse.de-sarg
%{__install} -D -m 755 %{SOURCE6} %{buildroot}%{_sysconfdir}/cron.weekly/suse.de-sarg
%{__install} -D -m 755 %{SOURCE7} %{buildroot}%{_sysconfdir}/cron.monthly/suse.de-sarg
%{__install} -d -m 755 %{buildroot}%{_mandir}/man8
%{__install} -m 644 %{SOURCE8} %{buildroot}%{_mandir}/man8
%clean
%{__rm} -rf %{buildroot}
%post
%{fillup_only -n sarg}
%files
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/sarg.conf
%{_sysconfdir}/cron.*/suse.de-sarg
%config(noreplace) %{_sysconfdir}/apache2/conf.d/sarg-apache.conf
%{_bindir}/sarg
%{_sbindir}/sarg-reports
%dir %{_datadir}/%{name}
%dir /srv/www/sarg
/srv/www/sarg/platform_suse.gif
%{_datadir}/%{name}/css.tpl
%{_datadir}/%{name}/exclude_codes
%{_datadir}/%{name}/sarg.conf
%{_datadir}/%{name}/sarg.hosts
%{_datadir}/%{name}/user_limit_block
%{_datadir}/%{name}/languages
%{_datadir}/%{name}/fonts
%{_datadir}/%{name}/images
%{_localstatedir}/adm/fillup-templates/sysconfig.sarg
%defattr(0644,root,root,0755)
/srv/www/htdocs/sarg-php
%doc %{_mandir}/man1/%{name}*
%doc %{_mandir}/man8/%{name}-report*
%doc CONTRIBUTORS COPYING ChangeLog DONATIONS LICENSE README
%changelog