dev-ruby/posix-spawn: fix compilation on x86
authorHans de Graaff <graaff@gentoo.org>
Mon, 11 Jun 2018 17:18:06 +0000 (19:18 +0200)
committerHans de Graaff <graaff@gentoo.org>
Mon, 11 Jun 2018 17:18:06 +0000 (19:18 +0200)
Closes: https://bugs.gentoo.org/657806
Package-Manager: Portage-2.3.40, Repoman-2.3.9

dev-ruby/posix-spawn/files/posix-spawn-0.3.13-x86.patch [new file with mode: 0644]
dev-ruby/posix-spawn/posix-spawn-0.3.13-r1.ebuild [new file with mode: 0644]

diff --git a/dev-ruby/posix-spawn/files/posix-spawn-0.3.13-x86.patch b/dev-ruby/posix-spawn/files/posix-spawn-0.3.13-x86.patch
new file mode 100644 (file)
index 0000000..b96579b
--- /dev/null
@@ -0,0 +1,23 @@
+From 5201e921a788fbb97f14ea0c617a2213dc3da1ca Mon Sep 17 00:00:00 2001
+From: Pascal Terjan <pterjan@google.com>
+Date: Sun, 20 Aug 2017 12:13:15 +0100
+Subject: [PATCH] Fix build when SIZEOF_INT == SIZEOF_LONG
+
+Signed-off-by: Aman Gupta <aman@tmm1.net>
+---
+ ext/posix-spawn.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/ext/posix-spawn.c b/ext/posix-spawn.c
+index 1659bed..2e4c4de 100644
+--- a/ext/posix-spawn.c
++++ b/ext/posix-spawn.c
+@@ -61,7 +61,7 @@ posixspawn_obj_to_fd(VALUE obj)
+                        * rb_fix2int takes care of raising if the provided object is a
+                        * Bignum and is out of range of an int
+                        */
+-                      fd = (int)rb_fix2int(obj);
++                      fd = FIX2INT(obj);
+                       break;
+               case T_SYMBOL:
diff --git a/dev-ruby/posix-spawn/posix-spawn-0.3.13-r1.ebuild b/dev-ruby/posix-spawn/posix-spawn-0.3.13-r1.ebuild
new file mode 100644 (file)
index 0000000..e9cd83e
--- /dev/null
@@ -0,0 +1,37 @@
+# Copyright 1999-2018 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+USE_RUBY="ruby23 ruby24 ruby25"
+
+RUBY_FAKEGEM_TASK_DOC=""
+RUBY_FAKEGEM_EXTRADOC="README.md TODO HACKING"
+
+inherit ruby-fakegem
+
+DESCRIPTION="Library that implements a subset of the Ruby 1.9 Process::spawn"
+HOMEPAGE="https://github.com/rtomayko/posix-spawn/"
+
+KEYWORDS="~amd64"
+
+LICENSE="MIT LGPL-2.1"
+SLOT="0"
+IUSE="test"
+
+all_ruby_prepare() {
+       eapply "${FILESDIR}/${P}-x86.patch"
+}
+
+each_ruby_configure() {
+       ${RUBY} -Cext extconf.rb || die
+}
+
+each_ruby_compile() {
+       emake V=1 -Cext
+       cp ext/*$(get_modname) lib/ || die
+}
+
+each_ruby_test() {
+       ${RUBY} -Ilib:.:test -e 'Dir["test/test_*.rb"].each {|f| require f}' || die
+}