Magellan Linux

Contents of /smage/branches/alx07x-unstable/core/python/python-2.7.15-r1.smage2

Parent Directory Parent Directory | Revision Log Revision Log


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