-%define pkg_version 0.3
-%define xsp_version 0.3
+#
+# TODO:
+# - figure out how to kill mod-mono-server.exe process
+# when apache is restarted
+#
+%define _name mod_mono
+%define apxs /usr/sbin/apxs
Summary: Mono module for Apache 2
Summary(pl): Modu³ Mono dla serwera Apache 2
-Name: mod_mono
-Version: 0.3.6
+Name: apache-%{_name}
+Version: 1.0.4
Release: 1
-License: The Apache License
+Epoch: 1
+License: Apache
Group: Networking/Daemons
-Source0: http://www.apacheworld.org/modmono/%{name}-%{pkg_version}.tar.gz
-Source1: xsp-%{xsp_version}.tar.gz
-Source2: mono.conf
+Source0: http://mono2.ximian.com/archive/%{version}/%{_name}-%{version}.tar.gz
+# Source0-md5: 0ba69cf5716920c75e628715f7236401
+# Source0-size: 18245041
+Patch0: %{name}-apu-config.patch
+Patch1: %{name}-apr_fixes.patch
+URL: http://www.mono-project.com/
+BuildRequires: apache-devel >= 2.0
+BuildRequires: %{apxs}
BuildRequires: autoconf
-BuildRequires: apache-devel
-BuildRequires: mono
-Requires: apache
-#Requires: httpd-mmn = %(cat %{_includedir}/httpd/.mmn)
+BuildRequires: automake
+BuildRequires: libtool
+BuildRequires: mono-csharp >= 1.0
+Requires: xsp
+Requires: apache >= 2.0
+Requires: mono-csharp >= 1.0
+Obsoletes: mod_mono
+ExcludeArch: alpha
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define httpdir /home/services/httpd
-%define htmldir %{httpdir}/html
-%define moddir /usr/lib/apache
+%define _httpdir /home/services/httpd
+%define _pkglibdir %(%{apxs} -q LIBEXECDIR)
+%define _sysconfdir /etc/httpd
%description
-This module allows you to run ASP.NET pages on Unix with Apache and
-Mono.
+This is an experimental module that allows you to run ASP.NET pages on
+Unix with Apache and Mono.
%description -l pl
-Ten modu³ umo¿liwia uruchamianie stron ASP.NET na Uniksie z serwerem
-Apache i Mono.
+Ten eksperymentalny modu³ umo¿liwia uruchamianie stron ASP.NET na
+Uniksie z serwerem Apache i Mono.
%prep
-%setup -q -n %{name}-%{pkg_version} -a 1
+%setup -q -n %{_name}-%{version}
+%patch0 -p1
+%patch1 -p1
%build
-# Build sample ASP.NET pages from xsp distribution
-cd xsp-%{xsp_version}
-%{__make}
-%{__make} install
-cd ..
-
+rm -rf $RPM_BUILD_ROOT
# Build Apache Module
+%{__libtoolize}
+%{__aclocal}
%{__autoconf}
+%{__automake}
+
%configure \
- --with-apxs=%{_sbindir}/apxs
-%{__make}
+ --with-apxs=%{apxs} \
+ --with-apr-config=%{_bindir}/apr-1-config \
+ --with-apu-config=%{_bindir}/apu-1-config \
+ CFLAGS="%{rpmcflags} -D_GNU_SOURCE -D_LARGEFILE64_SOURCE"
-# Build Mono DLL
-%{__make} -C src -f makedll.mak
+%{__make} \
+ DESTDIR=$RPM_BUILD_ROOT
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
-install -d $RPM_BUILD_ROOT%{moddir}
-install -d $RPM_BUILD_ROOT%{htmldir}/mono
-install -d $RPM_BUILD_ROOT%{httpdir}/.wapi
+install -d $RPM_BUILD_ROOT{%{_sysconfdir}/httpd.conf,%{_pkglibdir},%{_mandir}/man8}
+
+install src/.libs/%{_name}.so $RPM_BUILD_ROOT%{_pkglibdir}/%{_name}.so
+install man/%{_name}.8 $RPM_BUILD_ROOT%{_mandir}/man8
-cp %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/httpd/conf.d
-install src/.libs/libmod_mono.so $RPM_BUILD_ROOT%{moddir}
-install src/ModMono.dll $RPM_BUILD_ROOT%{_libdir}
-cp -r xsp-%{xsp_version}/server/test/* $RPM_BUILD_ROOT%{htmldir}/mono
+cat > $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/70_%{_name}.conf <<EOF
+LoadModule mono_module modules/%{_name}.so
+MonoApplications "/asp_net:%{_httpdir}/asp_net"
+Alias /asp_net "%{_httpdir}/asp_net"
+<Location /asp_net>
+ SetHandler mono
+</Location>
+EOF
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
-%doc ChangeLog COPYING INSTALL NEWS README
-%attr(755,root,root) %{moddir}/libmod_mono.so
-%{_libdir}/ModMono.dll
-%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd/conf.d/mono.conf
-# FIXME
-%defattr(-,http,http)
-%{htmldir}/mono
-%{httpdir}/.wapi
+%config(noreplace) %verify(not size mtime md5) %{_sysconfdir}/httpd.conf/*
+%doc ChangeLog INSTALL NEWS README
+%attr(755,root,root) %{_pkglibdir}/%{_name}.so
+%{_mandir}/man8/*