Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pypy3-exe/
Date: Wed, 25 Dec 2019 18:38:21
Message-Id: 1577299086.085a75d02cc118df810d64348dfb860304799acf.mgorny@gentoo
1 commit: 085a75d02cc118df810d64348dfb860304799acf
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Wed Dec 25 14:58:20 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Wed Dec 25 18:38:06 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=085a75d0
7
8 dev-python/pypy3-exe: New split package, v7.3.0
9
10 Split the actual PyPy3 executable into a separate, slotted package
11 that is going to be pulled in by new dev-python/pypy3.
12
13 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
14
15 dev-python/pypy3-exe/Manifest | 1 +
16 dev-python/pypy3-exe/metadata.xml | 17 ++++
17 dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild | 149 ++++++++++++++++++++++++++++
18 3 files changed, 167 insertions(+)
19
20 diff --git a/dev-python/pypy3-exe/Manifest b/dev-python/pypy3-exe/Manifest
21 new file mode 100644
22 index 00000000000..ba24d510819
23 --- /dev/null
24 +++ b/dev-python/pypy3-exe/Manifest
25 @@ -0,0 +1 @@
26 +DIST pypy3.6-v7.3.0-src.tar.bz2 21937786 BLAKE2B c53ac32a9cca1c4624160eae9f11b5705a59613f1e5100fbb0ee86118de5a7845b8fa5087165d7f5a077d20337dfca14a1c7eadbe768995e20e249ec271ac10d SHA512 313a4254262dd8d8b995a50bddbc360cfb67add0818e51a3e9ce25bda6a9b639e9fea8efe7da6adda76dff0a86a364544a13faa516e51b9ea6c25ec99223b435
27
28 diff --git a/dev-python/pypy3-exe/metadata.xml b/dev-python/pypy3-exe/metadata.xml
29 new file mode 100644
30 index 00000000000..89f86a0b2be
31 --- /dev/null
32 +++ b/dev-python/pypy3-exe/metadata.xml
33 @@ -0,0 +1,17 @@
34 +<?xml version="1.0" encoding="UTF-8"?>
35 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
36 +<pkgmetadata>
37 + <maintainer type="project">
38 + <email>python@g.o</email>
39 + <name>Python</name>
40 + </maintainer>
41 + <use>
42 + <flag name="low-memory">Build using PyPy with the engine configured towards low memory footprint.
43 + This makes it possible to build PyPy using ~3.5G of RAM on amd64 and ~half of that on x86,
44 + at the cost of lengthened build time.</flag>
45 + <flag name="sandbox">Enable sandboxing functionality</flag>
46 + </use>
47 + <upstream>
48 + <remote-id type="bitbucket">pypy/pypy</remote-id>
49 + </upstream>
50 +</pkgmetadata>
51
52 diff --git a/dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild b/dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild
53 new file mode 100644
54 index 00000000000..d5c7abffda2
55 --- /dev/null
56 +++ b/dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild
57 @@ -0,0 +1,149 @@
58 +# Copyright 1999-2019 Gentoo Authors
59 +# Distributed under the terms of the GNU General Public License v2
60 +
61 +EAPI=7
62 +
63 +# pypy3 needs to be built using python 2
64 +PYTHON_COMPAT=( python2_7 pypy )
65 +inherit check-reqs pax-utils python-any-r1 toolchain-funcs
66 +
67 +MY_P=pypy3.6-v${PV/_/}
68 +DESCRIPTION="PyPy3 executable (build from source)"
69 +HOMEPAGE="https://pypy.org/"
70 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2"
71 +S="${WORKDIR}/${MY_P}-src"
72 +
73 +LICENSE="MIT"
74 +SLOT="${PV}"
75 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
76 +IUSE="bzip2 +jit low-memory ncurses sandbox cpu_flags_x86_sse2"
77 +
78 +RDEPEND=">=sys-libs/zlib-1.1.3:0=
79 + virtual/libffi:0=
80 + virtual/libintl:0=
81 + dev-libs/expat:0=
82 + bzip2? ( app-arch/bzip2:0= )
83 + ncurses? ( sys-libs/ncurses:0= )
84 + !dev-python/pypy3-exe-bin:${PV}"
85 +DEPEND="${RDEPEND}
86 + low-memory? ( virtual/pypy )
87 + !low-memory? (
88 + || (
89 + virtual/pypy
90 + (
91 + dev-lang/python:2.7
92 + dev-python/pycparser[python_targets_python2_7(-),python_single_target_python2_7(+)]
93 + )
94 + )
95 + )"
96 +
97 +check_env() {
98 + if use low-memory; then
99 + CHECKREQS_MEMORY="1750M"
100 + use amd64 && CHECKREQS_MEMORY="3500M"
101 + else
102 + CHECKREQS_MEMORY="3G"
103 + use amd64 && CHECKREQS_MEMORY="6G"
104 + fi
105 +
106 + check-reqs_pkg_pretend
107 +}
108 +
109 +pkg_pretend() {
110 + [[ ${MERGE_TYPE} != binary ]] && check_env
111 +}
112 +
113 +pkg_setup() {
114 + if [[ ${MERGE_TYPE} != binary ]]; then
115 + check_env
116 +
117 + # unset to allow forcing pypy below :)
118 + use low-memory && local EPYTHON=
119 + if python_is_installed pypy && [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]]; then
120 + einfo "Using PyPy to perform the translation."
121 + local EPYTHON=pypy
122 + else
123 + einfo "Using ${EPYTHON:-python2} to perform the translation. Please note that upstream"
124 + einfo "recommends using PyPy for that. If you wish to do so, please install"
125 + einfo "virtual/pypy and ensure that EPYTHON variable is unset."
126 + fi
127 +
128 + python-any-r1_pkg_setup
129 + fi
130 +}
131 +
132 +src_configure() {
133 + tc-export CC
134 +
135 + local jit_backend
136 + if use jit; then
137 + jit_backend='--jit-backend='
138 +
139 + # We only need the explicit sse2 switch for x86.
140 + # On other arches we can rely on autodetection which uses
141 + # compiler macros. Plus, --jit-backend= doesn't accept all
142 + # the modern values...
143 +
144 + if use x86; then
145 + if use cpu_flags_x86_sse2; then
146 + jit_backend+=x86
147 + else
148 + jit_backend+=x86-without-sse2
149 + fi
150 + else
151 + jit_backend+=auto
152 + fi
153 + fi
154 +
155 + local args=(
156 + --no-shared
157 + $(usex jit -Ojit -O2)
158 + $(usex sandbox --sandbox '')
159 +
160 + ${jit_backend}
161 +
162 + pypy/goal/targetpypystandalone
163 + )
164 +
165 + # Avoid linking against libraries disabled by use flags
166 + local opts=(
167 + bzip2:bz2
168 + ncurses:_minimal_curses
169 + )
170 +
171 + local opt
172 + for opt in "${opts[@]}"; do
173 + local flag=${opt%:*}
174 + local mod=${opt#*:}
175 +
176 + args+=(
177 + $(usex ${flag} --withmod --withoutmod)-${mod}
178 + )
179 + done
180 +
181 + local interp=( "${PYTHON}" )
182 + if use low-memory; then
183 + interp=( env PYPY_GC_MAX_DELTA=200MB
184 + "${PYTHON}" --jit loop_longevity=300 )
185 + fi
186 +
187 + # translate into the C sources
188 + # we're going to make them ourselves since otherwise pypy does not
189 + # free up the unneeded memory before spawning the compiler
190 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
191 + echo -e "\033[1m${@}\033[0m"
192 + "${@}" || die "translation failed"
193 +}
194 +
195 +src_compile() {
196 + emake -C "${T}"/usession*-0/testing_1
197 +}
198 +
199 +src_install() {
200 + local dest=/usr/lib/pypy3.6
201 + exeinto "${dest}"
202 + newexe "${T}"/usession*-0/testing_1/pypy3-c pypy3-c-${PV}
203 + insinto "${dest}"/include/${PV}
204 + doins include/pypy_*
205 + pax-mark m "${ED}${dest}/pypy3-c-${PV}"
206 +}