File analog.spec of Package analog

Summary: WWW server logfile analysis program
Name: analog
Version: 6.0
Release: 8.1
Source: http://www.analog.cx/%{name}-%{version}.tar.gz
License: GPL-1.0-only
Group: Utilities
URL: http://www.analog.cx/
BuildRequires:  apache2-devel

%define apxs /usr/sbin/apxs2
%define apache apache2
%define apache_libexecdir %(%{apxs} -q LIBEXECDIR)
%define apache_sysconfdir %(%{apxs} -q SYSCONFDIR)
%define apache_includedir %(%{apxs} -q INCLUDEDIR)
%define apache_serverroot %(%{apxs} -q PREFIX)
%define apache_mmn        %(MMN=$(%{apxs} -q LIBEXECDIR)_MMN; test -x $MMN && $MMN)


BuildRoot: %{_tmppath}/anlg-root
Source1: analog-httpd.conf
Source2: analog-monthly
Source3: analog.cron
Source4: analog-php.php
Source5: datum.inc
Source6: footer.inc
Source7: header.inc
Source8: rebuild_analog_stats
Source9: split-logfile2-bymonth
Source10: RefSpam.txt
Source11: RobotInclude.txt
Source12: SearchEngines.txt
Source13: TypeAlias.txt
Source14: analog.cfg
Patch0: analog-compiler.patch

%description
Analog is a popular WWW server logfile analysis program with lots of features.
You should edit the /etc/analog.cfg and customize it for your webserver, in
particular you'll probably want to configure the HOSTNAME and HOSTURL options.
Perl is required if you want to use the html forms interface (which is not
installed automatically by this package - see the documentation for instructions).

%prep
%setup -q
%patch -P0 -p1

%build
make -e CFLAGS="$RPM_OPT_FLAGS" DEFS='-DCONFIGDIR=\"/etc/analog/\" -DLANGDIR=\"/usr/share/analog/lang/\" -DLOGSDIR=\"/var/log/httpd/\" -DLOGFILE=\"access*\"'

%install
rm -rf $RPM_BUILD_ROOT
mkdir -p $RPM_BUILD_ROOT/usr/share/analog $RPM_BUILD_ROOT/srv/www/exec \
	$RPM_BUILD_ROOT/usr/bin anlgform \
	$RPM_BUILD_ROOT/etc/analog $RPM_BUILD_ROOT/usr/share/analog/html/images \
	$RPM_BUILD_ROOT/usr/share/analog/lang $RPM_BUILD_ROOT/usr/share/man/man1 \
	$RPM_BUILD_ROOT%{apache_sysconfdir}/conf.d $RPM_BUILD_ROOT/etc/cron.d \
	$RPM_BUILD_ROOT/usr/share/analog/html $RPM_BUILD_ROOT/usr/share/analog/html/charts \
	$RPM_BUILD_ROOT/usr/share/analog/include
install -s analog $RPM_BUILD_ROOT/usr/bin/analog
install %{SOURCE8} $RPM_BUILD_ROOT/usr/bin
install %{SOURCE9} $RPM_BUILD_ROOT/usr/bin/split-logfile2-bymonth
install -d $RPM_BUILD_ROOT/usr/share/analog
install -d $RPM_BUILD_ROOT/usr/share/analog/lang
install -d $RPM_BUILD_ROOT/usr/share/analog/html/images
install -d $RPM_BUILD_ROOT/usr/share/analog/html/charts
install -d $RPM_BUILD_ROOT/usr/share/analog/include
install -m 644 analog.cfg $RPM_BUILD_ROOT/etc/analog
install -m 555 anlgform.pl anlgform
install -m 644 anlgform.html anlgform
install -m 644 analog.man $RPM_BUILD_ROOT/usr/share/man/man1/analog.1
install -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{apache_sysconfdir}/conf.d/analog.conf
install -m 755 %{SOURCE2} $RPM_BUILD_ROOT/usr/bin/analog-monthly
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/etc/cron.d/analog
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/usr/share/analog/html/index.php
install -m 644 %{SOURCE5} $RPM_BUILD_ROOT/usr/share/analog/include
install -m 644 %{SOURCE6} $RPM_BUILD_ROOT/usr/share/analog/include
install -m 644 %{SOURCE7} $RPM_BUILD_ROOT/usr/share/analog/include
install -m 644 %{SOURCE10} $RPM_BUILD_ROOT/etc/analog
install -m 644 %{SOURCE11} $RPM_BUILD_ROOT/etc/analog
install -m 644 %{SOURCE12} $RPM_BUILD_ROOT/etc/analog
install -m 644 %{SOURCE13} $RPM_BUILD_ROOT/etc/analog
install -m 644 %{SOURCE14} $RPM_BUILD_ROOT/etc/analog

cp images/* $RPM_BUILD_ROOT/usr/share/analog/html/images
cp lang/* $RPM_BUILD_ROOT/usr/share/analog/lang

ln -sf /usr/bin/analog $RPM_BUILD_ROOT/srv/www/exec/

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,wwwrun,www,-)
%dir /usr/share/analog
%dir /srv/www/exec
%doc Licence.txt
%doc README.txt
%doc docs/*
%doc how-to/
%doc examples/
%doc anlgform/
/usr/share/analog/lang/
/usr/share/analog/html/
/usr/share/analog/include/
/srv/www/exec/analog

%defattr(-,root,root,-)
%dir /etc/analog
%dir %{apache_sysconfdir}/conf.d
%ghost /etc/cron.d
%config /etc/analog/analog.cfg
%config %{apache_sysconfdir}/conf.d/analog.conf
%config /etc/analog/RefSpam.txt
%config /etc/analog/RobotInclude.txt
%config /etc/analog/SearchEngines.txt
%config /etc/analog/TypeAlias.txt
%attr(0755,root,root) /usr/bin/analog
%attr(0755,root,root) /usr/bin/rebuild_analog_stats
%attr(0755,root,root) /usr/bin/split-logfile2-bymonth
%attr(0755,root,root) /usr/bin/analog-monthly
%attr(0640,root,root) /etc/cron.d/analog

%attr(-,root,root) /usr/share/man/man1/analog.1*

%changelog
* Fri Feb 3 2006 Danilo Godec <danci@agenda.si>
- corrected the script analog-montlhy to set proper permissions and ownership
- corrected the script rebuild_analog_stats to proper permissions and ownership

* Tue Jan 10 2006 Danilo Godec <danci@agenda.si>
- corrected the script analog-montlhy to properly create needed directories
- corrected the script rebuild_analog_stats to properly create needed directories

* Thu Dec 15 2005 Danilo Godec <danci@agenda.si>
- adapted to SuSE
- added configuraton for apache (analog.conf)
- added a script for monthly statistics
- added configuration files from http://www2.owen.vanderbilt.edu/mike.shor/diversions/analog/
- added a PHP script for building and displaying current statistics

* Sun Dec 19 2004 Johan Petersson <spock@trilithium.com>
- version 6.0

* Sun Mar 23 2003 Johan Petersson <spock@trilithium.com>
- version 5.32

* Sat Jan 11 2003 Johan Petersson <spock@trilithium.com>
- version 5.31

* Sun Dec 1 2002 Johan Petersson <spock@trilithium.com>
- version 5.30

* Tue Jun 25 2002 Johan Petersson <spock@trilithium.com>
- version 5.24

* Tue May 14 2002 Johan Petersson <spock@trilithium.com>
- version 5.23

* Wed Mar 20 2002 Johan Petersson <spock@trilithium.com>
- version 5.22 (security fix)

* Wed Feb 20 2002 Johan Petersson <spock@trilithium.com>
- version 5.21

* Wed Feb 13 2002 Johan Petersson <spock@trilithium.com>
- version 5.2

* Thu Dec 20 2001 Johan Petersson <spock@trilithium.com>
- fixed quoting problem with CFLAGS

* Wed Nov 7 2001 Johan Petersson <spock@trilithium.com>
- version 5.1
- added serial to convince rpm this package is newer than 5.03

* Sat Jul 7 2001 Johan Petersson <spock@trilithium.com>
- version 5.03

* Sun Jun 24 2001 Johan Petersson <spock@trilithium.com>
- version 5.02

* Sat May 19 2001 Johan Petersson <spock@trilithium.com>
- version 5.01
- man page added

* Tue May 1 2001 Johan Petersson <spock@trilithium.com>
- version 5.0 (lots of new features)
- finally got rid of the clunky anlghead.h patch
- added reasonable defaults for CONFIGDIR and LANGDIR
- added Apache-friendly defaults for LOGSDIR and LOGFILE
- how-to docs added

* Wed Feb 28 2001 Johan Petersson <spock@trilithium.com>
- Renamed shared directory to make upgrades easier
- Moved images to shared directory

* Tue Feb 13 2001 Johan Petersson <spock@trilithium.com>
- version 4.16 (potentially dangerous buffer overflow bug fixed)
- don't install form interface automatically (security risk)

* Sun Feb 4 2001 Johan Petersson <spock@trilithium.com>
- Initial RPM package for version 4.15
openSUSE Build Service is sponsored by