[packages/apache-mod_wsgi] build python2/python3 versions
glen
glen at pld-linux.org
Sat Oct 1 21:13:25 CEST 2016
commit 1e85a36c71aeeffec420a9964fac167bf0606a67
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Sat Oct 1 22:12:52 2016 +0300
build python2/python3 versions
see devel-en thread about naming used
http://lists.pld-linux.org/mailman/pipermail/pld-devel-en/2016-October/025148.html
apache-mod_wsgi.spec | 132 +++++++++++++++++++++++++++++++++++++++++----------
1 file changed, 106 insertions(+), 26 deletions(-)
---
diff --git a/apache-mod_wsgi.spec b/apache-mod_wsgi.spec
index 8768a65..ad2ed29 100644
--- a/apache-mod_wsgi.spec
+++ b/apache-mod_wsgi.spec
@@ -1,11 +1,11 @@
# TODO:
-# - build py2 and py3 variants both?
# - add -n mod_wsgi-express package
# https://github.com/GrahamDumpleton/mod_wsgi#installation-into-python
#
# Conditional build:
-%bcond_with python3 # use CPython 3.x
+%bcond_without python2 # mod_wsgi for CPython 2.x
+%bcond_without python3 # mod_wsgi for CPython 3.x
%define mod_name wsgi
%define apxs /usr/sbin/apxs
@@ -13,7 +13,7 @@ Summary: WSGI interface for the Apache Web server
Summary(pl.UTF-8): Interfejs WSGI dla serwera WWW Apache
Name: apache-mod_%{mod_name}
Version: 4.5.7
-Release: 0.1
+Release: 0.2
License: Apache
Group: Networking/Daemons
Source0: https://github.com/GrahamDumpleton/mod_wsgi/archive/%{version}/mod_%{mod_name}-%{version}.tar.gz
@@ -25,21 +25,13 @@ 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
+%if %{with python2}
BuildRequires: python-devel >= 2.3
%endif
-BuildRequires: rpmbuild(macros) >= 1.268
-Requires: apache(modules-api) = %{apache_modules_api}
-Requires: apr >= 1:1.0.0
%if %{with python3}
-Requires: python3-modules
-%else
-Requires: python-modules
+BuildRequires: python3-devel
%endif
-# http://helpful.knobs-dials.com/index.php/Mod_wsgi_notes#PyEval_AcquireThread:_non-NULL_old_thread_state
-Conflicts: apache-mod_python
+BuildRequires: rpmbuild(macros) >= 1.268
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
@@ -60,41 +52,129 @@ bibliotekę uruchomieniową Apache i ma mniejsze wymagania niż w
przypadku używania istniejących adapterów WSGI dla modułu mod_python
lub CGI.
+%package py2
+Summary: WSGI interface for the Apache Web server
+Summary(pl.UTF-8): Interfejs WSGI dla serwera WWW Apache
+Group: Networking/Daemons
+Requires: apache(modules-api) = %{apache_modules_api}
+Requires: apr >= 1:1.0.0
+Requires: python-modules
+Conflicts: %{name} < 4.5.7-0.2
+# http://helpful.knobs-dials.com/index.php/Mod_wsgi_notes#PyEval_AcquireThread:_non-NULL_old_thread_state
+Conflicts: apache-mod_python
+
+%description py2
+The mod_wsgi adapter is an Apache module that provides a WSGI
+compliant interface for hosting Python based web applications within
+Apache. The adapter is written 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.
+
+%description py2 -l pl.UTF-8
+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ł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.
+
+%package py3
+Summary: WSGI interface for the Apache Web server
+Summary(pl.UTF-8): Interfejs WSGI dla serwera WWW Apache
+Group: Networking/Daemons
+Requires: apache(modules-api) = %{apache_modules_api}
+Requires: apr >= 1:1.0.0
+Requires: python3-modules
+Conflicts: %{name} < 4.5.7-0.2
+# http://helpful.knobs-dials.com/index.php/Mod_wsgi_notes#PyEval_AcquireThread:_non-NULL_old_thread_state
+Conflicts: apache-mod_python3
+
+%description py3
+The mod_wsgi adapter is an Apache module that provides a WSGI
+compliant interface for hosting Python based web applications within
+Apache. The adapter is written 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.
+
+%description py3 -l pl.UTF-8
+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ł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}
+
+# doesn't support out of tree builds, so we just build twice
+%if %{with python2}
%configure \
-%if %{with python3}
- --with-python=%{__python3} \
-%else
--with-python=%{__python} \
+ --with-apxs=%{apxs}
+%{__make}
+%{__make} install DESTDIR=$(pwd)/py2
+%{__make} clean
%endif
+
+%if %{with python3}
+%configure \
+ --with-python=%{__python3} \
--with-apxs=%{apxs}
+%{__make}
+%{__make} install DESTDIR=$(pwd)/py3
+%{__make} clean
+%endif
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}}
-%{__make} install \
- DESTDIR=$RPM_BUILD_ROOT
-
-cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/61_mod_wsgi.conf
+%if %{with python2}
+cp -a py2/* $RPM_BUILD_ROOT
+mv $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}{,-py2}.so
+sed -e 's/mod_wsgi.so/mod_wsgi-py2.so/' %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/61_mod_wsgi-py2.conf
+%endif
+%if %{with python3}
+cp -a py3/* $RPM_BUILD_ROOT
+mv $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}{,-py3}.so
+sed -e 's/mod_wsgi.so/mod_wsgi-py3.so/' %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/61_mod_wsgi-py3.conf
+%endif
%clean
rm -rf $RPM_BUILD_ROOT
-%post
+%post py2
%service -q httpd restart
-%postun
+%postun py2
if [ "$1" = "0" ]; then
%service -q httpd restart
fi
-%files
+%post py3
+%service -q httpd restart
+
+%postun py3
+if [ "$1" = "0" ]; then
+ %service -q httpd restart
+fi
+
+%if %{with python2}
+%files py2
%defattr(644,root,root,755)
%doc README.rst CREDITS.rst
-%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}.conf
-%attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}.so
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}-py2.conf
+%attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}-py2.so
+%endif
+
+%if %{with python3}
+%files py3
+%defattr(644,root,root,755)
+%doc README.rst CREDITS.rst
+%attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}-py3.conf
+%attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}-py3.so
+%endif
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/apache-mod_wsgi.git/commitdiff/1e85a36c71aeeffec420a9964fac167bf0606a67
More information about the pld-cvs-commit
mailing list