Blame SPECS/python3.11-mod_wsgi.spec

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