ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/python.spec
(Generate patch)

Comparing COMP/CMSDIST/python.spec (file contents):
Revision 1.5 by eulisse, Mon Apr 24 22:22:12 2006 UTC vs.
Revision 1.91 by dsr, Mon Aug 20 13:30:52 2012 UTC

# Line 1 | Line 1
1 < ### RPM external python 2.4.2
1 > ### RPM external python 2.6.8
2   ## INITENV +PATH PATH %i/bin
3   ## INITENV +PATH LD_LIBRARY_PATH %i/lib
4 + ## INITENV SETV PYTHON_LIB_SITE_PACKAGES lib/python%{python_major_version}/site-packages
5 + ## INITENV SETV PYTHONHASHSEED random
6   # OS X patches and build fudging stolen from fink
7 < Requires: zlib expat openssl bz2lib
8 < # FIXME: readline, ncurses, crypt, various [ng]dbm, db-*, db[1-3],
7 > %{expand:%%define python_major_version %(echo %realversion | cut -d. -f1,2)}
8 > %define online %(case %cmsplatf in (*onl_*_*) echo true;; (*) echo false;; esac)
9 >
10 > Requires: expat bz2lib db4 gdbm
11 >
12 > %if "%online" != "true"
13 > Requires: zlib openssl sqlite
14 > %endif
15 >
16 > # FIXME: readline, crypt
17   # FIXME: gmp, panel, tk/tcl, x11
18  
19 < Source0: http://www.python.org/ftp/%n/%v/Python-%v.tgz
20 < #Patch0: python-osx
19 > Source0: http://www.python.org/ftp/%n/%realversion/Python-%realversion.tgz
20 > Patch0: python-dont-detect-dbm
21 > Patch1: python-fix-macosx-relocation
22 > Patch2: python-2.6.8-ssl-fragment
23  
24   %prep
25 < %setup -n Python-%v
26 < perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" Lib/cgi.py
27 <
28 < %ifos darwin
29 < sed 's|@PREFIX@|%i|g' < %_sourcedir/python-osx | patch -p1
30 < %endif
25 > %setup -n Python-%realversion
26 > find . -type f | while read f; do
27 >  if head -n1 $f | grep -q /usr/local; then
28 >    perl -p -i -e "s|#!.*/usr/local/bin/python|#!/usr/bin/env python|" $f
29 >  else :; fi
30 > done
31 > %patch0 -p0
32 > %patch1 -p0
33 > %patch2 -p1
34  
35   %build
36 +
37   # Python is awkward about passing other include or library directories
38   # to it.  Basically there is no way to pass anything from configure to
39   # make, or down to python itself.  To get python detect the extensions
# Line 29 | Line 45 | perl -p -i -e "s|#!.*/usr/local/bin/pyth
45   # see above for the commented-out list of packages that could be
46   # linked specifically, or could be built by ourselves, depending on
47   # whether we like to pick up system libraries or want total control.
48 < mkdir -p %i/include %i/lib
49 < dirs="$ZLIB_ROOT $EXPAT_ROOT $OPENSSL_ROOT $BZ2LIB_ROOT"
48 > #mkdir -p %i/include %i/lib
49 > mkdir -p %i/include %i/lib %i/bin
50 >
51 > %if "%online" != "true"
52 > %define extradirs $ZLIB_ROOT $OPENSSL_ROOT $SQLITE_ROOT
53 > %else
54 > %define extradirs %{nil}
55 > %endif
56 >
57 > dirs="$EXPAT_ROOT $BZ2LIB_ROOT $NCURSES_ROOT $DB4_ROOT $GDBM_ROOT %{extradirs}"
58 >
59 > # We need to export it because setup.py now uses it to determine the actual
60 > # location of DB4, this was needed to avoid having it picked up from the system.
61 > export DB4_ROOT
62 >
63 > # Python's configure parses LDFLAGS and CPPFLAGS to look for aditional library and include directories
64 > echo $dirs
65 > LDFLAGS=""
66 > CPPFLAGS=""
67   for d in $dirs; do
68 <  for f in $d/include/*; do
69 <    [ -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
68 >  LDFLAGS="$LDFLAGS -L $d/lib"
69 >  CPPFLAGS="$CPPFLAGS -I $d/include"
70   done
71 + export LDFLAGS
72 + export CPPFLAGS
73 +
74 + additionalConfigureOptions=""
75 + case %cmsplatf in
76 +    osx105* )
77 +    additionalConfigureOptions="--disable-readline"
78 +    ;;
79 + esac
80 +
81 + ./configure --prefix=%i $additionalConfigureOptions --enable-shared \
82 +            --without-tkinter --disable-tkinter
83  
47 ./configure --prefix=%i --enable-shared --without-tk --disable-tk --without-readline
84   make %makeprocesses
85  
86   %install
87 + # We need to export it because setup.py now uses it to determine the actual
88 + # location of DB4, this was needed to avoid having it picked up from the system.
89 + export DB4_ROOT
90   make install
91 < if [ $(uname) = Darwin ]; then
92 <  # make install prefix=%i
93 <  # (cd Misc; /bin/rm -rf RPM)
94 <  # mkdir -p %i/share/doc/%n
95 <  # cp -R Demo Doc %i/share/doc/%n
96 <  # cp -R Misc Tools %i/lib/python2.3
97 <  cc -dynamiclib -all_load -single_module \
91 > %define pythonv %(echo %realversion | cut -d. -f 1,2)
92 >
93 > case %cmsplatf in
94 >  osx*)
95 >   make install prefix=%i
96 >   (cd Misc; /bin/rm -rf RPM)
97 >   mkdir -p %i/share/doc/%n
98 >   cp -R Demo Doc %i/share/doc/%n
99 >   cp -R Misc Tools %i/lib/python%{pythonv}
100 >   gcc -dynamiclib -all_load -single_module \
101      -framework System -framework CoreServices -framework Foundation \
102 <    %i/lib/python2.3/config/libpython2.3.a \
103 <    -o %i/lib/python2.3/config/libpython2.3.dylib \
104 <    -install_name %i/lib/python2.3/config/libpython2.3.dylib \
105 <    -current_version 2.3 -compatibility_version 2.3 -ldl
106 <  ln -s libpython2.3.dylib %i/lib/python2.3/config/libpython23.dylib # for boost
107 <  # (cd %i/lib/python2.3/config; mv Makefile Makefile.orig;
108 <  #  sed 's|-fno-common||g' < Makefile.orig > Makefile; /bin/rm -f Makefile.orig)
109 < fi
102 >    %i/lib/python%{pythonv}/config/libpython%{pythonv}.a \
103 >    -undefined dynamic_lookup \
104 >    -o %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
105 >    -install_name %i/lib/python%{pythonv}/config/libpython%{pythonv}.dylib \
106 >    -current_version %{pythonv} -compatibility_version %{pythonv} -ldl
107 >   (cd %i/lib/python%{pythonv}/config
108 >    perl -p -i -e 's|-fno-common||g' Makefile)
109 >
110 >   find %i/lib/python%{pythonv}/config -name 'libpython*' -exec mv -f {} %i/lib \;
111 >  ;;
112 > esac
113 >
114 > perl -p -i -e "s|^#!.*python|#!/usr/bin/env python|" %{i}/bin/idle \
115 >                     %{i}/bin/pydoc \
116 >                     %{i}/bin/python-config \
117 >                     %{i}/bin/2to3 \
118 >                     %{i}/bin/python2.6-config \
119 >                     %{i}/bin/smtpd.py \
120 >                     %{i}/lib/python2.6/bsddb/dbshelve.py \
121 >                     %{i}/lib/python2.6/test/test_bz2.py \
122 >                     %{i}/lib/python2.6/test/test_largefile.py \
123 >                     %{i}/lib/python2.6/test/test_optparse.py
124 >
125 > find %{i}/lib -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
126 > find %{i}/include -maxdepth 1 -mindepth 1 ! -name '*python*' -exec rm {} \;
127 >
128 > # remove executable permission anything which is *.py script,
129 > # is executable, but does not start with she-bang so not valid
130 > # executable; this avoids problems with rpm 4.8+ find-requires
131 > find %i -name '*.py' -perm +0111 | while read f; do
132 >  if head -n1 $f | grep -q '"'; then chmod -x $f; else :; fi
133 > done
134 >
135 > # remove tkinter that brings dependency on libtk:
136 > find %{i}/lib -type f -name "_tkinter.so" -exec rm {} \;
137 >
138 > # Remove documentation, examples and test files.
139 > %define drop_files { %i/share %{i}/lib/python%{pythonv}/test \
140 >                   %{i}/lib/python%{pythonv}/distutils/tests \
141 >                   %{i}/lib/python%{pythonv}/json/tests \
142 >                   %{i}/lib/python%{pythonv}/ctypes/test \
143 >                   %{i}/lib/python%{pythonv}/sqlite3/test \
144 >                   %{i}/lib/python%{pythonv}/bsddb/test \
145 >                   %{i}/lib/python%{pythonv}/email/test \
146 >                   %{i}/lib/python%{pythonv}/lib2to3/tests }
147 >
148 > # Remove .pyo files
149 > find %i -name '*.pyo' -exec rm {} \;
150 >
151 > # Generate dependencies-setup.{sh,csh} so init.{sh,csh} picks full environment.
152 > mkdir -p %i/etc/profile.d
153 > : > %i/etc/profile.d/dependencies-setup.sh
154 > : > %i/etc/profile.d/dependencies-setup.csh
155 > for tool in $(echo %{requiredtools} | sed -e's|\s+| |;s|^\s+||'); do
156 >  root=$(echo $tool | tr a-z- A-Z_)_ROOT; eval r=\$$root
157 >  if [ X"$r" != X ] && [ -r "$r/etc/profile.d/init.sh" ]; then
158 >    echo "test X\$$root != X || . $r/etc/profile.d/init.sh" >> %i/etc/profile.d/dependencies-setup.sh
159 >    echo "test X\$$root != X || source $r/etc/profile.d/init.csh" >> %i/etc/profile.d/dependencies-setup.csh
160 >  fi
161 > done
162 >
163 > %post
164 > %{relocateConfig}lib/python2.6/config/Makefile
165 > %{relocateConfig}etc/profile.d/dependencies-setup.*sh

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines