%define docroot			/var/www/html
%define apxs2			/usr/bin/apxs
%define apache2moddir		%(%{apxs2} -q LIBEXECDIR)
%define apache2confdir		%(%{apxs2} -q SYSCONFDIR)
%define apache2confmodruby	httpd.conf.mod_ruby
%define apache2ver		2.2.14

Summary: A Ruby interpreter for the Apache Web server.
Summary(ja): Apache2サーバ組み込みのRuby言語インタプリタ
Name: mod_ruby
Version: 1.3.0
Release: 2%{?_dist_release}
License: distributable
Group: System Environment/Daemons
Source0: http://www.modruby.net/archive/%{name}-%{version}.tar.gz
Source100: httpd.conf.mod_ruby-apache2
URL: http://www.modruby.net/

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: ruby, ruby-devel
BuildRequires: apache2, apache2-devel >= %{apache2ver}
Requires: apache2 >= %{apache2ver}
Requires: ruby >= 1.8
Provides: mod_ruby-apache2 = %{version}-%{release}
Obsoletes: mod_ruby-apache2 < 1.3.0
Obsoletes: mod_ruby-common < 1.3.0


%description
mod_ruby embeds the Ruby interpreter into the Apache web server,
allowing Ruby CGI scripts to be executed natively. These scripts 
will start up much faster than without mod_ruby.

%description -l ja
mod_rubyはApache2ウェブサーバにRubyインタプリタを組み込み、CGIスクリ
プトがネイティブに起動されることを許します。スクリプトはmod_rubyを利
用しない場合よりも速く起動するでしょう。


%prep
%setup -q


%build
ruby configure.rb --with-apxs=%{apxs2} --with-apr-includes=/usr/include/apr-1
make


%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{apache2moddir}
mkdir -p ${RPM_BUILD_ROOT}%{apache2confdir}
make install DESTDIR=${RPM_BUILD_ROOT} \
             rubylibdir=${RPM_BUILD_ROOT}/%{ruby_vendorlibdir}

sed -e 's|@@DOCROOT@@|%{docroot}|g' < %{SOURCE100} \
  > ${RPM_BUILD_ROOT}/%{apache2confdir}/%{apache2confmodruby}
chmod 644 ${RPM_BUILD_ROOT}/%{apache2confdir}/%{apache2confmodruby}


%clean
rm -rf ${RPM_BUILD_ROOT}
rm -f *.files


%files
%defattr(-, root, root)
%doc README.en
%doc README.ja
%doc ChangeLog
%doc examples/
%config %{apache2confdir}/%{apache2confmodruby}
%{_libdir}/apache2/*
%{ruby_vendorlibdir}/auto-reload.rb
%dir %{ruby_vendorlibdir}/apache
%{ruby_vendorlibdir}/apache/*


%changelog
* Fri Oct 26 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3.0-2
- rebuild with ruby-1.9.3

* Sun May 22 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 1.3.0-1
- update to 1.3.0
- drop apache1 support
  - merge mod_ruby-apache2 and common to main package

* Mon Sep 22 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.2.6-1
- new upstream release
- add apache2/common subpackages

* Wed Aug 27 2008 Shu KONNO <owa@bg.wakwak.com> 1.0.7-1vl5
- applied new versioning policy, spec in utf-8

* Mon Aug 27 2007 Shu KONNO <owa@bg.wakwak.com> 1.0.7-0vl2
- s/Copyright/License/
* Sat Feb 14 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 1.0.7-0vl1
- new upstream release
- rebuild on apache-1.3.29, ruby-1.8.1

* Thu Aug 22 2002 Satoshi MACHINO <machino@vinelinux.org> 1.0.0-0vl1
- new upstream version.

* Thu May 30 2002 akira yamada <akira@vinelinux.org> 0.9.8-0vl2
- updated URL of upstream sources.

* Thu May 30 2002 akira yamada <akira@vinelinux.org> 0.9.8-0vl1
- new upstream version.

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

* Mon Feb 11 2002 akira yamada <akira@vinelinux.org> 0.9.6-0vl1
- new upstream version.

* Mon Oct 17 2001 akira yamada <akira@vinelinux.org> 0.9.4-0vl1
- new upstream version.

* Mon Oct 17 2001 akira yamada <akira@vinelinux.org> 0.9.3-0vl2
- rebuild with apache-1.3.22. Requires: apache = 1.3.22.
- added apache to BuildRequires. (apxs checks /usr/bin/httpd.)

* Mon Sep 03 2001 akira yamada <akira@vinelinux.org> 0.9.3-0vl1
- new upstream release.

* Sat Aug 18 2001 akira yamada <akira@vinelinux.org>
- 0.9.2-0vl1
- new upstream version 0.9.2.

* Wed Aug 08 2001 akira yamada <akira@vinelinux.org>
- 0.9.1-0vl1
- new upstream version 0.9.1.

* Fri Jul 06 2001 akira yamada <akira@vinelinux.org>
- new upstream version 0.9.0.

* Thu Jul 03 2001 akira yamada <akira@vinelinux.org>
- remove liberuby-dev from BuildRequires.

* Thu Jun 28 2001 akira yamada <akira@vinelinux.org>
- new upstream version 0.8.5.

* Thu Jun 21 2001 akira yamada <akira@vinelinux.org>
- new upstream version 0.8.4.

* Mon Jun 06 2001 akira yamada <akira@vinelinux.org>
- new upstream version 0.8.3.

* Mon Jun 04 2001 akira yamada <akira@vinelinux.org>
- new upstream version 0.8.2.

* Thu May 23 2001 Daisuke SUZUKI <daisuke@linux.or.jp> 0.8.0-0vl3
- rebuild with papche-1.3.20

* Thu Apr 13 2001 akira yamada <akira@vinelinux.org>
- new upstream version 0.8.0.

* Thu Mar 15 2001 akira yamada <akira@vinelinux.org>
- rebuild with apache-1.3.19.

* Fri Feb 09 2001 akira yamada <akira@vinelinux.org>
- rebuild with apache-1.3.17.

* Wed Dec 20 2000 akira yamada <akira@vinelinux.org>
- Updated to new upstream version 0.2.2.

* Sun Nov 05 2000 akira yamada <akira@vinelinux.org>
- excute Makefile.RB with --apxs option, because normal user's PATH dose not
  include /usr/sbin.

* Thu Oct 19 2000 akira yamada <akira@vinelinux.org>
- Updated to new upstream version 0.2.1.
- BuildPreReq: apache-devel, Requires: apache.
- Build with apache 1.3.14.

* Wed Oct 11 2000 akira yamada <akira@vinelinux.org>
- Removed mod_ruby-0.2.0-egcs-2.91.66.patch, because fixed this probrem in
  ruby.

* Thu Oct 03 2000 akira yamada <akira@vinelinux.org>
- Added mod_ruby-0.2.0-egcs-2.91.66.patch to work around for segv.

* Thu Oct 03 2000 akira yamada <akira@vinelinux.org>
- Initial packaging.
