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