commit:     291d890559aa71d5810b43a72488f316055effa5
Author:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 15 09:06:53 2023 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Fri Sep 15 10:09:30 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=291d8905

dev-ruby/ruby-ldap: add ruby32

Use unmerged upstream PR to fix compatibility with ruby32.
https://github.com/bearded/ruby-ldap/pull/45

Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>

 .../ruby-ldap/files/ruby-ldap-0.9.20-ruby32.patch  | 24 +++++++++++++
 .../ruby-ldap/files/ruby-ldap-0.9.20-tainted.patch | 28 +++++++++++++++
 dev-ruby/ruby-ldap/ruby-ldap-0.9.20-r5.ebuild      | 40 ++++++++++++++++++++++
 3 files changed, 92 insertions(+)

diff --git a/dev-ruby/ruby-ldap/files/ruby-ldap-0.9.20-ruby32.patch 
b/dev-ruby/ruby-ldap/files/ruby-ldap-0.9.20-ruby32.patch
new file mode 100644
index 000000000000..b7b101db2f30
--- /dev/null
+++ b/dev-ruby/ruby-ldap/files/ruby-ldap-0.9.20-ruby32.patch
@@ -0,0 +1,24 @@
+From aa43040eb6b6d591e42a19ee385fc1ba17c7202b Mon Sep 17 00:00:00 2001
+From: Jeremy Evans <[email protected]>
+Date: Tue, 27 Dec 2022 17:19:45 -0800
+Subject: [PATCH] Don't use rb_cData
+
+This fixes ruby-ldap on Ruby 3.2+
+---
+ conn.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/conn.c b/conn.c
+index e628695..39eeb5f 100644
+--- a/conn.c
++++ b/conn.c
+@@ -1855,7 +1855,8 @@ Init_ldap_conn ()
+ {
+   rb_ldap_sort_obj = Qnil;
+ 
+-  rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cData);
++  rb_cLDAP_Conn = rb_define_class_under (rb_mLDAP, "Conn", rb_cObject);
++  rb_undef_alloc_func(rb_cLDAP_Conn);
+   rb_define_attr (rb_cLDAP_Conn, "referrals", 1, 0);
+   rb_define_attr (rb_cLDAP_Conn, "controls", 1, 0);
+   rb_define_attr (rb_cLDAP_Conn, "sasl_quiet", 1, 1);

diff --git a/dev-ruby/ruby-ldap/files/ruby-ldap-0.9.20-tainted.patch 
b/dev-ruby/ruby-ldap/files/ruby-ldap-0.9.20-tainted.patch
new file mode 100644
index 000000000000..84c9ee29610d
--- /dev/null
+++ b/dev-ruby/ruby-ldap/files/ruby-ldap-0.9.20-tainted.patch
@@ -0,0 +1,28 @@
+From 849ca6bb46bf4826d51648feddd453142281e541 Mon Sep 17 00:00:00 2001
+From: Hisashi MINAMINO <[email protected]>
+Date: Thu, 28 May 2020 14:04:05 +0900
+Subject: [PATCH] for ruby-2.7
+
+---
+ rbldap.h | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/rbldap.h b/rbldap.h
+index 1fa04e1..b7b1765 100644
+--- a/rbldap.h
++++ b/rbldap.h
+@@ -205,3 +205,14 @@ VALUE rb_ldap_mod_vals (VALUE);
+         rb_define_method(rb_cLDAP_Mod,method,cfunc,argc)
+ 
+ #endif
++
++#if RUBY_VERSION_CODE >= 270
++# if defined rb_tainted_str_new
++#  undef rb_tainted_str_new
++# endif
++# if defined rb_tainted_str_new2
++#  undef rb_tainted_str_new2
++# endif
++# define rb_tainted_str_new(p,l)      rb_str_new((p),(l))
++# define rb_tainted_str_new2(p)               rb_str_new_cstr((p))
++#endif

diff --git a/dev-ruby/ruby-ldap/ruby-ldap-0.9.20-r5.ebuild 
b/dev-ruby/ruby-ldap/ruby-ldap-0.9.20-r5.ebuild
new file mode 100644
index 000000000000..9230db150bd6
--- /dev/null
+++ b/dev-ruby/ruby-ldap/ruby-ldap-0.9.20-r5.ebuild
@@ -0,0 +1,40 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+USE_RUBY="ruby31 ruby32"
+
+inherit ruby-fakegem
+
+RUBY_FAKEGEM_TASK_TEST=""
+RUBY_FAKEGEM_EXTENSIONS=(./extconf.rb)
+RUBY_FAKEGEM_EXTRADOC="ChangeLog FAQ NOTES README TODO"
+
+DESCRIPTION="A Ruby interface to some LDAP libraries"
+HOMEPAGE="https://github.com/bearded/ruby-ldap";
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~riscv ~sparc ~x86"
+IUSE="ssl"
+DEPEND=">=net-nds/openldap-2:=
+       dev-libs/cyrus-sasl
+       ssl? ( dev-libs/openssl:0= )"
+RDEPEND="${DEPEND}"
+
+# Current test set is interactive due to certificate generation and requires
+# running LDAP daemon
+RESTRICT="test"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-0.9.20-clang16-fix.patch
+       "${FILESDIR}"/${PN}-0.9.20-ruby32.patch
+       "${FILESDIR}"/${PN}-0.9.20-tainted.patch
+)
+
+each_ruby_configure() {
+       local myconf="--with-openldap2"
+       if ! use ssl ; then
+               myconf="${myconf} --without-libcrypto --without-libssl"
+       fi
+       RUBY_FAKEGEM_EXTENSION_OPTIONS=${myconf} each_fakegem_configure
+}

Reply via email to