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