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