Magellan Linux

Contents of /trunk/core/python/python-2.7.15-r2.smage2

Parent Directory Parent Directory | Revision Log Revision Log


Revision 31776 - (show annotations) (download)
Fri Dec 7 12:17:22 2018 UTC (5 years, 4 months ago) by niro
File size: 4940 byte(s)
-use multilib-wrapper for python-config
1 # $Id$
2
3 PNAME="python"
4 PVER="2.7.15"
5 PBUILD="r2"
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.1
18 >= sys-libs/zlib-1.2
19 >= dev-libs/expat-2
20 >= dev-libs/openssl-1.1
21 >= sys-libs/readline-7.0
22 >= dev-db/db-6.2
23 >= dev-db/sqlite-3.9
24 >= app-arch/bzip2-1.0.6
25 >= dev-libs/libffi-3.2"
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 multilib mtools mbuild
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.13-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 UP2DATE="updatecmd ${HOMEPAGE}/download/ | grep -- '-2\.' | highesttarball xz"
55
56 src_prepare()
57 {
58 munpack ${SRCFILE} || die
59
60 # adds support for PYTHON_DONTCOMPILE shell environment to
61 # supress automatic generation of .pyc and .pyo files
62 mpatch ${PNAME}-2.7.0-gentoo_py_dontcompile.patch || die
63 mpatch ${PNAME}-2.4-disable_modules_and_ssl.patch || die
64 mpatch ${PNAME}-2.5.0-mimetypes-apache.patch || die
65
66 only-m64 mpatch ${PNAME}-2.7.13-lib64.patch || die
67
68 # ensure to use system-wide copies of expat, zlib and libffi
69 # rather than copies shipped in the tarball
70 all-abis 'rm -r Modules/expat || die'
71 all-abis 'rm -r Modules/zlib || die'
72 all-abis 'rm -r Modules/_ctypes/{darwin,libffi}* || die'
73 }
74
75 src_compile()
76 {
77 mconfigure \
78 --with-fpectl \
79 --enable-shared \
80 --enable-unicode=ucs4 \
81 --infodir=/usr/share/info \
82 --mandir=/usr/share/man \
83 --with-threads \
84 --with-system-expat \
85 --with-system-ffi \
86 || die
87
88 mmake || die
89 }
90
91 src_install()
92 {
93 # install some missing directories
94 minstalldir /usr || die
95
96 mmake DESTDIR=${BINDIR} altinstall || die
97
98 all-abis minstalldir /usr/'$(mlibdir)'/python${PVER%.*}/config || die
99 all-abis minstallfile Makefile.pre.in /usr/'$(mlibdir)'/python${PVER%.*}/config || die
100
101 # remove hardcoded CFLAGS from default Makefile
102 all-abis sed -i 's:^OPT=.*:OPT=-DNDEBUG:' ${BINDIR}/usr/'$(mlibdir)'/python${PVER%.*}/config/Makefile || die
103
104 if [[ $(mlibdir) != lib ]]
105 then
106 # move config header
107 all-abis minstallfile pyconfig.h /usr/include/python${PVER%.*}/pyconfig-$(mabi).h || die
108
109 # install a stub header
110 cat > ${BINDIR}/usr/include/python${PVER%.*}/pyconfig.h << "EOF"
111 /* pyconfig.h - Stub Header */
112 #ifndef __STUB__PYCONFIG_H__
113 #define __STUB__PYCONFIG_H__
114
115 #if defined(__x86_64__) || \
116 defined(__sparc64__) || \
117 defined(__arch64__) || \
118 defined(__powerpc64__) || \
119 defined (__s390x__)
120 # include "pyconfig-m64.h"
121 #else
122 # include "pyconfig-m32.h"
123 #endif
124
125 #endif /* __STUB__PYCONFIG_H__ */
126 EOF
127 # install the multiarch-wrapper for python binary
128 if [[ -f ${BINDIR}/usr/bin/python${PVER%.*} ]]
129 then
130 rm -f ${BINDIR}/usr/bin/python${PVER%.*} || die
131 fi
132 all-abis minstallexec python /usr/bin/python${PVER%.*}-$(mabi) || die
133 mlink multiarch-wrapper /usr/bin/python${PVER%.*} || die
134 all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python-$(mabi) || die
135 all-abis mlink python${PVER%.*}-$(mabi) /usr/bin/python${PVER:0:1}-$(mabi) || die
136
137 # install the multiarch-wrapper for python-config
138 if [[ -f ${BINDIR}/usr/bin/python${PVER%.*}-config ]]
139 then
140 rm -f ${BINDIR}/usr/bin/python${PVER%.*}-config || die
141 fi
142 # generate missing python-config
143 mmake python-config || die
144 all-abis minstallexec python-config /usr/bin/python${PVER%.*}-config-$(mabi) || die
145 mlink multiarch-wrapper /usr/bin/python${PVER%.*}-config || die
146 all-abis mlink python${PVER%.*}-config-$(mabi) /usr/bin/python-config-$(mabi) || die
147 all-abis mlink python${PVER%.*}-config-$(mabi) /usr/bin/python${PVER:0:1}-config-$(mabi) || die
148 fi
149
150 # link python2.7-config to python-config
151 mlink python${PVER%.*}-config /usr/bin/python-config || die
152
153 # link python2.7-config with python2-config
154 mlink python${PVER%.*}-config /usr/bin/python${PVER:0:1}-config || die
155
156 # link python2.7 binary with python
157 mlink python${PVER%.*} /usr/bin/python || die
158
159 # link python2.7 binary with python2
160 mlink python${PVER%.*} /usr/bin/python${PVER:0:1} || die
161
162 minstalldocs LICENSE README || die
163 }