diff options
author | Sam James <sam@gentoo.org> | 2023-04-09 02:24:40 +0100 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-04-09 02:27:29 +0100 |
commit | 67547fd52c2831c349f0deb1f71c30a1d5db9628 (patch) | |
tree | 32b73ee4e34421b10fd96c05272755186d74736f /dev-ruby | |
parent | dev-ruby/slim: drop dev-ruby/sass test dep (for now?) (diff) | |
download | gentoo-67547fd52c2831c349f0deb1f71c30a1d5db9628.tar.gz gentoo-67547fd52c2831c349f0deb1f71c30a1d5db9628.tar.bz2 gentoo-67547fd52c2831c349f0deb1f71c30a1d5db9628.zip |
dev-ruby/ffi: fix runtime for HPPA
Tests now pass, as do tests of reverse dependencies, like dev-ruby/llhttp-ffi!
I think more work is needed to get dev-ruby/ffi's own implementation for
closure allocations working - like dev-python/cffi had:
https://foss.heptapod.net/pypy/cffi/-/commit/ab11bfa551697cd2b61fdaa571c7975c06e6912c.
I've started trying that but it doesn't work (yet?). In any case, upstream
do this for Apple arm64 anyway.
Bug: https://bugs.gentoo.org/761550
Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-ruby')
-rw-r--r-- | dev-ruby/ffi/ffi-1.15.5-r2.ebuild | 74 | ||||
-rw-r--r-- | dev-ruby/ffi/files/add-types.conf-for-hppa2.0-linux.patch | 191 | ||||
-rw-r--r-- | dev-ruby/ffi/files/use-libffi-closure-allocations-on-hppa.patch | 21 |
3 files changed, 286 insertions, 0 deletions
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 + |