public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] dev/mgorny:master commit in: dev-python/pypy-bin/, dev-python/pypy/, dev-python/pypy-binpackage/, ...
@ 2013-07-21  7:00 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2013-07-21  7:00 UTC (permalink / raw
  To: gentoo-commits

commit:     8f4c5259e7614cccafeaba98b34cfa842354a48d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sat Jul 20 19:37:26 2013 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul 20 19:37:26 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/mgorny.git;a=commit;h=8f4c5259

Introduce my testing pypy packages.

---
 dev-python/pypy-bin/Manifest                       |   3 +
 dev-python/pypy-bin/metadata.xml                   |  14 +
 dev-python/pypy-bin/pypy-bin-2.0.2.ebuild          |  97 +++++++
 dev-python/pypy-binpackage/Manifest                |   1 +
 ....UnixCCompiler.runtime_library_dir_option.patch |  11 +
 .../files/1.9-scripts-location.patch               |  11 +
 ...ils-fix_handling_of_executables_and_flags.patch | 323 +++++++++++++++++++++
 dev-python/pypy-binpackage/metadata.xml            |  13 +
 .../pypy-binpackage/pypy-binpackage-2.0.2.ebuild   | 127 ++++++++
 dev-python/pypy/Manifest                           |   1 +
 ....UnixCCompiler.runtime_library_dir_option.patch |  11 +
 dev-python/pypy/files/1.9-scripts-location.patch   |  11 +
 ...ils-fix_handling_of_executables_and_flags.patch | 323 +++++++++++++++++++++
 dev-python/pypy/metadata.xml                       |  12 +
 dev-python/pypy/pypy-2.0.2.ebuild                  | 139 +++++++++
 15 files changed, 1097 insertions(+)

diff --git a/dev-python/pypy-bin/Manifest b/dev-python/pypy-bin/Manifest
new file mode 100644
index 0000000..606e981
--- /dev/null
+++ b/dev-python/pypy-bin/Manifest
@@ -0,0 +1,3 @@
+DIST pypy-2.0.2-src.tar.bz2 14819848 SHA256 1991c90d6b98e2408b3790d4b57b71ec1c69346328b8321505ce8f6ab4544c3c SHA512 5b8b56194dff468dd249dea0014fadafb791eb69858ffae0b9c7638f087df277a84ddadc7d5b0fdb48a12ca8e6b70eb95cb5b7a5f56fe8fe3396820b814ecfd7 WHIRLPOOL bb1f71e0b2d3e145edcb1baa17b0a13c09f5229cf1b0532edbb3d0d5c87ef39543c0ef6b9dc7ce2778c4a3336d4a1580fce9cf960f82b72ddfed02e06d10d8af
+DIST pypy-bin-2.0.2+bzip2+jit+ncurses+shadowstack+ssl.tar.xz 15089652 SHA256 8e0faf6cb87311b267ef05728da335483892f5454e0ecb0044350bc02e86ba9e SHA512 594b665305e3b4727b6229e4173179836fe70c12a217740ae6e34fa9c960875496492ea60791b879a88e47b3f9ae9887f5671d14bd8396ca3691856408658afd WHIRLPOOL d9a052843cf75beca10e16ba011f96f440f8f0f63eabf82320e0a45b2ca04d71a6fe07f14f67ff4388af709b8a47ee1176b4311bcbe956b5d4bc297673e657d3
+DIST pypy-bin-2.0.2-doc.tar.xz 1160968 SHA256 65a5859e230d45c363ead08381951b202c15a0669feb0d54ff90c0d683e2ec34 SHA512 20d651f9ba1176314e5c63dea9c992abf74fba211bd1a2ed41a0a0f9c879fd1e126e56407cd07a400e544ee9e9032b229b189741c6344b6e90757d871cd9bb94 WHIRLPOOL 0673deba43481abbb6d138b64b6fa9eef22871088d5c3d9aa64aa06ae829772ebd5874877e00fe8422c5503dd3016e7308b85ecfffc3b5bcec4bef0e1ef118b9

diff --git a/dev-python/pypy-bin/metadata.xml b/dev-python/pypy-bin/metadata.xml
new file mode 100644
index 0000000..02bf3ff
--- /dev/null
+++ b/dev-python/pypy-bin/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>
+		<description>amd64 build maintainer</description>
+	</maintainer>
+	<use>
+		<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-python/pypy-bin/pypy-bin-2.0.2.ebuild b/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild
new file mode 100644
index 0000000..26dd013
--- /dev/null
+++ b/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild
@@ -0,0 +1,97 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pypy/pypy-2.0.2.ebuild,v 1.3 2013/06/18 10:41:29 idella4 Exp $
+
+EAPI=5
+
+# XXX: test other implementations
+PYTHON_COMPAT=( python2_7 pypy{1_8,1_9,2_0} )
+inherit pax-utils python-any-r1 versionator
+
+BINHOST="http://dev.gentoo.org/~mgorny/dist/${PN}"
+
+DESCRIPTION="A fast, compliant alternative implementation of the Python language (binary package)"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="
+	amd64? (
+		bzip2? ( jit? ( ncurses? ( shadowstack? ( ssl? (
+			${BINHOST}/${P}+bzip2+jit+ncurses+shadowstack+ssl.tar.xz
+		) ) ) ) )
+	)
+	doc? ( ${BINHOST}/${P}-doc.tar.xz )
+	test? ( mirror://bitbucket/pypy/pypy/downloads/pypy-${PV}-src.tar.bz2 )"
+
+LICENSE="MIT"
+SLOT=$(get_version_component_range 1-2 ${PV})
+KEYWORDS="~amd64"
+IUSE="bzip2 doc +jit ncurses sandbox shadowstack sqlite ssl test +xml"
+
+RDEPEND="
+	~sys-libs/glibc-2.17
+	~sys-libs/zlib-1.2.8
+	~dev-libs/libffi-3.0.13
+	~dev-libs/expat-2.1.0
+	bzip2? ( ~app-arch/bzip2-1.0.6 )
+	ncurses? ( ~sys-libs/ncurses-5.9 )
+	sqlite? ( dev-db/sqlite:3 )
+	ssl? ( ~dev-libs/openssl-1.0.1e )
+	!dev-python/pypy:${SLOT}"
+DEPEND="test? ( ${RDEPEND} )"
+PDEPEND="app-admin/python-updater"
+
+# Supported variants
+REQUIRED_USE="bzip2 jit ncurses !sandbox shadowstack ssl"
+
+pkg_setup() {
+	use test && python-any-r1_pkg_setup
+}
+
+src_test() {
+	# Move necessary libs and tools.
+	mv "${WORKDIR}"/pypy-${PV}-src/{_pytest,py,pypy,pytest*,rpython} . || die
+
+	PYTHONDONTWRITEBYTECODE=1 \
+	./pypy-c ./pypy/test_all.py --pypy=./pypy-c lib-python || die
+}
+
+src_install() {
+	einfo "Installing PyPy ..."
+	insinto "/usr/$(get_libdir)/pypy${SLOT}"
+	doins -r include lib_pypy lib-python pypy-c
+	fperms a+x ${INSDESTTREE}/pypy-c
+	use jit && pax-mark m "${ED%/}${INSDESTTREE}/pypy-c"
+	dosym ../$(get_libdir)/pypy${SLOT}/pypy-c /usr/bin/pypy-c${SLOT}
+	dosym ../$(get_libdir)/pypy${SLOT}/include /usr/include/pypy${SLOT}
+	dodoc README.rst
+
+	if ! use sqlite; then
+		rm -r "${ED%/}${INSDESTTREE}"/lib-python/*2.7/sqlite3 || die
+		rm "${ED%/}${INSDESTTREE}"/lib_pypy/_sqlite3.py || die
+	fi
+
+	python_export pypy-c${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
+
+	local PYTHON=${ED%/}${INSDESTTREE}/pypy-c
+	local -x PYTHONPATH="${ED%/}${INSDESTTREE}/lib_pypy:${ED%/}${INSDESTTREE}/lib-python/2.7"
+
+	einfo "Generating caches and byte-compiling ..."
+
+	# Generate Grammar and PatternGrammar pickles.
+	"${PYTHON}" -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
+		|| die "Generation of Grammar and PatternGrammar pickles failed"
+
+	# Generate cffi cache
+	"${PYTHON}" -c "import _curses" || die "Failed to import _curses"
+	if use sqlite; then
+		"${PYTHON}" -c "import _sqlite3" || die "Failed to import _sqlite3"
+	fi
+
+	# compile the installed modules
+	python_optimize "${ED%/}${INSDESTTREE}"
+
+	# Install docs
+	use doc && dohtml -r "${WORKDIR}"/${P}-doc/.
+
+	echo "EPYTHON='${EPYTHON}'" > epython.py
+	python_domodule epython.py
+}

diff --git a/dev-python/pypy-binpackage/Manifest b/dev-python/pypy-binpackage/Manifest
new file mode 100644
index 0000000..51e4906
--- /dev/null
+++ b/dev-python/pypy-binpackage/Manifest
@@ -0,0 +1 @@
+DIST pypy-2.0.2-src.tar.bz2 14819848 SHA256 1991c90d6b98e2408b3790d4b57b71ec1c69346328b8321505ce8f6ab4544c3c SHA512 5b8b56194dff468dd249dea0014fadafb791eb69858ffae0b9c7638f087df277a84ddadc7d5b0fdb48a12ca8e6b70eb95cb5b7a5f56fe8fe3396820b814ecfd7 WHIRLPOOL bb1f71e0b2d3e145edcb1baa17b0a13c09f5229cf1b0532edbb3d0d5c87ef39543c0ef6b9dc7ce2778c4a3336d4a1580fce9cf960f82b72ddfed02e06d10d8af

diff --git a/dev-python/pypy-binpackage/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch b/dev-python/pypy-binpackage/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
new file mode 100644
index 0000000..b3d5235
--- /dev/null
+++ b/dev-python/pypy-binpackage/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
@@ -0,0 +1,11 @@
+--- lib-python/2.7/distutils/unixccompiler.py
++++ lib-python/2.7/distutils/unixccompiler.py
+@@ -297,7 +297,7 @@
+         # this time, there's no way to determine this information from
+         # the configuration data stored in the Python installation, so
+         # we use this hack.
+-        compiler = os.path.basename(sysconfig.get_config_var("CC"))
++        compiler = os.path.basename(self.compiler[0])
+         if sys.platform[:6] == "darwin":
+             # MacOSX's linker doesn't understand the -R flag at all
+             return "-L" + dir

diff --git a/dev-python/pypy-binpackage/files/1.9-scripts-location.patch b/dev-python/pypy-binpackage/files/1.9-scripts-location.patch
new file mode 100644
index 0000000..5f0190d
--- /dev/null
+++ b/dev-python/pypy-binpackage/files/1.9-scripts-location.patch
@@ -0,0 +1,11 @@
+--- pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py
++++ pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py
+@@ -87,7 +87,7 @@
+         'purelib': '$base/site-packages',
+         'platlib': '$base/site-packages',
+         'headers': '$base/include',
+-        'scripts': '$base/bin',
++        'scripts': '/usr/bin',
+         'data'   : '$base',
+         },
+     }

diff --git a/dev-python/pypy-binpackage/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch b/dev-python/pypy-binpackage/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch
new file mode 100644
index 0000000..db7db3b
--- /dev/null
+++ b/dev-python/pypy-binpackage/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch
@@ -0,0 +1,323 @@
+http://bugs.python.org/issue1222585
+
+--- lib-python/2.7/distutils/cygwinccompiler.py
++++ lib-python/2.7/distutils/cygwinccompiler.py
+@@ -132,9 +132,13 @@
+         self.set_executables(compiler='gcc -mcygwin -O -Wall',
+                              compiler_so='gcc -mcygwin -mdll -O -Wall',
+                              compiler_cxx='g++ -mcygwin -O -Wall',
++                             compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
+                              linker_exe='gcc -mcygwin',
+                              linker_so=('%s -mcygwin %s' %
+-                                        (self.linker_dll, shared_option)))
++                                        (self.linker_dll, shared_option)),
++                             linker_exe_cxx='g++ -mcygwin',
++                             linker_so_cxx=('%s -mcygwin %s' %
++                                            (self.linker_dll, shared_option)))
+ 
+         # cygwin and mingw32 need different sets of libraries
+         if self.gcc_version == "2.91.57":
+@@ -160,8 +164,12 @@
+                 raise CompileError, msg
+         else: # for other files use the C-compiler
+             try:
+-                self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+-                           extra_postargs)
++                if self.detect_language(src) == 'c++':
++                    self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++                               extra_postargs)
++                else:
++                    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++                               extra_postargs)
+             except DistutilsExecError, msg:
+                 raise CompileError, msg
+ 
+@@ -322,10 +330,15 @@
+         self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
+                              compiler_so='gcc -mno-cygwin -mdll -O -Wall',
+                              compiler_cxx='g++ -mno-cygwin -O -Wall',
++                             compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall',
+                              linker_exe='gcc -mno-cygwin',
+                              linker_so='%s -mno-cygwin %s %s'
+                                         % (self.linker_dll, shared_option,
+-                                           entry_point))
++                                           entry_point),
++                             linker_exe_cxx='g++ -mno-cygwin',
++                             linker_so_cxx='%s -mno-cygwin %s %s'
++                                            % (self.linker_dll, shared_option,
++                                               entry_point))
+         # Maybe we should also append -mthreads, but then the finished
+         # dlls need another dll (mingwm10.dll see Mingw32 docs)
+         # (-mthreads: Support thread-safe exception handling on `Mingw32')
+--- lib-python/2.7/distutils/emxccompiler.py
++++ lib-python/2.7/distutils/emxccompiler.py
+@@ -65,8 +65,12 @@
+         # XXX optimization, warnings etc. should be customizable.
+         self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+                              compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++                             compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++                             compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+                              linker_exe='gcc -Zomf -Zmt -Zcrtdll',
+-                             linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
++                             linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
++                             linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
++                             linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
+ 
+         # want the gcc library statically linked (so that we don't have
+         # to distribute a version dependent on the compiler we have)
+@@ -83,8 +87,12 @@
+                 raise CompileError, msg
+         else: # for other files use the C-compiler
+             try:
+-                self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+-                           extra_postargs)
++                if self.detect_language(src) == 'c++':
++                    self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++                               extra_postargs)
++                else:
++                    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++                               extra_postargs)
+             except DistutilsExecError, msg:
+                 raise CompileError, msg
+ 
+--- lib-python/2.7/distutils/sysconfig_cpython.py
++++ lib-python/2.7/distutils/sysconfig_cpython.py
+@@ -150,10 +150,12 @@
+     varies across Unices and is stored in Python's Makefile.
+     """
+     if compiler.compiler_type == "unix":
+-        (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
+-            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+-                            'CCSHARED', 'LDSHARED', 'SO', 'AR',
+-                            'ARFLAGS')
++        (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
++            get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++                            'SO', 'AR', 'ARFLAGS')
++
++        cflags = ''
++        cxxflags = ''
+ 
+         newcc = None
+         if 'CC' in os.environ:
+@@ -191,19 +193,27 @@
+             cxx = os.environ['CXX']
+         if 'LDSHARED' in os.environ:
+             ldshared = os.environ['LDSHARED']
++        if 'LDCXXSHARED' in os.environ:
++            ldcxxshared = os.environ['LDCXXSHARED']
+         if 'CPP' in os.environ:
+             cpp = os.environ['CPP']
+         else:
+             cpp = cc + " -E"           # not always
+         if 'LDFLAGS' in os.environ:
+             ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
+         if 'CFLAGS' in os.environ:
+-            cflags = opt + ' ' + os.environ['CFLAGS']
++            cflags = os.environ['CFLAGS']
+             ldshared = ldshared + ' ' + os.environ['CFLAGS']
++        if 'CXXFLAGS' in os.environ:
++            cxxflags = os.environ['CXXFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
+         if 'CPPFLAGS' in os.environ:
+             cpp = cpp + ' ' + os.environ['CPPFLAGS']
+             cflags = cflags + ' ' + os.environ['CPPFLAGS']
++            cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
+             ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
+         if 'AR' in os.environ:
+             ar = os.environ['AR']
+         if 'ARFLAGS' in os.environ:
+@@ -212,13 +222,17 @@
+             archiver = ar + ' ' + ar_flags
+ 
+         cc_cmd = cc + ' ' + cflags
++        cxx_cmd = cxx + ' ' + cxxflags
+         compiler.set_executables(
+             preprocessor=cpp,
+             compiler=cc_cmd,
+             compiler_so=cc_cmd + ' ' + ccshared,
+-            compiler_cxx=cxx,
++            compiler_cxx=cxx_cmd,
++            compiler_so_cxx=cxx_cmd + ' ' + ccshared,
+             linker_so=ldshared,
+             linker_exe=cc,
++            linker_so_cxx=ldcxxshared,
++            linker_exe_cxx=cxx,
+             archiver=archiver)
+ 
+         compiler.shared_lib_extension = so_ext
+@@ -530,7 +544,7 @@
+                 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                         # a number of derived variables. These need to be
+                         # patched up as well.
+-                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                        'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+                     flags = _config_vars[key]
+                     flags = re.sub('-arch\s+\w+\s', ' ', flags)
+                     flags = re.sub('-isysroot [^ \t]*', ' ', flags)
+@@ -549,7 +563,7 @@
+                     for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                         # a number of derived variables. These need to be
+                         # patched up as well.
+-                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                        'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+ 
+                         flags = _config_vars[key]
+                         flags = re.sub('-arch\s+\w+\s', ' ', flags)
+@@ -573,7 +587,7 @@
+                         for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                              # a number of derived variables. These need to be
+                              # patched up as well.
+-                            'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                            'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+ 
+                             flags = _config_vars[key]
+                             flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
+--- lib-python/2.7/distutils/sysconfig_pypy.py
++++ lib-python/2.7/distutils/sysconfig_pypy.py
+@@ -114,13 +114,56 @@
+     optional C speedup components.
+     """
+     if compiler.compiler_type == "unix":
+-        compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit'])
++        cc = ' '.join(compiler.compiler)
++        cxx = ' '.join(compiler.compiler_cxx)
++        ldshared = ' '.join(compiler.linker_so)
++        ldcxxshared = ' '.join(compiler.linker_so_cxx)
++
++        cflags = ''
++        cxxflags = ''
++        ccshared = '-fPIC'
++
++        if 'CC' in os.environ:
++            cc = os.environ['CC']
++        if 'CXX' in os.environ:
++            cxx = os.environ['CXX']
++        if 'LDSHARED' in os.environ:
++            ldshared = os.environ['LDSHARED']
++        if 'LDCXXSHARED' in os.environ:
++            ldcxxshared = os.environ['LDCXXSHARED']
++        if 'CPP' in os.environ:
++            cpp = os.environ['CPP']
++        else:
++            cpp = cc + " -E"           # not always
++        if 'LDFLAGS' in os.environ:
++            ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
++        if 'CFLAGS' in os.environ:
++            cflags = os.environ['CFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CFLAGS']
++        if 'CXXFLAGS' in os.environ:
++            cxxflags = os.environ['CXXFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
++        if 'CPPFLAGS' in os.environ:
++            cpp = cpp + ' ' + os.environ['CPPFLAGS']
++            cflags = cflags + ' ' + os.environ['CPPFLAGS']
++            cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
++
++        cc_cmd = cc + ' ' + cflags
++        cxx_cmd = cxx + ' ' + cxxflags
++        compiler.set_executables(
++            preprocessor=cpp,
++            compiler=cc_cmd,
++            compiler_so=cc_cmd + ' ' + ccshared,
++            compiler_cxx=cxx_cmd,
++            compiler_so_cxx=cxx_cmd + ' ' + ccshared,
++            linker_so=ldshared,
++            linker_exe=cc,
++            linker_so_cxx=ldcxxshared,
++            linker_exe_cxx=cxx)
+         compiler.shared_lib_extension = get_config_var('SO')
+-        if "CFLAGS" in os.environ:
+-            cflags = os.environ["CFLAGS"]
+-            compiler.compiler.append(cflags)
+-            compiler.compiler_so.append(cflags)
+-            compiler.linker_so.append(cflags)
+ 
+ 
+ from sysconfig_cpython import (
+--- lib-python/2.7/distutils/unixccompiler.py
++++ lib-python/2.7/distutils/unixccompiler.py
+@@ -114,14 +114,17 @@
+     # are pretty generic; they will probably have to be set by an outsider
+     # (eg. using information discovered by the sysconfig about building
+     # Python extensions).
+-    executables = {'preprocessor' : None,
+-                   'compiler'     : ["cc"],
+-                   'compiler_so'  : ["cc"],
+-                   'compiler_cxx' : ["cc"],
+-                   'linker_so'    : ["cc", "-shared"],
+-                   'linker_exe'   : ["cc"],
+-                   'archiver'     : ["ar", "-cr"],
+-                   'ranlib'       : None,
++    executables = {'preprocessor'    : None,
++                   'compiler'        : ["cc"],
++                   'compiler_so'     : ["cc"],
++                   'compiler_cxx'    : ["c++"],
++                   'compiler_so_cxx' : ["c++"],
++                   'linker_so'       : ["cc", "-shared"],
++                   'linker_exe'      : ["cc"],
++                   'linker_so_cxx'   : ["c++", "-shared"],
++                   'linker_exe_cxx'  : ["c++"],
++                   'archiver'        : ["ar", "-cr"],
++                   'ranlib'          : None,
+                   }
+ 
+     if sys.platform[:6] == "darwin":
+@@ -171,11 +174,18 @@
+ 
+     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+         compiler_so = self.compiler_so
++        compiler_so_cxx = self.compiler_so_cxx
+         if sys.platform == 'darwin':
+             compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs)
++            compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args +
++                                                     extra_postargs)
+         try:
+-            self.spawn(compiler_so + cc_args + [src, '-o', obj] +
+-                       extra_postargs)
++            if self.detect_language(src) == 'c++':
++                self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
++                           extra_postargs)
++            else:
++                self.spawn(compiler_so + cc_args + [src, '-o', obj] +
++                           extra_postargs)
+         except DistutilsExecError, msg:
+             raise CompileError, msg
+ 
+@@ -232,23 +242,16 @@
+                 ld_args.extend(extra_postargs)
+             self.mkpath(os.path.dirname(output_filename))
+             try:
+-                if target_desc == CCompiler.EXECUTABLE:
+-                    linker = self.linker_exe[:]
++                if target_lang == "c++":
++                    if target_desc == CCompiler.EXECUTABLE:
++                        linker = self.linker_exe_cxx[:]
++                    else:
++                        linker = self.linker_so_cxx[:]
+                 else:
+-                    linker = self.linker_so[:]
+-                if target_lang == "c++" and self.compiler_cxx:
+-                    # skip over environment variable settings if /usr/bin/env
+-                    # is used to set up the linker's environment.
+-                    # This is needed on OSX. Note: this assumes that the
+-                    # normal and C++ compiler have the same environment
+-                    # settings.
+-                    i = 0
+-                    if os.path.basename(linker[0]) == "env":
+-                        i = 1
+-                        while '=' in linker[i]:
+-                            i = i + 1
+-
+-                    linker[i] = self.compiler_cxx[i]
++                    if target_desc == CCompiler.EXECUTABLE:
++                        linker = self.linker_exe[:]
++                    else:
++                        linker = self.linker_so[:]
+ 
+                 if sys.platform == 'darwin':
+                     linker = _darwin_compiler_fixup(linker, ld_args)

diff --git a/dev-python/pypy-binpackage/metadata.xml b/dev-python/pypy-binpackage/metadata.xml
new file mode 100644
index 0000000..6fb4588
--- /dev/null
+++ b/dev-python/pypy-binpackage/metadata.xml
@@ -0,0 +1,13 @@
+<?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="sandbox">Enable sandboxing functionality</flag>
+		<flag name="shadowstack">Use a shadow stack for finding GC roots</flag>
+	</use>
+</pkgmetadata>

diff --git a/dev-python/pypy-binpackage/pypy-binpackage-2.0.2.ebuild b/dev-python/pypy-binpackage/pypy-binpackage-2.0.2.ebuild
new file mode 100644
index 0000000..de489b4
--- /dev/null
+++ b/dev-python/pypy-binpackage/pypy-binpackage-2.0.2.ebuild
@@ -0,0 +1,127 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pypy/pypy-2.0.2.ebuild,v 1.3 2013/06/18 10:41:29 idella4 Exp $
+
+EAPI=5
+
+# XXX: test other implementations
+PYTHON_COMPAT=( python2_7 pypy{1_8,1_9,2_0} )
+inherit check-reqs eutils flag-o-matic multilib multiprocessing pax-utils python-any-r1 toolchain-funcs versionator
+
+MY_P=pypy-${PV}
+
+DESCRIPTION="A fast, compliant alternative implementation of the Python language"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="mirror://bitbucket/pypy/pypy/downloads/${MY_P}-src.tar.bz2"
+
+LICENSE="MIT"
+SLOT=$(get_version_component_range 1-2 ${PV})
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="bzip2 doc +jit ncurses sandbox shadowstack ssl"
+
+DEPEND=">=sys-libs/zlib-1.1.3
+	virtual/libffi
+	virtual/libintl
+	dev-libs/expat
+	bzip2? ( app-arch/bzip2 )
+	ncurses? ( sys-libs/ncurses )
+	ssl? ( dev-libs/openssl )
+	app-arch/xz-utils
+	${PYTHON_DEPS}"
+
+S="${WORKDIR}/${MY_P}-src"
+
+pkg_pretend() {
+	CHECKREQS_MEMORY="2G"
+	use amd64 && CHECKREQS_MEMORY="4G"
+	check-reqs_pkg_pretend
+#	if [[ ${MERGE_TYPE} != binary && "$(gcc-version)" == "4.8" ]]; then
+#		die "PyPy does not build correctly with GCC 4.8"
+#	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+	python-any-r1_pkg_setup
+}
+
+src_prepare() {
+	epatch "${FILESDIR}/1.9-scripts-location.patch"
+	epatch "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
+	epatch "${FILESDIR}/2.0.2-distutils-fix_handling_of_executables_and_flags.patch"
+
+	epatch_user
+}
+
+src_compile() {
+	tc-export CC
+
+	local args=(
+		$(usex jit -Ojit -O2)
+		$(usex shadowstack --gcrootfinder=shadowstack '')
+		$(usex sandbox --sandbox '')
+
+		--thread
+		--make-jobs=$(makeopts_jobs)
+
+		pypy/goal/targetpypystandalone
+	)
+
+	# Avoid linking against libraries disabled by use flags
+	local opts=(
+		bzip2:bz2
+		ncurses:_minimal_curses
+		ssl:_ssl
+	)
+
+	local opt
+	for opt in "${opts[@]}"; do
+		local flag=${opt%:*}
+		local mod=${opt#*:}
+
+		args+=(
+			$(usex ${flag} --withmod --withoutmod)-${mod}
+		)
+	done
+
+	set -- "${PYTHON}" rpython/bin/rpython --batch "${args[@]}"
+	echo -e "\033[1m${@}\033[0m"
+	"${@}" || die "compile error"
+
+	use doc && emake -C pypy/doc/ html
+}
+
+src_install() {
+	local flags=( bzip2 jit ncurses sandbox shadowstack ssl )
+	local f suffix=''
+
+	for f in ${flags[@]}; do
+		use ${f} && suffix+="+${f}"
+	done
+
+	local BIN_P=pypy-bin-${PV}
+
+	einfo "Zipping PyPy ..."
+	mkdir ${BIN_P} || die
+	mv README.rst include lib_pypy lib-python pypy-c ${BIN_P}/ || die
+	chmod +x ${BIN_P}/pypy-c || die
+
+	tar -cf "${BIN_P}${suffix}.tar" ${BIN_P} || die
+	xz -vz9 "${BIN_P}${suffix}.tar" || die
+
+	if use doc; then
+		einfo "Zipping docs ..."
+		mv pypy/doc/_build/html/ ${BIN_P}-doc || die
+
+		tar -cf ${BIN_P}-doc.tar ${BIN_P}-doc || die
+		xz -vz9 ${BIN_P}-doc.tar || die
+	fi
+
+	insinto /tmp
+	doins *.tar.xz
+}
+
+pkg_postinst() {
+	mkdir -p "${ROOT%/}"/home/mgorny/pypy-bin || die
+	mv "${ROOT%/}"/tmp/${BIN_P}*.tar.xz "${ROOT%/}"/home/mgorny/pypy-bin || die
+}

diff --git a/dev-python/pypy/Manifest b/dev-python/pypy/Manifest
new file mode 100644
index 0000000..51e4906
--- /dev/null
+++ b/dev-python/pypy/Manifest
@@ -0,0 +1 @@
+DIST pypy-2.0.2-src.tar.bz2 14819848 SHA256 1991c90d6b98e2408b3790d4b57b71ec1c69346328b8321505ce8f6ab4544c3c SHA512 5b8b56194dff468dd249dea0014fadafb791eb69858ffae0b9c7638f087df277a84ddadc7d5b0fdb48a12ca8e6b70eb95cb5b7a5f56fe8fe3396820b814ecfd7 WHIRLPOOL bb1f71e0b2d3e145edcb1baa17b0a13c09f5229cf1b0532edbb3d0d5c87ef39543c0ef6b9dc7ce2778c4a3336d4a1580fce9cf960f82b72ddfed02e06d10d8af

diff --git a/dev-python/pypy/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch b/dev-python/pypy/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
new file mode 100644
index 0000000..b3d5235
--- /dev/null
+++ b/dev-python/pypy/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
@@ -0,0 +1,11 @@
+--- lib-python/2.7/distutils/unixccompiler.py
++++ lib-python/2.7/distutils/unixccompiler.py
+@@ -297,7 +297,7 @@
+         # this time, there's no way to determine this information from
+         # the configuration data stored in the Python installation, so
+         # we use this hack.
+-        compiler = os.path.basename(sysconfig.get_config_var("CC"))
++        compiler = os.path.basename(self.compiler[0])
+         if sys.platform[:6] == "darwin":
+             # MacOSX's linker doesn't understand the -R flag at all
+             return "-L" + dir

diff --git a/dev-python/pypy/files/1.9-scripts-location.patch b/dev-python/pypy/files/1.9-scripts-location.patch
new file mode 100644
index 0000000..5f0190d
--- /dev/null
+++ b/dev-python/pypy/files/1.9-scripts-location.patch
@@ -0,0 +1,11 @@
+--- pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py
++++ pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py
+@@ -87,7 +87,7 @@
+         'purelib': '$base/site-packages',
+         'platlib': '$base/site-packages',
+         'headers': '$base/include',
+-        'scripts': '$base/bin',
++        'scripts': '/usr/bin',
+         'data'   : '$base',
+         },
+     }

diff --git a/dev-python/pypy/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch b/dev-python/pypy/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch
new file mode 100644
index 0000000..db7db3b
--- /dev/null
+++ b/dev-python/pypy/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch
@@ -0,0 +1,323 @@
+http://bugs.python.org/issue1222585
+
+--- lib-python/2.7/distutils/cygwinccompiler.py
++++ lib-python/2.7/distutils/cygwinccompiler.py
+@@ -132,9 +132,13 @@
+         self.set_executables(compiler='gcc -mcygwin -O -Wall',
+                              compiler_so='gcc -mcygwin -mdll -O -Wall',
+                              compiler_cxx='g++ -mcygwin -O -Wall',
++                             compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
+                              linker_exe='gcc -mcygwin',
+                              linker_so=('%s -mcygwin %s' %
+-                                        (self.linker_dll, shared_option)))
++                                        (self.linker_dll, shared_option)),
++                             linker_exe_cxx='g++ -mcygwin',
++                             linker_so_cxx=('%s -mcygwin %s' %
++                                            (self.linker_dll, shared_option)))
+ 
+         # cygwin and mingw32 need different sets of libraries
+         if self.gcc_version == "2.91.57":
+@@ -160,8 +164,12 @@
+                 raise CompileError, msg
+         else: # for other files use the C-compiler
+             try:
+-                self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+-                           extra_postargs)
++                if self.detect_language(src) == 'c++':
++                    self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++                               extra_postargs)
++                else:
++                    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++                               extra_postargs)
+             except DistutilsExecError, msg:
+                 raise CompileError, msg
+ 
+@@ -322,10 +330,15 @@
+         self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
+                              compiler_so='gcc -mno-cygwin -mdll -O -Wall',
+                              compiler_cxx='g++ -mno-cygwin -O -Wall',
++                             compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall',
+                              linker_exe='gcc -mno-cygwin',
+                              linker_so='%s -mno-cygwin %s %s'
+                                         % (self.linker_dll, shared_option,
+-                                           entry_point))
++                                           entry_point),
++                             linker_exe_cxx='g++ -mno-cygwin',
++                             linker_so_cxx='%s -mno-cygwin %s %s'
++                                            % (self.linker_dll, shared_option,
++                                               entry_point))
+         # Maybe we should also append -mthreads, but then the finished
+         # dlls need another dll (mingwm10.dll see Mingw32 docs)
+         # (-mthreads: Support thread-safe exception handling on `Mingw32')
+--- lib-python/2.7/distutils/emxccompiler.py
++++ lib-python/2.7/distutils/emxccompiler.py
+@@ -65,8 +65,12 @@
+         # XXX optimization, warnings etc. should be customizable.
+         self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+                              compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++                             compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++                             compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+                              linker_exe='gcc -Zomf -Zmt -Zcrtdll',
+-                             linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
++                             linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
++                             linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
++                             linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
+ 
+         # want the gcc library statically linked (so that we don't have
+         # to distribute a version dependent on the compiler we have)
+@@ -83,8 +87,12 @@
+                 raise CompileError, msg
+         else: # for other files use the C-compiler
+             try:
+-                self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+-                           extra_postargs)
++                if self.detect_language(src) == 'c++':
++                    self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++                               extra_postargs)
++                else:
++                    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++                               extra_postargs)
+             except DistutilsExecError, msg:
+                 raise CompileError, msg
+ 
+--- lib-python/2.7/distutils/sysconfig_cpython.py
++++ lib-python/2.7/distutils/sysconfig_cpython.py
+@@ -150,10 +150,12 @@
+     varies across Unices and is stored in Python's Makefile.
+     """
+     if compiler.compiler_type == "unix":
+-        (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
+-            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+-                            'CCSHARED', 'LDSHARED', 'SO', 'AR',
+-                            'ARFLAGS')
++        (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
++            get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++                            'SO', 'AR', 'ARFLAGS')
++
++        cflags = ''
++        cxxflags = ''
+ 
+         newcc = None
+         if 'CC' in os.environ:
+@@ -191,19 +193,27 @@
+             cxx = os.environ['CXX']
+         if 'LDSHARED' in os.environ:
+             ldshared = os.environ['LDSHARED']
++        if 'LDCXXSHARED' in os.environ:
++            ldcxxshared = os.environ['LDCXXSHARED']
+         if 'CPP' in os.environ:
+             cpp = os.environ['CPP']
+         else:
+             cpp = cc + " -E"           # not always
+         if 'LDFLAGS' in os.environ:
+             ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
+         if 'CFLAGS' in os.environ:
+-            cflags = opt + ' ' + os.environ['CFLAGS']
++            cflags = os.environ['CFLAGS']
+             ldshared = ldshared + ' ' + os.environ['CFLAGS']
++        if 'CXXFLAGS' in os.environ:
++            cxxflags = os.environ['CXXFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
+         if 'CPPFLAGS' in os.environ:
+             cpp = cpp + ' ' + os.environ['CPPFLAGS']
+             cflags = cflags + ' ' + os.environ['CPPFLAGS']
++            cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
+             ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
+         if 'AR' in os.environ:
+             ar = os.environ['AR']
+         if 'ARFLAGS' in os.environ:
+@@ -212,13 +222,17 @@
+             archiver = ar + ' ' + ar_flags
+ 
+         cc_cmd = cc + ' ' + cflags
++        cxx_cmd = cxx + ' ' + cxxflags
+         compiler.set_executables(
+             preprocessor=cpp,
+             compiler=cc_cmd,
+             compiler_so=cc_cmd + ' ' + ccshared,
+-            compiler_cxx=cxx,
++            compiler_cxx=cxx_cmd,
++            compiler_so_cxx=cxx_cmd + ' ' + ccshared,
+             linker_so=ldshared,
+             linker_exe=cc,
++            linker_so_cxx=ldcxxshared,
++            linker_exe_cxx=cxx,
+             archiver=archiver)
+ 
+         compiler.shared_lib_extension = so_ext
+@@ -530,7 +544,7 @@
+                 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                         # a number of derived variables. These need to be
+                         # patched up as well.
+-                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                        'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+                     flags = _config_vars[key]
+                     flags = re.sub('-arch\s+\w+\s', ' ', flags)
+                     flags = re.sub('-isysroot [^ \t]*', ' ', flags)
+@@ -549,7 +563,7 @@
+                     for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                         # a number of derived variables. These need to be
+                         # patched up as well.
+-                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                        'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+ 
+                         flags = _config_vars[key]
+                         flags = re.sub('-arch\s+\w+\s', ' ', flags)
+@@ -573,7 +587,7 @@
+                         for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                              # a number of derived variables. These need to be
+                              # patched up as well.
+-                            'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                            'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+ 
+                             flags = _config_vars[key]
+                             flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
+--- lib-python/2.7/distutils/sysconfig_pypy.py
++++ lib-python/2.7/distutils/sysconfig_pypy.py
+@@ -114,13 +114,56 @@
+     optional C speedup components.
+     """
+     if compiler.compiler_type == "unix":
+-        compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit'])
++        cc = ' '.join(compiler.compiler)
++        cxx = ' '.join(compiler.compiler_cxx)
++        ldshared = ' '.join(compiler.linker_so)
++        ldcxxshared = ' '.join(compiler.linker_so_cxx)
++
++        cflags = ''
++        cxxflags = ''
++        ccshared = '-fPIC'
++
++        if 'CC' in os.environ:
++            cc = os.environ['CC']
++        if 'CXX' in os.environ:
++            cxx = os.environ['CXX']
++        if 'LDSHARED' in os.environ:
++            ldshared = os.environ['LDSHARED']
++        if 'LDCXXSHARED' in os.environ:
++            ldcxxshared = os.environ['LDCXXSHARED']
++        if 'CPP' in os.environ:
++            cpp = os.environ['CPP']
++        else:
++            cpp = cc + " -E"           # not always
++        if 'LDFLAGS' in os.environ:
++            ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
++        if 'CFLAGS' in os.environ:
++            cflags = os.environ['CFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CFLAGS']
++        if 'CXXFLAGS' in os.environ:
++            cxxflags = os.environ['CXXFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
++        if 'CPPFLAGS' in os.environ:
++            cpp = cpp + ' ' + os.environ['CPPFLAGS']
++            cflags = cflags + ' ' + os.environ['CPPFLAGS']
++            cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
++
++        cc_cmd = cc + ' ' + cflags
++        cxx_cmd = cxx + ' ' + cxxflags
++        compiler.set_executables(
++            preprocessor=cpp,
++            compiler=cc_cmd,
++            compiler_so=cc_cmd + ' ' + ccshared,
++            compiler_cxx=cxx_cmd,
++            compiler_so_cxx=cxx_cmd + ' ' + ccshared,
++            linker_so=ldshared,
++            linker_exe=cc,
++            linker_so_cxx=ldcxxshared,
++            linker_exe_cxx=cxx)
+         compiler.shared_lib_extension = get_config_var('SO')
+-        if "CFLAGS" in os.environ:
+-            cflags = os.environ["CFLAGS"]
+-            compiler.compiler.append(cflags)
+-            compiler.compiler_so.append(cflags)
+-            compiler.linker_so.append(cflags)
+ 
+ 
+ from sysconfig_cpython import (
+--- lib-python/2.7/distutils/unixccompiler.py
++++ lib-python/2.7/distutils/unixccompiler.py
+@@ -114,14 +114,17 @@
+     # are pretty generic; they will probably have to be set by an outsider
+     # (eg. using information discovered by the sysconfig about building
+     # Python extensions).
+-    executables = {'preprocessor' : None,
+-                   'compiler'     : ["cc"],
+-                   'compiler_so'  : ["cc"],
+-                   'compiler_cxx' : ["cc"],
+-                   'linker_so'    : ["cc", "-shared"],
+-                   'linker_exe'   : ["cc"],
+-                   'archiver'     : ["ar", "-cr"],
+-                   'ranlib'       : None,
++    executables = {'preprocessor'    : None,
++                   'compiler'        : ["cc"],
++                   'compiler_so'     : ["cc"],
++                   'compiler_cxx'    : ["c++"],
++                   'compiler_so_cxx' : ["c++"],
++                   'linker_so'       : ["cc", "-shared"],
++                   'linker_exe'      : ["cc"],
++                   'linker_so_cxx'   : ["c++", "-shared"],
++                   'linker_exe_cxx'  : ["c++"],
++                   'archiver'        : ["ar", "-cr"],
++                   'ranlib'          : None,
+                   }
+ 
+     if sys.platform[:6] == "darwin":
+@@ -171,11 +174,18 @@
+ 
+     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+         compiler_so = self.compiler_so
++        compiler_so_cxx = self.compiler_so_cxx
+         if sys.platform == 'darwin':
+             compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs)
++            compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args +
++                                                     extra_postargs)
+         try:
+-            self.spawn(compiler_so + cc_args + [src, '-o', obj] +
+-                       extra_postargs)
++            if self.detect_language(src) == 'c++':
++                self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
++                           extra_postargs)
++            else:
++                self.spawn(compiler_so + cc_args + [src, '-o', obj] +
++                           extra_postargs)
+         except DistutilsExecError, msg:
+             raise CompileError, msg
+ 
+@@ -232,23 +242,16 @@
+                 ld_args.extend(extra_postargs)
+             self.mkpath(os.path.dirname(output_filename))
+             try:
+-                if target_desc == CCompiler.EXECUTABLE:
+-                    linker = self.linker_exe[:]
++                if target_lang == "c++":
++                    if target_desc == CCompiler.EXECUTABLE:
++                        linker = self.linker_exe_cxx[:]
++                    else:
++                        linker = self.linker_so_cxx[:]
+                 else:
+-                    linker = self.linker_so[:]
+-                if target_lang == "c++" and self.compiler_cxx:
+-                    # skip over environment variable settings if /usr/bin/env
+-                    # is used to set up the linker's environment.
+-                    # This is needed on OSX. Note: this assumes that the
+-                    # normal and C++ compiler have the same environment
+-                    # settings.
+-                    i = 0
+-                    if os.path.basename(linker[0]) == "env":
+-                        i = 1
+-                        while '=' in linker[i]:
+-                            i = i + 1
+-
+-                    linker[i] = self.compiler_cxx[i]
++                    if target_desc == CCompiler.EXECUTABLE:
++                        linker = self.linker_exe[:]
++                    else:
++                        linker = self.linker_so[:]
+ 
+                 if sys.platform == 'darwin':
+                     linker = _darwin_compiler_fixup(linker, ld_args)

diff --git a/dev-python/pypy/metadata.xml b/dev-python/pypy/metadata.xml
new file mode 100644
index 0000000..742b70a
--- /dev/null
+++ b/dev-python/pypy/metadata.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+  <herd>python</herd>
+  <maintainer>
+    <email>nirbheek@gentoo.org</email>
+  </maintainer>
+  <use>
+    <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-python/pypy/pypy-2.0.2.ebuild b/dev-python/pypy/pypy-2.0.2.ebuild
new file mode 100644
index 0000000..56f1982
--- /dev/null
+++ b/dev-python/pypy/pypy-2.0.2.ebuild
@@ -0,0 +1,139 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-python/pypy/pypy-2.0.2.ebuild,v 1.3 2013/06/18 10:41:29 idella4 Exp $
+
+EAPI=5
+
+# XXX: test other implementations
+PYTHON_COMPAT=( python2_7 pypy{1_8,1_9,2_0} )
+inherit check-reqs eutils flag-o-matic multilib multiprocessing pax-utils python-any-r1 toolchain-funcs versionator
+
+DESCRIPTION="A fast, compliant alternative implementation of the Python language"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="mirror://bitbucket/pypy/pypy/downloads/${P}-src.tar.bz2"
+
+LICENSE="MIT"
+SLOT=$(get_version_component_range 1-2 ${PV})
+KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
+IUSE="bzip2 doc +jit ncurses sandbox shadowstack sqlite ssl"
+
+RDEPEND=">=sys-libs/zlib-1.1.3
+	virtual/libffi
+	virtual/libintl
+	dev-libs/expat
+	bzip2? ( app-arch/bzip2 )
+	ncurses? ( sys-libs/ncurses )
+	sqlite? ( dev-db/sqlite:3 )
+	ssl? ( dev-libs/openssl )"
+DEPEND="${RDEPEND}
+	${PYTHON_DEPS}"
+PDEPEND="app-admin/python-updater"
+
+S="${WORKDIR}/${P}-src"
+
+pkg_pretend() {
+	CHECKREQS_MEMORY="2G"
+	use amd64 && CHECKREQS_MEMORY="4G"
+	check-reqs_pkg_pretend
+#	if [[ ${MERGE_TYPE} != binary && "$(gcc-version)" == "4.8" ]]; then
+#		die "PyPy does not build correctly with GCC 4.8"
+#	fi
+}
+
+pkg_setup() {
+	pkg_pretend
+	python-any-r1_pkg_setup
+}
+
+src_prepare() {
+	epatch "${FILESDIR}/1.9-scripts-location.patch"
+	epatch "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
+	epatch "${FILESDIR}/2.0.2-distutils-fix_handling_of_executables_and_flags.patch"
+
+	epatch_user
+}
+
+src_compile() {
+	tc-export CC
+
+	local args=(
+		$(usex jit -Ojit -O2)
+		$(usex shadowstack --gcrootfinder=shadowstack '')
+		$(usex sandbox --sandbox '')
+
+		--thread
+		--make-jobs=$(makeopts_jobs)
+
+		pypy/goal/targetpypystandalone
+	)
+
+	# Avoid linking against libraries disabled by use flags
+	local opts=(
+		bzip2:bz2
+		ncurses:_minimal_curses
+		ssl:_ssl
+	)
+
+	local opt
+	for opt in "${opts[@]}"; do
+		local flag=${opt%:*}
+		local mod=${opt#*:}
+
+		args+=(
+			$(usex ${flag} --withmod --withoutmod)-${mod}
+		)
+	done
+
+	set -- "${PYTHON}" rpython/bin/rpython --batch "${args[@]}"
+	echo -e "\033[1m${@}\033[0m"
+	"${@}" || die "compile error"
+
+	use doc && emake -C ${PN}/doc/ html
+}
+
+src_test() {
+	PYTHONDONTWRITEBYTECODE=1 \
+	./pypy-c ./pypy/test_all.py --pypy=./pypy-c lib-python || die
+}
+
+src_install() {
+	einfo "Installing PyPy ..."
+	insinto "/usr/$(get_libdir)/pypy${SLOT}"
+	doins -r include lib_pypy lib-python pypy-c
+	fperms a+x ${INSDESTTREE}/pypy-c
+	use jit && pax-mark m "${ED%/}${INSDESTTREE}/pypy-c"
+	dosym ../$(get_libdir)/pypy${SLOT}/pypy-c /usr/bin/pypy-c${SLOT}
+	dosym ../$(get_libdir)/pypy${SLOT}/include /usr/include/pypy${SLOT}
+	dodoc README.rst
+
+	if ! use sqlite; then
+		rm -r "${ED%/}${INSDESTTREE}"/lib-python/*2.7/sqlite3 || die
+		rm "${ED%/}${INSDESTTREE}"/lib_pypy/_sqlite3.py || die
+	fi
+
+	python_export pypy-c${SLOT} EPYTHON PYTHON PYTHON_SITEDIR
+
+	local PYTHON=${ED%/}${INSDESTTREE}/pypy-c
+	local -x PYTHONPATH="${ED%/}${INSDESTTREE}/lib_pypy:${ED%/}${INSDESTTREE}/lib-python/2.7"
+
+	einfo "Generating caches and byte-compiling ..."
+
+	# Generate Grammar and PatternGrammar pickles.
+	"${PYTHON}" -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
+		|| die "Generation of Grammar and PatternGrammar pickles failed"
+
+	# Generate cffi cache
+	"${PYTHON}" -c "import _curses" || die "Failed to import _curses"
+	if use sqlite; then
+		"${PYTHON}" -c "import _sqlite3" || die "Failed to import _sqlite3"
+	fi
+
+	# compile the installed modules
+	python_optimize "${ED%/}${INSDESTTREE}"
+
+	# Install docs
+	use doc && dohtml -r ${PN}/doc/_build/html/
+
+	echo "EPYTHON='${EPYTHON}'" > epython.py
+	python_domodule epython.py
+}


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [gentoo-commits] dev/mgorny:master commit in: dev-python/pypy-bin/, dev-python/pypy/, dev-python/pypy-binpackage/, ...
@ 2013-07-21 11:16 Michał Górny
  0 siblings, 0 replies; 2+ messages in thread
From: Michał Górny @ 2013-07-21 11:16 UTC (permalink / raw
  To: gentoo-commits

commit:     29c2376d84e331b9d1922246baf454c6db6c40bc
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jul 21 08:30:53 2013 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Jul 21 08:30:53 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=dev/mgorny.git;a=commit;h=29c2376d

Reuse pypy source package in pypy-bin.

This reduces the size of binpackages since the only changing file is
the 'pypy-c' executable.

---
 dev-python/pypy-bin/Manifest                       |   2 +
 ....UnixCCompiler.runtime_library_dir_option.patch |  11 +
 .../pypy-bin/files/1.9-scripts-location.patch      |  11 +
 ...ils-fix_handling_of_executables_and_flags.patch | 323 +++++++++++++++++++++
 dev-python/pypy-bin/pypy-bin-2.0.2.ebuild          |  41 ++-
 .../pypy-binpackage/pypy-binpackage-2.0.2.ebuild   |   8 +-
 dev-python/pypy/pypy-2.0.2.ebuild                  |   5 +-
 7 files changed, 384 insertions(+), 17 deletions(-)

diff --git a/dev-python/pypy-bin/Manifest b/dev-python/pypy-bin/Manifest
index 606e981..27d0715 100644
--- a/dev-python/pypy-bin/Manifest
+++ b/dev-python/pypy-bin/Manifest
@@ -1,3 +1,5 @@
 DIST pypy-2.0.2-src.tar.bz2 14819848 SHA256 1991c90d6b98e2408b3790d4b57b71ec1c69346328b8321505ce8f6ab4544c3c SHA512 5b8b56194dff468dd249dea0014fadafb791eb69858ffae0b9c7638f087df277a84ddadc7d5b0fdb48a12ca8e6b70eb95cb5b7a5f56fe8fe3396820b814ecfd7 WHIRLPOOL bb1f71e0b2d3e145edcb1baa17b0a13c09f5229cf1b0532edbb3d0d5c87ef39543c0ef6b9dc7ce2778c4a3336d4a1580fce9cf960f82b72ddfed02e06d10d8af
 DIST pypy-bin-2.0.2+bzip2+jit+ncurses+shadowstack+ssl.tar.xz 15089652 SHA256 8e0faf6cb87311b267ef05728da335483892f5454e0ecb0044350bc02e86ba9e SHA512 594b665305e3b4727b6229e4173179836fe70c12a217740ae6e34fa9c960875496492ea60791b879a88e47b3f9ae9887f5671d14bd8396ca3691856408658afd WHIRLPOOL d9a052843cf75beca10e16ba011f96f440f8f0f63eabf82320e0a45b2ca04d71a6fe07f14f67ff4388af709b8a47ee1176b4311bcbe956b5d4bc297673e657d3
+DIST pypy-bin-2.0.2+bzip2+jit+ncurses+ssl.tar.xz 16714288 SHA256 e9f49d213a8872ae9f8797a079e35ba4f3bb1c2e54bca8bab65eea15d5067382 SHA512 95970c568fa24a1c9b183b629a2f94548053d2e90a8f47f890bb65f14ce679945760e8f4e05b03b2911b496cc98f03c1061cdb9a19b85a095f3f5146ce1fdceb WHIRLPOOL c5a0f92c093ea50a2a8b71fcb0697ddd8ef7b4a8ef5cc90f6b46dbc9cd205cd4e1fea4d6660cc4e4488284193402220c8105a36bb5f15bfe7f8f406a53335212
+DIST pypy-bin-2.0.2+bzip2+ncurses+ssl.tar.xz 11306824 SHA256 76f6458a00c22613e2f5a0f5f69728ad69762ce64a47231628a50967f9350b5c SHA512 e2257c1e7a03d468b6e238e17b1cd9578aa6edabb531559120f229475d69be22958badad60f50371ade9aeb67d10990afa6ab338da0f4d7c360f650a306b4a22 WHIRLPOOL d52c15cdf700c9f4c28110c43fcff3cb2e05fe239531bdd00068c5e567fad0b6a56f36694149eafa8e814dec938fb0c9b4336a200fc85285cb6168cca11cdf97
 DIST pypy-bin-2.0.2-doc.tar.xz 1160968 SHA256 65a5859e230d45c363ead08381951b202c15a0669feb0d54ff90c0d683e2ec34 SHA512 20d651f9ba1176314e5c63dea9c992abf74fba211bd1a2ed41a0a0f9c879fd1e126e56407cd07a400e544ee9e9032b229b189741c6344b6e90757d871cd9bb94 WHIRLPOOL 0673deba43481abbb6d138b64b6fa9eef22871088d5c3d9aa64aa06ae829772ebd5874877e00fe8422c5503dd3016e7308b85ecfffc3b5bcec4bef0e1ef118b9

diff --git a/dev-python/pypy-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch b/dev-python/pypy-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
new file mode 100644
index 0000000..b3d5235
--- /dev/null
+++ b/dev-python/pypy-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
@@ -0,0 +1,11 @@
+--- lib-python/2.7/distutils/unixccompiler.py
++++ lib-python/2.7/distutils/unixccompiler.py
+@@ -297,7 +297,7 @@
+         # this time, there's no way to determine this information from
+         # the configuration data stored in the Python installation, so
+         # we use this hack.
+-        compiler = os.path.basename(sysconfig.get_config_var("CC"))
++        compiler = os.path.basename(self.compiler[0])
+         if sys.platform[:6] == "darwin":
+             # MacOSX's linker doesn't understand the -R flag at all
+             return "-L" + dir

diff --git a/dev-python/pypy-bin/files/1.9-scripts-location.patch b/dev-python/pypy-bin/files/1.9-scripts-location.patch
new file mode 100644
index 0000000..5f0190d
--- /dev/null
+++ b/dev-python/pypy-bin/files/1.9-scripts-location.patch
@@ -0,0 +1,11 @@
+--- pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py
++++ pypy-pypy-release-1.7/lib-python/2.7/distutils/command/install.py
+@@ -87,7 +87,7 @@
+         'purelib': '$base/site-packages',
+         'platlib': '$base/site-packages',
+         'headers': '$base/include',
+-        'scripts': '$base/bin',
++        'scripts': '/usr/bin',
+         'data'   : '$base',
+         },
+     }

diff --git a/dev-python/pypy-bin/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch b/dev-python/pypy-bin/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch
new file mode 100644
index 0000000..db7db3b
--- /dev/null
+++ b/dev-python/pypy-bin/files/2.0.2-distutils-fix_handling_of_executables_and_flags.patch
@@ -0,0 +1,323 @@
+http://bugs.python.org/issue1222585
+
+--- lib-python/2.7/distutils/cygwinccompiler.py
++++ lib-python/2.7/distutils/cygwinccompiler.py
+@@ -132,9 +132,13 @@
+         self.set_executables(compiler='gcc -mcygwin -O -Wall',
+                              compiler_so='gcc -mcygwin -mdll -O -Wall',
+                              compiler_cxx='g++ -mcygwin -O -Wall',
++                             compiler_so_cxx='g++ -mcygwin -mdll -O -Wall',
+                              linker_exe='gcc -mcygwin',
+                              linker_so=('%s -mcygwin %s' %
+-                                        (self.linker_dll, shared_option)))
++                                        (self.linker_dll, shared_option)),
++                             linker_exe_cxx='g++ -mcygwin',
++                             linker_so_cxx=('%s -mcygwin %s' %
++                                            (self.linker_dll, shared_option)))
+ 
+         # cygwin and mingw32 need different sets of libraries
+         if self.gcc_version == "2.91.57":
+@@ -160,8 +164,12 @@
+                 raise CompileError, msg
+         else: # for other files use the C-compiler
+             try:
+-                self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+-                           extra_postargs)
++                if self.detect_language(src) == 'c++':
++                    self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++                               extra_postargs)
++                else:
++                    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++                               extra_postargs)
+             except DistutilsExecError, msg:
+                 raise CompileError, msg
+ 
+@@ -322,10 +330,15 @@
+         self.set_executables(compiler='gcc -mno-cygwin -O -Wall',
+                              compiler_so='gcc -mno-cygwin -mdll -O -Wall',
+                              compiler_cxx='g++ -mno-cygwin -O -Wall',
++                             compiler_so_cxx='g++ -mno-cygwin -mdll -O -Wall',
+                              linker_exe='gcc -mno-cygwin',
+                              linker_so='%s -mno-cygwin %s %s'
+                                         % (self.linker_dll, shared_option,
+-                                           entry_point))
++                                           entry_point),
++                             linker_exe_cxx='g++ -mno-cygwin',
++                             linker_so_cxx='%s -mno-cygwin %s %s'
++                                            % (self.linker_dll, shared_option,
++                                               entry_point))
+         # Maybe we should also append -mthreads, but then the finished
+         # dlls need another dll (mingwm10.dll see Mingw32 docs)
+         # (-mthreads: Support thread-safe exception handling on `Mingw32')
+--- lib-python/2.7/distutils/emxccompiler.py
++++ lib-python/2.7/distutils/emxccompiler.py
+@@ -65,8 +65,12 @@
+         # XXX optimization, warnings etc. should be customizable.
+         self.set_executables(compiler='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+                              compiler_so='gcc -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++                             compiler_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
++                             compiler_so_cxx='g++ -Zomf -Zmt -O3 -fomit-frame-pointer -mprobe -Wall',
+                              linker_exe='gcc -Zomf -Zmt -Zcrtdll',
+-                             linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll')
++                             linker_so='gcc -Zomf -Zmt -Zcrtdll -Zdll',
++                             linker_exe_cxx='g++ -Zomf -Zmt -Zcrtdll',
++                             linker_so_cxx='g++ -Zomf -Zmt -Zcrtdll -Zdll')
+ 
+         # want the gcc library statically linked (so that we don't have
+         # to distribute a version dependent on the compiler we have)
+@@ -83,8 +87,12 @@
+                 raise CompileError, msg
+         else: # for other files use the C-compiler
+             try:
+-                self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
+-                           extra_postargs)
++                if self.detect_language(src) == 'c++':
++                    self.spawn(self.compiler_so_cxx + cc_args + [src, '-o', obj] +
++                               extra_postargs)
++                else:
++                    self.spawn(self.compiler_so + cc_args + [src, '-o', obj] +
++                               extra_postargs)
+             except DistutilsExecError, msg:
+                 raise CompileError, msg
+ 
+--- lib-python/2.7/distutils/sysconfig_cpython.py
++++ lib-python/2.7/distutils/sysconfig_cpython.py
+@@ -150,10 +150,12 @@
+     varies across Unices and is stored in Python's Makefile.
+     """
+     if compiler.compiler_type == "unix":
+-        (cc, cxx, opt, cflags, ccshared, ldshared, so_ext, ar, ar_flags) = \
+-            get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+-                            'CCSHARED', 'LDSHARED', 'SO', 'AR',
+-                            'ARFLAGS')
++        (cc, cxx, ccshared, ldshared, ldcxxshared, so_ext, ar, ar_flags) = \
++            get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++                            'SO', 'AR', 'ARFLAGS')
++
++        cflags = ''
++        cxxflags = ''
+ 
+         newcc = None
+         if 'CC' in os.environ:
+@@ -191,19 +193,27 @@
+             cxx = os.environ['CXX']
+         if 'LDSHARED' in os.environ:
+             ldshared = os.environ['LDSHARED']
++        if 'LDCXXSHARED' in os.environ:
++            ldcxxshared = os.environ['LDCXXSHARED']
+         if 'CPP' in os.environ:
+             cpp = os.environ['CPP']
+         else:
+             cpp = cc + " -E"           # not always
+         if 'LDFLAGS' in os.environ:
+             ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
+         if 'CFLAGS' in os.environ:
+-            cflags = opt + ' ' + os.environ['CFLAGS']
++            cflags = os.environ['CFLAGS']
+             ldshared = ldshared + ' ' + os.environ['CFLAGS']
++        if 'CXXFLAGS' in os.environ:
++            cxxflags = os.environ['CXXFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
+         if 'CPPFLAGS' in os.environ:
+             cpp = cpp + ' ' + os.environ['CPPFLAGS']
+             cflags = cflags + ' ' + os.environ['CPPFLAGS']
++            cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
+             ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
+         if 'AR' in os.environ:
+             ar = os.environ['AR']
+         if 'ARFLAGS' in os.environ:
+@@ -212,13 +222,17 @@
+             archiver = ar + ' ' + ar_flags
+ 
+         cc_cmd = cc + ' ' + cflags
++        cxx_cmd = cxx + ' ' + cxxflags
+         compiler.set_executables(
+             preprocessor=cpp,
+             compiler=cc_cmd,
+             compiler_so=cc_cmd + ' ' + ccshared,
+-            compiler_cxx=cxx,
++            compiler_cxx=cxx_cmd,
++            compiler_so_cxx=cxx_cmd + ' ' + ccshared,
+             linker_so=ldshared,
+             linker_exe=cc,
++            linker_so_cxx=ldcxxshared,
++            linker_exe_cxx=cxx,
+             archiver=archiver)
+ 
+         compiler.shared_lib_extension = so_ext
+@@ -530,7 +544,7 @@
+                 for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                         # a number of derived variables. These need to be
+                         # patched up as well.
+-                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                        'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+                     flags = _config_vars[key]
+                     flags = re.sub('-arch\s+\w+\s', ' ', flags)
+                     flags = re.sub('-isysroot [^ \t]*', ' ', flags)
+@@ -549,7 +563,7 @@
+                     for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                         # a number of derived variables. These need to be
+                         # patched up as well.
+-                        'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                        'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+ 
+                         flags = _config_vars[key]
+                         flags = re.sub('-arch\s+\w+\s', ' ', flags)
+@@ -573,7 +587,7 @@
+                         for key in ('LDFLAGS', 'BASECFLAGS', 'LDSHARED',
+                              # a number of derived variables. These need to be
+                              # patched up as well.
+-                            'CFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
++                            'CFLAGS', 'CXXFLAGS', 'PY_CFLAGS', 'BLDSHARED'):
+ 
+                             flags = _config_vars[key]
+                             flags = re.sub('-isysroot\s+\S+(\s|$)', ' ', flags)
+--- lib-python/2.7/distutils/sysconfig_pypy.py
++++ lib-python/2.7/distutils/sysconfig_pypy.py
+@@ -114,13 +114,56 @@
+     optional C speedup components.
+     """
+     if compiler.compiler_type == "unix":
+-        compiler.compiler_so.extend(['-O2', '-fPIC', '-Wimplicit'])
++        cc = ' '.join(compiler.compiler)
++        cxx = ' '.join(compiler.compiler_cxx)
++        ldshared = ' '.join(compiler.linker_so)
++        ldcxxshared = ' '.join(compiler.linker_so_cxx)
++
++        cflags = ''
++        cxxflags = ''
++        ccshared = '-fPIC'
++
++        if 'CC' in os.environ:
++            cc = os.environ['CC']
++        if 'CXX' in os.environ:
++            cxx = os.environ['CXX']
++        if 'LDSHARED' in os.environ:
++            ldshared = os.environ['LDSHARED']
++        if 'LDCXXSHARED' in os.environ:
++            ldcxxshared = os.environ['LDCXXSHARED']
++        if 'CPP' in os.environ:
++            cpp = os.environ['CPP']
++        else:
++            cpp = cc + " -E"           # not always
++        if 'LDFLAGS' in os.environ:
++            ldshared = ldshared + ' ' + os.environ['LDFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['LDFLAGS']
++        if 'CFLAGS' in os.environ:
++            cflags = os.environ['CFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CFLAGS']
++        if 'CXXFLAGS' in os.environ:
++            cxxflags = os.environ['CXXFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CXXFLAGS']
++        if 'CPPFLAGS' in os.environ:
++            cpp = cpp + ' ' + os.environ['CPPFLAGS']
++            cflags = cflags + ' ' + os.environ['CPPFLAGS']
++            cxxflags = cxxflags + ' ' + os.environ['CPPFLAGS']
++            ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
++            ldcxxshared = ldcxxshared + ' ' + os.environ['CPPFLAGS']
++
++        cc_cmd = cc + ' ' + cflags
++        cxx_cmd = cxx + ' ' + cxxflags
++        compiler.set_executables(
++            preprocessor=cpp,
++            compiler=cc_cmd,
++            compiler_so=cc_cmd + ' ' + ccshared,
++            compiler_cxx=cxx_cmd,
++            compiler_so_cxx=cxx_cmd + ' ' + ccshared,
++            linker_so=ldshared,
++            linker_exe=cc,
++            linker_so_cxx=ldcxxshared,
++            linker_exe_cxx=cxx)
+         compiler.shared_lib_extension = get_config_var('SO')
+-        if "CFLAGS" in os.environ:
+-            cflags = os.environ["CFLAGS"]
+-            compiler.compiler.append(cflags)
+-            compiler.compiler_so.append(cflags)
+-            compiler.linker_so.append(cflags)
+ 
+ 
+ from sysconfig_cpython import (
+--- lib-python/2.7/distutils/unixccompiler.py
++++ lib-python/2.7/distutils/unixccompiler.py
+@@ -114,14 +114,17 @@
+     # are pretty generic; they will probably have to be set by an outsider
+     # (eg. using information discovered by the sysconfig about building
+     # Python extensions).
+-    executables = {'preprocessor' : None,
+-                   'compiler'     : ["cc"],
+-                   'compiler_so'  : ["cc"],
+-                   'compiler_cxx' : ["cc"],
+-                   'linker_so'    : ["cc", "-shared"],
+-                   'linker_exe'   : ["cc"],
+-                   'archiver'     : ["ar", "-cr"],
+-                   'ranlib'       : None,
++    executables = {'preprocessor'    : None,
++                   'compiler'        : ["cc"],
++                   'compiler_so'     : ["cc"],
++                   'compiler_cxx'    : ["c++"],
++                   'compiler_so_cxx' : ["c++"],
++                   'linker_so'       : ["cc", "-shared"],
++                   'linker_exe'      : ["cc"],
++                   'linker_so_cxx'   : ["c++", "-shared"],
++                   'linker_exe_cxx'  : ["c++"],
++                   'archiver'        : ["ar", "-cr"],
++                   'ranlib'          : None,
+                   }
+ 
+     if sys.platform[:6] == "darwin":
+@@ -171,11 +174,18 @@
+ 
+     def _compile(self, obj, src, ext, cc_args, extra_postargs, pp_opts):
+         compiler_so = self.compiler_so
++        compiler_so_cxx = self.compiler_so_cxx
+         if sys.platform == 'darwin':
+             compiler_so = _darwin_compiler_fixup(compiler_so, cc_args + extra_postargs)
++            compiler_so_cxx = _darwin_compiler_fixup(compiler_so_cxx, cc_args +
++                                                     extra_postargs)
+         try:
+-            self.spawn(compiler_so + cc_args + [src, '-o', obj] +
+-                       extra_postargs)
++            if self.detect_language(src) == 'c++':
++                self.spawn(compiler_so_cxx + cc_args + [src, '-o', obj] +
++                           extra_postargs)
++            else:
++                self.spawn(compiler_so + cc_args + [src, '-o', obj] +
++                           extra_postargs)
+         except DistutilsExecError, msg:
+             raise CompileError, msg
+ 
+@@ -232,23 +242,16 @@
+                 ld_args.extend(extra_postargs)
+             self.mkpath(os.path.dirname(output_filename))
+             try:
+-                if target_desc == CCompiler.EXECUTABLE:
+-                    linker = self.linker_exe[:]
++                if target_lang == "c++":
++                    if target_desc == CCompiler.EXECUTABLE:
++                        linker = self.linker_exe_cxx[:]
++                    else:
++                        linker = self.linker_so_cxx[:]
+                 else:
+-                    linker = self.linker_so[:]
+-                if target_lang == "c++" and self.compiler_cxx:
+-                    # skip over environment variable settings if /usr/bin/env
+-                    # is used to set up the linker's environment.
+-                    # This is needed on OSX. Note: this assumes that the
+-                    # normal and C++ compiler have the same environment
+-                    # settings.
+-                    i = 0
+-                    if os.path.basename(linker[0]) == "env":
+-                        i = 1
+-                        while '=' in linker[i]:
+-                            i = i + 1
+-
+-                    linker[i] = self.compiler_cxx[i]
++                    if target_desc == CCompiler.EXECUTABLE:
++                        linker = self.linker_exe[:]
++                    else:
++                        linker = self.linker_so[:]
+ 
+                 if sys.platform == 'darwin':
+                     linker = _darwin_compiler_fixup(linker, ld_args)

diff --git a/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild b/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild
index 26dd013..61639b5 100644
--- a/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild
+++ b/dev-python/pypy-bin/pypy-bin-2.0.2.ebuild
@@ -12,14 +12,15 @@ BINHOST="http://dev.gentoo.org/~mgorny/dist/${PN}"
 
 DESCRIPTION="A fast, compliant alternative implementation of the Python language (binary package)"
 HOMEPAGE="http://pypy.org/"
-SRC_URI="
+SRC_URI="mirror://bitbucket/pypy/pypy/downloads/pypy-${PV}-src.tar.bz2
 	amd64? (
 		bzip2? ( jit? ( ncurses? ( shadowstack? ( ssl? (
 			${BINHOST}/${P}+bzip2+jit+ncurses+shadowstack+ssl.tar.xz
 		) ) ) ) )
-	)
-	doc? ( ${BINHOST}/${P}-doc.tar.xz )
-	test? ( mirror://bitbucket/pypy/pypy/downloads/pypy-${PV}-src.tar.bz2 )"
+		bzip2? ( !jit? ( ncurses? ( !shadowstack? ( ssl? (
+			${BINHOST}/${P}+bzip2+ncurses+ssl.tar.xz
+		) ) ) ) )
+	)"
 
 LICENSE="MIT"
 SLOT=$(get_version_component_range 1-2 ${PV})
@@ -36,20 +37,36 @@ RDEPEND="
 	sqlite? ( dev-db/sqlite:3 )
 	ssl? ( ~dev-libs/openssl-1.0.1e )
 	!dev-python/pypy:${SLOT}"
-DEPEND="test? ( ${RDEPEND} )"
+DEPEND="doc? ( dev-python/sphinx )
+	test? ( ${RDEPEND} )"
 PDEPEND="app-admin/python-updater"
 
 # Supported variants
-REQUIRED_USE="bzip2 jit ncurses !sandbox shadowstack ssl"
+REQUIRED_USE="bzip2 ncurses !sandbox ssl
+	jit? ( shadowstack )"
+
+S=${WORKDIR}/pypy-${PV}-src
 
 pkg_setup() {
-	use test && python-any-r1_pkg_setup
+	use doc && python-any-r1_pkg_setup
 }
 
-src_test() {
-	# Move necessary libs and tools.
-	mv "${WORKDIR}"/pypy-${PV}-src/{_pytest,py,pypy,pytest*,rpython} . || die
+src_prepare() {
+	epatch "${FILESDIR}/1.9-scripts-location.patch"
+	epatch "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
+	epatch "${FILESDIR}/2.0.2-distutils-fix_handling_of_executables_and_flags.patch"
+
+	epatch_user
+}
 
+src_compile() {
+	# Tadaam! PyPy compiled!
+	mv "${WORKDIR}"/${P}*/pypy-c . || die
+
+	use doc && emake -C pypy/doc/ html
+}
+
+src_test() {
 	PYTHONDONTWRITEBYTECODE=1 \
 	./pypy-c ./pypy/test_all.py --pypy=./pypy-c lib-python || die
 }
@@ -76,6 +93,8 @@ src_install() {
 
 	einfo "Generating caches and byte-compiling ..."
 
+	cd .. || die
+
 	# Generate Grammar and PatternGrammar pickles.
 	"${PYTHON}" -c "import lib2to3.pygram, lib2to3.patcomp; lib2to3.patcomp.PatternCompiler()" \
 		|| die "Generation of Grammar and PatternGrammar pickles failed"
@@ -90,7 +109,7 @@ src_install() {
 	python_optimize "${ED%/}${INSDESTTREE}"
 
 	# Install docs
-	use doc && dohtml -r "${WORKDIR}"/${P}-doc/.
+	use doc && dohtml -r pypy/doc/_build/html/
 
 	echo "EPYTHON='${EPYTHON}'" > epython.py
 	python_domodule epython.py

diff --git a/dev-python/pypy-binpackage/pypy-binpackage-2.0.2.ebuild b/dev-python/pypy-binpackage/pypy-binpackage-2.0.2.ebuild
index de489b4..e8fa0fc 100644
--- a/dev-python/pypy-binpackage/pypy-binpackage-2.0.2.ebuild
+++ b/dev-python/pypy-binpackage/pypy-binpackage-2.0.2.ebuild
@@ -102,11 +102,11 @@ src_install() {
 	local BIN_P=pypy-bin-${PV}
 
 	einfo "Zipping PyPy ..."
-	mkdir ${BIN_P} || die
-	mv README.rst include lib_pypy lib-python pypy-c ${BIN_P}/ || die
-	chmod +x ${BIN_P}/pypy-c || die
+	mkdir "${BIN_P}${suffix}" || die
+	mv pypy-c "${BIN_P}${suffix}"/ || die
+	chmod +x "${BIN_P}${suffix}"/pypy-c || die
 
-	tar -cf "${BIN_P}${suffix}.tar" ${BIN_P} || die
+	tar -cf "${BIN_P}${suffix}.tar" "${BIN_P}${suffix}" || die
 	xz -vz9 "${BIN_P}${suffix}.tar" || die
 
 	if use doc; then

diff --git a/dev-python/pypy/pypy-2.0.2.ebuild b/dev-python/pypy/pypy-2.0.2.ebuild
index 56f1982..99e170f 100644
--- a/dev-python/pypy/pypy-2.0.2.ebuild
+++ b/dev-python/pypy/pypy-2.0.2.ebuild
@@ -26,6 +26,7 @@ RDEPEND=">=sys-libs/zlib-1.1.3
 	sqlite? ( dev-db/sqlite:3 )
 	ssl? ( dev-libs/openssl )"
 DEPEND="${RDEPEND}
+	doc? ( dev-python/sphinx )
 	${PYTHON_DEPS}"
 PDEPEND="app-admin/python-updater"
 
@@ -88,7 +89,7 @@ src_compile() {
 	echo -e "\033[1m${@}\033[0m"
 	"${@}" || die "compile error"
 
-	use doc && emake -C ${PN}/doc/ html
+	use doc && emake -C pypy/doc/ html
 }
 
 src_test() {
@@ -132,7 +133,7 @@ src_install() {
 	python_optimize "${ED%/}${INSDESTTREE}"
 
 	# Install docs
-	use doc && dohtml -r ${PN}/doc/_build/html/
+	use doc && dohtml -r pypy/doc/_build/html/
 
 	echo "EPYTHON='${EPYTHON}'" > epython.py
 	python_domodule epython.py


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-07-21 11:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-21 11:16 [gentoo-commits] dev/mgorny:master commit in: dev-python/pypy-bin/, dev-python/pypy/, dev-python/pypy-binpackage/, Michał Górny
  -- strict thread matches above, loose matches on Subject: below --
2013-07-21  7:00 Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox