Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/mgorny:master commit in: dev-binpkg/pypy/
Date: Sat, 03 Sep 2016 11:13:27
Message-Id: 1472901162.983e6231c24804c1d8f48c311a55bcda55588d4d.mgorny@gentoo
1 commit: 983e6231c24804c1d8f48c311a55bcda55588d4d
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 3 11:12:42 2016 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 3 11:12:42 2016 +0000
6 URL: https://gitweb.gentoo.org/dev/mgorny.git/commit/?id=983e6231
7
8 dev-binpkg/pypy: Bump to 5.4.0
9
10 dev-binpkg/pypy/Manifest | 1 +
11 dev-binpkg/pypy/pypy-5.4.0.ebuild | 193 ++++++++++++++++++++++++++++++++++++++
12 2 files changed, 194 insertions(+)
13
14 diff --git a/dev-binpkg/pypy/Manifest b/dev-binpkg/pypy/Manifest
15 index 9bf23b9..712061e 100644
16 --- a/dev-binpkg/pypy/Manifest
17 +++ b/dev-binpkg/pypy/Manifest
18 @@ -5,3 +5,4 @@ DIST pypy-5.0.0-src.tar.bz2 17223494 SHA256 89027b1b33553b53ff7733dc4838f0a76af2
19 DIST pypy-5.1.1-src.tar.bz2 17328934 SHA256 ca3d943d7fbd78bb957ee9e5833ada4bb8506ac99a41b7628790e286a65ed2be SHA512 2d81b62747ac02980c275fe24fff689e93b4b352e6279c55ca570fd76b8477a55f819e81fab4c6ffdb6991f29536c606d75e238d5bbe04518357509020f23ca9 WHIRLPOOL 17f78c8c7df9e07af3fce15392061652284606fbd872706888094ec01d222957c8ee43d2667369377ceb1a9720692d130e4a540bcaff269b4c7d8896b14d708d
20 DIST pypy2-v5.3.0-src.tar.bz2 17361429 SHA256 4142eb8f403810bc88a4911792bb5a502e152df95806e33e69050c828cd160d5 SHA512 6387987b93bebf8ca6d820bde6c42c1a7427a778ff01cf93766df34be792cb1a8d927b3e402f90159df75f68aa1c913a28e9d453e3b13b28489cb68670ef121d WHIRLPOOL 57b9718b1ed72f13005a6d5a60b24d0fdab522ff63b3f91264433cf17f0bb4c5f36e3121d8d92744386fa5d31fbce14711689c85f87a53b68bfdbddaa19a3edd
21 DIST pypy2-v5.3.1-src.tar.bz2 17361760 SHA256 31a52bab584abf3a0f0defd1bf9a29131dab08df43885e7eeddfc7dc9b71836e SHA512 3138dde3cb1a155e389a2be615601e22f468d2bc77dd219a35b310052fa06f68f80c3ff62fa4d0a9179eae014ace18620d0a076a0528cb155b1c33cc94d6b397 WHIRLPOOL 518b73ec649673fb1fc333b5d0e7669f06e9569624e2f8b55dbbf24b5f109a3b9680ed1d45c6401eb62ee8761043ec9c38a33e6d396c39c3f2fb5ba30f15e93a
22 +DIST pypy2-v5.4.0-src.tar.bz2 17414795 SHA256 d9568ebe9a14d0eaefde887d78f3cba63d665e95c0d234bb583932341f55a655 SHA512 a989393f75ff45d6a8b8b2597c0a208559b3188ffdf65205ad491332f1836a86bbb419a3dfba67f80e5ab8d075aa97f44c63316f805a51d7ce1481e81b461373 WHIRLPOOL 623bbaed02214cbc2092abd163e102c11405f12b73dd2ace8098e08a415bd43a0bf13809913b56c378a8a688ff6ff561dc9a90bcd479de85bb301aa67c670d26
23
24 diff --git a/dev-binpkg/pypy/pypy-5.4.0.ebuild b/dev-binpkg/pypy/pypy-5.4.0.ebuild
25 new file mode 100644
26 index 0000000..63dc8fe
27 --- /dev/null
28 +++ b/dev-binpkg/pypy/pypy-5.4.0.ebuild
29 @@ -0,0 +1,193 @@
30 +# Copyright 1999-2016 Gentoo Foundation
31 +# Distributed under the terms of the GNU General Public License v2
32 +# $Id$
33 +
34 +EAPI=5
35 +
36 +PYTHON_COMPAT=( python2_7 pypy )
37 +inherit check-reqs eutils multilib multiprocessing pax-utils python-any-r1 toolchain-funcs versionator
38 +
39 +MY_P=pypy2-v${PV}
40 +
41 +DESCRIPTION="A fast, compliant alternative implementation of the Python language"
42 +HOMEPAGE="http://pypy.org/"
43 +SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2"
44 +
45 +LICENSE="MIT"
46 +SLOT="0/$(get_version_component_range 1-2 ${PV})"
47 +KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
48 +IUSE="bzip2 +jit low-memory ncurses sandbox shadowstack sqlite cpu_flags_x86_sse2"
49 +
50 +DEPEND=">=sys-libs/zlib-1.1.3:0=
51 + virtual/libffi:0=
52 + virtual/libintl:0=
53 + dev-libs/expat:0=
54 + dev-libs/openssl:0=[-bindist]
55 + bzip2? ( app-arch/bzip2:0= )
56 + ncurses? ( sys-libs/ncurses:0= )
57 + app-arch/lzip
58 + ${PYTHON_DEPS}"
59 +
60 +S="${WORKDIR}/${MY_P}-src"
61 +
62 +pkg_pretend() {
63 + if use low-memory; then
64 + if ! python_is_installed pypy; then
65 + eerror "USE=low-memory requires a (possibly old) version of dev-python/pypy"
66 + eerror "or dev-python/pypy-bin being installed. Please install it using e.g.:"
67 + eerror
68 + eerror " $ emerge -1v dev-python/pypy-bin"
69 + eerror
70 + eerror "before attempting to build dev-python/pypy[low-memory]."
71 + die "dev-python/pypy-bin (or dev-python/pypy) needs to be installed for USE=low-memory"
72 + fi
73 +
74 + CHECKREQS_MEMORY="1750M"
75 + use amd64 && CHECKREQS_MEMORY="3500M"
76 + else
77 + CHECKREQS_MEMORY="3G"
78 + use amd64 && CHECKREQS_MEMORY="6G"
79 + fi
80 +
81 + check-reqs_pkg_pretend
82 +
83 + [[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
84 +}
85 +
86 +pkg_setup() {
87 + pkg_pretend
88 +
89 + if python_is_installed pypy; then
90 + if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] || use low-memory; then
91 + einfo "Using already-installed PyPy to perform the translation."
92 + local EPYTHON=pypy
93 + else
94 + einfo "Using ${EPYTHON} to perform the translation. Please note that upstream"
95 + einfo "recommends using PyPy for that. If you wish to do so, please unset"
96 + einfo "the EPYTHON variable."
97 + fi
98 + fi
99 +
100 + python-any-r1_pkg_setup
101 +
102 + local cpu
103 + if use amd64; then
104 + # common denominator between Intel & AMD
105 + cpu='x86-64'
106 + elif use x86; then
107 + if use cpu_flags_x86_sse2; then
108 + # lowest with SSE2
109 + cpu='pentium-m'
110 + else
111 + # lowest with SSE, compat. with athlon-xp
112 + # TODO: do we want to support something older?
113 + cpu='pentium3'
114 + fi
115 + else
116 + die "Unsupported arch ${ARCH}"
117 + fi
118 +
119 + export CFLAGS="-march=${cpu} -mtune=generic -O2 -pipe"
120 + export CXXFLAGS=${CFLAGS}
121 +
122 + elog "CFLAGS: ${CFLAGS}"
123 +}
124 +
125 +src_prepare() {
126 + epatch "${FILESDIR}"/2.5.0-shared-lib.patch # 517002
127 +
128 + epatch_user
129 +}
130 +
131 +src_compile() {
132 + tc-export CC
133 +
134 + local jit_backend
135 + if use jit; then
136 + jit_backend='--jit-backend='
137 +
138 + # We only need the explicit sse2 switch for x86.
139 + # On other arches we can rely on autodetection which uses
140 + # compiler macros. Plus, --jit-backend= doesn't accept all
141 + # the modern values...
142 +
143 + if use x86; then
144 + if use cpu_flags_x86_sse2; then
145 + jit_backend+=x86
146 + else
147 + jit_backend+=x86-without-sse2
148 + fi
149 + else
150 + jit_backend+=auto
151 + fi
152 + fi
153 +
154 + local args=(
155 + --shared
156 + $(usex jit -Ojit -O2)
157 + $(usex shadowstack --gcrootfinder=shadowstack '')
158 + $(usex sandbox --sandbox '')
159 +
160 + ${jit_backend}
161 + --make-jobs=$(makeopts_jobs)
162 +
163 + pypy/goal/targetpypystandalone
164 + )
165 +
166 + # Avoid linking against libraries disabled by use flags
167 + local opts=(
168 + bzip2:bz2
169 + ncurses:_minimal_curses
170 + )
171 +
172 + local opt
173 + for opt in "${opts[@]}"; do
174 + local flag=${opt%:*}
175 + local mod=${opt#*:}
176 +
177 + args+=(
178 + $(usex ${flag} --withmod --withoutmod)-${mod}
179 + )
180 + done
181 +
182 + local interp=( "${PYTHON}" )
183 + if use low-memory; then
184 + interp=( env PYPY_GC_MAX_DELTA=200MB
185 + "${PYTHON}" --jit loop_longevity=300 )
186 + fi
187 +
188 + set -- "${interp[@]}" rpython/bin/rpython --batch "${args[@]}"
189 + echo -e "\033[1m${@}\033[0m"
190 + "${@}" || die "compile error"
191 +
192 + pax-mark m "${ED%/}${INSDESTTREE}/pypy-c"
193 +}
194 +
195 +src_install() {
196 + local flags=( bzip2 jit ncurses sandbox shadowstack )
197 + use x86 && flags+=( cpu_flags_x86_sse2 )
198 + local f suffix="-${ARCH}"
199 +
200 + for f in ${flags[@]}; do
201 + use ${f} && suffix+="+${f#cpu_flags_x86_}"
202 + done
203 +
204 + local BIN_P=pypy-bin-${PV}
205 +
206 + einfo "Zipping PyPy ..."
207 + mkdir "${BIN_P}${suffix}"{,/include} || die
208 + mv pypy-c libpypy-c.so "${BIN_P}${suffix}"/ || die
209 + mv include/pypy_* "${BIN_P}${suffix}"/include/ || die
210 + chmod +x "${BIN_P}${suffix}"/pypy-c || die
211 +
212 + tar -cf "${BIN_P}${suffix}.tar" "${BIN_P}${suffix}" || die
213 + lzip -v9 "${BIN_P}${suffix}.tar" || die
214 +}
215 +
216 +# Yup, very hacky.
217 +pkg_preinst() {
218 + # integrity check.
219 + [[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
220 + mkdir -p "${ROOT%/}${PYPY_BINPKG_STORE}" || die
221 + mv "${S}"/*.tar.lz "${ROOT%/}${PYPY_BINPKG_STORE}" || die
222 +}