Magellan Linux

Contents of /smage/trunk/core/python/python-2.7.2-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1775 - (show annotations) (download)
Mon Sep 19 11:15:38 2011 UTC (12 years, 7 months ago) by niro
File size: 3928 byte(s)
auto added: ver bump to 2.7.2-r1
1 # $Id$
2
3 PNAME="python"
4 PVER="2.7.2"
5 PBUILD="r1"
6
7 PCATEGORIE="dev-lang"
8
9 DESCRIPTION="Python is an interpreted, interactive, object-oriented programming language."
10 HOMEPAGE="http://www.python.org/"
11
12 DEPEND_x86_64=">= sys-apps/multiarch-wrapper-1"
13 SPECIAL_VARS="DEPEND_x86_64"
14
15 DEPEND="\$(eval echo \\\$DEPEND_\${ARCH/i*86/x86} | tr ';' '\n')
16 >= virtual/glibc
17 >= sys-libs/ncurses-5.9
18 >= sys-libs/zlib-1.2
19 >= dev-libs/expat-2"
20
21 SDEPEND=">= virtual/sed"
22
23 SRCFILE="${PNAME/py/Py}-${PVER/.0}.tar.bz2"
24 SRCDIR="${BUILDDIR}/${PNAME/py/Py}-${PVER/.0}"
25
26 # disabled modules (needs the gentoo_py_dontcompile patch)
27 export PYTHON_DISABLE_MODULES="gdbm dbm bsddb _tkinter" || die
28
29 # force usage of our CFLAGS
30 export OPT="${CFLAGS}"
31
32 sminclude mtools multilib
33
34 # uses PYVER and sometimes PVER; so keep both
35 SRC_URI=(
36 http://www.python.org/ftp/python/${PVER%.*}/${SRCFILE}
37 http://www.python.org/ftp/python/${PVER}/${SRCFILE}
38 mirror://${PNAME}/${SRCFILE}
39 mirror://${PNAME}/${PNAME}-2.7.0-gentoo_py_dontcompile.patch
40 mirror://${PNAME}/${PNAME}-2.4-disable_modules_and_ssl.patch
41 mirror://${PNAME}/${PNAME}-2.5.0-mimetypes-apache.patch
42 mirror://${PNAME}/${PNAME}-2.7.0-lib64-3.patch
43 )
44
45 # sed line: on 2 digits add an zero: 2.6 -> 2.6.0
46 UP2DATE="updatecmd ${HOMEPAGE}/download/releases/ | grep 'Python .*(.*)' | sed 's/.*Python\ \([0-9].*\) (.*/\1/g;s/\([0-9]\.[0-9]\$\)/\1.0/;q'"
47
48 src_prepare()
49 {
50 munpack ${SRCFILE} || die
51
52 # adds support for PYTHON_DONTCOMPILE shell environment to
53 # supress automatic generation of .pyc and .pyo files
54 mpatch ${PNAME}-2.7.0-gentoo_py_dontcompile.patch || die
55 mpatch ${PNAME}-2.4-disable_modules_and_ssl.patch || die
56 mpatch ${PNAME}-2.5.0-mimetypes-apache.patch || die
57
58 only-m64 mpatch ${PNAME}-2.7.0-lib64-3.patch || die
59 }
60
61 src_compile()
62 {
63 # disable all unneccessary modules
64 export PYTHON_DISABLE_MODULES="dbm _bsddb gdbm _curses _curses_panel readline _sqlite3 _tkinter _elementtree pyexpat"
65 # no ssl
66 export PYTHON_DISABLE_SSL="1"
67
68 mconfigure \
69 --with-fpectl \
70 --enable-shared \
71 --infodir='${prefix}'/share/info \
72 --mandir='${prefix}'/share/man \
73 --with-threads \
74 ${myconf} \
75 || die
76
77 mmake || die
78 }
79
80 src_install()
81 {
82 # install some missing directories
83 minstalldir /usr || die
84
85 mmake DESTDIR=${BINDIR} altinstall || die
86
87 all-abis minstalldir /usr/'$(mlibdir)'/python${PVER%.*}/config || die
88 all-abis minstallfile Makefile.pre.in /usr/'$(mlibdir)'/python${PVER%.*}/config || die
89
90 # remove hardcoded CFLAGS from default Makefile
91 all-abis sed -i 's:^OPT=.*:OPT=-DNDEBUG:' ${BINDIR}/usr/'$(mlibdir)'/python${PVER%.*}/config/Makefile || die
92
93 if [[ ${ARCH} = x86_64 ]]
94 then
95 # move config header
96 all-abis minstallfile pyconfig.h /usr/include/python${PVER%.*}/pyconfig-$(mabi).h || die
97
98 # install a stub header
99 cat > ${BINDIR}/usr/include/python${PVER%.*}/pyconfig.h << "EOF"
100 /* pyconfig.h - Stub Header */
101 #ifndef __STUB__PYCONFIG_H__
102 #define __STUB__PYCONFIG_H__
103
104 #if defined(__x86_64__) || \
105 defined(__sparc64__) || \
106 defined(__arch64__) || \
107 defined(__powerpc64__) || \
108 defined (__s390x__)
109 # include "pyconfig-m64.h"
110 #else
111 # include "pyconfig-m32.h"
112 #endif
113
114 #endif /* __STUB__PYCONFIG_H__ */
115 EOF
116 # install the multiarch-wrapper
117 if [[ -f ${BINDIR}/usr/bin/python${PVER%.*} ]]
118 then
119 rm -f ${BINDIR}/usr/bin/python${PVER%.*} || die
120 fi
121 all-abis minstallexec python /usr/bin/python${PVER%.*}-$(mabi) || die
122 mlink multiarch-wrapper /usr/bin/python${PVER%.*} || die
123 all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python-$(mabi) || die
124 all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python2-$(mabi) || die
125 fi
126
127 # link python${PVER%.*}-config to python-config
128 mlink python${PVER%.*}-config /usr/bin/python-config || die
129
130 # link python2.7 binary with python
131 mlink python${PVER%.*} /usr/bin/python || die
132
133 # link python2.7 binary with python2
134 mlink python${PVER%.*} /usr/bin/python2 || die
135
136 minstalldocs LICENSE README || die
137 }