ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
Revision: 1.47
Committed: Tue May 19 09:01:05 2009 UTC (15 years, 11 months ago) by andreasp
Branch: MAIN
CVS Tags: ap20090520-osx105, ap20090519-osx105
Changes since 1.46: +38 -46 lines
Log Message:
updates for building on mac os x 10.5 (leopard)

File Contents

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