2 # - add -n mod_wsgi-express package
3 # https://github.com/GrahamDumpleton/mod_wsgi#installation-into-python
7 %bcond_without python2 # mod_wsgi for CPython 2.x
8 %bcond_without python3 # mod_wsgi for CPython 3.x
11 %define apxs /usr/sbin/apxs
12 Summary: WSGI interface for the Apache Web server
13 Summary(pl.UTF-8): Interfejs WSGI dla serwera WWW Apache
14 Name: apache-mod_%{mod_name}
18 Group: Networking/Daemons
19 Source0: https://github.com/GrahamDumpleton/mod_wsgi/archive/%{version}/mod_%{mod_name}-%{version}.tar.gz
20 # Source0-md5: 3849425d78e716511388a5894cc00479
22 URL: http://www.modwsgi.org/
23 BuildRequires: %{apxs}
24 BuildRequires: apache-devel >= 2.0.52-7
25 BuildRequires: apr-devel >= 1:1.0.0
26 BuildRequires: autoconf
27 BuildRequires: automake
29 BuildRequires: python-devel >= 2.3
32 BuildRequires: python3-devel
34 BuildRequires: rpmbuild(macros) >= 1.268
35 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
37 %define _pkglibdir %(%{apxs} -q LIBEXECDIR 2>/dev/null)
38 %define _sysconfdir %(%{apxs} -q SYSCONFDIR 2>/dev/null)/conf.d
41 The mod_wsgi adapter is an Apache module that provides a WSGI
42 compliant interface for hosting Python based web applications within
43 Apache. The adapter is written completely in C code against the Apache
44 C runtime and for hosting WSGI applications within Apache has a lower
45 overhead than using existing WSGI adapters for mod_python or CGI.
47 %description -l pl.UTF-8
48 Adapter mod_wsgi jest modułem udostępniającym interfejs WSGI dla
49 aplikacji WWW napisanych w języku Python i osadzonych w serwerze
50 Apache. Adapter jest w całości napisany w języku C w oparciu o
51 bibliotekę uruchomieniową Apache i ma mniejsze wymagania niż w
52 przypadku używania istniejących adapterów WSGI dla modułu mod_python
56 Summary: WSGI interface for the Apache Web server
57 Summary(pl.UTF-8): Interfejs WSGI dla serwera WWW Apache
58 Group: Networking/Daemons
59 Requires: apache(modules-api) = %{apache_modules_api}
60 Requires: apr >= 1:1.0.0
61 Requires: python-modules
62 Provides: apache(mod_wsgi) = %{version}-%{release}
63 Obsoletes: apache-mod_wsgi < 4.5.7-0.2
64 Conflicts: %{name}-py3
65 # http://helpful.knobs-dials.com/index.php/Mod_wsgi_notes#PyEval_AcquireThread:_non-NULL_old_thread_state
66 Conflicts: apache-mod_python
69 The mod_wsgi adapter is an Apache module that provides a WSGI
70 compliant interface for hosting Python based web applications within
71 Apache. The adapter is written completely in C code against the Apache
72 C runtime and for hosting WSGI applications within Apache has a lower
73 overhead than using existing WSGI adapters for mod_python or CGI.
75 %description py2 -l pl.UTF-8
76 Adapter mod_wsgi jest modułem udostępniającym interfejs WSGI dla
77 aplikacji WWW napisanych w języku Python i osadzonych w serwerze
78 Apache. Adapter jest w całości napisany w języku C w oparciu o
79 bibliotekę uruchomieniową Apache i ma mniejsze wymagania niż w
80 przypadku używania istniejących adapterów WSGI dla modułu mod_python
84 Summary: WSGI interface for the Apache Web server
85 Summary(pl.UTF-8): Interfejs WSGI dla serwera WWW Apache
86 Group: Networking/Daemons
87 Requires: apache(modules-api) = %{apache_modules_api}
88 Requires: apr >= 1:1.0.0
89 Requires: python3-modules
90 Provides: apache(mod_wsgi) = %{version}-%{release}
91 Conflicts: %{name} < 4.5.7-0.2
92 Conflicts: %{name}-py2
93 # http://helpful.knobs-dials.com/index.php/Mod_wsgi_notes#PyEval_AcquireThread:_non-NULL_old_thread_state
94 Conflicts: apache-mod_python3
97 The mod_wsgi adapter is an Apache module that provides a WSGI
98 compliant interface for hosting Python based web applications within
99 Apache. The adapter is written completely in C code against the Apache
100 C runtime and for hosting WSGI applications within Apache has a lower
101 overhead than using existing WSGI adapters for mod_python or CGI.
103 %description py3 -l pl.UTF-8
104 Adapter mod_wsgi jest modułem udostępniającym interfejs WSGI dla
105 aplikacji WWW napisanych w języku Python i osadzonych w serwerze
106 Apache. Adapter jest w całości napisany w języku C w oparciu o
107 bibliotekę uruchomieniową Apache i ma mniejsze wymagania niż w
108 przypadku używania istniejących adapterów WSGI dla modułu mod_python
112 %setup -q -n mod_%{mod_name}-%{version}
118 # doesn't support out of tree builds, so we just build twice
121 --with-python=%{__python} \
124 %{__make} install DESTDIR=$(pwd)/py2
130 --with-python=%{__python3} \
133 %{__make} install DESTDIR=$(pwd)/py3
138 rm -rf $RPM_BUILD_ROOT
139 install -d $RPM_BUILD_ROOT{%{_pkglibdir},%{_sysconfdir}}
141 cp -a py2/* $RPM_BUILD_ROOT
142 mv $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}{,-py2}.so
143 sed -e 's/mod_wsgi.so/mod_wsgi-py2.so/' %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/61_mod_wsgi-py2.conf
146 cp -a py3/* $RPM_BUILD_ROOT
147 mv $RPM_BUILD_ROOT%{_pkglibdir}/mod_%{mod_name}{,-py3}.so
148 sed -e 's/mod_wsgi.so/mod_wsgi-py3.so/' %{SOURCE1} > $RPM_BUILD_ROOT%{_sysconfdir}/61_mod_wsgi-py3.conf
152 rm -rf $RPM_BUILD_ROOT
154 %triggerpostun py2 -- %{name} < 4.5.7-0.2
155 if [ -f %{_sysconfdir}/61_mod_wsgi.conf.rpmsave ]; then
156 mv %{_sysconfdir}/61_mod_wsgi-py2.conf{,.rpmnew}
157 mv %{_sysconfdir}/61_mod_wsgi{.conf.rpmsave,-py2.conf}
158 %{__sed} -i -e 's/mod_wsgi.so/mod_wsgi-py2.so/' $RPM_BUILD_ROOT%{_sysconfdir}/61_mod_wsgi-py2.conf
159 %service -q httpd restart
163 %service -q httpd restart
166 if [ "$1" = "0" ]; then
167 %service -q httpd restart
171 %service -q httpd restart
174 if [ "$1" = "0" ]; then
175 %service -q httpd restart
180 %defattr(644,root,root,755)
181 %doc README.rst CREDITS.rst
182 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}-py2.conf
183 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}-py2.so
188 %defattr(644,root,root,755)
189 %doc README.rst CREDITS.rst
190 %attr(640,root,root) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/*_mod_%{mod_name}-py3.conf
191 %attr(755,root,root) %{_pkglibdir}/mod_%{mod_name}-py3.so