1 %define mod_name python
2 Summary: A Python for the Apache Web server
3 Name: apache-mod_%{mod_name}
7 Group: Networking/Daemons
8 Group(pl): Sieciowe/Serwery
9 Source: http://www.modpython.org/dist/mod_%{mod_name}-%{version}.tgz
10 URL: http://www.modpython.org/
14 BuildRequires: apache-devel
15 BuildRequires: python-devel
16 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
18 %define apache_moddir %(/usr/sbin/apxs -q LIBEXECDIR)
19 %define python_prefix %(echo `python -c "import sys; print sys.prefix"`)
20 %define python_version %(echo `python -c "import sys; print sys.version[:3]"`)
21 %define python_libdir %{python_prefix}/lib/python%{python_version}
22 %define python_includedir %{python_prefix}/include/python%{python_version}
23 %define python_sitedir %{python_libdir}/site-packages
26 mod_python allows embedding Python within the Apache Web server
27 for a considerable boost in performance and added flexibility
28 in designing web based applications.
30 NOTE: This versions should still be considered Beta
33 %setup -q -n mod_%{mod_name}-%{version}
36 python %{python_libdir}/compileall.py lib/python/mod_python/
40 if [ -f %{python_libdir}/config/libpython%{python_version}.a ]; then
41 LDFLAGS="$LDFLAGS -L%{python_libdir}/config/ -lpython%{python_version}"
44 LDFLAGS="$LDFLAGS -lpython"
47 if ldd %{python_prefix}/bin/python | grep libpthread >/dev/null; then
48 LDFLAGS="$LDFLAGS -lpthread"
52 /usr/sbin/apxs -I%{python_includedir} $LDFLAGS -o mod_%{mod_name}.so -c mod_%{mod_name}.c
54 gzip -9nf README COPYRIGHT NEWS CREDITS
57 rm -rf $RPM_BUILD_ROOT
58 install -d $RPM_BUILD_ROOT{%{apache_moddir},%{python_sitedir}/mod_%{mod_name}}
60 install src/mod_%{mod_name}.so $RPM_BUILD_ROOT%{apache_moddir}
62 strip --strip-unneeded $RPM_BUILD_ROOT%{apache_moddir}/*
64 install lib/python/mod_python/* $RPM_BUILD_ROOT%{python_sitedir}/mod_%{mod_name}
67 /usr/sbin/apxs -e -a -n %{mod_name} %{apache_moddir}/mod_%{mod_name}.so 1>&2
68 if [ -f /var/lock/subsys/httpd ]; then
69 /etc/rc.d/init.d/httpd restart 1>&2
73 if [ "$1" = "0" ]; then
74 /usr/sbin/apxs -e -A -n %{mod_name} %{apache_moddir}/mod_%{mod_name}.so 1>&2
75 if [ -f /var/lock/subsys/httpd ]; then
76 /etc/rc.d/init.d/httpd restart 1>&2
81 rm -rf $RPM_BUILD_ROOT
84 %defattr(644,root,root,755)
86 %doc {README,COPYRIGHT,NEWS,CREDITS}.gz
87 %attr(755,root,root) %{apache_moddir}/*
88 %{python_sitedir}/mod_%{mod_name}