1 |
commit: 80dfd9952e4b140aa5b797b765f4d95fb65a7c98 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Mar 8 09:04:47 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Mar 8 11:32:43 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=80dfd995 |
7 |
|
8 |
dev-python/pypy: Split translation and compile phases |
9 |
|
10 |
Use the --source option to disable automatic compiling of generating C |
11 |
sources, and build them manually afterwards. Most importantly, this |
12 |
significantly reduces memory use because pypy failed to free memory that |
13 |
was used for the translation, and that is no longer needed when |
14 |
the compilation is started. Furthermore, it makes resuming compilation |
15 |
possible. |
16 |
|
17 |
dev-python/pypy/pypy-5.6.0.ebuild | 25 ++++++++++++++++++------- |
18 |
dev-python/pypy/pypy-9999.ebuild | 25 ++++++++++++++++++------- |
19 |
2 files changed, 36 insertions(+), 14 deletions(-) |
20 |
|
21 |
diff --git a/dev-python/pypy/pypy-5.6.0.ebuild b/dev-python/pypy/pypy-5.6.0.ebuild |
22 |
index ce1b1a3f764..34c1826c856 100644 |
23 |
--- a/dev-python/pypy/pypy-5.6.0.ebuild |
24 |
+++ b/dev-python/pypy/pypy-5.6.0.ebuild |
25 |
@@ -105,7 +105,7 @@ src_prepare() { |
26 |
epatch_user |
27 |
} |
28 |
|
29 |
-src_compile() { |
30 |
+src_configure() { |
31 |
tc-export CC |
32 |
|
33 |
local jit_backend |
34 |
@@ -162,12 +162,22 @@ src_compile() { |
35 |
"${PYTHON}" --jit loop_longevity=300 ) |
36 |
fi |
37 |
|
38 |
- set -- "${interp[@]}" rpython/bin/rpython --batch "${args[@]}" |
39 |
+ # translate into the C sources |
40 |
+ # we're going to make them ourselves since otherwise pypy does not |
41 |
+ # free up the unneeded memory before spawning the compiler |
42 |
+ set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}" |
43 |
echo -e "\033[1m${@}\033[0m" |
44 |
- "${@}" || die "compile error" |
45 |
+ "${@}" || die "translation failed" |
46 |
+} |
47 |
+ |
48 |
+src_compile() { |
49 |
+ emake -C "${T}"/usession*-current/testing_1 |
50 |
|
51 |
- use doc && emake -C pypy/doc/ html |
52 |
+ # copy back to make sys.prefix happy |
53 |
+ cp -p "${T}"/usession*-current/testing_1/{pypy-c,libpypy-c.so} . || die |
54 |
pax-mark m pypy-c libpypy-c.so |
55 |
+ |
56 |
+ use doc && emake -C pypy/doc html |
57 |
} |
58 |
|
59 |
src_test() { |
60 |
@@ -180,10 +190,11 @@ src_test() { |
61 |
src_install() { |
62 |
local dest=/usr/$(get_libdir)/pypy |
63 |
einfo "Installing PyPy ..." |
64 |
- insinto "${dest}" |
65 |
- doins -r include lib_pypy lib-python pypy-c libpypy-c.so |
66 |
- fperms a+x ${dest}/pypy-c ${dest}/libpypy-c.so |
67 |
+ exeinto "${dest}" |
68 |
+ doexe pypy-c libpypy-c.so |
69 |
pax-mark m "${ED%/}${dest}/pypy-c" "${ED%/}${dest}/libpypy-c.so" |
70 |
+ insinto "${dest}" |
71 |
+ doins -r include lib_pypy lib-python |
72 |
dosym ../$(get_libdir)/pypy/pypy-c /usr/bin/pypy |
73 |
dodoc README.rst |
74 |
|
75 |
|
76 |
diff --git a/dev-python/pypy/pypy-9999.ebuild b/dev-python/pypy/pypy-9999.ebuild |
77 |
index de88fb98a5f..de566f88e80 100644 |
78 |
--- a/dev-python/pypy/pypy-9999.ebuild |
79 |
+++ b/dev-python/pypy/pypy-9999.ebuild |
80 |
@@ -111,7 +111,7 @@ src_prepare() { |
81 |
epatch_user |
82 |
} |
83 |
|
84 |
-src_compile() { |
85 |
+src_configure() { |
86 |
tc-export CC |
87 |
|
88 |
local jit_backend |
89 |
@@ -168,12 +168,22 @@ src_compile() { |
90 |
"${PYTHON}" --jit loop_longevity=300 ) |
91 |
fi |
92 |
|
93 |
- set -- "${interp[@]}" rpython/bin/rpython --batch "${args[@]}" |
94 |
+ # translate into the C sources |
95 |
+ # we're going to make them ourselves since otherwise pypy does not |
96 |
+ # free up the unneeded memory before spawning the compiler |
97 |
+ set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}" |
98 |
echo -e "\033[1m${@}\033[0m" |
99 |
- "${@}" || die "compile error" |
100 |
+ "${@}" || die "translation failed" |
101 |
+} |
102 |
+ |
103 |
+src_compile() { |
104 |
+ emake -C "${T}"/usession*-current/testing_1 |
105 |
|
106 |
- use doc && emake -C pypy/doc/ html |
107 |
+ # copy back to make sys.prefix happy |
108 |
+ cp -p "${T}"/usession*-current/testing_1/{pypy-c,libpypy-c.so} . || die |
109 |
pax-mark m pypy-c libpypy-c.so |
110 |
+ |
111 |
+ use doc && emake -C pypy/doc html |
112 |
} |
113 |
|
114 |
src_test() { |
115 |
@@ -186,10 +196,11 @@ src_test() { |
116 |
src_install() { |
117 |
local dest=/usr/$(get_libdir)/pypy |
118 |
einfo "Installing PyPy ..." |
119 |
- insinto "${dest}" |
120 |
- doins -r include lib_pypy lib-python pypy-c libpypy-c.so |
121 |
- fperms a+x ${dest}/pypy-c ${dest}/libpypy-c.so |
122 |
+ exeinto "${dest}" |
123 |
+ doexe pypy-c libpypy-c.so |
124 |
pax-mark m "${ED%/}${dest}/pypy-c" "${ED%/}${dest}/libpypy-c.so" |
125 |
+ insinto "${dest}" |
126 |
+ doins -r include lib_pypy lib-python |
127 |
dosym ../$(get_libdir)/pypy/pypy-c /usr/bin/pypy |
128 |
dodoc README.rst |