Blame SPECS/python3.11-mod_wsgi.spec

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