+# TODO
+# - fix build with apache/apr (apr_off_t)
%define mod_name mod_ruby
%define apxs /usr/sbin/apxs
Summary: Apache mod_ruby module - embeds the Ruby interpreter into the Apache web server
Name: apache-%{mod_name}
Version: 1.2.4
Release: 1
-Group: Networking/Daemons
License: BSD-like
+Group: Networking/Daemons
Source0: http://www.modruby.net/archive/%{mod_name}-%{version}.tar.gz
# Source0-md5: 2b803c021297517eecb3dc6cf77b9534
Source1: %{name}.conf
Patch0: %{name}-struct.patch
URL: http://www.modruby.net/
-BuildRequires: apache-devel >= 1.3.3
BuildRequires: %{apxs}
-BuildRequires: ruby >= 1:1.6.4
-Requires(post,preun): %{apxs}
-Requires: apache >= 1.3.3
+BuildRequires: apache-devel >= 2.0
+BuildRequires: rpmbuild(macros) >= 1.268
+BuildRequires: ruby-devel >= 1:1.6.4
+Requires: apache(modules-api) = %apache_modules_api
Requires: ruby >= 1:1.6.4
+%{?ruby_mod_ver_requires_eq}
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _sysconfdir %(%{apxs} -q SYSCONFDIR)
-%define _pkglibdir %(%{apxs} -q LIBEXECDIR)
-%define ruby_rubylibdir %(ruby -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
+%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
+%define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
%description
mod_ruby embeds the Ruby interpreter into the Apache web server,
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{ruby_rubylibdir}}
+install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/httpd.conf,%{ruby_rubylibdir}}
install %{mod_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/%{mod_name}.so
-
-# Install the config file
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf
install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/70_mod_ruby.conf
-
cp -a lib/* $RPM_BUILD_ROOT%{ruby_rubylibdir}
%clean
rm -rf $RPM_BUILD_ROOT
%post
-if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
-fi
+%service -q httpd restart
%preun
if [ "$1" = "0" ]; then
- if [ -f /var/lock/subsys/httpd ]; then
- /etc/rc.d/init.d/httpd restart 1>&2
- fi
+ %service -q httpd restart
fi
%files
%defattr(644,root,root,755)
%doc COPYING ChangeLog README.en examples doc/*
%lang(ja) %doc README.ja
-%attr(640,root,root) %config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd.conf/*.conf
-%attr(755,root,root) %{_pkglibdir}/*
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf/*_mod_%{mod_name}.conf
+%attr(755,root,root) %{_pkglibdir}/*.so
%{ruby_rubylibdir}/*