Blame SPECS/python3.11-mod_wsgi.spec

5f4416
%global __python3 /usr/bin/python3.11
5f4416
%global python3_pkgversion 3.11
5f4416
5f4416
%{!?_httpd_apxs: %{expand: %%global _httpd_apxs %%{_sbindir}/apxs}}
5f4416
5f4416
%{!?_httpd_mmn: %{expand: %%global _httpd_mmn %%(cat %{_includedir}/httpd/.mmn 2>/dev/null || echo 0-0)}}
5f4416
%{!?_httpd_confdir:    %{expand: %%global _httpd_confdir    %%{_sysconfdir}/httpd/conf.d}}
5f4416
# /etc/httpd/conf.d with httpd < 2.4 and defined as /etc/httpd/conf.modules.d with httpd >= 2.4
5f4416
%{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}}
5f4416
%{!?_httpd_moddir:    %{expand: %%global _httpd_moddir    %%{_libdir}/httpd/modules}}
5f4416
5f4416
%if 0%{?fedora} || 0%{?rhel} > 7
5f4416
%bcond_without python3
5f4416
%bcond_with python2
5f4416
%else
5f4416
%bcond_with python3
5f4416
%bcond_without python2
5f4416
%endif
5f4416
5f4416
Name:           python%{python3_pkgversion}-mod_wsgi
5f4416
Version:        4.9.4
5f4416
Release:        1%{?dist}
5f4416
Summary:        A WSGI interface for Python web applications in Apache
5f4416
License:        ASL 2.0
5f4416
URL:            https://modwsgi.readthedocs.io/
5f4416
Source0:        https://github.com/GrahamDumpleton/mod_wsgi/archive/%{version}.tar.gz#/mod_wsgi-%{version}.tar.gz
5f4416
Source1:        wsgi.conf
5f4416
Source2:        wsgi-python3.conf
5f4416
Patch1:         mod_wsgi-4.5.20-exports.patch
5f4416
Patch2:         mod_wsgi-4.7.1-remove-rpath.patch
5f4416
5f4416
BuildRequires:  httpd-devel
5f4416
BuildRequires:  gcc
5f4416
BuildRequires:  make
5f4416
5f4416
5f4416
Requires:       httpd-mmn = %{_httpd_mmn}
5f4416
BuildRequires:  python%{python3_pkgversion}-devel
5f4416
BuildRequires:  python%{python3_pkgversion}-rpm-macros
5f4416
BuildRequires:  python%{python3_pkgversion}-setuptools
5f4416
5f4416
# Suppress auto-provides for module DSO
5f4416
%{?filter_provides_in: %filter_provides_in %{_httpd_moddir}/.*\.so$}
5f4416
%{?filter_setup}
5f4416
5f4416
# httpd can only load one Python 3 version of mod_wsgi at the time, and
5f4416
# therefore we use a Conflicts tag to only allow one to be installed.  The
5f4416
# alternative would be to define a priority between them (e.g. python3- has
5f4416
# priority over python38-), however, it would be potentially confusing and
5f4416
# tricky to notice why the other version is not working.
5f4416
Conflicts: python3-mod_wsgi
5f4416
Conflicts: python38-mod_wsgi
5f4416
Conflicts: python39-mod_wsgi
5f4416
5f4416
%global _description\
5f4416
The mod_wsgi adapter is an Apache module that provides a WSGI compliant\
5f4416
interface for hosting Python based web applications within Apache. The\
5f4416
adapter is written completely in C code against the Apache C runtime and\
5f4416
for hosting WSGI applications within Apache has a lower overhead than using\
5f4416
existing WSGI adapters for mod_python or CGI.\
5f4416
5f4416
5f4416
%description %_description
5f4416
5f4416
%if %{with python2}
5f4416
%package -n python2-%{name}
5f4416
Summary: %summary
5f4416
Requires:       httpd-mmn = %{_httpd_mmn}
5f4416
BuildRequires:  python2-devel, python2-setuptools
5f4416
%{?python_provide:%python_provide python2-%{name}}
5f4416
%if 0%{?rhel} && 0%{?rhel} <= 7
5f4416
Provides: mod_wsgi = %{version}-%{release}
5f4416
Provides: mod_wsgi%{?_isa} = %{version}-%{release}
5f4416
Obsoletes: mod_wsgi < %{version}-%{release}
5f4416
%endif
5f4416
5f4416
%description -n python2-%{name} %_description
5f4416
5f4416
%endif
5f4416
5f4416
5f4416
5f4416
%prep
5f4416
%autosetup -p1 -n mod_wsgi-%{version}
5f4416
5f4416
: Python2=%{with python2} Python3=%{with python3}
5f4416
5f4416
%build
5f4416
5f4416
export LDFLAGS="$RPM_LD_FLAGS -L%{_libdir}"
5f4416
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
5f4416
5f4416
%if %{with python3}
5f4416
mkdir py3build/
5f4416
# this always produces an error (because of trying to copy py3build
5f4416
# into itself) but we don't mind, so || :
5f4416
cp -R * py3build/ || :
5f4416
pushd py3build
5f4416
%configure --enable-shared --with-apxs=%{_httpd_apxs} --with-python=%{__python3}
5f4416
%make_build
5f4416
%py3_build
5f4416
popd
5f4416
%endif
5f4416
5f4416
%if %{with python2}
5f4416
%configure --enable-shared --with-apxs=%{_httpd_apxs} --with-python=%{python2}
5f4416
%make_build
5f4416
%py2_build
5f4416
%endif
5f4416
5f4416
%install
5f4416
# first install python3 variant and rename the so file
5f4416
%if %{with python3}
5f4416
pushd py3build
5f4416
%make_install LIBEXECDIR=%{_httpd_moddir}
5f4416
mv  $RPM_BUILD_ROOT%{_httpd_moddir}/mod_wsgi{,_python3}.so
5f4416
5f4416
install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir}
5f4416
# httpd >= 2.4.x
5f4416
install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi-python3.conf
5f4416
5f4416
%py3_install
5f4416
mv $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express{,-3}
5f4416
ln -s %{_bindir}/mod_wsgi-express-3  $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express-%{python3_version}
5f4416
popd
5f4416
5f4416
%endif
5f4416
5f4416
# second install python2 variant
5f4416
%if %{with python2}
5f4416
%make_install LIBEXECDIR=%{_httpd_moddir}
5f4416
5f4416
install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir}
5f4416
# httpd >= 2.4.x
5f4416
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi.conf
5f4416
5f4416
%py2_install
5f4416
mv $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express{,-2}
5f4416
ln -s %{_bindir}/mod_wsgi-express-2 $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express
5f4416
%endif
5f4416
5f4416
%if %{with python2}
5f4416
%files -n python2-%{name}
5f4416
%license LICENSE
5f4416
%doc CREDITS.rst README.rst
5f4416
%config(noreplace) %{_httpd_modconfdir}/*wsgi.conf
5f4416
%{_httpd_moddir}/mod_wsgi.so
5f4416
%{python2_sitearch}/mod_wsgi-*.egg-info
5f4416
%{python2_sitearch}/mod_wsgi
5f4416
%{_bindir}/mod_wsgi-express-2
5f4416
%{_bindir}/mod_wsgi-express
5f4416
%endif
5f4416
5f4416
%if %{with python3}
5f4416
%files -n python%{python3_pkgversion}-mod_wsgi
5f4416
%license LICENSE
5f4416
%doc CREDITS.rst README.rst
5f4416
%config(noreplace) %{_httpd_modconfdir}/*wsgi-python3.conf
5f4416
%{_httpd_moddir}/mod_wsgi_python3.so
5f4416
%{python3_sitearch}/mod_wsgi-*.egg-info
5f4416
%{python3_sitearch}/mod_wsgi
5f4416
%{_bindir}/mod_wsgi-express-%{python3_version}
5f4416
%{_bindir}/mod_wsgi-express-3
5f4416
%endif
5f4416
5f4416
%changelog
5f4416
* Thu Dec 01 2022 Charalampos Stratakis <cstratak@redhat.com> - 4.9.4-1
5f4416
- Initial package
5f4416
- Fedora contributions by:
5f4416
      Adam Williamson <awilliam@redhat.com>
5f4416
      Alexander Bokovoy <abokovoy@redhat.com>
5f4416
      Bill Nottingham <notting@fedoraproject.org>
5f4416
      Dennis Gilmore <dennis@ausil.us>
5f4416
      dmalcolm <dmalcolm@fedoraproject.org>
5f4416
      Ignacio Vazquez-Abrams <ivazquez@fedoraproject.org>
5f4416
      Igor Gnatenko <ignatenkobrain@fedoraproject.org>
5f4416
      Iryna Shcherbina <shcherbina.iryna@gmail.com>
5f4416
      Jakub Dorňák <jakub.dornak@misli.cz>
5f4416
      James Bowes <jbowes@repl.ca>
5f4416
      Jan Kaluza <jkaluza@redhat.com>
5f4416
      jbowes <jbowes@fedoraproject.org>
5f4416
      Jesse Keating <jkeating@fedoraproject.org>
5f4416
      Joe Orton <jorton@redhat.com>
5f4416
      joshkayse <joshkayse@fedoraproject.org>
5f4416
      Kevin Fenzi <kevin@fedoraproject.org>
5f4416
      Luboš Uhliarik <luhliari@redhat.com>
5f4416
      Luke Macken <lmacken@fedoraproject.org>
5f4416
      Matthias Runge <mrunge@redhat.com>
5f4416
      Miro Hrončok <miro@hroncok.cz>
5f4416
      Orion Poplawski <orion@cora.nwra.com>
5f4416
      Peter Robinson <pbrobinson@fedoraproject.org>
5f4416
      Richard W.M. Jones <rjones@redhat.com>
5f4416
      Ricky Zhou (周家杰) <ricky@fedoraproject.org>
5f4416
      Tomas Hrnciar <thrnciar@redhat.com>
5f4416
      Tom Stellard <tstellar@redhat.com>
5f4416
      Troy Dawson <tdawson@redhat.com>
5f4416
      Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>