File w3perl.spec of Package w3perl
#
# spec file for package w3perl
#
# 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: w3perl
Version: 3.18
Release: 0
Summary: Web analytic tool for Web / FTP / Squid / CUPS and Mail servers
License: GPL-3.0
Group: Productivity/Other
Url: http://www.w3perl.com/
Source0: http://www.w3perl.com/download/%{name}.tar.gz
Source1: %{name}.conf.default
Source2: %{name}.conf.vhost
Source3: %{name}.conf.nonsuse
# Old getopt.pl and pwd.pl are used for the install script
# http://cpansearch.perl.org/src/CHIPS/perl5.004_05/lib/
Source4: getopt.pl
Source5: pwd.pl
%if 0%{?mandriva_version}
BuildRequires: apache-devel
%endif
%if 0%{?suse_version}
BuildRequires: apache2-devel
%endif
%if 0%{?suse_version} >= 1130
BuildRequires: fdupes
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
BuildRequires: httpd-devel
%endif
%if 0%{?mandriva_version}
Requires: apache-base
Requires: apache-conf
%endif
%if 0%{?suse_version}
Requires: apache2
Requires: fly
%endif
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version}
Requires: httpd
%endif
Requires: perl
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%if 0%{?suse_version}
%define apxs /usr/sbin/apxs2
%else
%define apxs /usr/sbin/apxs
%endif
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define w3perl_dir /srv/w3perl
%define w3perl_src_dir w3perl
%define w3perl_cgi /srv/www/cgi-bin/w3perl
%define perl_path %(which perl)
%description
W3Perl is a free software logfile analyser, which can parse Web/FTP/Mail/CUPS/DHCP and Squid logfiles.
%prep
%setup -q -n %{w3perl_src_dir}
%build
sed -i 's/\/home\/web\/cgi-bin\/w3perl/\/srv\/www\/cgi-bin\/w3perl/' admin/scripts/init.pl
sed -i 's/\/home\/web\/html\/w3perl/\/srv\/w3perl/' admin/scripts/init.pl
sed -i 's/\/var\/w3perl\/cgi-bin\/w3perl/\/srv\/www\/cgi-bin\/w3perl/' install.pl
sed -i 's/\/home\/domisse\/public_html\/w3perl/\/srv\/w3perl/' install.pl
sed -i 's/require "getopt.pl";/use Getopt::Std;/' install.pl
sed -i 's/&Getopt/getopt/' install.pl
install -m555 %{SOURCE4} .
install -m555 %{SOURCE5} .
%install
#perl admin/scripts/init.pl
perl install.pl -r %{buildroot} -i %{buildroot}%{w3perl_dir} -d %{buildroot}%{w3perl_cgi} -p %{perl_path}
%if 0%{?suse_version}
mkdir -p %{buildroot}/%{apache_sysconfdir}/conf.d
cp -avL %{SOURCE1} %{buildroot}/%{apache_sysconfdir}/conf.d/w3perl.conf
mkdir -p %{buildroot}/%{apache_sysconfdir}/vhosts.d/conf.d
cp -avL %{SOURCE2} %{buildroot}/%{apache_sysconfdir}/vhosts.d/conf.d/w3perl.conf
%else
mkdir -p %{buildroot}/%{apache_sysconfdir}/../conf.d
cp -avL %{SOURCE3} %{buildroot}/%{apache_sysconfdir}/../conf.d/w3perl.conf
%endif
#
rm %{buildroot}/srv/w3perl/resources/admin/locconf.orig
rm %{buildroot}/srv/w3perl/docs/uk/.#futur.html
#
find %{buildroot}/%{w3perl_dir} -exec chmod o-rwx {} \;
find %{buildroot}/%{w3perl_cgi} -exec chmod o-rwx {} \;
#
%if 0%{?suse_version} >= 1130
%fdupes %{buildroot}/%{w3perl_dir}
%fdupes %{buildroot}/%{w3perl_cgi}
%endif
%files
%defattr(-,wwwrun,www)
%{w3perl_dir}/
%{w3perl_cgi}/
%config %{w3perl_dir}/config/config*.pl
%config %{w3perl_dir}/resources/admin/config*
%if 0%{?suse_version}
%dir %{apache_sysconfdir}/conf.d
%config (noreplace) %{apache_sysconfdir}/conf.d/w3perl.conf
%dir %{apache_sysconfdir}/vhosts.d/conf.d
%config (noreplace) %{apache_sysconfdir}/vhosts.d/conf.d/w3perl.conf
%else
%dir %{apache_sysconfdir}/../conf.d
%config (noreplace) %{apache_sysconfdir}/../conf.d/w3perl.conf
%endif
%changelog