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: Thu, 14 Feb 2019 13:10:30
Message-Id: 1550149819.ea88620ac2bceebef5bfaee598a053a172ef8634.mgorny@gentoo
1 commit: ea88620ac2bceebef5bfaee598a053a172ef8634
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Thu Feb 14 13:10:19 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Thu Feb 14 13:10:19 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/dev/mgorny.git/commit/?id=ea88620a
7
8 dev-binpkg/pypy: Bump to 7.0.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.0.0.ebuild | 208 ++++++++++++++++++++++++++++++++++++++
14 2 files changed, 209 insertions(+)
15
16 diff --git a/dev-binpkg/pypy/Manifest b/dev-binpkg/pypy/Manifest
17 index 2bcb3e7..26499c9 100644
18 --- a/dev-binpkg/pypy/Manifest
19 +++ b/dev-binpkg/pypy/Manifest
20 @@ -12,3 +12,4 @@ DIST pypy2-v5.7.1-src.tar.bz2 18940413 BLAKE2B 391af7816e48b481e6c93b55415f39114
21 DIST pypy2-v5.8.0-src.tar.bz2 19163498 BLAKE2B 377971cf9e9a5ea75966937e9f22fe24d149af28678947d33356333fe67c8295cf07bf2dac3e7b45d265fef6126d8ebb23aee132e3b43d872bd61ec1ddf17a2c SHA512 222c6ce11b00830e310b766df4c145b7f554f23b87fc6146f214d758d7a6159c5c00af475aa7fa630ef4c37b52cdf2fd73049b6ec3610715b6abc0a925fe1365
22 DIST pypy2-v5.9.0-src.tar.bz2 19175394 BLAKE2B 0d5fa0d013d8cdb9765bf0f535877894d7a3544c19481973f788187251d1bd2ba11f88950430e85c7608ea394cc952ae7dd7275b9843397ab098e153cf96ec7f SHA512 3170747e81088043c6a4885bd0bc92e911556420b6c2539a4ed7e62956f1c741651f772def0fb00d8826a1bef9d6f4e79a13682a4456a31d987f7c9bd8608a4d
23 DIST pypy2-v6.0.0-src.tar.bz2 19741694 BLAKE2B 55f5000e590613b516b12c3682a658fe6a17fbe264be3d61a81698cdf098b39177cf4355eb3f28980209c7a0e005498201cbad8884e3aa02cc86a228d1552046 SHA512 d3bdcd65fc83f2fda3203a604733fe6765049a17cca2715cd6045dc302a6159b4741a821c53fa4c97acf7297cef4c62e941a6a6eb7f8a253a93a28dcf2aa2ca0
24 +DIST pypy2.7-v7.0.0-src.tar.bz2 19811330 BLAKE2B 38089896934d79d2b3f5813cc9dae23b0534d9d312871b22336a277d5a15b82d748f66f896558cfdb45a23004944a648436e89ae36fadc107930e7b99963e12b SHA512 7fb5682ee4226af51008f50a81c922e44c231410fe36b7656efa20f22c855ba30a01bc96ee897b4c7a02941d37a405c922b09855977313878e34aaad6bf023dc
25
26 diff --git a/dev-binpkg/pypy/pypy-7.0.0.ebuild b/dev-binpkg/pypy/pypy-7.0.0.ebuild
27 new file mode 100644
28 index 0000000..1d8d127
29 --- /dev/null
30 +++ b/dev-binpkg/pypy/pypy-7.0.0.ebuild
31 @@ -0,0 +1,208 @@
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 libressl 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 + !libressl? ( dev-libs/openssl:0=[-bindist] )
61 + libressl? ( dev-libs/libressl:0= )
62 + ncurses? ( sys-libs/ncurses:0= )
63 + app-arch/lzip
64 + ${PYTHON_DEPS}"
65 +
66 +S="${WORKDIR}/${MY_P}-src"
67 +
68 +pkg_pretend() {
69 + if [[ ${MERGE_TYPE} != binary ]]; then
70 + if use low-memory; then
71 + if ! python_is_installed pypy; then
72 + eerror "USE=low-memory requires a (possibly old) version of dev-python/pypy"
73 + eerror "or dev-python/pypy-bin being installed. Please install it using e.g.:"
74 + eerror
75 + eerror " $ emerge -1v dev-python/pypy-bin"
76 + eerror
77 + eerror "before attempting to build dev-python/pypy[low-memory]."
78 + die "dev-python/pypy-bin (or dev-python/pypy) needs to be installed for USE=low-memory"
79 + fi
80 +
81 + CHECKREQS_MEMORY="1750M"
82 + use amd64 && CHECKREQS_MEMORY="3500M"
83 + else
84 + CHECKREQS_MEMORY="3G"
85 + use amd64 && CHECKREQS_MEMORY="6G"
86 + fi
87 +
88 + check-reqs_pkg_pretend
89 + fi
90 +
91 + [[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
92 +}
93 +
94 +pkg_setup() {
95 + if [[ ${MERGE_TYPE} != binary ]]; then
96 + pkg_pretend
97 +
98 + if python_is_installed pypy; then
99 + if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] || use low-memory; then
100 + einfo "Using already-installed PyPy to perform the translation."
101 + local EPYTHON=pypy
102 + else
103 + einfo "Using ${EPYTHON} to perform the translation. Please note that upstream"
104 + einfo "recommends using PyPy for that. If you wish to do so, please unset"
105 + einfo "the EPYTHON variable."
106 + fi
107 + fi
108 +
109 + python-any-r1_pkg_setup
110 +
111 + local cpu
112 + if use amd64; then
113 + # common denominator between Intel & AMD
114 + cpu='x86-64'
115 + elif use x86; then
116 + if use cpu_flags_x86_sse2; then
117 + # lowest with SSE2
118 + cpu='pentium-m'
119 + else
120 + # lowest with SSE, compat. with athlon-xp
121 + # TODO: do we want to support something older?
122 + cpu='pentium3'
123 + fi
124 + else
125 + die "Unsupported arch ${ARCH}"
126 + fi
127 +
128 + export CFLAGS="-march=${cpu} -mtune=generic -O2 -pipe"
129 + export CXXFLAGS=${CFLAGS}
130 +
131 + elog "CFLAGS: ${CFLAGS}"
132 + fi
133 +}
134 +
135 +src_prepare() {
136 + eapply "${FILESDIR}"/5.9.0-shared-lib.patch # 517002
137 +
138 + eapply_user
139 +}
140 +
141 +src_configure() {
142 + tc-export CC
143 +
144 + local jit_backend
145 + if use jit; then
146 + jit_backend='--jit-backend='
147 +
148 + # We only need the explicit sse2 switch for x86.
149 + # On other arches we can rely on autodetection which uses
150 + # compiler macros. Plus, --jit-backend= doesn't accept all
151 + # the modern values...
152 +
153 + if use x86; then
154 + if use cpu_flags_x86_sse2; then
155 + jit_backend+=x86
156 + else
157 + jit_backend+=x86-without-sse2
158 + fi
159 + else
160 + jit_backend+=auto
161 + fi
162 + fi
163 +
164 + local args=(
165 + --shared
166 + $(usex jit -Ojit -O2)
167 + $(usex sandbox --sandbox '')
168 +
169 + ${jit_backend}
170 +
171 + pypy/goal/targetpypystandalone
172 + )
173 +
174 + # Avoid linking against libraries disabled by use flags
175 + local opts=(
176 + bzip2:bz2
177 + ncurses:_minimal_curses
178 + )
179 +
180 + local opt
181 + for opt in "${opts[@]}"; do
182 + local flag=${opt%:*}
183 + local mod=${opt#*:}
184 +
185 + args+=(
186 + $(usex ${flag} --withmod --withoutmod)-${mod}
187 + )
188 + done
189 +
190 + local interp=( "${PYTHON}" )
191 + if use low-memory; then
192 + interp=( env PYPY_GC_MAX_DELTA=200MB
193 + "${PYTHON}" --jit loop_longevity=300 )
194 + fi
195 +
196 + # translate into the C sources
197 + # we're going to make them ourselves since otherwise pypy does not
198 + # free up the unneeded memory before spawning the compiler
199 + set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
200 + echo -e "\033[1m${@}\033[0m"
201 + "${@}" || die "translation failed"
202 +}
203 +
204 +src_compile() {
205 + emake -C "${T}"/usession*-0/testing_1
206 +
207 + # copy back to make sys.prefix happy
208 + cp -p "${T}"/usession*-0/testing_1/{pypy-c,libpypy-c.so} . || die
209 + pax-mark m pypy-c libpypy-c.so
210 +}
211 +
212 +src_install() {
213 + local flags=( bzip2 jit libressl ncurses sandbox )
214 + use x86 && flags+=( cpu_flags_x86_sse2 )
215 + local f suffix="-${ARCH}"
216 +
217 + for f in ${flags[@]}; do
218 + use ${f} && suffix+="+${f#cpu_flags_x86_}"
219 + done
220 +
221 + local BIN_P=pypy-bin-${PV}
222 +
223 + einfo "Zipping PyPy ..."
224 + mkdir "${BIN_P}${suffix}"{,/include} || die
225 + mv pypy-c libpypy-c.so "${BIN_P}${suffix}"/ || die
226 + mv include/pypy_* "${BIN_P}${suffix}"/include/ || die
227 + chmod +x "${BIN_P}${suffix}"/pypy-c || die
228 +
229 + tar -cf "${BIN_P}${suffix}.tar" "${BIN_P}${suffix}" || die
230 + lzip -v9 "${BIN_P}${suffix}.tar" || die
231 +}
232 +
233 +# Yup, very hacky.
234 +pkg_preinst() {
235 + # integrity check.
236 + [[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
237 + mkdir -p "${ROOT%/}${PYPY_BINPKG_STORE}" || die
238 + mv "${S}"/*.tar.lz "${ROOT%/}${PYPY_BINPKG_STORE}" || die
239 +}