summaryrefslogtreecommitdiff
path: root/dev-ruby/ffi
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2022-10-23 03:49:35 +0100
committerV3n3RiX <venerix@koprulu.sector>2022-10-23 03:49:35 +0100
commit850d399c4f1568d3c6d013d7f4e2e371c0118bd6 (patch)
tree37fe91f80d4b072d27976558c05df3503c196e85 /dev-ruby/ffi
parent7b77dd2858b06e4a9367ca16d4c24aacb119b142 (diff)
gentoo auto-resync : 23:10:2022 - 03:49:35
Diffstat (limited to 'dev-ruby/ffi')
-rw-r--r--dev-ruby/ffi/Manifest3
-rw-r--r--dev-ruby/ffi/ffi-1.15.5-r1.ebuild71
-rw-r--r--dev-ruby/ffi/files/backport-pr-962.patch48
-rw-r--r--dev-ruby/ffi/files/pr-957-sparc.patch42
4 files changed, 164 insertions, 0 deletions
diff --git a/dev-ruby/ffi/Manifest b/dev-ruby/ffi/Manifest
index 354fe9d86d96..5aff438ef78a 100644
--- a/dev-ruby/ffi/Manifest
+++ b/dev-ruby/ffi/Manifest
@@ -1,6 +1,9 @@
+AUX backport-pr-962.patch 1773 BLAKE2B b4eb227a949136143a98e8a5ed9067599d3a4ec14376c52619e2f3db56906ed028f9be889aa6eea5abe7e7ca9c3196208ede7dc5768cba43ecf9d000f1e3e1da SHA512 dc6a17bccde42b3a64e7de3bed5fe0818a4bfe9e109b665ccf06963a4939fec2a77e3fcff073cf3a4feccb68d3dc05bbb4885ebe53c2060965e114041c9e3ce5
AUX ffi-1.14.2-32bit-long-double.patch 701 BLAKE2B d8a3f2a00f8b93f42953bf5317cf6ae45ed662c81b993f83b728125d6fae15c6f75d11e0f76b0f46912b1c52c849764d3393a09c3ac1e35f3557e97bd3662364 SHA512 9cfe4e1c80e08c672eee30fe3b170d667e72cc2e047f4edd1e9573bfe6d4dca315a84baa54855756631f90c04fee59a417f286df95662f6abcfd3728c1b1a4d7
+AUX pr-957-sparc.patch 1681 BLAKE2B e08a03d5e054ce030c04cb0645ed2683faa9d0ec8782313464112e3dd3adf0b8ee40f7fbea9aec15ee7590189e93f03617fe06b506e2ea049535e48bc33a8f23 SHA512 32bd488a3cc4b0c81d8f7f9f2875e591b8de7bf741b838aab3f20ea64025984b3d83c393e1e8f0b628f009b2473d381139655f965cc746dc9074cbe57171cb7d
DIST ffi-git-1.14.2.tgz 165100 BLAKE2B 598d1771860a7884f8dc6a4cf0006cb42f741308bdd01720d7ea4b63690d42ff6e93f2d48de7132f5d82b275b30672b0bf1ac586b713994b68e98da4cf71a481 SHA512 20fffab047d810ddea1d4d2b66a563adf5787a0602a26cc59724090d393852ae57464a8c7b5a47ca0534efc453bb06d2f8fbf00a203a7060cd3ac78b683119f5
DIST ffi-git-1.15.5.tgz 168139 BLAKE2B 2ddd5bd7bfb7bcd39b6d740cbb1e0f4cd419ce6cb4ec12926f91f254b3f3142bc6166728a81a6f23dccfbf7aec911c63237c20fb0e2c70d30d48f4648e352585 SHA512 3668bafae936bf5010f014fbcf63258b023bcc318882775e7d2fcfc11334722ec2b6e8a8b9c910d406889fb173dd503c5c13f5af8e4f6927921f12f688461707
EBUILD ffi-1.14.2-r1.ebuild 1635 BLAKE2B ef999eedbb4c80ef9d64e04c21f7b8abdf390bf1189fd4c24683934930323fd71cefd70d734c76e8b908473d5167463a3da73b1bfbb2d15ddbbca6f4214b30c5 SHA512 fb9af61383048819156d2a2919c487a41bc30e67a4bf6602cd6e9c9383e63ae001f8c26c3b4562bf011234c4d16b187d418ff667ac17126ac9f265dcafdfb84e
+EBUILD ffi-1.15.5-r1.ebuild 1813 BLAKE2B d9ad8b311eacb12ae1af340d4bbd25784fea999f2bbf2b465f67910dedf3892d2900e479980c2afdbd64b80a5d36884faad6cc3a8cde1c1850526b062a735178 SHA512 f03fdfb9315896ebf50d776114c0391308ec477aa6ad946e0d55c65beedac015d2be95f0660a41a4c4cc75017e80e13c1b98384d6a3ddc39c33195e80babdf78
EBUILD ffi-1.15.5.ebuild 1679 BLAKE2B 0f21e74f3843306c7416d8b11e43ec8ab279ea1f79662d50a77b8a430806d6d526ca529b13017130f05f1ce2709d3a90b8f4a8efce5231dfd96ca944a0866d5d SHA512 460791276a6e6d158e041a9b57aba47a7535095e6e4f776d8a883d5d8b7e08c61f346ca7b5cc9180d0d4143e4967043a6c96f02a097719195034b81ee4c412ce
MISC metadata.xml 334 BLAKE2B 02ad2c909797d4aaf2a23497611777a790000683866cfbd9d12c4b19cca6de902e219584c4edc85c46b4b0dc51c63e770506a077a4c1052b46f8df19a9588c15 SHA512 e72dc6ce177ad3881f5465f10cd44ca6740b7603ab4e55cfa9e6088be3c6615abeefaee4b717e76fab2850c64d66eee626115544e10709f64c4187f1987bcfe3
diff --git a/dev-ruby/ffi/ffi-1.15.5-r1.ebuild b/dev-ruby/ffi/ffi-1.15.5-r1.ebuild
new file mode 100644
index 000000000000..98c573a70b41
--- /dev/null
+++ b/dev-ruby/ffi/ffi-1.15.5-r1.ebuild
@@ -0,0 +1,71 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+USE_RUBY="ruby26 ruby27 ruby30 ruby31"
+
+RUBY_FAKEGEM_RECIPE_TEST="rspec3"
+
+RUBY_FAKEGEM_DOCDIR="doc"
+RUBY_FAKEGEM_EXTRADOC="README.md"
+
+RUBY_FAKEGEM_GEMSPEC="ffi.gemspec"
+
+RUBY_FAKEGEM_EXTENSIONS=(ext/ffi_c/extconf.rb)
+
+inherit ruby-fakegem toolchain-funcs
+
+DESCRIPTION="Ruby extension for programmatically loading dynamic libraries"
+HOMEPAGE="https://wiki.github.com/ffi/ffi"
+
+SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${PN}-git-${PV}.tgz"
+
+IUSE=""
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="amd64 arm arm64 ~hppa ~loong ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+PATCHES=(
+ "${FILESDIR}/backport-pr-962.patch"
+ "${FILESDIR}/pr-957-sparc.patch" # submitted upstream as https://github.com/ffi/ffi/pull/957
+)
+
+RDEPEND+=" dev-libs/libffi:="
+DEPEND+=" dev-libs/libffi:="
+
+ruby_add_bdepend "dev-ruby/rake"
+
+all_ruby_prepare() {
+ sed -i -e '/tasks/ s:^:#:' \
+ -e '/Gem::Tasks/,/end/ s:^:#:' Rakefile || die
+
+ sed -e '/require/c\require "./lib/ffi/version"' \
+ -e 's/git ls-files -z/find * -print0/' \
+ -e '/^ lfs/,/^ end/ s:^:#:' \
+ -i ${RUBY_FAKEGEM_GEMSPEC} || die
+
+ # Fix Makefile for tests
+ sed -i -e '/CCACHE :=/ s:^:#:' \
+ -e 's/-O2//' \
+ -e 's/^CFLAGS =/CFLAGS +=/' spec/ffi/fixtures/GNUmakefile || die
+
+ # Remove bundled version of libffi.
+ rm -rf ext/ffi_c/libffi || die
+}
+
+each_ruby_compile() {
+ each_fakegem_compile
+
+ ${RUBY} -S rake -f gen/Rakefile || die "types.conf generation failed"
+}
+
+each_ruby_test() {
+ CC=$(tc-getCC) CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}" ${RUBY} -S rspec spec || die
+}
+
+all_ruby_install() {
+ all_fakegem_install
+
+ docinto examples
+ dodoc samples/*
+}
diff --git a/dev-ruby/ffi/files/backport-pr-962.patch b/dev-ruby/ffi/files/backport-pr-962.patch
new file mode 100644
index 000000000000..708c52025bd5
--- /dev/null
+++ b/dev-ruby/ffi/files/backport-pr-962.patch
@@ -0,0 +1,48 @@
+From edc54894f77d00c4ca34593c8b4c94f656f5807e Mon Sep 17 00:00:00 2001
+From: Frederick Cheung <frederick.cheung@gmail.com>
+Date: Fri, 17 Jun 2022 18:57:28 +0100
+Subject: [PATCH] Fix Pointer#initialize using NUM2LL instead of NUM2ULL
+
+If the high bit of the address was set this would raise RangeError
+(bignum too big to convert into long long). This is not uncommon on
+platforms that use the high bits of pointers for purposes such as
+pointer authentication
+
+This also now matches Pointer#address which uses ULL2NUM.
+---
+ ext/ffi_c/Pointer.c | 2 +-
+ spec/ffi/pointer_spec.rb | 8 ++++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/ext/ffi_c/Pointer.c b/ext/ffi_c/Pointer.c
+index 153fff101..79886811f 100644
+--- a/ext/ffi_c/Pointer.c
++++ b/ext/ffi_c/Pointer.c
+@@ -112,7 +112,7 @@ ptr_initialize(int argc, VALUE* argv, VALUE self)
+ switch (TYPE(rbAddress)) {
+ case T_FIXNUM:
+ case T_BIGNUM:
+- p->memory.address = (void*) (uintptr_t) NUM2LL(rbAddress);
++ p->memory.address = (void*) (uintptr_t) NUM2ULL(rbAddress);
+ p->memory.size = LONG_MAX;
+ if (p->memory.address == NULL) {
+ p->memory.flags = 0;
+diff --git a/spec/ffi/pointer_spec.rb b/spec/ffi/pointer_spec.rb
+index b216a161d..7a2ac1565 100644
+--- a/spec/ffi/pointer_spec.rb
++++ b/spec/ffi/pointer_spec.rb
+@@ -237,6 +237,14 @@ def to_ptr
+ expect(FFI::Pointer.new(0).slice(0, 10).size_limit?).to be true
+ end
+ end
++
++ describe "#initialise" do
++ it 'can use adresses with high bit set' do
++ max_address = 2**FFI::Platform::ADDRESS_SIZE - 1
++ pointer = FFI::Pointer.new(:uint8, max_address)
++ expect(pointer.address).to eq(max_address)
++ end
++ end
+ end
+
+ describe "AutoPointer" do
diff --git a/dev-ruby/ffi/files/pr-957-sparc.patch b/dev-ruby/ffi/files/pr-957-sparc.patch
new file mode 100644
index 000000000000..b68b5e06a7d4
--- /dev/null
+++ b/dev-ruby/ffi/files/pr-957-sparc.patch
@@ -0,0 +1,42 @@
+From 241b10322283743b79c9489993bfb964b5167f7f Mon Sep 17 00:00:00 2001
+From: matoro <matoro@users.noreply.github.com>
+Date: Wed, 25 May 2022 14:23:55 -0400
+Subject: [PATCH 1/2] Rename sparc64-linux -> sparcv9-linux
+
+In https://github.com/ffi/ffi/pull/575, 64-bit sparc was changed to also
+use sparcv9 as the platform name, but the types.conf directory was never
+renamed. This breaks only on Ruby 3.0 and later due to the fileutils
+change to use keyword arguments in
+https://github.com/ruby/fileutils/commit/482de6d397742526d1111576e2791f9b7051e3c0
+---
+ lib/ffi/platform/{sparc64-linux => sparcv9-linux}/types.conf | 0
+ 1 file changed, 0 insertions(+), 0 deletions(-)
+ rename lib/ffi/platform/{sparc64-linux => sparcv9-linux}/types.conf (100%)
+
+diff --git a/lib/ffi/platform/sparc64-linux/types.conf b/lib/ffi/platform/sparcv9-linux/types.conf
+similarity index 100%
+rename from lib/ffi/platform/sparc64-linux/types.conf
+rename to lib/ffi/platform/sparcv9-linux/types.conf
+
+From 76dc5c7d69a445268f47f5b6a9185e644bcd68e8 Mon Sep 17 00:00:00 2001
+From: matoro <matoro@users.noreply.github.com>
+Date: Mon, 13 Jun 2022 22:56:26 -0400
+Subject: [PATCH 2/2] Also normalize sparc64 -> sparcv9 in test fixture
+
+---
+ spec/ffi/fixtures/compile.rb | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/spec/ffi/fixtures/compile.rb b/spec/ffi/fixtures/compile.rb
+index f2e831a63..58ee5611d 100644
+--- a/spec/ffi/fixtures/compile.rb
++++ b/spec/ffi/fixtures/compile.rb
+@@ -22,6 +22,8 @@ module TestLibrary
+ "powerpc64"
+ when /ppc|powerpc/
+ "powerpc"
++ when /sparcv9|sparc64/
++ "sparcv9"
+ when /^arm/
+ if RbConfig::CONFIG['host_os'] =~ /darwin/
+ "aarch64"