public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] dev/mgorny:master commit in: dev-python/pypy-binpackage/, dev-python/pypy-binpackage/files/
Date: Wed,  5 Nov 2014 22:20:19 +0000 (UTC)	[thread overview]
Message-ID: <1415224887.611b64c24de9a5825b457228d426cab8dd4de9c6.mgorny@gentoo> (raw)

commit:     611b64c24de9a5825b457228d426cab8dd4de9c6
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Nov  5 22:01:27 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Nov  5 22:01:27 2014 +0000
URL:        http://sources.gentoo.org/gitweb/?p=dev/mgorny.git;a=commit;h=611b64c2

dev-python/pypy-binpackage: Update to match current dev-python/pypy code.

Package-Manager: portage-2.2.14

---
 .../pypy-binpackage/files/2.3.1-shared-lib.patch   | 11 ++++
 dev-python/pypy-binpackage/metadata.xml            |  1 +
 ....3.1.ebuild => pypy-binpackage-2.3.1-r1.ebuild} | 63 +++++++++++++++++++---
 3 files changed, 68 insertions(+), 7 deletions(-)

diff --git a/dev-python/pypy-binpackage/files/2.3.1-shared-lib.patch b/dev-python/pypy-binpackage/files/2.3.1-shared-lib.patch
new file mode 100644
index 0000000..ae1139f
--- /dev/null
+++ b/dev-python/pypy-binpackage/files/2.3.1-shared-lib.patch
@@ -0,0 +1,11 @@
+--- rpython/translator/platform/posix.py
++++ rpython/translator/platform/posix.py
+@@ -180,7 +180,7 @@
+                    'int main(int argc, char* argv[]) '
+                    '{ return $(PYPY_MAIN_FUNCTION)(argc, argv); }" > $@')
+             m.rule('$(DEFAULT_TARGET)', ['$(TARGET)', 'main.o'],
+-                   '$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) -o $@')
++                   '$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) \'-Wl,-rpath,$$ORIGIN\' -o $@')
+ 
+         return m
+ 

diff --git a/dev-python/pypy-binpackage/metadata.xml b/dev-python/pypy-binpackage/metadata.xml
index 6fb4588..675ce03 100644
--- a/dev-python/pypy-binpackage/metadata.xml
+++ b/dev-python/pypy-binpackage/metadata.xml
@@ -7,6 +7,7 @@
 		<name>Michał Górny</name>
 	</maintainer>
 	<use>
+		<flag name="low-memory">Build using PyPy with the engine configured towards low memory footprint. This makes it possible to build PyPy using ~3.5G of RAM on amd64 and ~half of that on x86, at the cost of lengthened build time. Please note that you will need an extra ~1G of extra RAM or swap since the translation memory (unused at the time) is not freed when the C compiler is spawned.</flag>
 		<flag name="sandbox">Enable sandboxing functionality</flag>
 		<flag name="shadowstack">Use a shadow stack for finding GC roots</flag>
 	</use>

diff --git a/dev-python/pypy-binpackage/pypy-binpackage-2.3.1.ebuild b/dev-python/pypy-binpackage/pypy-binpackage-2.3.1-r1.ebuild
similarity index 65%
rename from dev-python/pypy-binpackage/pypy-binpackage-2.3.1.ebuild
rename to dev-python/pypy-binpackage/pypy-binpackage-2.3.1-r1.ebuild
index fb30bcf..e495b29 100644
--- a/dev-python/pypy-binpackage/pypy-binpackage-2.3.1.ebuild
+++ b/dev-python/pypy-binpackage/pypy-binpackage-2.3.1-r1.ebuild
@@ -16,7 +16,7 @@ SRC_URI="https://bitbucket.org/${PN}/${PN}/get/release-${PV}.tar.bz2 -> ${MY_P}-
 LICENSE="MIT"
 SLOT="0/$(get_version_component_range 1-2 ${PV})"
 KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
