%define oversion 2.01
%define patchlevel 10

Summary: Web access analyzer tool
Summary(ja): ウェブアクセス解析ツール
Name: webalizer
Version: %{oversion}.%{patchlevel}
Release: 1%{?_dist_release}
#Serial: 1
License: MIT
Group: Applications/System
Source: webalizer-%{oversion}-%{patchlevel}-src.tar.bz2
Source2: gd-1.8.3.tar.gz
Source3: webalizer-vine.conf
Source4: webalizer.cron
Patch1: webalizer-%{oversion}-%{patchlevel}-jp.patch
Patch2: gd-1.8.3-jpttf_for_webalizer.patch
# http://www.securiteam.com/unixfocus/6U00O202UG.html
#Patch100: ftp://ftp.mrunix.net/pub/webalizer/sec-fix.patch
Requires: webserver libpng freetype
Requires: TrueTypeFonts_jp

BuildRoot: %{_tmppath}/%{name}-root
Vendor: Project Vine
Distribution: Vine Linux
Packager: Daisuke SUZUKI <daisuke@linux.or.jp>

%description

The Webalizer is a web server log file analysis program which produces
usage statistics in HTML format for viewing with a browser. 

%description -l ja
Webalzerはウェブサーバのログファイルを解析するプログラムです.
統計結果をHTML形式にして出力してブラウザで確認できます.

%prep
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

%setup -n webalizer-%{oversion}-%{patchlevel} -a 2
%patch1 -p1 -b .jp
%patch2 -p0 -b .jpttf
#%patch100 -p0 -b .sec-fix

%build
ln -s gd-1.8.3 gd
cd gd
make
cd ..

%configure --with-language=japanese \
	   --with-gdlib=$PWD/gd 
make

%install
# make prefix=$RPM_BUILD_ROOT/usr install

install -d $RPM_BUILD_ROOT%{_bindir}
install -s webalizer $RPM_BUILD_ROOT%{_bindir}
ln -s webalizer $RPM_BUILD_ROOT%{_bindir}/webazolver

install -d $RPM_BUILD_ROOT%{_mandir}/man1
cp webalizer.1 $RPM_BUILD_ROOT%{_mandir}/man1

install -d $RPM_BUILD_ROOT%{_sysconfdir}
cp %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/webalizer.conf

install -d $RPM_BUILD_ROOT/etc/cron.weekly
install -m 755  %{SOURCE4} $RPM_BUILD_ROOT/etc/cron.weekly/webalizer.cron

install -d $RPM_BUILD_ROOT/home/httpd/html/webalizer

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc DNS.README  README README.ja README.FIRST CHANGES Copyright country-codes.txt
%config(noreplace) %{_sysconfdir}/webalizer.conf
%config(missingok) /etc/cron.weekly/webalizer.cron
%dir /home/httpd/html/webalizer
%{_bindir}/*
%{_mandir}/man1/*

%changelog
* Tue Oct 14 2008 Shu KONNO <owa@bg.wakwak.com> 2.01.10-1vl5
- applied new versioning policy, spec in utf-8

* Mon Feb 04 2008 Shu KONNO <owa@bg.wakwak.com> 2.01.10-0vl4
- dropt Serial:1 tag
- s/Copyright/License/

* Mon Sep 15 2003 IWAI, Masaharu <iwai@alib.jp> 2.01.10-0vl3
- update Requires: apache -> webserver

* Sat May 24 2003 IWAI Masaharu <iwai@alib.jp> 2.01.10-0vl2
- rebuild with new toolchain

* Sat May 18 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 2.01.10-0vl1
- new upstream release 2.01-10
- update webalizer.conf to use new TrueType-{kochi,ricohlx}

* Wed Oct 31 2001 IWAI Masaharu <iwaim@cc.mbn.or.jp> 2.01.06-0vl3
- used RPM macros

* Wed Oct 31 2001 IWAI Masaharu <iwaim@cc.mbn.or.jp> 2.01.06-0vl2
- patched for Cross-Site Scripting Flaw
- added noreplace flag (%%config file is not replaced)

* Thu Dec 14 2000 Daisuke SUZUKI <daisuke@linux.or.jp> 2.01.06-0vl1
- updated to 2.00-12

* Mon Jun  5 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated to 2.00-12
- updated gd to 1.8.3.
- optimized jpttf patch .

* Wed Apr 12 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- updated to 2.00-11
- modified webalizer.cron file to fit with default logrotate setting.

* Thu Jan 20 2000 Yasuyuki Furukawa <furukawa@vinelinux.org>
- first release
