summaryrefslogtreecommitdiff
path: root/dev-ruby/ffi
diff options
context:
space:
mode:
Diffstat (limited to 'dev-ruby/ffi')
-rw-r--r--dev-ruby/ffi/Manifest3
-rw-r--r--dev-ruby/ffi/ffi-1.15.5-r2.ebuild74
-rw-r--r--dev-ruby/ffi/files/add-types.conf-for-hppa2.0-linux.patch191
-rw-r--r--dev-ruby/ffi/files/use-libffi-closure-allocations-on-hppa.patch21
4 files changed, 289 insertions, 0 deletions
diff --git a/dev-ruby/ffi/Manifest b/dev-ruby/ffi/Manifest
index 4afcc702a728..ff61011b6825 100644
--- a/dev-ruby/ffi/Manifest
+++ b/dev-ruby/ffi/Manifest
@@ -1,6 +1,9 @@
+AUX add-types.conf-for-hppa2.0-linux.patch 7837 BLAKE2B 01991d89716c8a4de95ecd57a71b217926ac99e2c252dddd3fa5953ae46a677915fe61a88555302d4c7d213a4749f6069b542487187f4873543b34c8d2b686fb SHA512 1b9c8e026b999b96490af57e2a12895cc2690a108046461f1011ef6a2f3d2594a09bbfecc3020c064af2f7e2242232fae955db63b4001f889d784b15c7ce5130
AUX backport-pr-962.patch 1773 BLAKE2B b4eb227a949136143a98e8a5ed9067599d3a4ec14376c52619e2f3db56906ed028f9be889aa6eea5abe7e7ca9c3196208ede7dc5768cba43ecf9d000f1e3e1da SHA512 dc6a17bccde42b3a64e7de3bed5fe0818a4bfe9e109b665ccf06963a4939fec2a77e3fcff073cf3a4feccb68d3dc05bbb4885ebe53c2060965e114041c9e3ce5
AUX fix-regenerate-types-conf.patch 906 BLAKE2B dfeb2257e4cf63de918a194a74ac367bbe5755c6104a1c289adcaf04805623ffcad3ac553b07e063aea468fdc9cb3a904fa86f22b40f22a2a5d68b23aa01baae SHA512 6c6c8518e7bebe55a64ea4469b8649f13c4ac81266a1788ac88229438084a894d222907edcf9aeb28587531e95a33644c58f53890a1b3cbcde181365c4352875
AUX pr-957-sparc.patch 1681 BLAKE2B e08a03d5e054ce030c04cb0645ed2683faa9d0ec8782313464112e3dd3adf0b8ee40f7fbea9aec15ee7590189e93f03617fe06b506e2ea049535e48bc33a8f23 SHA512 32bd488a3cc4b0c81d8f7f9f2875e591b8de7bf741b838aab3f20ea64025984b3d83c393e1e8f0b628f009b2473d381139655f965cc746dc9074cbe57171cb7d
+AUX use-libffi-closure-allocations-on-hppa.patch 761 BLAKE2B a6f460a967752b20ecf9a138b9b7dfa76acd290dae369629af75fe691402ad444bae9d9f27360df38770c018287d2e526c594394a206cf295bd586701f1aa9c8 SHA512 b247a5276f51a66042a235bc6e02a675bb696c6fa600d541c040f6adfaadd458d037db2eecbfff4ddc2d9bd61b0dfb8b90c149bf3181517377d0ccb71ec31161
DIST ffi-git-1.15.5.tgz 168139 BLAKE2B 2ddd5bd7bfb7bcd39b6d740cbb1e0f4cd419ce6cb4ec12926f91f254b3f3142bc6166728a81a6f23dccfbf7aec911c63237c20fb0e2c70d30d48f4648e352585 SHA512 3668bafae936bf5010f014fbcf63258b023bcc318882775e7d2fcfc11334722ec2b6e8a8b9c910d406889fb173dd503c5c13f5af8e4f6927921f12f688461707
EBUILD ffi-1.15.5-r1.ebuild 1852 BLAKE2B a8888b6e45f06c3e45d347d9a057170acc1d06da9fddcc2816f96bc2da0488d852ce29c754c572a30db7ba7993a8db2da2043a5a0968a128d2ddd2f3c7669070 SHA512 5f67ec6e50b63fce07ed252a70f6e6088b25683ef3e8ab36132992d56460bd2616aa2f61c1822656979e0199fdbff1cd12852bdd2bed09c88424e74f1b952e80
+EBUILD ffi-1.15.5-r2.ebuild 2063 BLAKE2B b05310e37cb0a6d414924ce5347bae5a1c508ed6715543f4ecaa612fa97018cca7f93e4c38d68f414fb0025adab0a601f7bc0352bd4ebac802a5ad35965b19cd SHA512 3936dd6d0e22f2a798bc9a467f0b7dd22d2be51b5e1008a34b5feb99fdc7d8f67fd851b9cd69120da404af211970829fb153e315c8b935dfecb326de9f304a6a
MISC metadata.xml 334 BLAKE2B 02ad2c909797d4aaf2a23497611777a790000683866cfbd9d12c4b19cca6de902e219584c4edc85c46b4b0dc51c63e770506a077a4c1052b46f8df19a9588c15 SHA512 e72dc6ce177ad3881f5465f10cd44ca6740b7603ab4e55cfa9e6088be3c6615abeefaee4b717e76fab2850c64d66eee626115544e10709f64c4187f1987bcfe3
diff --git a/dev-ruby/ffi/ffi-1.15.5-r2.ebuild b/dev-ruby/ffi/ffi-1.15.5-r2.ebuild
new file mode 100644
index 000000000000..847608756add
--- /dev/null
+++ b/dev-ruby/ffi/ffi-1.15.5-r2.ebuild
@@ -0,0 +1,74 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+USE_RUBY="ruby27 ruby30 ruby31 ruby32"
+
+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"
+
+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"
+
+# Needs recent libffi for HPPA fixes (and probably Apple arm64 too)
+RDEPEND+=" >=dev-libs/libffi-3.4.4-r1:="
+DEPEND+=" >=dev-libs/libffi-3.4.4-r1:="
+
+ruby_add_bdepend "dev-ruby/rake"
+
+PATCHES=(
+ "${FILESDIR}/backport-pr-962.patch"
+ "${FILESDIR}/pr-957-sparc.patch" # submitted upstream as https://github.com/ffi/ffi/pull/957
+ "${FILESDIR}/fix-regenerate-types-conf.patch"
+ "${FILESDIR}/use-libffi-closure-allocations-on-hppa.patch"
+ "${FILESDIR}/add-types.conf-for-hppa2.0-linux.patch"
+)
+
+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/add-types.conf-for-hppa2.0-linux.patch b/dev-ruby/ffi/files/add-types.conf-for-hppa2.0-linux.patch
new file mode 100644
index 000000000000..2594d2b8359c
--- /dev/null
+++ b/dev-ruby/ffi/files/add-types.conf-for-hppa2.0-linux.patch
@@ -0,0 +1,191 @@
+https://github.com/ffi/ffi/pull/1017
+
+From 1f0a4db3d6b16142d2ef547c8dde7a36b21bd39a Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 9 Apr 2023 02:20:32 +0100
+Subject: [PATCH 2/2] Add types.conf for hppa2.0-linux
+
+--- /dev/null
++++ b/lib/ffi/platform/hppa2.0-linux/types.conf
+@@ -0,0 +1,178 @@
++rbx.platform.typedef.*__caddr_t = char
++rbx.platform.typedef.__blkcnt64_t = long_long
++rbx.platform.typedef.__blkcnt_t = long
++rbx.platform.typedef.__blksize_t = long
++rbx.platform.typedef.__clock_t = long
++rbx.platform.typedef.__clockid_t = int
++rbx.platform.typedef.__daddr_t = int
++rbx.platform.typedef.__dev_t = ulong_long
++rbx.platform.typedef.__fd_mask = long
++rbx.platform.typedef.__fsblkcnt64_t = ulong_long
++rbx.platform.typedef.__fsblkcnt_t = ulong
++rbx.platform.typedef.__fsfilcnt64_t = ulong_long
++rbx.platform.typedef.__fsfilcnt_t = ulong
++rbx.platform.typedef.__fsword_t = int
++rbx.platform.typedef.__gid_t = uint
++rbx.platform.typedef.__id_t = uint
++rbx.platform.typedef.__ino64_t = ulong_long
++rbx.platform.typedef.__ino_t = ulong
++rbx.platform.typedef.__int16_t = short
++rbx.platform.typedef.__int32_t = int
++rbx.platform.typedef.__int64_t = long_long
++rbx.platform.typedef.__int8_t = char
++rbx.platform.typedef.__int_least16_t = short
++rbx.platform.typedef.__int_least32_t = int
++rbx.platform.typedef.__int_least64_t = long_long
++rbx.platform.typedef.__int_least8_t = char
++rbx.platform.typedef.__intmax_t = long_long
++rbx.platform.typedef.__intptr_t = int
++rbx.platform.typedef.__kernel_caddr_t = string
++rbx.platform.typedef.__kernel_clock_t = long
++rbx.platform.typedef.__kernel_clockid_t = int
++rbx.platform.typedef.__kernel_daddr_t = int
++rbx.platform.typedef.__kernel_gid16_t = ushort
++rbx.platform.typedef.__kernel_gid32_t = uint
++rbx.platform.typedef.__kernel_gid_t = uint
++rbx.platform.typedef.__kernel_ino64_t = ulong_long
++rbx.platform.typedef.__kernel_ino_t = ulong
++rbx.platform.typedef.__kernel_ipc_pid_t = ushort
++rbx.platform.typedef.__kernel_key_t = int
++rbx.platform.typedef.__kernel_loff_t = long_long
++rbx.platform.typedef.__kernel_long_t = long
++rbx.platform.typedef.__kernel_mode_t = ushort
++rbx.platform.typedef.__kernel_mqd_t = int
++rbx.platform.typedef.__kernel_off64_t = long_long
++rbx.platform.typedef.__kernel_off_t = long
++rbx.platform.typedef.__kernel_old_dev_t = uint
++rbx.platform.typedef.__kernel_old_gid_t = uint
++rbx.platform.typedef.__kernel_old_time_t = long
++rbx.platform.typedef.__kernel_old_uid_t = uint
++rbx.platform.typedef.__kernel_pid_t = int
++rbx.platform.typedef.__kernel_ptrdiff_t = int
++rbx.platform.typedef.__kernel_size_t = uint
++rbx.platform.typedef.__kernel_ssize_t = int
++rbx.platform.typedef.__kernel_suseconds_t = long
++rbx.platform.typedef.__kernel_time64_t = long_long
++rbx.platform.typedef.__kernel_time_t = long
++rbx.platform.typedef.__kernel_timer_t = int
++rbx.platform.typedef.__kernel_uid16_t = ushort
++rbx.platform.typedef.__kernel_uid32_t = uint
++rbx.platform.typedef.__kernel_uid_t = uint
++rbx.platform.typedef.__kernel_ulong_t = ulong
++rbx.platform.typedef.__key_t = int
++rbx.platform.typedef.__loff_t = long_long
++rbx.platform.typedef.__mode_t = uint
++rbx.platform.typedef.__nlink_t = uint
++rbx.platform.typedef.__off64_t = long_long
++rbx.platform.typedef.__off_t = long
++rbx.platform.typedef.__pid_t = int
++rbx.platform.typedef.__priority_which_t = int
++rbx.platform.typedef.__quad_t = long_long
++rbx.platform.typedef.__rlim64_t = ulong_long
++rbx.platform.typedef.__rlim_t = ulong
++rbx.platform.typedef.__rlimit_resource_t = int
++rbx.platform.typedef.__rusage_who_t = int
++rbx.platform.typedef.__sig_atomic_t = int
++rbx.platform.typedef.__socklen_t = uint
++rbx.platform.typedef.__ssize_t = int
++rbx.platform.typedef.__suseconds64_t = long_long
++rbx.platform.typedef.__suseconds_t = long
++rbx.platform.typedef.__syscall_slong_t = long
++rbx.platform.typedef.__syscall_ulong_t = ulong
++rbx.platform.typedef.__thrd_t = ulong
++rbx.platform.typedef.__time64_t = long_long
++rbx.platform.typedef.__time_t = long
++rbx.platform.typedef.__timer_t = pointer
++rbx.platform.typedef.__tss_t = uint
++rbx.platform.typedef.__u_char = uchar
++rbx.platform.typedef.__u_int = uint
++rbx.platform.typedef.__u_long = ulong
++rbx.platform.typedef.__u_quad_t = ulong_long
++rbx.platform.typedef.__u_short = ushort
++rbx.platform.typedef.__uid_t = uint
++rbx.platform.typedef.__uint16_t = ushort
++rbx.platform.typedef.__uint32_t = uint
++rbx.platform.typedef.__uint64_t = ulong_long
++rbx.platform.typedef.__uint8_t = uchar
++rbx.platform.typedef.__uint_least16_t = ushort
++rbx.platform.typedef.__uint_least32_t = uint
++rbx.platform.typedef.__uint_least64_t = ulong_long
++rbx.platform.typedef.__uint_least8_t = uchar
++rbx.platform.typedef.__uintmax_t = ulong_long
++rbx.platform.typedef.__useconds_t = uint
++rbx.platform.typedef.blkcnt_t = long_long
++rbx.platform.typedef.blksize_t = long
++rbx.platform.typedef.clock_t = long
++rbx.platform.typedef.clockid_t = int
++rbx.platform.typedef.daddr_t = int
++rbx.platform.typedef.dev_t = ulong_long
++rbx.platform.typedef.fd_mask = long
++rbx.platform.typedef.fsblkcnt_t = ulong_long
++rbx.platform.typedef.fsfilcnt_t = ulong_long
++rbx.platform.typedef.gid_t = uint
++rbx.platform.typedef.id_t = uint
++rbx.platform.typedef.in_addr_t = uint
++rbx.platform.typedef.in_port_t = ushort
++rbx.platform.typedef.ino_t = ulong_long
++rbx.platform.typedef.int16_t = short
++rbx.platform.typedef.int32_t = int
++rbx.platform.typedef.int64_t = long_long
++rbx.platform.typedef.int8_t = char
++rbx.platform.typedef.int_fast16_t = int
++rbx.platform.typedef.int_fast32_t = int
++rbx.platform.typedef.int_fast64_t = long_long
++rbx.platform.typedef.int_fast8_t = char
++rbx.platform.typedef.int_least16_t = short
++rbx.platform.typedef.int_least32_t = int
++rbx.platform.typedef.int_least64_t = long_long
++rbx.platform.typedef.int_least8_t = char
++rbx.platform.typedef.intmax_t = long_long
++rbx.platform.typedef.intptr_t = int
++rbx.platform.typedef.key_t = int
++rbx.platform.typedef.loff_t = long_long
++rbx.platform.typedef.mode_t = uint
++rbx.platform.typedef.nlink_t = uint
++rbx.platform.typedef.off_t = long_long
++rbx.platform.typedef.pid_t = int
++rbx.platform.typedef.pthread_key_t = uint
++rbx.platform.typedef.pthread_once_t = int
++rbx.platform.typedef.pthread_t = ulong
++rbx.platform.typedef.ptrdiff_t = int
++rbx.platform.typedef.quad_t = long_long
++rbx.platform.typedef.register_t = long
++rbx.platform.typedef.rlim_t = ulong_long
++rbx.platform.typedef.sa_family_t = ushort
++rbx.platform.typedef.size_t = uint
++rbx.platform.typedef.socklen_t = uint
++rbx.platform.typedef.ssize_t = int
++rbx.platform.typedef.suseconds_t = long
++rbx.platform.typedef.time_t = long
++rbx.platform.typedef.timer_t = pointer
++rbx.platform.typedef.u_char = uchar
++rbx.platform.typedef.u_int = uint
++rbx.platform.typedef.u_int16_t = ushort
++rbx.platform.typedef.u_int32_t = uint
++rbx.platform.typedef.u_int64_t = ulong_long
++rbx.platform.typedef.u_int8_t = uchar
++rbx.platform.typedef.u_long = ulong
++rbx.platform.typedef.u_quad_t = ulong_long
++rbx.platform.typedef.u_short = ushort
++rbx.platform.typedef.uid_t = uint
++rbx.platform.typedef.uint = uint
++rbx.platform.typedef.uint16_t = ushort
++rbx.platform.typedef.uint32_t = uint
++rbx.platform.typedef.uint64_t = ulong_long
++rbx.platform.typedef.uint8_t = uchar
++rbx.platform.typedef.uint_fast16_t = uint
++rbx.platform.typedef.uint_fast32_t = uint
++rbx.platform.typedef.uint_fast64_t = ulong_long
++rbx.platform.typedef.uint_fast8_t = uchar
++rbx.platform.typedef.uint_least16_t = ushort
++rbx.platform.typedef.uint_least32_t = uint
++rbx.platform.typedef.uint_least64_t = ulong_long
++rbx.platform.typedef.uint_least8_t = uchar
++rbx.platform.typedef.uintmax_t = ulong_long
++rbx.platform.typedef.uintptr_t = uint
++rbx.platform.typedef.ulong = ulong
++rbx.platform.typedef.ushort = ushort
++rbx.platform.typedef.wchar_t = long
+--
+2.40.0
+
diff --git a/dev-ruby/ffi/files/use-libffi-closure-allocations-on-hppa.patch b/dev-ruby/ffi/files/use-libffi-closure-allocations-on-hppa.patch
new file mode 100644
index 000000000000..6a76a91c0842
--- /dev/null
+++ b/dev-ruby/ffi/files/use-libffi-closure-allocations-on-hppa.patch
@@ -0,0 +1,21 @@
+https://github.com/ffi/ffi/pull/1017
+
+From 587822fa8d21292d39400d2276ca49d37a752135 Mon Sep 17 00:00:00 2001
+From: Sam James <sam@gentoo.org>
+Date: Sun, 9 Apr 2023 02:17:23 +0100
+Subject: [PATCH 1/2] Use libffi closure allocations on hppa
+
+We currently do this for Apple arm64, but we need to do it for hppa too.
+--- a/ext/ffi_c/extconf.rb
++++ b/ext/ffi_c/extconf.rb
+@@ -61,6 +61,7 @@ if RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx'
+ append_ldflags "-pthread"
+
+ ffi_alloc_default = RbConfig::CONFIG['host_os'] =~ /darwin/i && RbConfig::CONFIG['host'] =~ /arm|aarch64/i
++ ffi_alloc_default = ffi_alloc_default || RbConfig::CONFIG['host'] =~ /hppa/i
+ if enable_config('libffi-alloc', ffi_alloc_default)
+ $defs << "-DUSE_FFI_ALLOC"
+ end
+--
+2.40.0
+