From 53d6c86765d6aeadadbc7bd32ef86144a67a301e Mon Sep 17 00:00:00 2001 From: Matthias Runge Date: Fri, 10 Jan 2014 15:28:43 +0100 Subject: [PATCH] add python3 subpackage --- mod_wsgi-3.4-configure-python3.patch | 20 +++++++ mod_wsgi.spec | 80 +++++++++++++++++++++++++++- wsgi-python3.conf | 1 + 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 mod_wsgi-3.4-configure-python3.patch create mode 100644 wsgi-python3.conf diff --git a/mod_wsgi-3.4-configure-python3.patch b/mod_wsgi-3.4-configure-python3.patch new file mode 100644 index 0000000..23cf1c9 --- /dev/null +++ b/mod_wsgi-3.4-configure-python3.patch @@ -0,0 +1,20 @@ +--- python3-mod_wsgi-3.4-11.fc21/configure.ac.orig 2013-11-28 13:50:26.969440552 +0100 ++++ python3-mod_wsgi-3.4-11.fc21/configure.ac 2013-11-28 13:50:46.879414776 +0100 +@@ -104,7 +104,7 @@ PYTHONLIBDIR=`${PYTHON} -c 'from sys imp + PYTHONCFGDIR=`${PYTHON} -c 'from sys import stdout; \ + import distutils.sysconfig; \ + stdout.write(distutils.sysconfig.get_python_lib(plat_specific=1, \ +- standard_lib=1) +"/config")'` ++ standard_lib=1))'` + PYTHONFRAMEWORKDIR=`${PYTHON} -c 'from sys import stdout; \ + from distutils import sysconfig; \ + stdout.write(sysconfig.get_config_var("PYTHONFRAMEWORKDIR"))'` +@@ -120,7 +120,7 @@ if test "${PYTHONFRAMEWORKDIR}" = "no-fr + LDFLAGS1="-L${PYTHONLIBDIR}" + LDFLAGS2="-L${PYTHONCFGDIR}" + +- LDLIBS1="-lpython${PYTHON_VERSION}" ++ LDLIBS1="-lpython${PYTHON_VERSION}m" + LDLIBS2=`${PYTHON} -c 'from sys import stdout; \ + from distutils import sysconfig; \ + stdout.write(sysconfig.get_config_var("LIBS"))'` diff --git a/mod_wsgi.spec b/mod_wsgi.spec index 0d1f7bf..a3e6781 100644 --- a/mod_wsgi.spec +++ b/mod_wsgi.spec @@ -5,25 +5,54 @@ %{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}} %{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}} +%if 0%{?fedora} > 12 +%global with_python3 1 +%else +%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print (get_python_lib())")} +%endif + + Name: mod_wsgi Version: 3.4 -Release: 10%{?dist} +Release: 11%{?dist} Summary: A WSGI interface for Python web applications in Apache Group: System Environment/Libraries License: ASL 2.0 URL: http://modwsgi.org Source0: http://modwsgi.googlecode.com/files/%{name}-%{version}.tar.gz Source1: wsgi.conf +Source2: wsgi-python3.conf Patch0: mod_wsgi-3.4-connsbh.patch Patch1: mod_wsgi-3.4-procexit.patch Patch2: mod_wsgi-3.4-coredump.patch +Patch3: mod_wsgi-3.4-configure-python3.patch + BuildRequires: httpd-devel, python-devel, autoconf +%if 0%{?with_python3} +BuildRequires: python3-devel +%endif Requires: httpd-mmn = %{_httpd_mmn} # Suppress auto-provides for module DSO %{?filter_provides_in: %filter_provides_in %{_httpd_moddir}/.*\.so$} %{?filter_setup} + +%if 0%{?with_python3} +%package -n python3-%{name} +Summary: A WSGI interface for Python3 web applications in Apache +Group: System Environment/Libraries +Requires: httpd-mmn = %{_httpd_mmn} +Conflicts: %{name} + +%description -n python3-%{name} +The mod_wsgi adapter is an Apacheache module that provides a WSGI compliant +interface for hosting Python based web applications within Apache. The +adapter is writtentten completely in C code against the Apache C runtime and +for hosting WSGI applications within Apache has a lower overhead than using +existing WSGI adapters for mod_python or CGI. +%endif + %description The mod_wsgi adapter is an Apache module that provides a WSGI compliant interface for hosting Python based web applications within Apache. The @@ -38,6 +67,15 @@ existing WSGI adapters for mod_python or CGI. %patch1 -p1 -b .procexit %patch2 -p1 -b .coredump + + +%if 0%{?with_python3} +cp -a . %{py3dir} +pushd %{py3dir} +%patch3 -p1 -b .python3 +popd +%endif + %build # Regenerate configure for -coredump patch change to configure.in autoconf @@ -46,7 +84,33 @@ export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" %configure --enable-shared --with-apxs=%{_httpd_apxs} make %{?_smp_mflags} +%if 0%{?with_python3} +pushd %{py3dir} +# Regenerate configure for -coredump patch change to configure.in +autoconf +%configure --enable-shared --with-apxs=%{_httpd_apxs} --with-python=python3 +make %{?_smp_mflags} +popd +%endif + %install +# first install python3 variant and rename the so file +%if 0%{?with_python3} +pushd %{py3dir} +make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir} +mv $RPM_BUILD_ROOT%{_httpd_moddir}/mod_wsgi{,_python3}.so + +install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir} +%if "%{_httpd_modconfdir}" == "%{_httpd_confdir}" +# httpd <= 2.2.x +install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_httpd_confdir}/wsgi-python3.conf +%else +# httpd >= 2.4.x +install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi-python3.conf +%endif +popd +%endif + make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir} install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir} @@ -60,9 +124,21 @@ install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi.conf %files %doc LICENCE README -%config(noreplace) %{_httpd_modconfdir}/*.conf +%config(noreplace) %{_httpd_modconfdir}/*wsgi.conf %{_httpd_moddir}/mod_wsgi.so +%if 0%{?with_python3} +%files -n python3-%{name} +%doc LICENCE README +%config(noreplace) %{_httpd_modconfdir}/*wsgi-python3.conf +%{_httpd_moddir}/mod_wsgi_python3.so +%endif + +%changelog +* Fri Jan 10 2014 Matthias Runge - 3.4-11 +- added python3 subpackage (thanks to Jakub Dorňák), rhbz#1035876 + + %changelog * Sat Aug 03 2013 Fedora Release Engineering - 3.4-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild diff --git a/wsgi-python3.conf b/wsgi-python3.conf new file mode 100644 index 0000000..e83fb34 --- /dev/null +++ b/wsgi-python3.conf @@ -0,0 +1 @@ +LoadModule wsgi_module modules/mod_wsgi_python3.so