summaryrefslogtreecommitdiff
path: root/dev-python/pypy3-bin
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /dev-python/pypy3-bin
reinit the tree, so we can have metadata
Diffstat (limited to 'dev-python/pypy3-bin')
-rw-r--r--dev-python/pypy3-bin/Manifest27
-rw-r--r--dev-python/pypy3-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch11
-rw-r--r--dev-python/pypy3-bin/files/4.0.0-gentoo-path.patch50
-rw-r--r--dev-python/pypy3-bin/files/5.2.0-distutils-c++.patch284
-rw-r--r--dev-python/pypy3-bin/files/5.7.1_all_distutils_cxx.patch342
-rw-r--r--dev-python/pypy3-bin/files/5.8.0_all_distutils_cxx.patch342
-rw-r--r--dev-python/pypy3-bin/files/python-3.5-distutils-OO-build.patch80
-rw-r--r--dev-python/pypy3-bin/metadata.xml18
-rw-r--r--dev-python/pypy3-bin/pypy3-bin-5.5.0_alpha.ebuild200
-rw-r--r--dev-python/pypy3-bin/pypy3-bin-5.7.1-r1.ebuild171
-rw-r--r--dev-python/pypy3-bin/pypy3-bin-5.8.0-r1.ebuild171
11 files changed, 1696 insertions, 0 deletions
diff --git a/dev-python/pypy3-bin/Manifest b/dev-python/pypy3-bin/Manifest
new file mode 100644
index 000000000000..c225826f0aad
--- /dev/null
+++ b/dev-python/pypy3-bin/Manifest
@@ -0,0 +1,27 @@
+AUX 1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch 551 SHA256 831bacb5d5c7b23699971aedf7b07a93654ba0cf8d700babe369330115c29896 SHA512 9b6b5ede218cea96a424376677d52cbd7c23cd7f569756403849523fc79f8db27190e0bd80501a9e428688fd393397d2fa4e59a59607212993f4ac6d93b18733 WHIRLPOOL 7124a9a1ec1a65bf1488060189306780e8e6890381a20fab27b00e031e59096b80d0fcd5193d1cd48393d51f4619bb294b846da6190b784aef92f1b09ff2acb8
+AUX 4.0.0-gentoo-path.patch 1906 SHA256 4f01ad3317e62147346d6548e0d5cf51bb1b01c4e4d34e48eb57dbefdaa82140 SHA512 ddf5664d289b3134a30e675a91ab9aec1a81c0df7bd4f6b0b43cd6fdbf99aca8e6d123c1df41f061784e5fe1a0a3ed4a7ebcd16790d76fb8a28cec442037d747 WHIRLPOOL 8e3b2d477a3db79874f679473032f83478bfbcce0d9df1d782f30fb5fcabeb2556efd7a1da85e7d8a0243dbf80ffbef96982d45252beb6c37fbce2ac23edc50e
+AUX 5.2.0-distutils-c++.patch 14234 SHA256 a07e65f2b7e8f8f52af45aec6a146e09390d30856118978d2e4b4d2c7e2967c9 SHA512 dfc404a71f0314988905b976d6beb1e9b8368006840cc199a94eae47a86ab7e2be92d86c53be349928fc0a8b12f3a78c60b07476bfc27cc0f7a383970a2e2e95 WHIRLPOOL 769bb355adaadb980cbb7c77faa8b47b356dc471a25cd1d1b3bc604f7eb84aba6b39e38100c9d1ad5e1dd06fc562a640437917b0c770d8e8ad02627bc309f6c1
+AUX 5.7.1_all_distutils_cxx.patch 15897 SHA256 cc6475551f74f416bd77eec58bab9ab48d6c5fe3f0c1595e197ffe1080bce44b SHA512 f82c4efb258a0ab029faaad35fbd85a9bf9aa98e12d9317920a7872f2f0db75668a37506fd69a3838286e7349948a60e158360b1f3f5d671e91b07a0e56af809 WHIRLPOOL 08c193c5a41ff85d14e6443aa1ba7c3141a7c9ebf15cc6ed99f7e705efe04916bfe3c305ec23f36448521a0d79d3121ab9363491458d7271144914fe6420efbf
+AUX 5.8.0_all_distutils_cxx.patch 15896 SHA256 cbedcf9e08280a99a5f2bf1a033e2b2e17bb0ee2bf00ce82b87b6f89df2718a6 SHA512 195dbc6cc75179c090b7f461f36e3fd19e341343f2d50c0a4ff24032da1074581578d51d62dbfc04349a8a46b9332097bb310bc923ea3813bf1afce91edfcea3 WHIRLPOOL 5ee53a44e6f85f0ceb93843d35856ddfe7da56662836c7ff25e9698e1bed0d75d5d72e4b5c8ee12b7ce4286903be46a6384a243f7f40e4918cfeaaaeca8f9209
+AUX python-3.5-distutils-OO-build.patch 3627 SHA256 9b0b86d8424304fe87a460bbf5ab503811d77ae4e557ad0c4081150a0af89a1f SHA512 5e8e4ab7d326386a244df9d0fca5b54e16b5943e35d12ecaf9ea986e79d2d8d8e85585f6286e0fc440dbb7a8c17e2bcf7a11498ff9cc5f523e97d8b353d9a511 WHIRLPOOL 4730a9110662a3c45ab5f3e842ebc2f81ecfd98e4e844e71a0fe56d41baaa6bb01aafe313ec8dd12bea40c956ec01f1a68d6bca3d695bf65705a811f4afd0289
+DIST pypy3-bin-5.5.0_alpha-amd64+bzip2+jit+ncurses+shadowstack.tar.lz 10860820 SHA256 46437ffdc3327b11fb116071ec8bb5c93aa94ac143a7105cadb678be708faeb5 SHA512 ed93e8452c82e627699aa876cfa55d2fd84d7ec7c6698e2a20bda2a5bb564def68b51a2e62ca45a36f88805cbca453b0a8a6565016428c4eef22a5539bb24647 WHIRLPOOL 858befe94e009628cee4e8527aaaa1e8e92fe264ff91b382fed74ba31314eccf914c403b376792eec322bcead140e8159d255b265bc88832accb3d65d16fd78c
+DIST pypy3-bin-5.5.0_alpha-amd64+bzip2+jit+ncurses.tar.lz 11610069 SHA256 a400bd9c2df450647278dec93d397e4d040fd058f78309e8cdaff8b0792b8c01 SHA512 e0dca44387c03306691c63263aae7d484a5244b686cfd57315d7c4bd630fd5fba888d8cb57855d3f84c9bda576194597e4048877990456812f747d7d099b5819 WHIRLPOOL 3f61e0b02bbfc77a413fe38aca59c626857b1b8a05b952e7a832e4d3cc20dd5d98d9173161d08cd92587e2a7b44a2a55ba61f516c632611cb4d16a20f3eb4e74
+DIST pypy3-bin-5.5.0_alpha-amd64+bzip2+ncurses.tar.lz 6243046 SHA256 34ae3b199194a90f0867e95306b6530faa3acafb9dc9ef077ba4e229f3a5d0de SHA512 4fdae8644c40734281d81adb5c8273a0f2429c47bff8672a7f98988195c6e9ab82d9a1443e2d1c1bc2ca75d471c112ac40ac403e75808d8610dce94fee15031b WHIRLPOOL ca2c5b4f0334f1193ef5cd6bf7ebe9034fbd176f0ce34b6302125c6e2b175e69129ca53d21ef34327bb064cf90af907c10bd81d62ccb429298020043a41fdfa0
+DIST pypy3-bin-5.5.0_alpha-x86+bzip2+jit+ncurses+shadowstack+sse2.tar.lz 8656783 SHA256 52bff882b65d4664661c70657c927d69cbc0b9377c7d0ae20ed8ca562d8e13f4 SHA512 6ae588077d92d1c4d494e2b657a3d963989e3f3cf2d689ec4cf460f196d69234d13b88160ebb46334af0733f5ec13720abb0d2bc3184c6744b9218a8a5f6440a WHIRLPOOL 81593ba510a71cc7ef47f3013e89e468bb5671da32a0ca5cdbfc1579cd2df90ce3b53ed59f2974243bc1b21eb8ea8d509d66ea4d2539c56f8a15ba9a3e7c6127
+DIST pypy3-bin-5.5.0_alpha-x86+bzip2+jit+ncurses+sse2.tar.lz 9549100 SHA256 fdd95b1fb91d669e1861b2dff52b97af0d01aaedf61eb11f07c8f92cd398c7f6 SHA512 2ac8cb894cafae8da81bddb601185941b42933aa41bda8d1696eb70ca22cbeaa0c23385e4a4cd640c46f9e301acfc2f9bc89adaf5a7f5cbef4bc23ca8af550bb WHIRLPOOL e4c21be6b52468135ff6e53434a8ae8c0450880d0f5c8d37bdc18a99f9ceb0ae101c82b8a7a6ae2088297f9dbfa7146fcf80a24948dd3316d56f0f798cc7ecec
+DIST pypy3-bin-5.5.0_alpha-x86+bzip2+ncurses+sse2.tar.lz 5231919 SHA256 6a9848bc2d1d948a91bc15ce20768bc7024726ec7afdd2767bfba25926a35c7f SHA512 fbdc955b1c2873d07e8ad36dd697fbb21932ac50726e76fed20da1fca218b329f18c81b8b4a65cd7ece26091859529d5bb56c7ed2efaf14ae8d9988581d88d9b WHIRLPOOL 08ffd98122e4745af4e785ebb986cd7d185472ec0879bb9dc6070b14de6d35e4177e35a85326468329a06617df03880744e23a6bef825f67d40476c92c7d430e
+DIST pypy3-bin-5.5.0_alpha-x86+bzip2+ncurses.tar.lz 5232239 SHA256 d808aa66ecd5b3d868554ad29b0eee3948e3de69390826bcb5e6b8ceb2408037 SHA512 5e107304537855f459cc7bee92d3b2d05e16f2421d2249205c34f40f1f9415ca657f3e0842c79de98fed732e0a2752b280b44880f96eeeaa0d50d4b4bf2c525c WHIRLPOOL 562fe0c00aeb83a74d9f1ccba4ffed70b5efa6592ef04c82ea06c38afc560e97aa02b835de8b69925690149c1d6803ecfbcad7eefd59bdf4462bdbbbf82c2577
+DIST pypy3-bin-5.7.1-amd64+bzip2+jit+ncurses.tar.lz 10329767 SHA256 041d6b6af48ec4a2de0062a2ae48a3d2a8e827d450b76fc4232f4a9eca8cbc47 SHA512 a5959d4bd5d267ea0386e4fab4b86b83f7597aaa3174281f15f180e0c83125af1437c0a693b0d534929c7199df5958a5f48867c72d1ce24494b2238523cde2aa WHIRLPOOL 8eef898eac108726b89751e6af80c112f46800ab1dd4efad118e71adb6c7cbaccbe46360da3be7d5ad5702262a2e377bfc530b7519fc38532123884c84e0c1ee
+DIST pypy3-bin-5.7.1-amd64+bzip2+ncurses.tar.lz 6352387 SHA256 0243a016a7b836af72e6e1172f2a4516b9705169a9ba2318093b5c3005917766 SHA512 a63b02dfc11b7675bd4ccceb58801aeb1fd40d0245196dd7fa9f646e4618f46c8e6c4d95072c6432381064d37bc13cb74fbd383d19f8769f069827a8969e7a95 WHIRLPOOL f09b82a6c8a4dada7597bfbe0b2ecd07d90d724eae3d2cc6f35a69c0f219b420236ed8ad37024ad8f9516d729389cbe919f58a48cf1aa323c3a74220c62b8aa3
+DIST pypy3-bin-5.8.0-amd64+bzip2+jit+ncurses.tar.lz 10706804 SHA256 fd8e3550426d747f65d52fb2edbe5b9133c1946eed5f1ada5a454fe5a99b489f SHA512 38e46503ba50987a36b68e7d6316b64a00c1e2fa0d2d0b0e0e517bbfa96cb777522346d2c4a78cc7bdf44fa237453dc97867f9323785ba38b21c1f1058d5e701 WHIRLPOOL 59ecc9f9c5d4a29819d0911cc1402f38bd9708ec3e28ba90cb33159b88e11a150a33390c2a73e26831de578ec77598018945e001a1bc3e8f2659b17743a3cdf6
+DIST pypy3-bin-5.8.0-amd64+bzip2+ncurses.tar.lz 6626453 SHA256 f840fba90a52e0bfaf9f7f3197f47823154709b86b33dbe61df1f721d8eb46ef SHA512 51d418668c48f8e2d740264855e193353900d56893c0fc81de09e8fab338a36a696a725dd3387ee1d626f82e8319b797bfa4957a5cc8f0b11610b3e6ece67539 WHIRLPOOL 45348517cb0bf8e98ac53149314288716cf8ee972505c354192a46b6472fff694cc037689f2f61707396ed55b9baebe35fa4e99695789f93cb8edeaa08e71fe2
+DIST pypy3-v5.7.1-src.tar.bz2 28811162 SHA256 40ece0145282980ac121390f13709404c0532896507d5767496381180b631bd0 SHA512 f8ead8214ad7d89fe80e24d97b13ece7f2c80b2f11446257a2eab0e3025fc7d8fec26474b0e9eb2b2e3ccd629532dd062829459361b601add12e40793bd5aa60 WHIRLPOOL 180a5cb39c9a5e3840f4940463dd9cccf44486f11a657d2ac644d1eac4561068f08905fdadc495918fb0ceaf018d4b85a3e5756ca6d99a020310b46bdb16ef87
+DIST pypy3-v5.8.0-src.tar.bz2 28986883 SHA256 9d090127335c3c0fd2b14c8835bf91752e62756e55ea06aad3353f24a6854223 SHA512 d78b4c899a5643028664365ed973a7b292a8e5b3989cc75203cd381ea3cda7dd73121c574726e23dca86e8364fcfcf42c372c9deee438c805f30d6e1c4ac115a WHIRLPOOL b7567fa21e3ded400a72ec06197184df37e0b5893adfb55622ea9afb668bfbda7ebbecd9b80660efef42f160838966d103c4181a9b07355e873981b35f4bf104
+DIST pypy3.3-v5.5.0-alpha-src.tar.bz2 25122033 SHA256 d5591c34d77253e9ed57d182b6f49585b95f7c09c3e121f0e8630e5a7e75ab5f SHA512 b2cf9700e45c452293297edffe08e572dffc3c567026b4b5d9165c1ba1b4d858ffc8a6754f5f28781020016c36440e5c02d07562d075b12444c9c32ea5dd2168 WHIRLPOOL 6bde174969413c55d6d077cd14e737c4f034f19935536af1bffaf3a1caa456d2bf6850760a18c274ad99089bd5ab7331d7d185f914cd6c69f708abf857d35df3
+DIST python-gentoo-patches-3.3.5-0.tar.xz 12892 SHA256 a7240de9598033cb40f8f273d8104d4e2b1dcaea028d45ac28efaa3c680ff6f7 SHA512 27eef4c2b3f631b000db3f6a5c426d9b498d63a08fe82b1ab7c2c010fb72208109461a5f008d47703852526655b70a734ea95be8742897026db5750bb9cc9d16 WHIRLPOOL edab9222d7da94cab3b1de0e1a27c6c7dbd49194b813a0a1cf9e532063029c4e4f19151c9f4878eeabed3168ff1f97eae7f008280c7ed2897fc14c5516c68d7e
+EBUILD pypy3-bin-5.5.0_alpha.ebuild 6155 SHA256 2ecdd3d55dee03eb40a2e1cea70fdb95c34466d42a082e96ee8d1f7cda790241 SHA512 b91c633f0688fe20f4db14fe374225a5f30fb1aeddf6c160fa74d273b1859f6702242cd373db4222a06b6a923051ce11569a32f097b6fe8a7e96ca56dfac06aa WHIRLPOOL 5e16861cc4f5380750b15ade16fc84ff1270ae84ce5fcde91a649fa859a88d09259f1ca5f718bbe1618fcaf7dcce24c40f8a6c055b527774269d14302b2b8a7b
+EBUILD pypy3-bin-5.7.1-r1.ebuild 5345 SHA256 0755a2418e5be596f88c334a05651de62e43f4159ce6dced62778ee13b192a7e SHA512 22d5f22f531b675d9db272db7ffab8ede77a1fcf883ea9c2b7d67f3eb8837d83abbed3005f8bc60f904d746cc5b548d7823f6984189a6129318d062a7055413e WHIRLPOOL 815fd636b23cf9e022081faaf8ebe9780b4c6b354d1b6f3435396f9187e0401546ba1b271ffeaed8f157ac51b190b82fa351d569a148fd7ffe0a2c9505688fa5
+EBUILD pypy3-bin-5.8.0-r1.ebuild 5345 SHA256 8737f3cd44ddfcab4482136f839bb9ac57c6a141b5200ca3e50efde9151bbca9 SHA512 e3d34a52716a66b42e37c77dc7d4b3f98ac7a80bc511156fd63ce47c65f549441a1b96667df58d9c2bb51e3b7280244c8619744ba9ccfccc06b73df365cb2d1b WHIRLPOOL f0afc372fd717f09023b650bb1bf5babe775a121357f986683b47add213aad924436cca6243b916f4dc68dff096f1d5cd1c30fb1d4917556aa613d5b433f2aae
+MISC ChangeLog 7700 SHA256 ba2326f1007aebe17871ea81213c69cc07c7dc334bbc267a50353ba79c0c4197 SHA512 e8b2817533bcacc09d120de24278ae3731235f26ce7120fb3f247fb202657667cf4b056e005786b40d2462d6e65f74dc94175e242f209725d24285192b64c2ac WHIRLPOOL de020e520c4befef4ca2bdf167d28ec7bd1b5ced194ecfb58c05d086e77c35abe0e17a20f4a65750c221aae0d1ca76c1cbbc524b9251a97584096aa5cd92ec65
+MISC ChangeLog-2015 975 SHA256 9ec6d637bd1373be724ded99f8deaa041e5587508f68cf15c8537f25235709fb SHA512 58290569acccc81298a0793b797e858365767629c94bc6d8b08790341cfa0c3efd6116c6c54e4585d65d158256767dd762a3eae431b8f3c0ca6571a98bb0bf34 WHIRLPOOL c52470823ec3e6e5b639fe454c705de58d02fd32155b72e49ae8cb94775839d9aee7b0b096f7128bde80f43a78dd6590a71daafc9bf52524161bcd548fc50947
+MISC metadata.xml 514 SHA256 418905501db31b0962ef487f62db5c376e6cce16be2e7513553049979dae1968 SHA512 a4f6fbf391b7f566b99cef0dc503d41ad1c0eb119187650b550697c4c10b394bae847fcd809eb9db2883f578e5bcf3416146941cabddc0632b2e10dd50fb0315 WHIRLPOOL a510d10c48a29615969f1332fb78e91b5036c3e7cc5456981a627f96b72bc3fb407b6023d7e564da4ccf4170925d3c3902a42074b11f9af105b200e7cfebe58f
diff --git a/dev-python/pypy3-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch b/dev-python/pypy3-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
new file mode 100644
index 000000000000..29d99dcfdb73
--- /dev/null
+++ b/dev-python/pypy3-bin/files/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch
@@ -0,0 +1,11 @@
+--- a/lib-python/3/distutils/unixccompiler.py
++++ b/lib-python/3/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/pypy3-bin/files/4.0.0-gentoo-path.patch b/dev-python/pypy3-bin/files/4.0.0-gentoo-path.patch
new file mode 100644
index 000000000000..cf96d3fb2a53
--- /dev/null
+++ b/dev-python/pypy3-bin/files/4.0.0-gentoo-path.patch
@@ -0,0 +1,50 @@
+From 165e05bbdc93e54411217c0198d0a5cbb9de4e33 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Fri, 27 Nov 2015 17:02:42 +0100
+Subject: [PATCH] Gentoo: override paths for system-wide install based on
+ sys.prefix
+
+Override all default distutils install paths to ones suitable for
+system-wide install when sys.prefix indicates we're running the Gentoo
+system-wide install of PyPy with no prefix overrides (e.g. virtualenv).
+
+Fixes: https://bugs.gentoo.org/462306
+Fixes: https://bugs.gentoo.org/465546
+---
+ lib-python/3/distutils/command/install.py | 13 ++++++++++++-
+ 1 file changed, 12 insertions(+), 1 deletion(-)
+
+diff --git a/lib-python/3/distutils/command/install.py b/lib-python/3/distutils/command/install.py
+index fc43951..fed5218 100644
+--- a/lib-python/3/distutils/command/install.py
++++ b/lib-python/3/distutils/command/install.py
+@@ -90,6 +90,13 @@ INSTALL_SCHEMES = {
+ 'scripts': '$base/bin',
+ 'data' : '$base',
+ },
++ 'gentoo': {
++ 'purelib': '$base/site-packages',
++ 'platlib': '$base/site-packages',
++ 'headers': '$base/include',
++ 'scripts': '@EPREFIX@/usr/bin',
++ 'data' : '@EPREFIX@/usr',
++ },
+ }
+
+ # The keys to an installation scheme; if any new types of files are to be
+@@ -476,7 +483,11 @@ class install (Command):
+ # it's the caller's problem if they supply a bad name!
+ if (hasattr(sys, 'pypy_version_info') and
+ not name.endswith(('_user', '_home'))):
+- name = 'pypy'
++ if self.install_base == os.path.normpath('@EPREFIX@/usr/@libdir@/pypy3'):
++ # override paths for system-wide install
++ name = 'gentoo'
++ else:
++ name = 'pypy'
+ scheme = INSTALL_SCHEMES[name]
+ for key in SCHEME_KEYS:
+ attrname = 'install_' + key
+--
+2.6.3
+
diff --git a/dev-python/pypy3-bin/files/5.2.0-distutils-c++.patch b/dev-python/pypy3-bin/files/5.2.0-distutils-c++.patch
new file mode 100644
index 000000000000..1251694107d8
--- /dev/null
+++ b/dev-python/pypy3-bin/files/5.2.0-distutils-c++.patch
@@ -0,0 +1,284 @@
+From e3afe6721897c8de830055621313bc0659518415 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Thu, 9 Jun 2016 20:48:10 +0200
+Subject: [PATCH] distutils c++ fixes, python3.3 patch updated for pypy3.3
+
+---
+ lib-python/3/_osx_support.py | 10 +++---
+ lib-python/3/distutils/cygwinccompiler.py | 21 +++++++++--
+ lib-python/3/distutils/emxccompiler.py | 14 ++++++--
+ lib-python/3/distutils/sysconfig_cpython.py | 25 ++++++++++---
+ lib-python/3/distutils/unixccompiler.py | 54 ++++++++++++++++-------------
+ 5 files changed, 83 insertions(+), 41 deletions(-)
+
+diff --git a/lib-python/3/_osx_support.py b/lib-python/3/_osx_support.py
+index 50b2d17..1d19599 100644
+--- a/lib-python/3/_osx_support.py
++++ b/lib-python/3/_osx_support.py
+@@ -14,13 +14,13 @@ __all__ = [
+ # configuration variables that may contain universal build flags,
+ # like "-arch" or "-isdkroot", that may need customization for
+ # the user environment
+-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
+- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
+- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
+- 'PY_CORE_CFLAGS')
++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
++ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
+
+ # configuration variables that may contain compiler calls
+-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
+
+ # prefix added to original configuration variable names
+ _INITPRE = '_OSX_SUPPORT_INITIAL_'
+diff --git a/lib-python/3/distutils/cygwinccompiler.py b/lib-python/3/distutils/cygwinccompiler.py
+index e0074a1..1b383d3 100644
+--- a/lib-python/3/distutils/cygwinccompiler.py
++++ b/lib-python/3/distutils/cygwinccompiler.py
+@@ -124,8 +124,10 @@ class CygwinCCompiler(UnixCCompiler):
+ # dllwrap 2.10.90 is buggy
+ if self.ld_version >= "2.10.90":
+ self.linker_dll = "gcc"
++ self.linker_dll_cxx = "g++"
+ else:
+ self.linker_dll = "dllwrap"
++ self.linker_dll_cxx = "dllwrap"
+
+ # ld_version >= "2.13" support -shared so use it instead of
+ # -mdll -static
+@@ -139,9 +141,13 @@ class CygwinCCompiler(UnixCCompiler):
+ 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_cxx, shared_option)))
+
+ # cygwin and mingw32 need different sets of libraries
+ if self.gcc_version == "2.91.57":
+@@ -165,8 +171,12 @@ class CygwinCCompiler(UnixCCompiler):
+ 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 as msg:
+ raise CompileError(msg)
+
+@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler):
+ self.set_executables(compiler='gcc%s -O -Wall' % no_cygwin,
+ compiler_so='gcc%s -mdll -O -Wall' % no_cygwin,
+ compiler_cxx='g++%s -O -Wall' % no_cygwin,
++ compiler_so_cxx='g++%s -mdll -O -Wall' % no_cygwin,
+ linker_exe='gcc%s' % no_cygwin,
+ linker_so='%s%s %s %s'
+ % (self.linker_dll, no_cygwin,
++ shared_option, entry_point),
++ linker_exe_cxx='g++%s' % no_cygwin,
++ linker_so_cxx='%s%s %s %s'
++ % (self.linker_dll_cxx, no_cygwin,
+ shared_option, entry_point))
+ # Maybe we should also append -mthreads, but then the finished
+ # dlls need another dll (mingwm10.dll see Mingw32 docs)
+diff --git a/lib-python/3/distutils/emxccompiler.py b/lib-python/3/distutils/emxccompiler.py
+index 3675f8d..17d2afa 100644
+--- a/lib-python/3/distutils/emxccompiler.py
++++ b/lib-python/3/distutils/emxccompiler.py
+@@ -63,8 +63,12 @@ class EMXCCompiler (UnixCCompiler):
+ # 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)
+@@ -81,8 +85,12 @@ class EMXCCompiler (UnixCCompiler):
+ 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 as msg:
+ raise CompileError(msg)
+
+diff --git a/lib-python/3/distutils/sysconfig_cpython.py b/lib-python/3/distutils/sysconfig_cpython.py
+index b947988..3f19020 100644
+--- a/lib-python/3/distutils/sysconfig_cpython.py
++++ b/lib-python/3/distutils/sysconfig_cpython.py
+@@ -191,9 +191,12 @@ def customize_compiler(compiler):
+ _osx_support.customize_compiler(_config_vars)
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
+
+- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++
++ cflags = ''
++ cxxflags = ''
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
+@@ -208,19 +211,27 @@ def customize_compiler(compiler):
+ 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:
+@@ -229,13 +240,17 @@ def customize_compiler(compiler):
+ 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 = shlib_suffix
+diff --git a/lib-python/3/distutils/unixccompiler.py b/lib-python/3/distutils/unixccompiler.py
+index 6819d50..19345ee 100644
+--- a/lib-python/3/distutils/unixccompiler.py
++++ b/lib-python/3/distutils/unixccompiler.py
+@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler):
+ # 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' : ["c++"], # pypy: changed, 'cc' is bogus
+- '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":
+@@ -123,12 +126,19 @@ class UnixCCompiler(CCompiler):
+
+ 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 = _osx_support.compiler_fixup(compiler_so,
+ cc_args + extra_postargs)
++ compiler_so_cxx = _osx_support.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 as msg:
+ raise CompileError(msg)
+
+@@ -186,22 +196,16 @@ class UnixCCompiler(CCompiler):
+ 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 += 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 = _osx_support.compiler_fixup(linker, ld_args)
+--
+2.8.4
+
diff --git a/dev-python/pypy3-bin/files/5.7.1_all_distutils_cxx.patch b/dev-python/pypy3-bin/files/5.7.1_all_distutils_cxx.patch
new file mode 100644
index 000000000000..52a833f29d9e
--- /dev/null
+++ b/dev-python/pypy3-bin/files/5.7.1_all_distutils_cxx.patch
@@ -0,0 +1,342 @@
+From b2f2c9d23996d431d606ac7d8ed731a5302b4e97 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 25 Apr 2017 17:42:33 +0200
+Subject: [PATCH] Fancy distutils C++ support, rebased for PyPy3.5
+
+https://bugs.python.org/issue1222585
+---
+ _osx_support.py | 10 +++---
+ distutils/cygwinccompiler.py | 21 +++++++++--
+ distutils/sysconfig_cpython.py | 25 ++++++++++---
+ distutils/sysconfig_pypy.py | 35 +++++++++++++++----
+ distutils/unixccompiler.py | 54 ++++++++++++++++-------------
+ 5 files changed, 100 insertions(+), 45 deletions(-)
+
+diff --git a/_osx_support.py b/_osx_support.py
+index 13fcd8b..0525be1 100644
+--- a/_osx_support.py
++++ b/_osx_support.py
+@@ -14,13 +14,13 @@ __all__ = [
+ # configuration variables that may contain universal build flags,
+ # like "-arch" or "-isdkroot", that may need customization for
+ # the user environment
+-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
+- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
+- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
+- 'PY_CORE_CFLAGS')
++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
++ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
+
+ # configuration variables that may contain compiler calls
+-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
+
+ # prefix added to original configuration variable names
+ _INITPRE = '_OSX_SUPPORT_INITIAL_'
+diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py
+index c879646..a6157fb 100644
+--- a/distutils/cygwinccompiler.py
++++ b/distutils/cygwinccompiler.py
+@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler):
+ # dllwrap 2.10.90 is buggy
+ if self.ld_version >= "2.10.90":
+ self.linker_dll = "gcc"
++ self.linker_dll_cxx = "g++"
+ else:
+ self.linker_dll = "dllwrap"
++ self.linker_dll_cxx = "dllwrap"
+
+ # ld_version >= "2.13" support -shared so use it instead of
+ # -mdll -static
+@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler):
+ 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_cxx, shared_option)))
+
+ # cygwin and mingw32 need different sets of libraries
+ if self.gcc_version == "2.91.57":
+@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler):
+ 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 as msg:
+ raise CompileError(msg)
+
+@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler):
+ self.set_executables(compiler='gcc -O -Wall',
+ compiler_so='gcc -mdll -O -Wall',
+ compiler_cxx='g++ -O -Wall',
++ compiler_so_cxx='g++ -mdll -O -Wall',
+ linker_exe='gcc',
+ linker_so='%s %s %s'
+ % (self.linker_dll, shared_option,
++ entry_point),
++ linker_exe_cxx='g++',
++ linker_so_cxx='%s %s %s'
++ % (self.linker_dll_cxx, shared_option,
+ entry_point))
+ # Maybe we should also append -mthreads, but then the finished
+ # dlls need another dll (mingwm10.dll see Mingw32 docs)
+diff --git a/distutils/sysconfig_cpython.py b/distutils/sysconfig_cpython.py
+index 573724d..0a04f33 100644
+--- a/distutils/sysconfig_cpython.py
++++ b/distutils/sysconfig_cpython.py
+@@ -173,9 +173,12 @@ def customize_compiler(compiler):
+ _osx_support.customize_compiler(_config_vars)
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
+
+- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++
++ cflags = ''
++ cxxflags = ''
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
+@@ -190,19 +193,27 @@ def customize_compiler(compiler):
+ 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:
+@@ -211,13 +222,17 @@ def customize_compiler(compiler):
+ 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 = shlib_suffix
+diff --git a/distutils/sysconfig_pypy.py b/distutils/sysconfig_pypy.py
+index a0a8dec..aa97c4e 100644
+--- a/distutils/sysconfig_pypy.py
++++ b/distutils/sysconfig_pypy.py
+@@ -72,6 +72,7 @@ def _init_posix():
+ g['CFLAGS'] = "-DNDEBUG -O2"
+ g['CCSHARED'] = "-fPIC"
+ g['LDSHARED'] = "gcc -pthread -shared"
++ g['LDCXXSHARED'] = "g++ -pthread -shared"
+ g['EXT_SUFFIX'] = so_ext
+ g['SHLIB_SUFFIX'] = so_ext
+ g['SO'] = so_ext # deprecated in Python 3, for backward compatibility
+@@ -156,36 +157,52 @@ def customize_compiler(compiler):
+ _osx_support.customize_compiler(_config_vars)
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
+
+- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++
++ cflags = ''
++ cxxflags = ''
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
+- if (sys.platform == 'darwin'
++ if (True
+ and 'LDSHARED' not in os.environ
+ and ldshared.startswith(cc)):
+ # On OS X, if CC is overridden, use that as the default
+ # command for LDSHARED as well
++ # Gentoo: s/OS X/every system/
+ ldshared = newcc + ldshared[len(cc):]
+ cc = newcc
+ if 'CXX' in os.environ:
+- cxx = os.environ['CXX']
++ newcxx = os.environ['CXX']
++ if ('LDCXXSHARED' not in os.environ
++ and ldcxxshared.startswith(cxx)):
++ ldcxxshared = newcxx + ldcxxshared[len(cxx):]
++ cxx = newcxx
+ 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:
+@@ -194,13 +211,17 @@ def customize_compiler(compiler):
+ 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 = shlib_suffix
+diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py
+index 254b22d..c9cacc1 100644
+--- a/distutils/unixccompiler.py
++++ b/distutils/unixccompiler.py
+@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler):
+ # 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' : ["c++"], # pypy: changed, 'cc' is bogus
+- '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":
+@@ -125,12 +128,19 @@ class UnixCCompiler(CCompiler):
+
+ 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 = _osx_support.compiler_fixup(compiler_so,
+ cc_args + extra_postargs)
++ compiler_so_cxx = _osx_support.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 as msg:
+ raise CompileError(msg)
+
+@@ -188,22 +198,16 @@ class UnixCCompiler(CCompiler):
+ 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 += 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 = _osx_support.compiler_fixup(linker, ld_args)
+--
+2.12.2
+
diff --git a/dev-python/pypy3-bin/files/5.8.0_all_distutils_cxx.patch b/dev-python/pypy3-bin/files/5.8.0_all_distutils_cxx.patch
new file mode 100644
index 000000000000..5d89ce2711cc
--- /dev/null
+++ b/dev-python/pypy3-bin/files/5.8.0_all_distutils_cxx.patch
@@ -0,0 +1,342 @@
+From b2f2c9d23996d431d606ac7d8ed731a5302b4e97 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Tue, 25 Apr 2017 17:42:33 +0200
+Subject: [PATCH] Fancy distutils C++ support, rebased for PyPy3.5
+
+https://bugs.python.org/issue1222585
+---
+ _osx_support.py | 10 +++---
+ distutils/cygwinccompiler.py | 21 +++++++++--
+ distutils/sysconfig_cpython.py | 25 ++++++++++---
+ distutils/sysconfig_pypy.py | 35 +++++++++++++++----
+ distutils/unixccompiler.py | 54 ++++++++++++++++-------------
+ 5 files changed, 100 insertions(+), 45 deletions(-)
+
+diff --git a/_osx_support.py b/_osx_support.py
+index 13fcd8b..0525be1 100644
+--- a/_osx_support.py
++++ b/_osx_support.py
+@@ -14,13 +14,13 @@ __all__ = [
+ # configuration variables that may contain universal build flags,
+ # like "-arch" or "-isdkroot", that may need customization for
+ # the user environment
+-_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'LDFLAGS', 'CPPFLAGS', 'BASECFLAGS',
+- 'BLDSHARED', 'LDSHARED', 'CC', 'CXX',
+- 'PY_CFLAGS', 'PY_LDFLAGS', 'PY_CPPFLAGS',
+- 'PY_CORE_CFLAGS')
++_UNIVERSAL_CONFIG_VARS = ('CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'CPPFLAGS',
++ 'BASECFLAGS', 'BLDSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'CC', 'CXX', 'PY_CFLAGS', 'PY_LDFLAGS',
++ 'PY_CPPFLAGS', 'PY_CORE_CFLAGS')
+
+ # configuration variables that may contain compiler calls
+-_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'CC', 'CXX')
++_COMPILER_CONFIG_VARS = ('BLDSHARED', 'LDSHARED', 'LDCXXSHARED', 'CC', 'CXX')
+
+ # prefix added to original configuration variable names
+ _INITPRE = '_OSX_SUPPORT_INITIAL_'
+diff --git a/distutils/cygwinccompiler.py b/distutils/cygwinccompiler.py
+index c879646..a6157fb 100644
+--- a/distutils/cygwinccompiler.py
++++ b/distutils/cygwinccompiler.py
+@@ -125,8 +125,10 @@ class CygwinCCompiler(UnixCCompiler):
+ # dllwrap 2.10.90 is buggy
+ if self.ld_version >= "2.10.90":
+ self.linker_dll = "gcc"
++ self.linker_dll_cxx = "g++"
+ else:
+ self.linker_dll = "dllwrap"
++ self.linker_dll_cxx = "dllwrap"
+
+ # ld_version >= "2.13" support -shared so use it instead of
+ # -mdll -static
+@@ -140,9 +142,13 @@ class CygwinCCompiler(UnixCCompiler):
+ 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_cxx, shared_option)))
+
+ # cygwin and mingw32 need different sets of libraries
+ if self.gcc_version == "2.91.57":
+@@ -166,8 +172,12 @@ class CygwinCCompiler(UnixCCompiler):
+ 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 as msg:
+ raise CompileError(msg)
+
+@@ -302,9 +312,14 @@ class Mingw32CCompiler(CygwinCCompiler):
+ self.set_executables(compiler='gcc -O -Wall',
+ compiler_so='gcc -mdll -O -Wall',
+ compiler_cxx='g++ -O -Wall',
++ compiler_so_cxx='g++ -mdll -O -Wall',
+ linker_exe='gcc',
+ linker_so='%s %s %s'
+ % (self.linker_dll, shared_option,
++ entry_point),
++ linker_exe_cxx='g++',
++ linker_so_cxx='%s %s %s'
++ % (self.linker_dll_cxx, shared_option,
+ entry_point))
+ # Maybe we should also append -mthreads, but then the finished
+ # dlls need another dll (mingwm10.dll see Mingw32 docs)
+diff --git a/distutils/sysconfig_cpython.py b/distutils/sysconfig_cpython.py
+index 573724d..0a04f33 100644
+--- a/distutils/sysconfig_cpython.py
++++ b/distutils/sysconfig_cpython.py
+@@ -173,9 +173,12 @@ def customize_compiler(compiler):
+ _osx_support.customize_compiler(_config_vars)
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
+
+- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++
++ cflags = ''
++ cxxflags = ''
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
+@@ -190,19 +193,27 @@ def customize_compiler(compiler):
+ 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:
+@@ -211,13 +222,17 @@ def customize_compiler(compiler):
+ 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 = shlib_suffix
+diff --git a/distutils/sysconfig_pypy.py b/distutils/sysconfig_pypy.py
+index a0a8dec..aa97c4e 100644
+--- a/distutils/sysconfig_pypy.py
++++ b/distutils/sysconfig_pypy.py
+@@ -72,6 +72,7 @@ def _init_posix():
+ g['CFLAGS'] = "-DNDEBUG -O2"
+ g['CCSHARED'] = "-fPIC"
+ g['LDSHARED'] = "cc -pthread -shared"
++ g['LDCXXSHARED'] = "c++ -pthread -shared"
+ g['EXT_SUFFIX'] = so_ext
+ g['SHLIB_SUFFIX'] = so_ext
+ g['SO'] = so_ext # deprecated in Python 3, for backward compatibility
+@@ -156,36 +157,52 @@ def customize_compiler(compiler):
+ _osx_support.customize_compiler(_config_vars)
+ _config_vars['CUSTOMIZED_OSX_COMPILER'] = 'True'
+
+- (cc, cxx, opt, cflags, ccshared, ldshared, shlib_suffix, ar, ar_flags) = \
+- get_config_vars('CC', 'CXX', 'OPT', 'CFLAGS',
+- 'CCSHARED', 'LDSHARED', 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++ (cc, cxx, ccshared, ldshared, ldcxxshared, shlib_suffix, ar, ar_flags) = \
++ get_config_vars('CC', 'CXX', 'CCSHARED', 'LDSHARED', 'LDCXXSHARED',
++ 'SHLIB_SUFFIX', 'AR', 'ARFLAGS')
++
++ cflags = ''
++ cxxflags = ''
+
+ if 'CC' in os.environ:
+ newcc = os.environ['CC']
+- if (sys.platform == 'darwin'
++ if (True
+ and 'LDSHARED' not in os.environ
+ and ldshared.startswith(cc)):
+ # On OS X, if CC is overridden, use that as the default
+ # command for LDSHARED as well
++ # Gentoo: s/OS X/every system/
+ ldshared = newcc + ldshared[len(cc):]
+ cc = newcc
+ if 'CXX' in os.environ:
+- cxx = os.environ['CXX']
++ newcxx = os.environ['CXX']
++ if ('LDCXXSHARED' not in os.environ
++ and ldcxxshared.startswith(cxx)):
++ ldcxxshared = newcxx + ldcxxshared[len(cxx):]
++ cxx = newcxx
+ 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:
+@@ -194,13 +211,17 @@ def customize_compiler(compiler):
+ 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 = shlib_suffix
+diff --git a/distutils/unixccompiler.py b/distutils/unixccompiler.py
+index 254b22d..c9cacc1 100644
+--- a/distutils/unixccompiler.py
++++ b/distutils/unixccompiler.py
+@@ -52,14 +52,17 @@ class UnixCCompiler(CCompiler):
+ # 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' : ["c++"], # pypy: changed, 'cc' is bogus
+- '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":
+@@ -125,12 +128,19 @@ class UnixCCompiler(CCompiler):
+
+ 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 = _osx_support.compiler_fixup(compiler_so,
+ cc_args + extra_postargs)
++ compiler_so_cxx = _osx_support.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 as msg:
+ raise CompileError(msg)
+
+@@ -188,22 +198,16 @@ class UnixCCompiler(CCompiler):
+ 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 += 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 = _osx_support.compiler_fixup(linker, ld_args)
+--
+2.12.2
+
diff --git a/dev-python/pypy3-bin/files/python-3.5-distutils-OO-build.patch b/dev-python/pypy3-bin/files/python-3.5-distutils-OO-build.patch
new file mode 100644
index 000000000000..ff4446662a95
--- /dev/null
+++ b/dev-python/pypy3-bin/files/python-3.5-distutils-OO-build.patch
@@ -0,0 +1,80 @@
+From 90507018442f9adabb586fd3d0a0206b9c2f2f50 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sun, 5 Jun 2016 08:18:01 +0200
+Subject: [PATCH] distutils: make -OO enable both opt-1 and opt-2 optimization
+
+Bug: http://bugs.python.org/issue27226
+Bug: https://bugs.gentoo.org/585060
+---
+ distutils/command/build_py.py | 8 ++++----
+ distutils/command/install_lib.py | 12 ++++++------
+ 2 files changed, 10 insertions(+), 10 deletions(-)
+
+diff --git a/distutils/command/build_py.py b/distutils/command/build_py.py
+index cf0ca57..838d4e4 100644
+--- a/distutils/command/build_py.py
++++ b/distutils/command/build_py.py
+@@ -315,9 +315,9 @@ class build_py (Command):
+ if self.compile:
+ outputs.append(importlib.util.cache_from_source(
+ filename, optimization=''))
+- if self.optimize > 0:
++ for opt in range(1, self.optimize + 1):
+ outputs.append(importlib.util.cache_from_source(
+- filename, optimization=self.optimize))
++ filename, optimization=opt))
+
+ outputs += [
+ os.path.join(build_dir, filename)
+@@ -387,8 +387,8 @@ class build_py (Command):
+ if self.compile:
+ byte_compile(files, optimize=0,
+ force=self.force, prefix=prefix, dry_run=self.dry_run)
+- if self.optimize > 0:
+- byte_compile(files, optimize=self.optimize,
++ for opt in range(1, self.optimize + 1):
++ byte_compile(files, optimize=opt,
+ force=self.force, prefix=prefix, dry_run=self.dry_run)
+
+ class build_py_2to3(build_py, Mixin2to3):
+diff --git a/distutils/command/install_lib.py b/distutils/command/install_lib.py
+index 6154cf0..049b662 100644
+--- a/distutils/command/install_lib.py
++++ b/distutils/command/install_lib.py
+@@ -24,8 +24,8 @@ class install_lib(Command):
+ # 2) compile .pyc only (--compile --no-optimize; default)
+ # 3) compile .pyc and "opt-1" .pyc (--compile --optimize)
+ # 4) compile "opt-1" .pyc only (--no-compile --optimize)
+- # 5) compile .pyc and "opt-2" .pyc (--compile --optimize-more)
+- # 6) compile "opt-2" .pyc only (--no-compile --optimize-more)
++ # 5) compile .pyc, "opt-1" and "opt-2" .pyc (--compile --optimize-more)
++ # 6) compile "opt-1" and "opt-2" .pyc (--no-compile --optimize-more)
+ #
+ # The UI for this is two options, 'compile' and 'optimize'.
+ # 'compile' is strictly boolean, and only decides whether to
+@@ -132,8 +132,8 @@ class install_lib(Command):
+ byte_compile(files, optimize=0,
+ force=self.force, prefix=install_root,
+ dry_run=self.dry_run)
+- if self.optimize > 0:
+- byte_compile(files, optimize=self.optimize,
++ for opt in range(1, self.optimize + 1):
++ byte_compile(files, optimize=opt,
+ force=self.force, prefix=install_root,
+ verbose=self.verbose, dry_run=self.dry_run)
+
+@@ -167,9 +167,9 @@ class install_lib(Command):
+ if self.compile:
+ bytecode_files.append(importlib.util.cache_from_source(
+ py_file, optimization=''))
+- if self.optimize > 0:
++ for opt in range(1, self.optimize + 1):
+ bytecode_files.append(importlib.util.cache_from_source(
+- py_file, optimization=self.optimize))
++ py_file, optimization=opt))
+
+ return bytecode_files
+
+--
+2.8.3
+
diff --git a/dev-python/pypy3-bin/metadata.xml b/dev-python/pypy3-bin/metadata.xml
new file mode 100644
index 000000000000..c1d59c6d4a0e
--- /dev/null
+++ b/dev-python/pypy3-bin/metadata.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>alicef@gentoo.org</email>
+ <name>Alice Ferrazzi</name>
+ </maintainer>
+ <maintainer type="project">
+ <email>python@gentoo.org</email>
+ <name>Python</name>
+ </maintainer>
+ <use>
+ <flag name="shadowstack">Use a shadow stack for finding GC roots</flag>
+ </use>
+ <upstream>
+ <remote-id type="bitbucket">pypy/pypy</remote-id>
+ </upstream>
+</pkgmetadata>
diff --git a/dev-python/pypy3-bin/pypy3-bin-5.5.0_alpha.ebuild b/dev-python/pypy3-bin/pypy3-bin-5.5.0_alpha.ebuild
new file mode 100644
index 000000000000..98c88850bafc
--- /dev/null
+++ b/dev-python/pypy3-bin/pypy3-bin-5.5.0_alpha.ebuild
@@ -0,0 +1,200 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+# some random parts need python 2...
+PYTHON_COMPAT=( python2_7 pypy )
+inherit eutils multilib pax-utils python-any-r1 unpacker versionator
+
+CPY_PATCHSET_VERSION="3.3.5-0"
+BINHOST="https://dev.gentoo.org/~mgorny/dist/pypy3-bin/${PV}"
+
+DESCRIPTION="A fast, compliant alternative implementation of Python 3.3 (binary package)"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="https://bitbucket.org/pypy/pypy/downloads/pypy3.3-v${PV/_/-}-src.tar.bz2
+ https://dev.gentoo.org/~floppym/python-gentoo-patches-${CPY_PATCHSET_VERSION}.tar.xz
+ amd64? (
+ jit? ( shadowstack? (
+ ${BINHOST}/${P}-amd64+bzip2+jit+ncurses+shadowstack.tar.lz
+ ) )
+ jit? ( !shadowstack? (
+ ${BINHOST}/${P}-amd64+bzip2+jit+ncurses.tar.lz
+ ) )
+ !jit? ( !shadowstack? (
+ ${BINHOST}/${P}-amd64+bzip2+ncurses.tar.lz
+ ) )
+ )
+ x86? (
+ cpu_flags_x86_sse2? (
+ jit? ( shadowstack? (
+ ${BINHOST}/${P}-x86+bzip2+jit+ncurses+shadowstack+sse2.tar.lz
+ ) )
+ jit? ( !shadowstack? (
+ ${BINHOST}/${P}-x86+bzip2+jit+ncurses+sse2.tar.lz
+ ) )
+ !jit? ( !shadowstack? (
+ ${BINHOST}/${P}-x86+bzip2+ncurses+sse2.tar.lz
+ ) )
+ )
+ !cpu_flags_x86_sse2? (
+ !jit? ( !shadowstack? (
+ ${BINHOST}/${P}-x86+bzip2+ncurses.tar.lz
+ ) )
+ )
+ )"
+
+# Supported variants
+REQUIRED_USE="!jit? ( !shadowstack )
+ x86? ( !cpu_flags_x86_sse2? ( !jit !shadowstack ) )"
+
+LICENSE="MIT"
+# XX from pypy3-XX.so module suffix
+SLOT="0/55"
+KEYWORDS="~amd64 ~x86"
+IUSE="gdbm +jit +shadowstack sqlite cpu_flags_x86_sse2 test tk"
+
+# yep, world would be easier if people started filling subslots...
+RDEPEND="
+ app-arch/bzip2:0=
+ dev-libs/expat:0=
+ dev-libs/libffi:0=
+ dev-libs/openssl:0=
+ sys-libs/glibc:2.2=
+ sys-libs/ncurses:0/6
+ sys-libs/zlib:0=
+ gdbm? ( sys-libs/gdbm:0= )
+ sqlite? ( dev-db/sqlite:3= )
+ tk? (
+ dev-lang/tk:0=
+ dev-tcltk/tix:0=
+ )
+ !dev-python/pypy3:0"
+DEPEND="${RDEPEND}
+ app-arch/lzip
+ test? ( ${PYTHON_DEPS} )"
+# doc? ( ${PYTHON_DEPS}
+# dev-python/sphinx )
+
+# Who would care about predictable directory names?
+S="${WORKDIR}/pypy3-v${PV%_*}-src"
+
+QA_PREBUILT="
+ usr/lib*/pypy3/pypy-c
+ usr/lib*/pypy3/libpypy-c.so"
+
+src_prepare() {
+ epatch "${FILESDIR}/4.0.0-gentoo-path.patch" \
+ "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
+
+ sed -e "s^@EPREFIX@^${EPREFIX}^" \
+ -e "s^@libdir@^$(get_libdir)^" \
+ -i lib-python/3/distutils/command/install.py || die
+
+ # apply CPython stdlib patches
+ pushd lib-python/3 > /dev/null || die
+ epatch "${FILESDIR}"/5.2.0-distutils-c++.patch \
+ "${WORKDIR}"/patches/24_all_sqlite-3.8.4.patch
+ popd > /dev/null || die
+
+ epatch_user
+}
+
+src_compile() {
+ # Tadaam! PyPy compiled!
+ mv "${WORKDIR}"/${P}*/{libpypy-c.so,pypy-c} . || die
+ mv "${WORKDIR}"/${P}*/include/*.h include/ || die
+ mv pypy/module/cpyext/include/*.h include/ || die
+
+ #use doc && emake -C pypy/doc/ html
+ #needed even without jit :( also needed in both compile and install phases
+ pax-mark m pypy-c libpypy-c.so
+}
+
+src_test() {
+ # (unset)
+ local -x PYTHONDONTWRITEBYTECODE
+
+ # Test runner requires Python 2 too. However, it spawns PyPy3
+ # internally so that we end up testing the correct interpreter.
+ "${PYTHON}" ./pypy/test_all.py --pypy=./pypy-c lib-python || die
+}
+
+src_install() {
+ local dest=/usr/$(get_libdir)/pypy3
+ einfo "Installing PyPy ..."
+ insinto "${dest}"
+ doins -r include lib_pypy lib-python pypy-c libpypy-c.so
+ fperms a+x ${dest}/pypy-c ${dest}/libpypy-c.so
+ pax-mark m "${ED%/}${dest}/pypy-c" "${ED%/}${dest}/libpypy-c.so"
+ dosym ../$(get_libdir)/pypy3/pypy-c /usr/bin/pypy3
+ dodoc README.rst
+
+ if ! use gdbm; then
+ rm -r "${ED%/}${dest}"/lib_pypy/gdbm.py \
+ "${ED%/}${dest}"/lib-python/*3/test/test_gdbm.py || die
+ fi
+ if ! use sqlite; then
+ rm -r "${ED%/}${dest}"/lib-python/*3/sqlite3 \
+ "${ED%/}${dest}"/lib_pypy/_sqlite3.py \
+ "${ED%/}${dest}"/lib-python/*3/test/test_sqlite.py || die
+ fi
+ if ! use tk; then
+ rm -r "${ED%/}${dest}"/lib-python/*3/{idlelib,tkinter} \
+ "${ED%/}${dest}"/lib_pypy/_tkinter \
+ "${ED%/}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
+ fi
+
+ # Install docs
+ #use doc && dohtml -r pypy/doc/_build/html/
+
+ einfo "Generating caches and byte-compiling ..."
+
+ local -x PYTHON=${ED%/}${dest}/pypy-c
+ local -x LD_LIBRARY_PATH="${ED%/}${dest}"
+ # we can't use eclass function since PyPy is dumb and always gives
+ # paths relative to the interpreter
+ local PYTHON_SITEDIR=${EPREFIX}/usr/$(get_libdir)/pypy3/site-packages
+ python_export pypy3 EPYTHON
+
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die
+ python_domodule epython.py
+
+ # 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 modules
+ # Please keep in sync with pypy/tool/build_cffi_imports.py!
+#cffi_build_scripts = {
+# "sqlite3": "_sqlite3_build.py",
+# "audioop": "_audioop_build.py",
+# "tk": "_tkinter/tklib_build.py",
+# "curses": "_curses_build.py" if sys.platform != "win32" else None,
+# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
+# "_gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
+# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
+# "resource": "_resource_build.py" if sys.platform != "win32" else None,
+# "lzma": "_lzma_build.py",
+# "_decimal": "_decimal_build.py",
+ cffi_targets=( audioop curses syslog pwdgrp resource lzma decimal )
+ use gdbm && cffi_targets+=( gdbm )
+ use sqlite && cffi_targets+=( sqlite3 )
+ use tk && cffi_targets+=( tkinter/tklib )
+
+ local t
+ # all modules except tkinter output to .
+ # tkinter outputs to the correct dir ...
+ cd "${ED%/}${dest}"/lib_pypy || die
+ for t in "${cffi_targets[@]}"; do
+ # tkinter doesn't work via -m
+ "${PYTHON}" "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
+ done
+
+ # Cleanup temporary objects
+ find "${ED%/}${dest}" -name "_cffi_*.[co]" -delete || die
+ find "${ED%/}${dest}" -type d -empty -delete || die
+
+ # compile the installed modules
+ python_optimize "${ED%/}${dest}"
+}
diff --git a/dev-python/pypy3-bin/pypy3-bin-5.7.1-r1.ebuild b/dev-python/pypy3-bin/pypy3-bin-5.7.1-r1.ebuild
new file mode 100644
index 000000000000..a69f3049b290
--- /dev/null
+++ b/dev-python/pypy3-bin/pypy3-bin-5.7.1-r1.ebuild
@@ -0,0 +1,171 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+# some random parts need python 2...
+PYTHON_COMPAT=( python2_7 pypy )
+inherit pax-utils python-any-r1 unpacker versionator
+
+BINHOST="https://dev.gentoo.org/~mgorny/dist/pypy3-bin/${PV}"
+MY_P=pypy3-v${PV}
+
+DESCRIPTION="A fast, compliant alternative implementation of Python 3.3 (binary package)"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2
+ amd64? (
+ jit? ( ${BINHOST}/${P}-amd64+bzip2+jit+ncurses.tar.lz )
+ !jit? ( ${BINHOST}/${P}-amd64+bzip2+ncurses.tar.lz )
+ )"
+
+LICENSE="MIT"
+# XX from pypy3-XX.so module suffix
+SLOT="0/57"
+KEYWORDS="~amd64"
+IUSE="gdbm +jit sqlite test tk"
+
+# yep, world would be easier if people started filling subslots...
+RDEPEND="
+ app-arch/bzip2:0=
+ dev-libs/expat:0=
+ dev-libs/libffi:0=
+ dev-libs/openssl:0=[-bindist]
+ sys-libs/glibc:2.2=
+ sys-libs/ncurses:0/6
+ sys-libs/zlib:0=
+ gdbm? ( sys-libs/gdbm:0= )
+ sqlite? ( dev-db/sqlite:3= )
+ tk? (
+ dev-lang/tk:0=
+ dev-tcltk/tix:0=
+ )
+ !dev-python/pypy3:0"
+DEPEND="${RDEPEND}
+ app-arch/lzip
+ app-arch/xz-utils
+ test? ( ${PYTHON_DEPS} )"
+# doc? ( ${PYTHON_DEPS}
+# dev-python/sphinx )
+
+S=${WORKDIR}/${MY_P}-src
+
+QA_PREBUILT="
+ usr/lib*/pypy3/pypy3-c
+ usr/lib*/pypy3/libpypy3-c.so"
+
+src_prepare() {
+ eapply "${FILESDIR}/4.0.0-gentoo-path.patch"
+ eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
+
+ sed -e "s^@EPREFIX@^${EPREFIX}^" \
+ -e "s^@libdir@^$(get_libdir)^" \
+ -i lib-python/3/distutils/command/install.py || die
+
+ # apply CPython stdlib patches
+ pushd lib-python/3 > /dev/null || die
+ eapply "${FILESDIR}"/5.7.1_all_distutils_cxx.patch
+ eapply "${FILESDIR}"/python-3.5-distutils-OO-build.patch
+ popd > /dev/null || die
+
+ eapply_user
+}
+
+src_compile() {
+ # Tadaam! PyPy compiled!
+ mv "${WORKDIR}"/${P}*/{libpypy3-c.so,pypy3-c} . || die
+ mv "${WORKDIR}"/${P}*/include/*.h include/ || die
+ mv pypy/module/cpyext/include/*.h include/ || die
+ mv pypy/module/cpyext/parse/*.h include/ || die
+
+ #use doc && emake -C pypy/doc/ html
+ #needed even without jit :( also needed in both compile and install phases
+ pax-mark m pypy3-c libpypy3-c.so
+}
+
+src_test() {
+ # (unset)
+ local -x PYTHONDONTWRITEBYTECODE
+
+ # Test runner requires Python 2 too. However, it spawns PyPy3
+ # internally so that we end up testing the correct interpreter.
+ "${PYTHON}" ./pypy/test_all.py --pypy=./pypy3-c lib-python || die
+}
+
+src_install() {
+ local dest=/usr/$(get_libdir)/pypy3
+ einfo "Installing PyPy ..."
+ insinto "${dest}"
+ doins -r include lib_pypy lib-python pypy3-c libpypy3-c.so
+ fperms a+x ${dest}/pypy3-c ${dest}/libpypy3-c.so
+ pax-mark m "${ED%/}${dest}/pypy3-c" "${ED%/}${dest}/libpypy3-c.so"
+ dosym ../$(get_libdir)/pypy3/pypy3-c /usr/bin/pypy3
+ dodoc README.rst
+
+ if ! use gdbm; then
+ rm -r "${ED%/}${dest}"/lib_pypy/_gdbm* || die
+ fi
+ if ! use sqlite; then
+ rm -r "${ED%/}${dest}"/lib-python/*3/sqlite3 \
+ "${ED%/}${dest}"/lib_pypy/_sqlite3* \
+ "${ED%/}${dest}"/lib-python/*3/test/test_sqlite.py || die
+ fi
+ if ! use tk; then
+ rm -r "${ED%/}${dest}"/lib-python/*3/{idlelib,tkinter} \
+ "${ED%/}${dest}"/lib_pypy/_tkinter \
+ "${ED%/}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
+ fi
+
+ # Install docs
+ #use doc && dodoc -r pypy/doc/_build/html
+
+ einfo "Generating caches and byte-compiling ..."
+
+ local -x PYTHON=${ED%/}${dest}/pypy3-c
+ local -x LD_LIBRARY_PATH="${ED%/}${dest}"
+ # we can't use eclass function since PyPy is dumb and always gives
+ # paths relative to the interpreter
+ local PYTHON_SITEDIR=${EPREFIX}/usr/$(get_libdir)/pypy3/site-packages
+ python_export pypy3 EPYTHON
+
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die
+ python_domodule epython.py
+
+ # 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 modules
+ # Please keep in sync with pypy/tool/build_cffi_imports.py!
+#cffi_build_scripts = {
+# "sqlite3": "_sqlite3_build.py",
+# "audioop": "_audioop_build.py",
+# "tk": "_tkinter/tklib_build.py",
+# "curses": "_curses_build.py" if sys.platform != "win32" else None,
+# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
+# "_gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
+# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
+# "resource": "_resource_build.py" if sys.platform != "win32" else None,
+# "lzma": "_lzma_build.py",
+# "_decimal": "_decimal_build.py",
+# "ssl": "_ssl_build.py",
+ cffi_targets=( audioop curses syslog pwdgrp resource lzma decimal ssl )
+ use gdbm && cffi_targets+=( gdbm )
+ use sqlite && cffi_targets+=( sqlite3 )
+ use tk && cffi_targets+=( tkinter/tklib )
+
+ local t
+ # all modules except tkinter output to .
+ # tkinter outputs to the correct dir ...
+ cd "${ED%/}${dest}"/lib_pypy || die
+ for t in "${cffi_targets[@]}"; do
+ # tkinter doesn't work via -m
+ "${PYTHON}" "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
+ done
+
+ # Cleanup temporary objects
+ find "${ED%/}${dest}" -name "_cffi_*.[co]" -delete || die
+ find "${ED%/}${dest}" -type d -empty -delete || die
+
+ # compile the installed modules
+ python_optimize "${ED%/}${dest}"
+}
diff --git a/dev-python/pypy3-bin/pypy3-bin-5.8.0-r1.ebuild b/dev-python/pypy3-bin/pypy3-bin-5.8.0-r1.ebuild
new file mode 100644
index 000000000000..17abeccf908b
--- /dev/null
+++ b/dev-python/pypy3-bin/pypy3-bin-5.8.0-r1.ebuild
@@ -0,0 +1,171 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+# some random parts need python 2...
+PYTHON_COMPAT=( python2_7 pypy )
+inherit pax-utils python-any-r1 unpacker versionator
+
+BINHOST="https://dev.gentoo.org/~mgorny/dist/pypy3-bin/${PV}"
+MY_P=pypy3-v${PV}
+
+DESCRIPTION="A fast, compliant alternative implementation of Python 3.3 (binary package)"
+HOMEPAGE="http://pypy.org/"
+SRC_URI="https://bitbucket.org/pypy/pypy/downloads/${MY_P}-src.tar.bz2
+ amd64? (
+ jit? ( ${BINHOST}/${P}-amd64+bzip2+jit+ncurses.tar.lz )
+ !jit? ( ${BINHOST}/${P}-amd64+bzip2+ncurses.tar.lz )
+ )"
+
+LICENSE="MIT"
+# XX from pypy3-XX.so module suffix
+SLOT="0/58"
+KEYWORDS="~amd64"
+IUSE="gdbm +jit sqlite test tk"
+
+# yep, world would be easier if people started filling subslots...
+RDEPEND="
+ app-arch/bzip2:0=
+ dev-libs/expat:0=
+ dev-libs/libffi:0=
+ dev-libs/openssl:0=[-bindist]
+ sys-libs/glibc:2.2=
+ sys-libs/ncurses:0/6
+ sys-libs/zlib:0=
+ gdbm? ( sys-libs/gdbm:0= )
+ sqlite? ( dev-db/sqlite:3= )
+ tk? (
+ dev-lang/tk:0=
+ dev-tcltk/tix:0=
+ )
+ !dev-python/pypy3:0"
+DEPEND="${RDEPEND}
+ app-arch/lzip
+ app-arch/xz-utils
+ test? ( ${PYTHON_DEPS} )"
+# doc? ( ${PYTHON_DEPS}
+# dev-python/sphinx )
+
+S=${WORKDIR}/${MY_P}-src
+
+QA_PREBUILT="
+ usr/lib*/pypy3/pypy3-c
+ usr/lib*/pypy3/libpypy3-c.so"
+
+src_prepare() {
+ eapply "${FILESDIR}/4.0.0-gentoo-path.patch"
+ eapply "${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch"
+
+ sed -e "s^@EPREFIX@^${EPREFIX}^" \
+ -e "s^@libdir@^$(get_libdir)^" \
+ -i lib-python/3/distutils/command/install.py || die
+
+ # apply CPython stdlib patches
+ pushd lib-python/3 > /dev/null || die
+ eapply "${FILESDIR}"/5.8.0_all_distutils_cxx.patch
+ eapply "${FILESDIR}"/python-3.5-distutils-OO-build.patch
+ popd > /dev/null || die
+
+ eapply_user
+}
+
+src_compile() {
+ # Tadaam! PyPy compiled!
+ mv "${WORKDIR}"/${P}*/{libpypy3-c.so,pypy3-c} . || die
+ mv "${WORKDIR}"/${P}*/include/*.h include/ || die
+ mv pypy/module/cpyext/include/*.h include/ || die
+ mv pypy/module/cpyext/parse/*.h include/ || die
+
+ #use doc && emake -C pypy/doc/ html
+ #needed even without jit :( also needed in both compile and install phases
+ pax-mark m pypy3-c libpypy3-c.so
+}
+
+src_test() {
+ # (unset)
+ local -x PYTHONDONTWRITEBYTECODE
+
+ # Test runner requires Python 2 too. However, it spawns PyPy3
+ # internally so that we end up testing the correct interpreter.
+ "${PYTHON}" ./pypy/test_all.py --pypy=./pypy3-c lib-python || die
+}
+
+src_install() {
+ local dest=/usr/$(get_libdir)/pypy3
+ einfo "Installing PyPy ..."
+ insinto "${dest}"
+ doins -r include lib_pypy lib-python pypy3-c libpypy3-c.so
+ fperms a+x ${dest}/pypy3-c ${dest}/libpypy3-c.so
+ pax-mark m "${ED%/}${dest}/pypy3-c" "${ED%/}${dest}/libpypy3-c.so"
+ dosym ../$(get_libdir)/pypy3/pypy3-c /usr/bin/pypy3
+ dodoc README.rst
+
+ if ! use gdbm; then
+ rm -r "${ED%/}${dest}"/lib_pypy/_gdbm* || die
+ fi
+ if ! use sqlite; then
+ rm -r "${ED%/}${dest}"/lib-python/*3/sqlite3 \
+ "${ED%/}${dest}"/lib_pypy/_sqlite3* \
+ "${ED%/}${dest}"/lib-python/*3/test/test_sqlite.py || die
+ fi
+ if ! use tk; then
+ rm -r "${ED%/}${dest}"/lib-python/*3/{idlelib,tkinter} \
+ "${ED%/}${dest}"/lib_pypy/_tkinter \
+ "${ED%/}${dest}"/lib-python/*3/test/test_{tcl,tk,ttk*}.py || die
+ fi
+
+ # Install docs
+ #use doc && dodoc -r pypy/doc/_build/html
+
+ einfo "Generating caches and byte-compiling ..."
+
+ local -x PYTHON=${ED%/}${dest}/pypy3-c
+ local -x LD_LIBRARY_PATH="${ED%/}${dest}"
+ # we can't use eclass function since PyPy is dumb and always gives
+ # paths relative to the interpreter
+ local PYTHON_SITEDIR=${EPREFIX}/usr/$(get_libdir)/pypy3/site-packages
+ python_export pypy3 EPYTHON
+
+ echo "EPYTHON='${EPYTHON}'" > epython.py || die
+ python_domodule epython.py
+
+ # 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 modules
+ # Please keep in sync with pypy/tool/build_cffi_imports.py!
+#cffi_build_scripts = {
+# "sqlite3": "_sqlite3_build.py",
+# "audioop": "_audioop_build.py",
+# "tk": "_tkinter/tklib_build.py",
+# "curses": "_curses_build.py" if sys.platform != "win32" else None,
+# "syslog": "_syslog_build.py" if sys.platform != "win32" else None,
+# "_gdbm": "_gdbm_build.py" if sys.platform != "win32" else None,
+# "pwdgrp": "_pwdgrp_build.py" if sys.platform != "win32" else None,
+# "resource": "_resource_build.py" if sys.platform != "win32" else None,
+# "lzma": "_lzma_build.py",
+# "_decimal": "_decimal_build.py",
+# "ssl": "_ssl_build.py",
+ cffi_targets=( audioop curses syslog pwdgrp resource lzma decimal ssl )
+ use gdbm && cffi_targets+=( gdbm )
+ use sqlite && cffi_targets+=( sqlite3 )
+ use tk && cffi_targets+=( tkinter/tklib )
+
+ local t
+ # all modules except tkinter output to .
+ # tkinter outputs to the correct dir ...
+ cd "${ED%/}${dest}"/lib_pypy || die
+ for t in "${cffi_targets[@]}"; do
+ # tkinter doesn't work via -m
+ "${PYTHON}" "_${t}_build.py" || die "Failed to build CFFI bindings for ${t}"
+ done
+
+ # Cleanup temporary objects
+ find "${ED%/}${dest}" -name "_cffi_*.[co]" -delete || die
+ find "${ED%/}${dest}" -type d -empty -delete || die
+
+ # compile the installed modules
+ python_optimize "${ED%/}${dest}"
+}