aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Tottenham <max@tottenham.io>2020-05-19 09:09:18 +0000
committerAnthony G. Basile <blueness@gentoo.org>2020-05-20 09:38:35 -0400
commit9d812a9836bf44f8f6ec9bffd012fdaeacfc9149 (patch)
tree0f37968a966dc5ed4c1e73f17f655a7dce97976e /dev-python
parentnet-misc/networkmanager: Fix bashism in configure (diff)
downloadmusl-9d812a9836bf44f8f6ec9bffd012fdaeacfc9149.tar.gz
musl-9d812a9836bf44f8f6ec9bffd012fdaeacfc9149.tar.bz2
musl-9d812a9836bf44f8f6ec9bffd012fdaeacfc9149.zip
Add pypy3-exe 7.3.0 to overlay
* pypy3-exe requires a few patches to build properly on musl based systems. This should solve the build problems once python2_7 is fixed on the host system. Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
Diffstat (limited to 'dev-python')
-rw-r--r--dev-python/pypy3-exe/Manifest1
-rw-r--r--dev-python/pypy3-exe/files/pypy3-exe-7.3.0-gcc10-fno-common.patch25
-rw-r--r--dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-fix-stdio-defs.patch41
-rw-r--r--dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-include-sys-time.patch41
-rw-r--r--dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild159
5 files changed, 267 insertions, 0 deletions
diff --git a/dev-python/pypy3-exe/Manifest b/dev-python/pypy3-exe/Manifest
new file mode 100644
index 0000000..ba24d51
--- /dev/null
+++ b/dev-python/pypy3-exe/Manifest
@@ -0,0 +1 @@
+DIST pypy3.6-v7.3.0-src.tar.bz2 21937786 BLAKE2B c53ac32a9cca1c4624160eae9f11b5705a59613f1e5100fbb0ee86118de5a7845b8fa5087165d7f5a077d20337dfca14a1c7eadbe768995e20e249ec271ac10d SHA512 313a4254262dd8d8b995a50bddbc360cfb67add0818e51a3e9ce25bda6a9b639e9fea8efe7da6adda76dff0a86a364544a13faa516e51b9ea6c25ec99223b435
diff --git a/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-gcc10-fno-common.patch b/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-gcc10-fno-common.patch
new file mode 100644
index 0000000..b072ee4
--- /dev/null
+++ b/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-gcc10-fno-common.patch
@@ -0,0 +1,25 @@
+From 455e1f635110df4bdc2981a3a0abf02e3d4d21b2 Mon Sep 17 00:00:00 2001
+From: Matti Picus <matti.picus@gmail.com>
+Date: Wed, 26 Feb 2020 13:06:29 +0200
+Subject: [PATCH] issue 3163: the constant is defined both in vmprof_common.h and vmprof_common.c
+
+---
+ rpython/rlib/rvmprof/src/shared/vmprof_common.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/rpython/rlib/rvmprof/src/shared/vmprof_common.h b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
+index b52ee5f..1b2278b 100644
+--- a/rpython/rlib/rvmprof/src/shared/vmprof_common.h
++++ b/rpython/rlib/rvmprof/src/shared/vmprof_common.h
+@@ -89,7 +89,7 @@ int opened_profile(const char *interp_name, int memory, int proflines, int nativ
+ result is NULL. */
+ #if PY_MAJOR_VERSION >= 3 && !defined(_Py_atomic_load_relaxed)
+ /* this was abruptly un-defined in 3.5.1 */
+-void *volatile _PyThreadState_Current;
++extern void *volatile _PyThreadState_Current;
+ /* XXX simple volatile access is assumed atomic */
+ # define _Py_atomic_load_relaxed(pp) (*(pp))
+ #endif
+--
+libgit2 0.26.0
+
diff --git a/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-fix-stdio-defs.patch b/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-fix-stdio-defs.patch
new file mode 100644
index 0000000..5483505
--- /dev/null
+++ b/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-fix-stdio-defs.patch
@@ -0,0 +1,41 @@
+From add8c17b51123f7919ab68e9e6bb8ffa0739ce39 Mon Sep 17 00:00:00 2001
+From: Max Tottenham <max@tottenham.io>
+Date: Tue, 19 May 2020 09:01:00 +0000
+Subject: [PATCH 2/2] [PATCH] musl compat: Correct definition of
+ std(out|err|in) in generated code
+
+ * One of the generated C files contains a redefinition of stdout as:
+
+ extern FILE* stdout;
+
+ It also happens to include <stdio.h>, this leads to conflicting
+ types for stdout as musl defines these as `extern FILE* const`.
+
+ This patch to rfile.py fixes the generated code to emit `extern
+ FILE* const` definitions.
+---
+ rpython/rlib/rfile.py | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/rpython/rlib/rfile.py b/rpython/rlib/rfile.py
+index c135cfb..d17c9a7 100644
+--- a/rpython/rlib/rfile.py
++++ b/rpython/rlib/rfile.py
+@@ -106,11 +106,11 @@ c_feof = llexternal('feof', [FILEP], rffi.INT)
+ c_ferror = llexternal('ferror', [FILEP], rffi.INT)
+ c_clearerr = llexternal('clearerr', [FILEP], lltype.Void)
+
+-c_stdin = rffi.CExternVariable(FILEP, 'stdin', eci, c_type='FILE*',
++c_stdin = rffi.CExternVariable(FILEP, 'stdin', eci, c_type='FILE* const',
+ getter_only=True)
+-c_stdout = rffi.CExternVariable(FILEP, 'stdout', eci, c_type='FILE*',
++c_stdout = rffi.CExternVariable(FILEP, 'stdout', eci, c_type='FILE* const',
+ getter_only=True)
+-c_stderr = rffi.CExternVariable(FILEP, 'stderr', eci, c_type='FILE*',
++c_stderr = rffi.CExternVariable(FILEP, 'stderr', eci, c_type='FILE* const',
+ getter_only=True)
+
+
+--
+2.26.2
+
diff --git a/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-include-sys-time.patch b/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-include-sys-time.patch
new file mode 100644
index 0000000..df78406
--- /dev/null
+++ b/dev-python/pypy3-exe/files/pypy3-exe-7.3.0-musl-compat-include-sys-time.patch
@@ -0,0 +1,41 @@
+From 82c173abcefff0d11ae59294ffdbe06bebebf3ac Mon Sep 17 00:00:00 2001
+From: Max Tottenham <max@tottenham.io>
+Date: Tue, 19 May 2020 08:58:11 +0000
+Subject: [PATCH 1/2] [PATCH] musl compat: Include <sys/time.h> in pytime.h for
+ struct timeval def
+
+ * pytime.h uses struct timeval* in the definition of functions without
+ importing the header that defines struct timeval.
+ This leads to redefinition errors like the following when attempting
+ to compile pytime.c which *does* include <sys/time.h>:
+
+pytime.c:506:1: error: conflicting types for __PyTime_AsTimeval_
+ 506 | _PyTime_AsTimeval(_PyTime_t t, struct timeval *tv, _PyTime_round_t round)
+ | ^~~~~~~~~~~~~~~~~
+In file included from /var/tmp/portage/dev-python/pypy3-exe-7.3.0/work/pypy3.6-v7.3.0-src/rpython/../pypy/module/cpyext/include/Python.h:84,
+ from pytime.c:1:
+/var/tmp/portage/dev-python/pypy3-exe-7.3.0/work/pypy3.6-v7.3.0-src/rpython/../pypy/module/cpyext/include/pytime.h:121:17: note: previous declaration of __PyTime_AsTimeval_ was here
+ 121 | PyAPI_FUNC(int) _PyTime_AsTimeval(_PyTime_t t,
+ | ^~~~~~~~~~~~~~~~~
+---
+ pypy/module/cpyext/include/pytime.h | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/pypy/module/cpyext/include/pytime.h b/pypy/module/cpyext/include/pytime.h
+index 158c460..40a16b8 100644
+--- a/pypy/module/cpyext/include/pytime.h
++++ b/pypy/module/cpyext/include/pytime.h
+@@ -2,6 +2,10 @@
+ #ifndef Py_PYTIME_H
+ #define Py_PYTIME_H
+
++#ifndef MS_WINDOWS
++#include <sys/time.h>
++#endif
++
+ #include "pyconfig.h" /* include for defines */
+ #include "object.h"
+
+--
+2.26.2
+
diff --git a/dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild b/dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild
new file mode 100644
index 0000000..75535e3
--- /dev/null
+++ b/dev-python/pypy3-exe/pypy3-exe-7.3.0.ebuild
@@ -0,0 +1,159 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+# pypy3 needs to be built using python 2
+PYTHON_COMPAT=( python2_7 )
+inherit check-reqs pax-utils python-any-r1 toolchain-funcs
+
+MY_P=pypy3.6-v${PV/_/}
+DESCRIPTION="PyPy3 executable (build from source)"
+HOMEPAGE="https://pypy.org/"
+SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2"
+S="${WORKDIR}/${MY_P}-src"
+
+LICENSE="MIT"
+SLOT="${PV}"
+KEYWORDS="amd64 ~ppc64 x86 ~amd64-linux ~x86-linux"
+IUSE="bzip2 +jit low-memory ncurses cpu_flags_x86_sse2"
+
+RDEPEND=">=sys-libs/zlib-1.1.3:0=
+ dev-libs/libffi:0=
+ virtual/libintl:0=
+ dev-libs/expat:0=
+ bzip2? ( app-arch/bzip2:0= )
+ ncurses? ( sys-libs/ncurses:0= )
+ !dev-python/pypy3-exe-bin:${PV}"
+DEPEND="${RDEPEND}"
+BDEPEND="
+ low-memory? ( dev-python/pypy )
+ !low-memory? (
+ || (
+ dev-python/pypy
+ (
+ dev-lang/python:2.7
+ dev-python/pycparser[python_targets_python2_7(-),python_single_target_python2_7(+)]
+ )
+ )
+ )"
+
+PATCHES=(
+ # https://bugs.gentoo.org/706760
+ "${FILESDIR}"/${PN}-7.3.0-gcc10-fno-common.patch
+ # musl compatability patches
+ "${FILESDIR}"/${PN}-7.3.0-musl-compat-include-sys-time.patch
+ "${FILESDIR}"/${PN}-7.3.0-musl-compat-fix-stdio-defs.patch
+)
+
+check_env() {
+ if use low-memory; then
+ CHECKREQS_MEMORY="1750M"
+ use amd64 && CHECKREQS_MEMORY="3500M"
+ else
+ CHECKREQS_MEMORY="3G"
+ use amd64 && CHECKREQS_MEMORY="6G"
+ fi
+
+ check-reqs_pkg_pretend
+}
+
+pkg_pretend() {
+ [[ ${MERGE_TYPE} != binary ]] && check_env
+}
+
+pkg_setup() {
+ if [[ ${MERGE_TYPE} != binary ]]; then
+ check_env
+
+ # unset to allow forcing pypy below :)
+ use low-memory && EPYTHON=
+ if [[ ! ${EPYTHON} || ${EPYTHON} == pypy ]] &&
+ { has_version -b dev-python/pypy ||
+ has_version -b dev-python/pypy-bin; }
+ then
+ einfo "Using PyPy to perform the translation."
+ 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 "dev-python/pypy and ensure that EPYTHON variable is unset."
+ python-any-r1_pkg_setup
+ fi
+ fi
+}
+
+src_configure() {
+ 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=(
+ --no-shared
+ $(usex jit -Ojit -O2)
+
+ ${jit_backend}
+
+ 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=( "${EPYTHON}" )
+ if use low-memory; then
+ interp=( env PYPY_GC_MAX_DELTA=200MB
+ "${EPYTHON}" --jit loop_longevity=300 )
+ fi
+
+ # translate into the C sources
+ # we're going to make them ourselves since otherwise pypy does not
+ # free up the unneeded memory before spawning the compiler
+ set -- "${interp[@]}" rpython/bin/rpython --batch --source "${args[@]}"
+ echo -e "\033[1m${@}\033[0m"
+ "${@}" || die "translation failed"
+}
+
+src_compile() {
+ emake -C "${T}"/usession*-0/testing_1
+}
+
+src_install() {
+ local dest=/usr/lib/pypy3.6
+ exeinto "${dest}"
+ newexe "${T}"/usession*-0/testing_1/pypy3-c pypy3-c-${PV}
+ insinto "${dest}"/include/${PV}
+ doins include/pypy_*
+ pax-mark m "${ED}${dest}/pypy3-c-${PV}"
+}