-IUSE="bzip2 +jit ncurses sandbox shadowstack sse2"
+IUSE="bzip2 +jit low-memory ncurses sandbox shadowstack sse2"
 
 DEPEND=">=sys-libs/zlib-1.1.3
 	virtual/libffi
@@ -31,16 +31,55 @@ DEPEND=">=sys-libs/zlib-1.1.3
 S="${WORKDIR}/${MY_P}-src"
 
 pkg_pretend() {
-	CHECKREQS_MEMORY="2G"
-	use amd64 && CHECKREQS_MEMORY="4G"
+	if use low-memory; then
+		if ! has_version dev-python/pypy && ! has_version dev-python/pypy-bin
+		then
+			eerror "USE=low-memory requires a (possibly old) version of dev-python/pypy"
+			eerror "or dev-python/pypy-bin being installed. Please install it using e.g.:"
+			eerror
+			eerror "  $ emerge -1v dev-python/pypy-bin"
+			eerror
+			eerror "before attempting to build dev-python/pypy[low-memory]."
+			die "dev-python/pypy-bin (or dev-python/pypy) needs to be installed for USE=low-memory"
+		fi
+
+		CHECKREQS_MEMORY="1750M"
+		use amd64 && CHECKREQS_MEMORY="3500M"
+	else
+		CHECKREQS_MEMORY="3G"
+		use amd64 && CHECKREQS_MEMORY="6G"
+	fi
+
 	check-reqs_pkg_pretend
 
 	[[ ${PYPY_BINPKG_STORE} ]] || die 'PYPY_BINPKG_STORE unset, wtf?!'
 }
 
 pkg_setup() {
+	local force_pypy
+
 	pkg_pretend
-	python-any-r1_pkg_setup
+
+	if has_version dev-python/pypy || has_version dev-python/pypy-bin
+	then
+		if [[ ! ${EPYTHON} ]] || use low-memory; then
+			einfo "Using already-installed PyPy to perform the translation."
+			force_pypy=1
+		else
+			einfo "Using ${EPYTHON} to perform the translation. Please note that upstream"
+			einfo "recommends using PyPy for that. If you wish to do so, please unset"
+			einfo "the EPYTHON variable."
+		fi
+	fi
+
+	if [[ ${force_pypy} ]]; then
+		# set manually since python_setup needs virtual/pypy
+		# and we don't force the dep
+		python_export pypy EPYTHON PYTHON
+		python_wrapper_setup
+	else
+		python-any-r1_pkg_setup
+	fi
 
 	local cpu
 	if use amd64; then
@@ -66,8 +105,9 @@ 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}/1.9-scripts-location.patch" \
+		"${FILESDIR}/1.9-distutils.unixccompiler.UnixCCompiler.runtime_library_dir_option.patch" \
+		"${FILESDIR}"/2.3.1-shared-lib.patch	# 517002
 
 	pushd lib-python/2.7 > /dev/null || die
 	epatch "${FILESDIR}/2.3-21_all_distutils_c++.patch"
@@ -127,9 +167,18 @@ src_compile() {
 		)
 	done
 
-	set -- "${PYTHON}" rpython/bin/rpython --batch "${args[@]}"
+	local interp=( "${PYTHON}" )
+	if use low-memory; then
+		interp=( env PYPY_GC_MAX_DELTA=200MB
+			"${PYTHON}" --jit loop_longevity=300 )
+	fi
+
+	set -- "${interp[@]}" rpython/bin/rpython --batch "${args[@]}"
 	echo -e "\033[1m${@}\033[0m"
 	"${@}" || die "compile error"
+
+	use doc && emake -C pypy/doc/ html
+	pax-mark m "${ED%/}${INSDESTTREE}/pypy-c"
 }
 
 src_install() {


             reply	other threads:[~2014-11-05 22:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-05 22:20 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-06-30  8:46 [gentoo-commits] dev/mgorny:master commit in: dev-python/pypy-binpackage/, dev-python/pypy-binpackage/files/ Michał Górny
2014-03-30 13:19 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415224887.611b64c24de9a5825b457228d426cab8dd4de9c6.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox