%define rlibdir %(ruby -rrbconfig -e 'print Config::CONFIG["rubylibdir"]')

Name: quickml
Version: 0.5
Release: 1%{?_dist_release}
License: GPL
Group: System Environment/Daemons
Source: http://quickml.com/quickml/%{name}-%{version}.tar.gz
Source1: quickml.init
Source2: quickml.logrotate
Patch1: quickml-0.5-docs.patch
URL: http://quickml.com/
Prefix: /usr
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Requires: ruby >= 1.6.7
Summary: very-easy-to-use mailing list system
Summary(ja): 超お手軽なメーリングリストシステム

%description
quickml server is a very-easy-to-use mailing list system.  quickml server
provides very-easy-to-use mailing list service.

%description -l ja
quickmlサーバは超お手軽なメーリングリストシステムです。quickmlサーバを利用す
れば、超お手軽なメーリングリストサービスを提供できます。

%prep

%setup -q
%patch1 -p0

%build
make         PREFIX=%{_prefix} \
	 SYSCONFDIR=%{_sysconfdir} \
      LOCALSTATEDIR=%{_localstatedir}/%{name} \
          SITE_RUBY=%{rlibdir}

%install
rm -rf ${RPM_BUILD_ROOT}

install -d ${RPM_BUILD_ROOT}
install -d ${RPM_BUILD_ROOT}%{_initdir}
install -d ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d
install -d ${RPM_BUILD_ROOT}%{_localstatedir}/%{name}
install -d ${RPM_BUILD_ROOT}%{_datadir}/%{name}
install -d ${RPM_BUILD_ROOT}%{rlibdir}/%{name}

make         PREFIX=${RPM_BUILD_ROOT}%{_prefix} \
         SYSCONFDIR=${RPM_BUILD_ROOT}%{_sysconfdir} \
      LOCALSTATEDIR=${RPM_BUILD_ROOT}%{_localstatedir}/%{name} \
          SITE_RUBY=${RPM_BUILD_ROOT}%{rlibdir} \
  install

install -m755 %{SOURCE1} ${RPM_BUILD_ROOT}%{_initdir}/%{name}
install -m755 %{SOURCE2} ${RPM_BUILD_ROOT}%{_sysconfdir}/logrotate.d/%{name}

%clean
rm -rf ${RPM_BUILD_ROOT}

%post
/sbin/chkconfig --add quickml

%preun
if [ $1 = 0 ]; then
  service quickml stop > /dev/null 2>&1
  /sbin/chkconfig --del quickml
fi

%files
%defattr(-, root, root)
%{_sbindir}/*
%{_localstatedir}/%{name}
%{_datadir}/%{name}
%{rlibdir}/*.rb
%{rlibdir}/%{name}/*.rb
%config %{_sysconfdir}/quickmlrc
%config %{_sysconfdir}/logrotate.d/%{name}
%config %{_initdir}/%{name}
%doc *.rd quickmlrc.sample

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

* Fri Mar 08 2002 akira yamada <akira@vinelinux.org> 0.5-0vl1
- new upstream version.

* Tue Feb 12 2002 akira yamada <akira@vinelinux.org> 0.2-0vl1
- new upstream version.
- removed quickml-0.1-*.patch. they are included in upstream source.

* Tue Feb 12 2002 akira yamada <akira@vinelinux.org> 0.1-0vl1
- Initial packaging.
