+# TODO:
+# - build py2 and py3 variants both?
+
+#
+# Conditional build:
+%bcond_with python3 # use CPython 3.x
+
%define mod_name wsgi
%define apxs /usr/sbin/apxs
Summary: WSGI interface for the Apache Web server
Summary(pl.UTF-8): Interfejs WSGI dla serwera WWW Apache
Name: apache-mod_%{mod_name}
-Version: 1.0
-Release: 1
-License: Apache Group License
+Version: 3.4
+Release: 2
+License: Apache
Group: Networking/Daemons
Source0: http://modwsgi.googlecode.com/files/mod_%{mod_name}-%{version}.tar.gz
-# Source0-md5: 44e20174c127a50a75f040f881b0a52c
+# Source0-md5: f42d69190ea0c337ef259cbe8d94d985
Source1: %{name}.conf
URL: http://code.google.com/p/modwsgi/
-BuildRequires: apache >= 2.0.52-7
BuildRequires: %{apxs}
BuildRequires: apache-devel >= 2.0.52-7
BuildRequires: apr-devel >= 1:1.0.0
BuildRequires: autoconf
BuildRequires: automake
+%if %{with python3}
+BuildRequires: python3-devel
+%else
BuildRequires: python-devel >= 2.3
+%endif
BuildRequires: rpmbuild(macros) >= 1.268
-Requires: apache(modules-api) = %apache_modules_api
+Requires: apache(modules-api) = %{apache_modules_api}
Requires: apr >= 1:1.0.0
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
-%define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)
+%define apacheconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)/conf.d
+%define apachelibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
%description
The mod_wsgi adapter is an Apache module that provides a WSGI
overhead than using existing WSGI adapters for mod_python or CGI.
%description -l pl.UTF-8
-Adapter mod_wsgi jest modułem udostępniajacym interfejs WSGI dla
+Adapter mod_wsgi jest modułem udostępniającym interfejs WSGI dla
aplikacji WWW napisanych w języku Python i osadzonych w serwerze
-Apache. Adapter jest w całosci napisany w języku C w oparciu o
-bibliotekę runtime Apache i ma mniejsze wymagania niż w przypadku
-używania istniejących adapterów WSGI dla mod_python lub CGI.
+Apache. Adapter jest w całości napisany w języku C w oparciu o
+bibliotekę uruchomieniową Apache i ma mniejsze wymagania niż w
+przypadku używania istniejących adapterów WSGI dla modułu mod_python
+lub CGI.
%prep
%setup -q -n mod_%{mod_name}-%{version}
%build
%{__aclocal}
%{__autoconf}
+%if %{with python3}
+PYTHONBIN=%{__python3}
+%else
+PYTHONBIN=%{__python}
+%endif
%configure \
- --with-apxs=%{apxs}
+ --with-apxs=%{apxs} \
+ --with-python=$PYTHONBIN
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}/httpd.conf}
-
+install -d $RPM_BUILD_ROOT{%{apachelibdir},%{apacheconfdir}}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT
-install %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/httpd.conf/61_mod_wsgi.conf
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{apacheconfdir}/61_mod_wsgi.conf
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(644,root,root,755)
%doc README
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/httpd.conf/*_mod_%{mod_name}.conf
-%attr(755,root,root) %{_pkglibdir}/*.so
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{apacheconfdir}/*_mod_%{mod_name}.conf
+%attr(755,root,root) %{apachelibdir}/*.so