%define is_python %(test -e /opt/freeware/bin/python3_32 && echo 1 || echo 0) %if %{is_python} %define python_sitelib %(python3_32 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") %endif %define _libdir64 %{_prefix}/lib64 %define is_python_64 %(test -e /opt/freeware/bin/python3 && echo 1 || echo 0) %if %{is_python_64} %define python_sitelib64 %(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))") %endif %{!?_httpd_modconfdir: %{expand: %%global _httpd_modconfdir %%{_sysconfdir}/httpd/conf.d}} %{!?_httpd_moddir: %{expand: %%global _httpd_moddir %%{_libdir}/httpd/modules}} %{!?_httpd_moddir64: %{expand: %%global _httpd_moddir64 %%{_libdir64}/httpd/modules}} Name: mod_wsgi Version: 4.7.1 Release: 1 Summary: A WSGI interface for Python web applications in Apache License: ASL 2.0 URL: https://modwsgi.readthedocs.io/ Source0: https://github.com/GrahamDumpleton/mod_wsgi/archive/%{version}.tar.gz#/mod_wsgi-%{version}.tar.gz Source1: wsgi-python3.conf Source2: wsgi-python3.conf_64 Patch0: mod_wsgi-4.7.1-aix.patch BuildRequires: httpd-devel BuildRequires: gcc %description 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. %package -n python3-%{name} Summary: %summary Requires: httpd >= 2.4.43 BuildRequires: python3-devel >= 3.7.9 Requires: apr >= 1.5.2 Requires: apr-util >= 1.5.4 Requires: expat >= 2.2.9 Requires: libffi >= 3.2.1 Requires: ncurses >= 6.2 Requires: sqlite >= 3.28.0 Requires: python3 >= 3.7.9 Requires: libgcc >= 8.3.0 Provides: mod_wsgi = %{version}-%{release} %description -n python3-%{name} 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. %prep %setup -q -n %{name}-%{version} %patch0 -p0 rm -rf /tmp/%{name}-%{version}-32bit cp -pr . /tmp/%{name}-%{version}-32bit rm -fr * mv /tmp/%{name}-%{version}-32bit 32bit cp -pr 32bit 64bit %build export PATH="/opt/freeware/bin:$PATH" export CC="gcc" export PKG_CONFIG_PATH="" # build on 64bit mode cd 64bit export OBJECT_MODE=64 export CFLAGS="-maix64 -O2" export LDFLAGS="-maix64 -L/opt/freeware/lib64 -L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib64:/opt/freeware/lib:/usr/lib:/lib" export APXS=/opt/freeware/bin/apxs_64 ./configure --prefix=%{_prefix} --with-apxs=apxs_64 --with-python=python3 gmake python3 setup.py build # build on 32bit mode cd ../32bit export OBJECT_MODE=32 export CFLAGS="-maix32 -O2 -D_LARGE_FILES" export LDFLAGS="-L/opt/freeware/lib -Wl,-blibpath:/opt/freeware/lib:/usr/lib:/lib -Wl,-bmaxdata:0x80000000" export APXS=/opt/freeware/bin/apxs ./configure --prefix=%{_prefix} --with-apxs=/opt/freeware/bin/apxs --with-python=python3_32 gmake python3_32 setup.py build %install [ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT} # install on 64bit mode cd 64bit export OBJECT_MODE=64 make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir64} mv $RPM_BUILD_ROOT%{_httpd_moddir64}/mod_wsgi.so $RPM_BUILD_ROOT%{_httpd_moddir64}/mod_wsgi_python3.so install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir} # httpd >= 2.4.x install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi-python3.conf_64 python3 setup.py install --skip-build --root ${RPM_BUILD_ROOT} mv $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express-3_64 # install on 32bit mode cd ../32bit export OBJECT_MODE=32 make install DESTDIR=$RPM_BUILD_ROOT LIBEXECDIR=%{_httpd_moddir} mv $RPM_BUILD_ROOT%{_httpd_moddir}/mod_wsgi.so $RPM_BUILD_ROOT%{_httpd_moddir}/mod_wsgi_python3.so install -d -m 755 $RPM_BUILD_ROOT%{_httpd_modconfdir} # httpd >= 2.4.x install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT%{_httpd_modconfdir}/10-wsgi-python3.conf python3_32 setup.py install --skip-build --root ${RPM_BUILD_ROOT} mv $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express $RPM_BUILD_ROOT%{_bindir}/mod_wsgi-express-3 %post -n python3-%{name} if [ "$1" = "1" ]; then echo "Include conf.d/10-wsgi-python3.conf" >> %{_prefix}/etc/httpd/conf/httpd.conf echo "Include conf.d/10-wsgi-python3.conf_64" >> %{_prefix}/etc/httpd/conf/httpd.conf_64 fi %preun -n python3-%{name} if [ "$1" = "0" ]; then /usr/bin/cat %{_sysconfdir}/httpd/conf/httpd.conf | \ /usr/bin/sed -e "s|Include conf.d/10-wsgi-python3.conf||" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf /usr/bin/mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf %{_sysconfdir}/httpd/conf/httpd.conf /usr/bin/cat %{_sysconfdir}/httpd/conf/httpd.conf_64| \ /usr/bin/sed -e "s|Include conf.d/10-wsgi-python3.conf_64||" \ > %{_sysconfdir}/httpd/conf/tmp_httpd.conf_64 /usr/bin/mv -f %{_sysconfdir}/httpd/conf/tmp_httpd.conf_64 %{_sysconfdir}/httpd/conf/httpd.conf_64 fi %files -n python3-%{name} %doc 32bit/CREDITS.rst 32bit/README.rst %config(noreplace) %{_httpd_modconfdir}/*wsgi-python3.conf* %{_httpd_moddir}/mod_wsgi_python3.so %{_httpd_moddir64}/mod_wsgi_python3.so %{python_sitelib}/mod_wsgi-*.egg-info %{python_sitelib}/mod_wsgi %{python_sitelib64}/mod_wsgi-*.egg-info %{python_sitelib64}/mod_wsgi %{_bindir}/mod_wsgi-express-3* %changelog * Thu Oct 08 2020 Reshma V Kumar - 4.7.1-1 - Initial port for AIX Toolbox