ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
Revision: 1.45
Committed: Thu May 14 13:35:07 2009 UTC (15 years, 11 months ago) by valya
Branch: MAIN
CVS Tags: DAS_20090514_2
Changes since 1.44: +1 -0 lines
Log Message:
New python should provide: python2.5, add it to spec file.

File Contents

# User Rev Content
1 eulisse 1.44 ### RPM external python 2.5.4
2 eulisse 1.3 ## INITENV +PATH PATH %i/bin
3     ## INITENV +PATH LD_LIBRARY_PATH %i/lib
4 argiro 1.1 # OS X patches and build fudging stolen from fink
5 ratnik 1.34
6     Requires: expat bz2lib db4 gdbm
7    
8 ratnik 1.41 %if "%cmsplatf" != "slc4onl_ia32_gcc346"
9 ratnik 1.34 Requires: zlib openssl
10     %endif
11 valya 1.45 Provides: python2.5
12 ratnik 1.34
13 eulisse 1.8 # FIXME: readline, crypt
14 argiro 1.1 # FIXME: gmp, panel, tk/tcl, x11
15    
16 elmer 1.24 Source0: http://www.python.org/ftp/%n/%realversion/Python-%realversion.tgz
17 elmer 1.13 Patch0: python-Include-pyport.h
18     Patch1: python-Lib-plat-mac-applesingle.py
19     Patch2: python-Lib-site.py
20     Patch3: python-Mac-OSX-Makefile
21     Patch4: python-Makefile.pre.in
22     Patch5: python-configure
23     Patch6: python-setup.py
24 argiro 1.1
25 steen 1.19
26 argiro 1.1 %prep
27 elmer 1.24 %setup -n Python-%realversion
28 elmer 1.13 #%patch0
29     #%patch1
30     #%patch2
31     #%patch3
32     #%patch4
33     #%patch5
34     #%patch6
35 eulisse 1.5 perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" Lib/cgi.py
36    
37 argiro 1.1 %ifos darwin
38     sed 's|@PREFIX@|%i|g' < %_sourcedir/python-osx | patch -p1
39     %endif
40    
41     %build
42     # Python is awkward about passing other include or library directories
43     # to it. Basically there is no way to pass anything from configure to
44     # make, or down to python itself. To get python detect the extensions
45     # we want to enable, we simply have to link the contents into python's
46     # own include/lib directories. Ugh.
47     #
48     # NB: It would sort-of make sense to link more stuff from /sw on OS X,
49     # but we simply cannot link the whole world. If you need something,
50     # see above for the commented-out list of packages that could be
51     # linked specifically, or could be built by ourselves, depending on
52     # whether we like to pick up system libraries or want total control.
53     mkdir -p %i/include %i/lib
54 ratnik 1.34
55 ratnik 1.41 %if "%cmsplatf" != "slc4onl_ia32_gcc346"
56 ratnik 1.34 %define extradirs $ZLIB_ROOT $OPENSSL_ROOT
57     %else
58     %define extradirs %{nil}
59     %endif
60    
61     dirs="$EXPAT_ROOT $BZ2LIB_ROOT $NCURSES_ROOT $DB4_ROOT $GDBM_ROOT %{extradirs}"
62    
63 eulisse 1.16 echo $dirs
64 argiro 1.1 for d in $dirs; do
65     for f in $d/include/*; do
66 eulisse 1.29 [ -e $f ] || continue
67 argiro 1.1 rm -f %i/include/$(basename $f)
68     ln -s $f %i/include
69     done
70     for f in $d/lib/*; do
71 eulisse 1.29 [ -e $f ] || continue
72 argiro 1.1 rm -f %i/lib/$(basename $f)
73     ln -s $f %i/lib
74     done
75     done
76    
77 eulisse 1.39 additionalConfigureOptions=""
78     case %cmsplatf in
79     osx105* )
80     additionalConfigureOptions="--disable-readline"
81     ;;
82     esac
83    
84     ./configure --prefix=%i $additionalConfigureOptions --enable-shared \
85     --without-tkinter --disable-tkinter
86    
87 ratnik 1.38 # The following is a kludge around the fact that the /usr/lib/libreadline.so
88     # symlink (for 32-bit lib) is missing on the 64bit machines
89 eulisse 1.43 case %cmsplatf in
90     slc4_ia32* )
91     mkdir -p %{i}/lib
92     ln -s /usr/lib/libreadline.so.4.3 %{i}/lib/libreadline.so
93     ;;
94     esac
95 ratnik 1.38 make %makeprocesses
96 ratnik 1.37
97 argiro 1.1 %install
98     make install
99 elmer 1.24 %define pythonv %(echo %realversion | cut -d. -f 1,2)
100 eulisse 1.8
101 eulisse 1.43 case %cmsplatf in
102     osx*)
103     make install prefix=%i
104     (cd Misc; /bin/rm -rf RPM)
105     mkdir -p %i/share/doc/%n
106     cp -R Demo Doc %i/share/doc/%n
107     cp -R Misc Tools %i/lib/python%{pythonv}
108     gcc -dynamiclib -all_load -single_module \
109     -framework System -framework CoreServices -framework Foundation \
110     %i/lib/python%{pythonv}/config/libpython%{pythonv}.a \
111     -undefined dynamic_lookup \
112     -o %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
113     -install_name %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
114     -current_version %{pythonv} -compatibility_version %{pythonv} -ldl
115     (cd %i/lib/python%{pythonv}/config
116     perl -p -i -e 's|-fno-common||g' Makefile)
117    
118     find %i/lib/python%{pythonv}/config -name 'libpython*' -exec mv {} %i/lib \;
119     ;;
120     esac
121 eulisse 1.9
122     perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
123     %{i}/bin/pydoc \
124     %{i}/bin/smtpd.py \
125     %{i}/lib/python2.4/bsddb/dbshelve.py \
126     %{i}/lib/python2.4/test/test_bz2.py \
127     %{i}/lib/python2.4/test/test_largefile.py \
128     %{i}/lib/python2.4/test/test_optparse.py
129 eulisse 1.17 rm `find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*'`
130 eulisse 1.18 rm `find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*'`
131 muzaffar 1.28
132 ratnik 1.42 # remove tkinter that brings dependency on libtk:
133     #
134    
135     rm `find %{i}/lib -type f -name "_tkinter.so"`
136    
137 muzaffar 1.28 # SCRAM ToolBox toolfile
138     mkdir -p %i/etc/scram.d
139     cat << \EOF_TOOLFILE >%i/etc/scram.d/%n
140     <doc type=BuildSystem::ToolDoc version=1.0>
141     <Tool name=%n version=%v>
142     <lib name=python2.4>
143     <Client>
144     <Environment name=PYTHON_BASE default="%i"></Environment>
145     <Environment name=LIBDIR default="$PYTHON_BASE/lib"></Environment>
146     <Environment name=INCLUDE default="$PYTHON_BASE/include/python2.4"></Environment>
147     <Environment name=PYTHON_COMPILE default="$PYTHON_BASE/lib/python2.4/compileall.py"></Environment>
148     </Client>
149     <use name=sockets>
150     <Runtime name=PATH value="$PYTHON_BASE/bin" type=path>
151     </Tool>
152     EOF_TOOLFILE
153    
154 eulisse 1.44 # Makes sure that executables start with /usr/bin/env perl and not with comments.
155     find %i -type f -perm -555 -name '*.py' -exec perl -p -i -e 'if ($. == 1) {s|^"""|#/usr/bin/env python\n"""|}' {} \;
156     find %i -type f -perm -555 -name '*.py' -exec perl -p -i -e 'if ($. == 1) {s|^\'\'\'|#/usr/bin/env python\n\'\'\'|}' {} \;
157     find %i -type f -perm -555 -name '*.py' -exec perl -p -i -e 'if ($. == 1) {s|/usr/local/bin/python|/usr/bin/env python|}' {} \;
158     rm -f %i/share/doc/python/Demo/rpc/test
159    
160 eulisse 1.16 %post
161     find $RPM_INSTALL_PREFIX/%pkgrel/lib -type l | xargs ls -la | sed -e "s|.*[ ]\(/.*\) -> \(.*\)| \2 \1|;s|[ ]/[^ ]*/external| $RPM_INSTALL_PREFIX/%cmsplatf/external|g" | xargs -n2 ln -sf
162 muzaffar 1.28 %{relocateConfig}etc/scram.d/%n