Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/dev/mgorny:master commit in: dev-binpkg/pypy/
Date: Fri, 18 Oct 2019 06:30:35
Message-Id: 1571380179.3caa819a54ff26fb54f4a1f55b292222d721ddfc.mgorny@gentoo
1 commit: 3caa819a54ff26fb54f4a1f55b292222d721ddfc
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Fri Oct 18 06:29:39 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Oct 18 06:29:39 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/dev/mgorny.git/commit/?id=3caa819a
7
8 dev-binpkg/pypy: Bump to 7.2.0
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 dev-binpkg/pypy/Manifest | 1 +
13 dev-binpkg/pypy/pypy-7.2.0.ebuild | 206 ++++++++++++++++++++++++++++++++++++++
14 2 files changed, 207 insertions(+)
15
16 diff --git a/dev-binpkg/pypy/Manifest b/dev-binpkg/pypy/Manifest
17 index 524f848..9e35763 100644
18 --- a/dev-binpkg/pypy/Manifest
19 +++ b/dev-binpkg/pypy/Manifest
20 @@ -15,3 +15,4 @@ DIST pypy2-v6.0.0-src.tar.bz2 19741694 BLAKE2B 55f5000e590613b516b12c3682a658fe6
21 DIST pypy2.7-v7.0.0-src.tar.bz2 19811330 BLAKE2B 38089896934d79d2b3f5813cc9dae23b0534d9d312871b22336a277d5a15b82d748f66f896558cfdb45a23004944a648436e89ae36fadc107930e7b99963e12b SHA512 7fb5682ee4226af51008f50a81c922e44c231410fe36b7656efa20f22c855ba30a01bc96ee897b4c7a02941d37a405c922b09855977313878e34aaad6bf023dc
22 DIST pypy2.7-v7.1.0-src.tar.bz2 20032490 BLAKE2B e916d63d7915959c87830509630d8b2ab993d012d314e88c7cc84bed4c595957c3fc575f7b57fac7c24aaf1492797ca43b146e457357b6e73d9772724461de66 SHA512 fa7c1a6669686dbd9c0da627dc2a06ad696f20274218af9602f91d73f3ebe0ede380c6e1a50534f53dee8f075eaef5a403c7c5b5bdbfff25e679ba30522391bb
23 DIST pypy2.7-v7.1.1-src.tar.bz2 20027876 BLAKE2B a411d7312ed3b9be9297e7ff4cc569530529272156117ca037bbe29ad477e7ce3b8903d13c6a5a35e9867a8ccbfaa418061a7b37317b4b713508c429a41ffe9a SHA512 f998931ecf4f9aeee24f0fed95589716175971816c00e50bc53de6de0cfe2a8537b89c1aee636d15faecf91df8c29943295485686185f5247a3e0913fa514f48
24 +DIST pypy2.7-v7.2.0-src.tar.bz2 20219532 BLAKE2B 225e2cebdfa3ceb310f2a047b1d9e1d375b181c10707822890f39fc0a5ec9e6ddd7a8cf6e073074067960b766a0a813294042513a08b8e7e02b011f612e17917 SHA512 8f724490f9fa06686c8e25ddd3592b260bbffae460395de4c7d29d983780ce9b8925fa87434aac6446aac2034381cc1a13074faf252f5d1ac466a252f219f1ae
25
26 diff --git a/dev-binpkg/pypy/pypy-7.2.0.ebuild b/dev-binpkg/pypy/pypy-7.2.0.ebuild
27 new file mode 100644
28 index 0000000..9ddef9b
29 --- /dev/null
30 +++ b/dev-binpkg/pypy/pypy-7.2.0.ebuild
31 @@ -0,0 +1,206 @@
32 +# Copyright 1999-2019 Gentoo Authors
33 +# Distributed under the terms of the GNU General Public License v2
34 +
35 +EAPI=7
36 +
37 +PYTHON_COMPAT=( python2_7 pypy )
38 +inherit check-reqs pax-utils python-any-r1 toolchain-funcs
39 +
40 +# note: remember to update this to newest dev-lang/python:2.7 on bump
41 +CPY_PATCHSET_VERSION="2.7.15"
42 +MY_P=pypy2.7-v${PV}
43 +
44 +DESCRIPTION="A fast, compliant alternative implementation of the Python language"
45 +HOMEPAGE="http://pypy.org/"
46 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2"
47 +
48 +LICENSE="MIT"
49 +# pypy -c 'import sysconfig; print sysconfig.get_config_var("SOABI")'
50 +# pypy 7.0.0: install directory changed to 'pypy2.7'
51 +SLOT="0/41-py27"
52 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
53 +IUSE="bzip2 +jit low-memory ncurses sandbox cpu_flags_x86_sse2 test"
54 +
55 +DEPEND=">=sys-libs/zlib-1.1.3:0=
56 + virtual/libffi:0=
57 + virtual/libintl:0=
58 + dev-libs/expat:0=
59 + bzip2? ( app-arch/bzip2:0= )
60 + ncurses? ( sys-libs/ncurses:0= )
61 + app-arch/lzip
62 + ${PYTHON_DEPS}"
63 +
64 +S="${WORKDIR}/${MY_P}-src"
65 +
66 +pkg_pretend() {
67 + if [[ ${MERGE_TYPE} != binary ]]; then
68 + if use low-memory; then
69 + if ! python_is_installed pypy; then
70 + eerror "USE=low-memory requires a (possibly old) version of dev-python/pypy"
71 + eerror "or dev-python/pypy-bin being installed. Please install it using e.g.:"
72 + eerror
73 + eerror " $ emerge -1v dev-python/pypy-bin"
74 + eerror
75 + eerror "before attempting to build dev-python/pypy[low-memory]."
76 + die "dev-python/pypy-bin (or dev-python/pypy) needs to be installed for USE=low-memory"
77 + fi
78 +
79 + CHECKREQS_MEMORY="1750M"
80 + use amd64 && CHECKREQS_MEMORY="3500M"
81 + else
82 + CHECKREQS_MEMORY="3G"
83 + use amd64 && CHECKREQS_MEMORY="6G"
84 + fi
85 +
86 + check-reqs_pkg_pretend
87 + fi
88 +
89 + [[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
90 +}
91 +
92 +pkg_setup() {
93 + if [[ ${MERGE_TYPE} != binary ]]; then
94 + pkg_pretend
95 +
96 + if python_is_installed pypy; then
97 + if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] || use low-memory; then
98 + einfo "Using already-installed PyPy to perform the translation."
99 + local EPYTHON=pypy
100 + else
101 + einfo "Using ${EPYTHON} to perform the translation. Please note that upstream"
102 + einfo "recommends using PyPy for that. If you wish to do so, please unset"
103 + einfo "the EPYTHON variable."
104 + fi
105 + fi
106 +
107 + python-any-r1_pkg_setup
108 +
109 + local cpu
110 + if use amd64; then
111 + # common denominator between Intel & AMD
112 + cpu='x86-64'
113 + elif use x86; then
114 + if use cpu_flags_x86_sse2; then
115 + # lowest with SSE2
116 + cpu='pentium-m'
117 + else
118 + # lowest with SSE, compat. with athlon-xp
119 + # TODO: do we want to support something older?
120 + cpu='pentium3'
121 + fi
122 + else
123 + die "Unsupported arch ${ARCH}"
124 + fi
125 +
126 + export CFLAGS="-march=${cpu} -mtune=generic -O2 -pipe"
127 + export CXXFLAGS=${CFLAGS}
128 +
129 + elog "CFLAGS: ${CFLAGS}"
130 + fi
131 +}
132 +
133 +src_prepare() {
134 + eapply "${FILESDIR}"/5.9.0-shared-lib.patch # 517002
135 +
136 + eapply_user
137 +}
138 +
139 +src_configure() {
140 + tc-export CC
141 +
142 + local jit_backend
143 + if use jit; then
144 + jit_backend='--jit-backend='
145 +
146 + # We only need the explicit sse2 switch for x86.
147 + # On other arches we can rely on autodetection which uses
148 + # compiler macros. Plus, --jit-backend= doesn't accept all
149 + # the modern values...
150 +
151 + if use x86; then
152 + if use cpu_flags_x86_sse2; then
153 + jit_backend+=x86
154 + else
155 + jit_backend+=x86-without-sse2
156 + fi
157 + else
158 + jit_backend+=auto
159 + fi
160 + fi
161 +
162 + local args=(
163 + --shared
164 + $(usex jit -Ojit -O2)
165 + $(usex sandbox --sandbox '')
166 +
167 + ${jit_backend}
168 +
169 + pypy/goal/targetpypystandalone
170 + )
171 +
172 + # Avoid linking against libraries disabled by use flags
173 + local opts=(
174 + bzip2:bz2
175 + ncurses:_minimal_curses
176 + )
177 +
178 + local opt
179 + for opt in "${opts[@]}"; do
180 + local flag=${opt%:*}
181 + local mod=${opt#*:}
182 +
183 + args+=(
184 + $(usex ${flag} --withmod --withoutmod)-${mod}
185 + )
186 + done
187 +
188 + local interp=( "${PYTHON}" )
189 + if use low-memory; then
190 + interp=( env PYPY_GC_MAX_DELTA=200MB
191 + "${PYTHON}" --jit loop_longevity=300 )
192 + fi
193 +
194 + # translate into the C sources
195 + # we're going to make them ourselves since otherwise pypy does not
196 + # free up the unneeded memory before spawning the compiler
197 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
198 + echo -e "\033[1m${@}\033[0m"
199 + "${@}" || die "translation failed"
200 +}
201 +
202 +src_compile() {
203 + emake -C "${T}"/usession*-0/testing_1
204 +
205 + # copy back to make sys.prefix happy
206 + cp -p "${T}"/usession*-0/testing_1/{pypy-c,libpypy-c.so} . || die
207 + pax-mark m pypy-c libpypy-c.so
208 +}
209 +
210 +src_install() {
211 + local flags=( bzip2 jit ncurses sandbox )
212 + use x86 && flags+=( cpu_flags_x86_sse2 )
213 + local f suffix="-${ARCH}"
214 +
215 + for f in ${flags[@]}; do
216 + use ${f} && suffix+="+${f#cpu_flags_x86_}"
217 + done
218 +
219 + local BIN_P=pypy-bin-${PV}
220 +
221 + einfo "Zipping PyPy ..."
222 + mkdir "${BIN_P}${suffix}"{,/include} || die
223 + mv pypy-c libpypy-c.so "${BIN_P}${suffix}"/ || die
224 + mv include/pypy_* "${BIN_P}${suffix}"/include/ || die
225 + chmod +x "${BIN_P}${suffix}"/pypy-c || die
226 +
227 + tar -cf "${BIN_P}${suffix}.tar" "${BIN_P}${suffix}" || die
228 + lzip -v9 "${BIN_P}${suffix}.tar" || die
229 +}
230 +
231 +# Yup, very hacky.
232 +pkg_preinst() {
233 + # integrity check.
234 + [[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
235 + mkdir -p "${ROOT%/}${PYPY_BINPKG_STORE}" || die
236 + mv "${S}"/*.tar.lz "${ROOT%/}${PYPY_BINPKG_STORE}" || die
237 +}