Magellan Linux

Contents of /branches/magellan-next/core/python/python-2.7.0-r4.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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