1 |
### RPM external python 2.4.2
|
2 |
## INITENV +PATH PATH %i/bin
|
3 |
## INITENV +PATH LD_LIBRARY_PATH %i/lib
|
4 |
# OS X patches and build fudging stolen from fink
|
5 |
Requires: zlib expat openssl bz2lib
|
6 |
# FIXME: readline, crypt
|
7 |
# FIXME: gmp, panel, tk/tcl, x11
|
8 |
|
9 |
Source0: http://www.python.org/ftp/%n/%v/Python-%v.tgz
|
10 |
#Patch0: python-osx
|
11 |
|
12 |
%prep
|
13 |
%setup -n Python-%v
|
14 |
perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" Lib/cgi.py
|
15 |
|
16 |
%ifos darwin
|
17 |
sed 's|@PREFIX@|%i|g' < %_sourcedir/python-osx | patch -p1
|
18 |
%endif
|
19 |
|
20 |
%build
|
21 |
# Python is awkward about passing other include or library directories
|
22 |
# to it. Basically there is no way to pass anything from configure to
|
23 |
# make, or down to python itself. To get python detect the extensions
|
24 |
# we want to enable, we simply have to link the contents into python's
|
25 |
# own include/lib directories. Ugh.
|
26 |
#
|
27 |
# NB: It would sort-of make sense to link more stuff from /sw on OS X,
|
28 |
# but we simply cannot link the whole world. If you need something,
|
29 |
# see above for the commented-out list of packages that could be
|
30 |
# linked specifically, or could be built by ourselves, depending on
|
31 |
# whether we like to pick up system libraries or want total control.
|
32 |
mkdir -p %i/include %i/lib
|
33 |
dirs="$ZLIB_ROOT $EXPAT_ROOT $OPENSSL_ROOT $BZ2LIB_ROOT $NCURSES_ROOT $DB4_ROOT $GDBM_ROOT"
|
34 |
for d in $dirs; do
|
35 |
for f in $d/include/*; do
|
36 |
[ -f $f ] || continue
|
37 |
rm -f %i/include/$(basename $f)
|
38 |
ln -s $f %i/include
|
39 |
done
|
40 |
for f in $d/lib/*; do
|
41 |
[ -f $f ] || continue
|
42 |
rm -f %i/lib/$(basename $f)
|
43 |
ln -s $f %i/lib
|
44 |
done
|
45 |
done
|
46 |
|
47 |
./configure --prefix=%i --enable-shared --without-tkinter --disable-tkinter --without-readline
|
48 |
make %makeprocesses
|
49 |
|
50 |
%install
|
51 |
make install
|
52 |
%define pythonv %(echo %v | cut -d. -f 1,2)
|
53 |
|
54 |
if [ $(uname) = Darwin ]; then
|
55 |
# make install prefix=%i
|
56 |
# (cd Misc; /bin/rm -rf RPM)
|
57 |
# mkdir -p %i/share/doc/%n
|
58 |
# cp -R Demo Doc %i/share/doc/%n
|
59 |
# cp -R Misc Tools %i/lib/python%{pythonv}
|
60 |
cc -dynamiclib -all_load -single_module \
|
61 |
-framework System -framework CoreServices -framework Foundation \
|
62 |
%i/lib/python%{pythonv}/config/libpython%{pythonv}.a \
|
63 |
-o %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
|
64 |
-install_name %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
|
65 |
-current_version %{pythonv} -compatibility_version %{pythonv} -ldl
|
66 |
ln -s libpython%{pythonv}.dylib %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib # for boost
|
67 |
# (cd %i/lib/python%{pythonv}/config; mv Makefile Makefile.orig;
|
68 |
# sed 's|-fno-common||g' < Makefile.orig > Makefile; /bin/rm -f Makefile.orig)
|
69 |
fi
|
70 |
|
71 |
perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
|
72 |
%{i}/bin/pydoc \
|
73 |
%{i}/bin/smtpd.py \
|
74 |
%{i}/lib/python2.4/bsddb/dbshelve.py \
|
75 |
%{i}/lib/python2.4/test/test_bz2.py \
|
76 |
%{i}/lib/python2.4/test/test_largefile.py \
|
77 |
%{i}/lib/python2.4/test/test_optparse.py
|