]> git.pld-linux.org Git - packages/apache-mod_python.git/blob - apache-mod_python.spec
e1b7fdbb1aebebd00d3cef30be8028207d0a4cb8
[packages/apache-mod_python.git] / apache-mod_python.spec
1 %define         mod_name        python
2 Summary:        A Python for the Apache Web server
3 Name:           apache-mod_%{mod_name}
4 Version:        2.2
5 Release:        1
6 License:        distributable
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/
11 Requires:       apache
12 Requires:       python 
13 BuildRequires:  apache
14 BuildRequires:  apache-devel
15 BuildRequires:  python-devel
16 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
17
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
24
25
26 %description
27 mod_python allows embedding Python within the Apache Web server 
28 for a considerable boost in performance and added flexibility 
29 in designing web based applications. 
30
31 NOTE: This versions should still be considered Beta
32
33 %prep 
34 %setup -q -n mod_%{mod_name}-%{version}
35
36 %build
37 python %{python_libdir}/compileall.py lib/python/mod_python/
38
39 LDFLAGS=
40 # RH  
41 if [ -f %{python_libdir}/config/libpython%{python_version}.a ]; then 
42         LDFLAGS="$LDFLAGS -L%{python_libdir}/config/ -lpython%{python_version}"
43 # PLD 
44 else  
45         LDFLAGS="$LDFLAGS -lpython"
46 fi  
47  
48 if ldd %{python_prefix}/bin/python | grep libpthread >/dev/null; then 
49         LDFLAGS="$LDFLAGS -lpthread"
50 fi 
51
52 cd src
53 /usr/sbin/apxs -I%{python_includedir} $LDFLAGS -o mod_%{mod_name}.so -c mod_%{mod_name}.c
54 cd ..
55 gzip -9nf README COPYRIGHT
56
57 %install
58 rm -rf $RPM_BUILD_ROOT
59
60 install -d $RPM_BUILD_ROOT%{apache_moddir}
61 install src/mod_%{mod_name}.so $RPM_BUILD_ROOT%{apache_moddir}
62 strip --strip-unneeded $RPM_BUILD_ROOT%{apache_moddir}/* 
63
64 install -d $RPM_BUILD_ROOT%{python_sitedir}/mod_%{mod_name}
65 install lib/python/mod_python/* $RPM_BUILD_ROOT%{python_sitedir}/mod_%{mod_name}
66
67 %post
68 /usr/sbin/apxs -e -a -n %{mod_name} %{apache_moddir}/mod_%{mod_name}.so 1>&2
69 if [ -f /var/lock/subsys/httpd ]; then
70         /etc/rc.d/init.d/httpd restart 1>&2
71 fi
72
73 %preun
74 if [ "$1" = "0" ]; then
75         /usr/sbin/apxs -e -A -n %{mod_name} %{apache_moddir}/mod_%{mod_name}.so 1>&2
76         if [ -f /var/lock/subsys/httpd ]; then
77                 /etc/rc.d/init.d/httpd restart 1>&2
78         fi
79 fi
80
81 %clean
82 rm -rf $RPM_BUILD_ROOT
83
84 %files
85 %defattr(644,root,root,755)
86 %attr(755,root,root) %{apache_moddir}/*
87 %{python_sitedir}/mod_%{mod_name}
88 %doc doc/*
89 %doc {README,COPYRIGHT}.gz
This page took 0.034411 seconds and 2 git commands to generate.