ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
Revision: 1.52
Committed: Thu Sep 3 20:05:08 2009 UTC (15 years, 7 months ago) by elmer
Branch: MAIN
CVS Tags: CMSSW_3_3_3_slc5-gcc434, apFor333v1-sl5igcc4, apFor333v1-sl4igcc4, apFor333v0_sl5igcc4, apFor333v0_sl4igcc4, sm091112a-slc5onl, sm091112-slc5onl, pe20091110c-for33X-slc5-gcc434, pe20091110c-for33X-slc4-gcc432, pe20091110b-for33X-slc5-gcc434, pe20091110b-for33X-slc4-gcc432, pe20091110a-for33X-slc5-gcc434, pe20091110a-for33X-slc4-gcc432, CMSSW_3_4_0_pre5-slc5-gcc434, CMSSW_3_4_0_pre5-slc4-gcc432, CMSSW_3_4_0_pre4-slc4-gcc432, CMSSW_3_4_0_pre5-slc4_gcc432, dl091106, ap-20091103a-slc5onl-bootstrap, ap-20091103-slc5onl-bootstrap, CMSSW_3_3_2_FWLITE-slc5-gcc434, apFor332fwlv1-slc5-gcc434, apFor332fwlv0, eskFor340p4, CMSSW_3_3_2-slc5-gcc434, CMSSW_3_3_2-slc4-gcc432, apFor332v0_sl4igcc4, apFor332v0_sl5igcc4, CMSSW_3_4_0_pre3, eskFor340p3, apFor331fwlv1-slc5gcc434, sm091023b-slc5onl, sm091023a-slc5onl, CMSSW_3_3_1-slc5-gcc434, CMSSW_3_3_1-slc4-gcc432, pe20091022a-ports, pe20091022a-ports5, pe20091021a-ports5, pe20091021a-ports, CMSSW_3_4_0_pre2-432, CMSSW_3_4_0_pre1-432, pe20091018a-ports5, ge20091019, ge20091015-comp-bootstrap, CMSSW_3_3_0-slc5, CMSSW_3_3_0-432, pe20091008d-ports5, pe20091008d-ports, pe20091008c-ports5, ge20091008-fix-rpm-relocation, pe20091008b-ports5, pe20091008a-ports5, ge20091010-bootstrap, pe20091006e-ports5, ge20091006-bootstrap-3, pe20091006d-ports5, ge20091006-bootstrap-2, CMSSW_3_3_0_pre6-432, pe20091006c-ports5, ge20091006, pe20091006b-ports5, pe20091006a-ports5, pe20091006a-ports, PerfSuiteDB_20090930, pe20090929a-ports, ge20090929-amd64, ge20090929-ia32, ap20090929a-ports, CMSSW_3_3_0_pre5-432, pe20090925a-ports, pe20090924a-ports, pe20090923b-ports, pe20090923a-ports, pe20090922e-ports, pe20090922d-ports, pe20090922c-ports, pe20090922b-ports, pe20090922a-ports, ge20090922-ports, pe20090921d-ports, ge20090921-ports, pe20090921c-ports, PerfSuiteDB_20090916, pe20090912a-ports-xdaq, pe20090911a-ports-xdaq, pe20090907a-ports, apFor330pre2v0, PerfSuiteDB_20090904_almost_stable, pe20090904a-ports, PerfSuiteDB_20090904, pe20090903b-ports, pe20090903a-ports, pe20090903-for33X
Changes since 1.51: +1 -0 lines
Log Message:
Set PYTHONHOME envvar in scram runtime environment

File Contents

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