Magellan Linux

Contents of /smage/branches/alx07x-stable/core/python/python-2.7.13-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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