Magellan Linux

Contents of /branches/R11-stable/core/python/python-2.7.8-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 22711 - (show annotations) (download)
Tue Oct 28 08:29:17 2014 UTC (9 years, 6 months ago) by niro
File size: 4136 byte(s)
-release branches/R11-stable
1 # $Id$
2
3 PNAME="python"
4 PVER="2.7.8"
5 PBUILD="r1"
6
7 PCAT="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="$(marchdepend)
16 >= virtual/glibc
17 >= sys-libs/ncurses-5.9
18 >= sys-libs/zlib-1.2
19 >= dev-libs/expat-2
20 >= dev-libs/openssl-1.0.1
21 >= sys-libs/readline-6.3
22 >= dev-db/db-6.0
23 >= dev-db/sqlite-3.8
24 >= app-arch/bzip2-1.0.6
25 >= dev-libs/libffi-3.1"
26
27 SDEPEND=">= virtual/sed"
28
29 SRCFILE="${PNAME/py/Py}-${PVER/.0}.tar.xz"
30 SRCDIR="${BUILDDIR}/${PNAME/py/Py}-${PVER/.0}"
31
32 # disabled modules (needs the disable_modules patch)
33 export PYTHON_DISABLE_MODULES="gdbm dbm bsddb _tkinter" || die
34
35 # force usage of our CFLAGS
36 export OPT="${CFLAGS}"
37
38 sminclude mtools multilib
39 msetfeature "!check"
40
41 # uses PYVER and sometimes PVER; so keep both
42 SRC_URI=(
43 http://www.python.org/ftp/python/${PVER%.*}/${SRCFILE}
44 http://www.python.org/ftp/python/${PVER}/${SRCFILE}
45 mirror://${PNAME}/${SRCFILE}
46 mirror://${PNAME}/${PNAME}-2.7.0-gentoo_py_dontcompile.patch
47 mirror://${PNAME}/${PNAME}-2.4-disable_modules_and_ssl.patch
48 mirror://${PNAME}/${PNAME}-2.5.0-mimetypes-apache.patch
49 mirror://${PNAME}/${PNAME}-2.7.6-lib64.patch
50 )
51
52 # sed line: on 2 digits add an zero: 2.6 -> 2.6.0
53 UP2DATE="updatecmd ${HOMEPAGE}/download/releases/ | grep 'Python .*(.*)' | sed 's/.*Python\ \([0-9].*\) (.*/\1/g;s/\([0-9]\.[0-9]\$\)/\1.0/;q'"
54
55 src_prepare()
56 {
57 munpack ${SRCFILE} || die
58
59 # adds support for PYTHON_DONTCOMPILE shell environment to
60 # supress automatic generation of .pyc and .pyo files
61 mpatch ${PNAME}-2.7.0-gentoo_py_dontcompile.patch || die
62 mpatch ${PNAME}-2.4-disable_modules_and_ssl.patch || die
63 mpatch ${PNAME}-2.5.0-mimetypes-apache.patch || die
64
65 only-m64 mpatch ${PNAME}-2.7.6-lib64.patch || die
66
67 # ensure to use system-wide copies of expat, zlib and libffi
68 # rather than copies shipped in the tarball
69 all-abis 'rm -r Modules/expat || die'
70 all-abis 'rm -r Modules/zlib || die'
71 all-abis 'rm -r Modules/_ctypes/{darwin,libffi}* || die'
72 }
73
74 src_compile()
75 {
76 mconfigure \
77 --with-fpectl \
78 --enable-shared \
79 --enable-unicode=ucs4 \
80 --infodir=/usr/share/info \
81 --mandir=/usr/share/man \
82 --with-threads \
83 --with-system-expat \
84 --with-system-ffi \
85 || die
86
87 mmake || die
88 }
89
90 src_install()
91 {
92 # install some missing directories
93 minstalldir /usr || die
94
95 mmake DESTDIR=${BINDIR} altinstall || die
96
97 all-abis minstalldir /usr/'$(mlibdir)'/python${PVER%.*}/config || die
98 all-abis minstallfile Makefile.pre.in /usr/'$(mlibdir)'/python${PVER%.*}/config || die
99
100 # remove hardcoded CFLAGS from default Makefile
101 all-abis sed -i 's:^OPT=.*:OPT=-DNDEBUG:' ${BINDIR}/usr/'$(mlibdir)'/python${PVER%.*}/config/Makefile || die
102
103 if [[ $(mlibdir) != lib ]]
104 then
105 # move config header
106 all-abis minstallfile pyconfig.h /usr/include/python${PVER%.*}/pyconfig-$(mabi).h || die
107
108 # install a stub header
109 cat > ${BINDIR}/usr/include/python${PVER%.*}/pyconfig.h << "EOF"
110 /* pyconfig.h - Stub Header */
111 #ifndef __STUB__PYCONFIG_H__
112 #define __STUB__PYCONFIG_H__
113
114 #if defined(__x86_64__) || \
115 defined(__sparc64__) || \
116 defined(__arch64__) || \
117 defined(__powerpc64__) || \
118 defined (__s390x__)
119 # include "pyconfig-m64.h"
120 #else
121 # include "pyconfig-m32.h"
122 #endif
123
124 #endif /* __STUB__PYCONFIG_H__ */
125 EOF
126 # install the multiarch-wrapper
127 if [[ -f ${BINDIR}/usr/bin/python${PVER%.*} ]]
128 then
129 rm -f ${BINDIR}/usr/bin/python${PVER%.*} || die
130 fi
131 all-abis minstallexec python /usr/bin/python${PVER%.*}-$(mabi) || die
132 mlink multiarch-wrapper /usr/bin/python${PVER%.*} || die
133 all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python-$(mabi) || die
134 all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python${PVER:0:1}-$(mabi) || die
135 fi
136
137 # link python2.7-config to python-config
138 mlink python${PVER%.*}-config /usr/bin/python-config || die
139
140 # link python2.7 binary with python
141 mlink python${PVER%.*} /usr/bin/python || die
142
143 # link python2.7 binary with python2
144 mlink python${PVER%.*} /usr/bin/python${PVER:0:1} || die
145
146 minstalldocs LICENSE README || die
147 }