summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2016-03-02 17:01:36 +0100
committerMichał Górny <mgorny@gentoo.org>2016-03-02 17:01:36 +0100
commit1ccca16c532cd3f8d17b2a3a29e5a9c9661749f7 (patch)
tree6dd09b134d2bd33a216ae38e6f33835d0f2e4c31 /dev-binpkg
parentdev-binpkg/pypy: Fix Manifest (diff)
downloadmgorny-1ccca16c532cd3f8d17b2a3a29e5a9c9661749f7.tar.gz
mgorny-1ccca16c532cd3f8d17b2a3a29e5a9c9661749f7.tar.bz2
mgorny-1ccca16c532cd3f8d17b2a3a29e5a9c9661749f7.zip
dev-binpkg/pypy3: Update
Diffstat (limited to 'dev-binpkg')
-rw-r--r--dev-binpkg/pypy3/Manifest1
-rw-r--r--dev-binpkg/pypy3/files/2.3.1-shared-lib.patch11
-rw-r--r--dev-binpkg/pypy3/files/pypy3-2.4.0-gcc-4.9.patch26
-rw-r--r--dev-binpkg/pypy3/files/pypy3-2.4.0-libressl.patch187
-rw-r--r--dev-binpkg/pypy3/metadata.xml14
-rw-r--r--dev-binpkg/pypy3/pypy3-2.4.0.ebuild188
6 files changed, 427 insertions, 0 deletions
diff --git a/dev-binpkg/pypy3/Manifest b/dev-binpkg/pypy3/Manifest
new file mode 100644
index 0000000..1543f05
--- /dev/null
+++ b/dev-binpkg/pypy3/Manifest
@@ -0,0 +1 @@
+DIST pypy3-2.4.0-src.tar.bz2 14693194 SHA256 d9ba207d6eecf8a0dc4414e9f4e92db1abd143e8cc6ec4a6bdcac75b29f104f3 SHA512 7e2b0c21f1833b8cd61251c2d58c6a9f99207e5d582618f0036886ff28dcb313541dce1c36bd1b57b332a36a94b13e416bb7b67110be7c8ece8283749ba712be WHIRLPOOL bd02009c828b7b491b46b260d687d268561e5372766adccbcb58e87a3f1c545f293c54e5cdd6e6b7fb95feb678677137211ee890f106140ce1bc256f8563d2cd
diff --git a/dev-binpkg/pypy3/files/2.3.1-shared-lib.patch b/dev-binpkg/pypy3/files/2.3.1-shared-lib.patch
new file mode 100644
index 0000000..ae1139f
--- /dev/null
+++ b/dev-binpkg/pypy3/files/2.3.1-shared-lib.patch
@@ -0,0 +1,11 @@
+--- rpython/translator/platform/posix.py
++++ rpython/translator/platform/posix.py
+@@ -180,7 +180,7 @@
+ 'int main(int argc, char* argv[]) '
+ '{ return $(PYPY_MAIN_FUNCTION)(argc, argv); }" > $@')
+ m.rule('$(DEFAULT_TARGET)', ['$(TARGET)', 'main.o'],
+- '$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) -o $@')
++ '$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) \'-Wl,-rpath,$$ORIGIN\' -o $@')
+
+ return m
+
diff --git a/dev-binpkg/pypy3/files/pypy3-2.4.0-gcc-4.9.patch b/dev-binpkg/pypy3/files/pypy3-2.4.0-gcc-4.9.patch
new file mode 100644
index 0000000..dd3a688
--- /dev/null
+++ b/dev-binpkg/pypy3/files/pypy3-2.4.0-gcc-4.9.patch
@@ -0,0 +1,26 @@
+Description: Expect cmovnb and jnb
+ Fixes an FTBFS since gcc 4.9.2, which is emmiting new operations
+Author: Stefano Rivera <stefanor@debian.org>
+Forwarded: https://bitbucket.org/pypy/pypy/commits/c1abec418acf30bb04891c3249bc12cbe8f48d4a
+Bug-Debian: https://bugs.debian.org/771137
+Last-Update: 2014-11-26
+
+--- a/rpython/translator/c/gcc/trackgcroot.py
++++ b/rpython/translator/c/gcc/trackgcroot.py
+@@ -590,7 +590,7 @@
+
+ # The various cmov* operations
+ for name in '''
+- e ne g ge l le a ae b be p np s ns o no
++ e ne g ge l le a ae b be nb p np s ns o no
+ '''.split():
+ locals()['visit_cmov' + name] = binary_insn
+ locals()['visit_cmov' + name + 'l'] = binary_insn
+@@ -837,6 +837,7 @@
+ visit_jb = conditional_jump
+ visit_jbe = conditional_jump
+ visit_jp = conditional_jump
++ visit_jnb = conditional_jump
+ visit_jnp = conditional_jump
+ visit_js = conditional_jump
+ visit_jns = conditional_jump
diff --git a/dev-binpkg/pypy3/files/pypy3-2.4.0-libressl.patch b/dev-binpkg/pypy3/files/pypy3-2.4.0-libressl.patch
new file mode 100644
index 0000000..5852939
--- /dev/null
+++ b/dev-binpkg/pypy3/files/pypy3-2.4.0-libressl.patch
@@ -0,0 +1,187 @@
+From 66bef80988c9efe60b61c6bc05f3206b4c3df7e8 Mon Sep 17 00:00:00 2001
+From: hasufell <hasufell@gentoo.org>
+Date: Mon, 12 Oct 2015 20:43:50 +0200
+Subject: [PATCH] Add LibreSSL support, patches backported from upstream
+
+https://bitbucket.org/pypy/pypy/pull-requests/333/deal-with-platforms-without-rand_egd-take/diff
+---
+ pypy/module/_ssl/interp_ssl.py | 34 +++++++++++++++-----------
+ pypy/module/_ssl/test/test_ssl.py | 8 +++---
+ rpython/rlib/ropenssl.py | 6 ++++-
+ rpython/rtyper/tool/rffi_platform.py | 12 ++++++---
+ rpython/rtyper/tool/test/test_rffi_platform.py | 24 +++++++++++++++++-
+ 5 files changed, 61 insertions(+), 23 deletions(-)
+
+diff --git a/pypy/module/_ssl/interp_ssl.py b/pypy/module/_ssl/interp_ssl.py
+index 0cac165..f210167 100644
+--- a/pypy/module/_ssl/interp_ssl.py
++++ b/pypy/module/_ssl/interp_ssl.py
+@@ -310,20 +310,26 @@ if HAVE_OPENSSL_RAND:
+ res = libssl_RAND_status()
+ return space.wrap(res)
+
+- @unwrap_spec(path=str)
+- def RAND_egd(space, path):
+- """RAND_egd(path) -> bytes
+-
+- Queries the entropy gather daemon (EGD) on socket path. Returns number
+- of bytes read. Raises socket.sslerror if connection to EGD fails or
+- if it does provide enough data to seed PRNG."""
+- with rffi.scoped_str2charp(path) as socket_path:
+- bytes = libssl_RAND_egd(socket_path)
+- if bytes == -1:
+- raise ssl_error(space,
+- "EGD connection failed or EGD did not return "
+- "enough data to seed the PRNG")
+- return space.wrap(bytes)
++ if HAVE_OPENSSL_RAND_EGD:
++ @unwrap_spec(path=str)
++ def RAND_egd(space, path):
++ """RAND_egd(path) -> bytes
++
++ Queries the entropy gather daemon (EGD) on socket path. Returns number
++ of bytes read. Raises socket.sslerror if connection to EGD fails or
++ if it does provide enough data to seed PRNG."""
++ with rffi.scoped_str2charp(path) as socket_path:
++ bytes = libssl_RAND_egd(socket_path)
++ if bytes == -1:
++ raise ssl_error(space,
++ "EGD connection failed or EGD did not return "
++ "enough data to seed the PRNG")
++ return space.wrap(bytes)
++ else:
++ # Dummy func for platforms missing RAND_egd(). Most likely LibreSSL.
++ @unwrap_spec(path=str)
++ def RAND_egd(space, path):
++ raise ssl_error(space, "RAND_egd unavailable")
+
+
+ class SSLSocket(W_Root):
+diff --git a/pypy/module/_ssl/test/test_ssl.py b/pypy/module/_ssl/test/test_ssl.py
+index 3204610..9722fd5 100644
+--- a/pypy/module/_ssl/test/test_ssl.py
++++ b/pypy/module/_ssl/test/test_ssl.py
+@@ -33,7 +33,8 @@ class AppTestSSL:
+ assert isinstance(_ssl.OPENSSL_VERSION_INFO, tuple)
+ assert len(_ssl.OPENSSL_VERSION_INFO) == 5
+ assert isinstance(_ssl.OPENSSL_VERSION, str)
+- assert 'openssl' in _ssl.OPENSSL_VERSION.lower()
++ lower_version = _ssl.OPENSSL_VERSION.lower()
++ assert 'openssl' in lower_version or "libressl" in lower_version
+
+ def test_RAND_add(self):
+ import _ssl
+@@ -64,8 +65,9 @@ class AppTestSSL:
+
+ def test_sslwrap(self):
+ import ssl, _socket, sys, gc
+- if sys.platform == 'darwin' or 'freebsd' in sys.platform:
+- skip("hangs indefinitely on OSX & FreeBSD (also on CPython)")
++ if sys.platform == 'darwin' or 'freebsd' in sys.platform or \
++ 'openbsd' in sys.platform:
++ skip("hangs indefinitely on OSX & BSD (also on CPython)")
+ s = _socket.socket()
+ ss = ssl.wrap_socket(s)
+
+diff --git a/rpython/rlib/ropenssl.py b/rpython/rlib/ropenssl.py
+index c36779d..6fe45d0 100644
+--- a/rpython/rlib/ropenssl.py
++++ b/rpython/rlib/ropenssl.py
+@@ -168,6 +168,9 @@ OBJ_NAME = rffi.CArrayPtr(OBJ_NAME_st)
+
+ HAVE_OPENSSL_RAND = OPENSSL_VERSION_NUMBER >= 0x0090500f
+ HAVE_SSL_CTX_CLEAR_OPTIONS = OPENSSL_VERSION_NUMBER >= 0x009080df
++HAVE_OPENSSL_RAND_EGD = rffi_platform.has('RAND_egd("/")',
++ '#include <openssl/rand.h>',
++ libraries=['ssl', 'crypto'])
+
+ def external(name, argtypes, restype, **kw):
+ kw['compilation_info'] = eci
+@@ -194,7 +197,8 @@ ssl_external('CRYPTO_set_id_callback',
+ if HAVE_OPENSSL_RAND:
+ ssl_external('RAND_add', [rffi.CCHARP, rffi.INT, rffi.DOUBLE], lltype.Void)
+ ssl_external('RAND_status', [], rffi.INT)
+- ssl_external('RAND_egd', [rffi.CCHARP], rffi.INT)
++ if HAVE_OPENSSL_RAND_EGD:
++ ssl_external('RAND_egd', [rffi.CCHARP], rffi.INT)
+ ssl_external('SSL_CTX_new', [SSL_METHOD], SSL_CTX)
+ ssl_external('SSL_get_SSL_CTX', [SSL], SSL_CTX)
+ ssl_external('TLSv1_method', [], SSL_METHOD)
+diff --git a/rpython/rtyper/tool/rffi_platform.py b/rpython/rtyper/tool/rffi_platform.py
+index 1760877..1d56c20 100755
+--- a/rpython/rtyper/tool/rffi_platform.py
++++ b/rpython/rtyper/tool/rffi_platform.py
+@@ -17,12 +17,15 @@ from rpython.rlib.rarithmetic import r_uint, r_longlong, r_ulonglong, intmask
+ #
+ # Helpers for simple cases
+
+-def eci_from_header(c_header_source, include_dirs=None):
++def eci_from_header(c_header_source, include_dirs=None, libraries=None):
+ if include_dirs is None:
+ include_dirs = []
++ if libraries is None:
++ libraries = []
+ return ExternalCompilationInfo(
+ post_include_bits=[c_header_source],
+- include_dirs=include_dirs
++ include_dirs=include_dirs,
++ libraries=libraries,
+ )
+
+ def getstruct(name, c_header_source, interesting_fields):
+@@ -75,9 +78,10 @@ def getintegerfunctionresult(function, args=None, c_header_source='', includes=[
+ CConfig._compilation_info_.includes = includes
+ return configure(CConfig)['RESULT']
+
+-def has(name, c_header_source, include_dirs=None):
++def has(name, c_header_source, include_dirs=None, libraries=None):
+ class CConfig:
+- _compilation_info_ = eci_from_header(c_header_source, include_dirs)
++ _compilation_info_ = \
++ eci_from_header(c_header_source, include_dirs, libraries)
+ HAS = Has(name)
+ return configure(CConfig)['HAS']
+
+diff --git a/rpython/rtyper/tool/test/test_rffi_platform.py b/rpython/rtyper/tool/test/test_rffi_platform.py
+index bfa069e..4feae87 100644
+--- a/rpython/rtyper/tool/test/test_rffi_platform.py
++++ b/rpython/rtyper/tool/test/test_rffi_platform.py
+@@ -271,12 +271,34 @@ def test_array():
+ [("d_name", lltype.FixedSizeArray(rffi.CHAR, 1))])
+ assert dirent.c_d_name.length == 32
+
+-def test_has():
++def test_has_0001():
+ assert rffi_platform.has("x", "int x = 3;")
+ assert not rffi_platform.has("x", "")
+ # has() should also not crash if it is given an invalid #include
+ assert not rffi_platform.has("x", "#include <some/path/which/cannot/exist>")
+
++def test_has_0002():
++ assert rffi_platform.has("pow", "#include <math.h>", libraries=["m"])
++
++def test_has_0003():
++ """multiple libraries"""
++ assert rffi_platform.has("pow", "#include <math.h>", libraries=["m", "c"])
++
++def test_has_0004():
++ """bogus symbol name"""
++ assert not rffi_platform.has("pow", "#include <math.h>",
++ libraries=["boguslibname"])
++
++def test_has_0005():
++ """bogus symbol name and lib name"""
++ assert not rffi_platform.has("bogus_symbol_name", "#include <math.h>",
++ libraries=["boguslibname"])
++
++def test_has_0006():
++ """missing include"""
++ assert not rffi_platform.has("pow", "", libraries=["m"])
++
++
+ def test_verify_eci():
+ eci = ExternalCompilationInfo()
+ rffi_platform.verify_eci(eci)
+--
+2.6.1
+
diff --git a/dev-binpkg/pypy3/metadata.xml b/dev-binpkg/pypy3/metadata.xml
new file mode 100644
index 0000000..675ce03
--- /dev/null
+++ b/dev-binpkg/pypy3/metadata.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <herd>python</herd>
+ <maintainer>
+ <email>mgorny@gentoo.org</email>
+ <name>Michał Górny</name>
+ </maintainer>
+ <use>
+ <flag name="low-memory">Build using PyPy with the engine configured towards low memory footprint. This makes it possible to build PyPy using ~3.5G of RAM on amd64 and ~half of that on x86, at the cost of lengthened build time. Please note that you will need an extra ~1G of extra RAM or swap since the translation memory (unused at the time) is not freed when the C compiler is spawned.</flag>
+ <flag name="sandbox">Enable sandboxing functionality</flag>
+ <flag name="shadowstack">Use a shadow stack for finding GC roots</flag>
+ </use>
+</pkgmetadata>
diff --git a/dev-binpkg/pypy3/pypy3-2.4.0.ebuild b/dev-binpkg/pypy3/pypy3-2.4.0.ebuild
new file mode 100644
index 0000000..b44ac88
--- /dev/null
+++ b/dev-binpkg/pypy3/pypy3-2.4.0.ebuild
@@ -0,0 +1,188 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+# pypy3 needs to be built using python 2
+PYTHON_COMPAT=( python2_7 pypy )
+inherit check-reqs eutils multilib multiprocessing pax-utils \
+ python-any-r1 toolchain-funcs versionator
+
+DESCRIPTION="A fast, compliant alternative implementation of Python 3"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${P}-src.tar.bz2"
+
+LICENSE="MIT"
+SLOT="0/$(get_version_component_range 1-2 ${PV})"
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="bzip2 +jit low-memory ncurses sandbox shadowstack cpu_flags_x86_sse2"
+
+DEPEND=">=sys-libs/zlib-1.1.3
+ virtual/libffi
+ virtual/libintl
+ dev-libs/expat
+ dev-libs/openssl
+ bzip2? ( app-arch/bzip2 )
+ ncurses? ( sys-libs/ncurses[-tinfo] )
+ app-arch/xz-utils
+ low-memory? ( virtual/pypy:0 )
+ !low-memory? ( ${PYTHON_DEPS} )"
+
+S="${WORKDIR}/${P}-src"
+
+pkg_pretend() {
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ if use low-memory; then
+ CHECKREQS_MEMORY="1750M"
+ use amd64 && CHECKREQS_MEMORY="3500M"
+ else
+ CHECKREQS_MEMORY="3G"
+ use amd64 && CHECKREQS_MEMORY="6G"
+ fi
+ fi
+
+ check-reqs_pkg_pretend
+}
+
+pkg_setup() {
+ local force_pypy
+
+ pkg_pretend
+
+ use low-memory && local EPYTHON
+ if has_version virtual/pypy && [[ ! ${EPYTHON} ]]; then
+ einfo "Using PyPy to perform the translation."
+ local EPYTHON=pypy
+ else
+ einfo "Using ${EPYTHON:-python2} to perform the translation. Please note that upstream"
+ einfo "recommends using PyPy for that. If you wish to do so, please install"
+ einfo "virtual/pypy and ensure that EPYTHON variable is unset."
+ fi
+
+ python-any-r1_pkg_setup
+
+ local cpu
+ if use amd64; then
+ # common denominator between Intel & AMD
+ cpu='x86-64'
+ elif use x86; then
+ if use sse2; then
+ # lowest with SSE2
+ cpu='pentium-m'
+ else
+ # lowest with SSE, compat. with athlon-xp
+ # TODO: do we want to support something older?
+ cpu='pentium3'
+ fi
+ else
+ die "Unsupported arch ${ARCH}"
+ fi
+
+ export CFLAGS="-march=${cpu} -mtune=generic -O2 -pipe"
+ export CXXFLAGS=${CFLAGS}
+
+ elog "CFLAGS: ${CFLAGS}"
+}
+
+src_prepare() {
+ epatch \
+ "${FILESDIR}"/${P}-gcc-4.9.patch \
+ "${FILESDIR}"/2.3.1-shared-lib.patch # 517002
+ epatch "${FILESDIR}"/${PN}-2.4.0-libressl.patch
+
+ epatch_user
+}
+
+src_compile() {
+ tc-export CC
+
+ local jit_backend
+ if use jit; then
+ jit_backend='--jit-backend='
+
+ # We only need the explicit sse2 switch for x86.
+ # On other arches we can rely on autodetection which uses
+ # compiler macros. Plus, --jit-backend= doesn't accept all
+ # the modern values...
+
+ if use x86; then
+ if use cpu_flags_x86_sse2; then
+ jit_backend+=x86
+ else
+ jit_backend+=x86-without-sse2
+ fi
+ else
+ jit_backend+=auto
+ fi
+ fi
+
+ local args=(
+ --shared
+ $(usex jit -Ojit -O2)
+ $(usex shadowstack --gcrootfinder=shadowstack '')
+ $(usex sandbox --sandbox '')
+
+ ${jit_backend}
+ --make-jobs=$(makeopts_jobs)
+
+ pypy/goal/targetpypystandalone
+ )
+
+ # Avoid linking against libraries disabled by use flags
+ local opts=(
+ bzip2:bz2
+ ncurses:_minimal_curses
+ )
+
+ local opt
+ for opt in "${opts[@]}"; do
+ local flag=${opt%:*}
+ local mod=${opt#*:}
+
+ args+=(
+ $(usex ${flag} --withmod --withoutmod)-${mod}
+ )
+ done
+
+ local interp=( "${PYTHON}" )
+ if use low-memory; then
+ interp=( env PYPY_GC_MAX_DELTA=200MB
+ "${PYTHON}" --jit loop_longevity=300 )
+ fi
+
+ set -- "${interp[@]}" rpython/bin/rpython --batch "${args[@]}"
+ echo -e "\033[1m${@}\033[0m"
+ "${@}" || die "compile error"
+
+ pax-mark m "${ED%/}${INSDESTTREE}/pypy-c"
+}
+
+src_install() {
+ local flags=( bzip2 jit ncurses sandbox shadowstack )
+ use x86 && flags+=( cpu_flags_x86_sse2 )
+ local f suffix="-${ARCH}"
+
+ for f in ${flags[@]}; do
+ use ${f} && suffix+="+${f#cpu_flags_x86_}"
+ done
+
+ local BIN_P=pypy3-bin-${PV}
+
+ einfo "Zipping PyPy ..."
+ mkdir "${BIN_P}${suffix}"{,/include} || die
+ mv pypy-c libpypy-c.so "${BIN_P}${suffix}"/ || die
+ mv include/pypy_* "${BIN_P}${suffix}"/include/ || die
+ chmod +x "${BIN_P}${suffix}"/pypy-c || die
+
+ tar -cf "${BIN_P}${suffix}.tar" "${BIN_P}${suffix}" || die
+ xz -vz9e "${BIN_P}${suffix}.tar" || die
+}
+
+# Yup, very hacky.
+pkg_preinst() {
+ # integrity check.
+ [[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
+ mkdir -p "${ROOT%/}${PYPY_BINPKG_STORE}" || die
+ mv "${S}"/*.tar.xz "${ROOT%/}${PYPY_BINPKG_STORE}" || die
+}