From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1675041-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id B6DE715808B
	for <garchives@archives.gentoo.org>; Mon, 30 Sep 2024 18:31:37 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 0C199E29E4;
	Mon, 30 Sep 2024 18:31:37 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id DC9D5E29E4
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Sep 2024 18:31:36 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id DB8A133BEB9
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Sep 2024 18:31:35 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 1817114CA
	for <gentoo-commits@lists.gentoo.org>; Mon, 30 Sep 2024 18:31:34 +0000 (UTC)
From: "Fabian Groffen" <grobian@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Fabian Groffen" <grobian@gentoo.org>
Message-ID: <1727721090.f33705ae454d2c783d54c0a62aad5a9927a53ef5.grobian@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/ruby/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-lang/ruby/ruby-3.1.6-r1.ebuild dev-lang/ruby/ruby-3.2.5.ebuild dev-lang/ruby/ruby-3.3.4-r1.ebuild dev-lang/ruby/ruby-3.3.5.ebuild
X-VCS-Directories: dev-lang/ruby/
X-VCS-Committer: grobian
X-VCS-Committer-Name: Fabian Groffen
X-VCS-Revision: f33705ae454d2c783d54c0a62aad5a9927a53ef5
X-VCS-Branch: master
Date: Mon, 30 Sep 2024 18:31:34 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 8748a313-21fe-4e63-8313-6053f162f086
X-Archives-Hash: e6442d7f5bdc9617cf82f62beb13d438

commit:     f33705ae454d2c783d54c0a62aad5a9927a53ef5
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Mon Sep 30 18:28:21 2024 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Mon Sep 30 18:31:30 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f33705ae

dev-lang/ruby: fix building on macOS

Since DYLD_LIBRARY_PATH and friends won't survive a fork, it needs to be
supplied right when launching the executable that requires it.
Disabling LIBPATHENV on Darwin prevents this logic from kicking in,
disallowing miniruby to run with the not yet installed libruby shared
library.

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 dev-lang/ruby/ruby-3.1.6-r1.ebuild | 26 ++++----------------------
 dev-lang/ruby/ruby-3.2.5.ebuild    | 26 ++++----------------------
 dev-lang/ruby/ruby-3.3.4-r1.ebuild | 26 ++++----------------------
 dev-lang/ruby/ruby-3.3.5.ebuild    | 26 ++++----------------------
 4 files changed, 16 insertions(+), 88 deletions(-)

diff --git a/dev-lang/ruby/ruby-3.1.6-r1.ebuild b/dev-lang/ruby/ruby-3.1.6-r1.ebuild
index 9d129e2534a8..39d96ae94853 100644
--- a/dev-lang/ruby/ruby-3.1.6-r1.ebuild
+++ b/dev-lang/ruby/ruby-3.1.6-r1.ebuild
@@ -113,23 +113,6 @@ src_prepare() {
 	if use prefix ; then
 		# Fix hardcoded SHELL var in mkmf library
 		sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
-
-		if [[ ${CHOST} == *darwin* ]] ; then
-			# avoid symlink loop on Darwin (?!)
-			sed -i \
-				-e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
-				configure.ac || die
-
-			# make ar/libtool hack for Darwin work
-			sed -i \
-				-e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
-				configure.ac || die
-
-			# disable using security framework (GCC barfs on those headers)
-			sed -i \
-				-e 's/MAC_OS_X_VERSION_MIN_REQUIRED/_DISABLED_/' \
-				random.c || die
-		fi
 	fi
 
 	eapply_user
@@ -197,7 +180,10 @@ src_configure() {
 	# Provide an empty LIBPATHENV because we disable rpath but we do not
 	# need LD_LIBRARY_PATH by default since that breaks USE=multitarget
 	# #564272
-	INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
+	# except on Darwin, where we really need LIBPATHENV to set the right
+	# DYLD_ stuff during the invocation of miniruby for it to work
+	[[ ${CHOST} == *-darwin* ]] || export LIBPATHENV=""
+	INSTALL="${EPREFIX}/usr/bin/install -c" econf \
 		--program-suffix=${MY_SUFFIX} \
 		--with-soname=ruby${MY_SUFFIX} \
 		--with-readline-dir="${EPREFIX}"/usr \
@@ -250,10 +236,6 @@ src_install() {
 
 	local -x LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
 
-	if [[ ${CHOST} == *darwin* ]] ; then
-		local -x DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
-	fi
-
 	local -x RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
 	for d in $(find "${S}/ext" -type d) ; do
 		RUBYLIB="${RUBYLIB}:$d"

diff --git a/dev-lang/ruby/ruby-3.2.5.ebuild b/dev-lang/ruby/ruby-3.2.5.ebuild
index 213e5f3d18a4..2c3a3f8c63c1 100644
--- a/dev-lang/ruby/ruby-3.2.5.ebuild
+++ b/dev-lang/ruby/ruby-3.2.5.ebuild
@@ -119,23 +119,6 @@ src_prepare() {
 	if use prefix ; then
 		# Fix hardcoded SHELL var in mkmf library
 		sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
-
-		if [[ ${CHOST} == *darwin* ]] ; then
-			# avoid symlink loop on Darwin (?!)
-			sed -i \
-				-e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
-				configure.ac || die
-
-			# make ar/libtool hack for Darwin work
-			sed -i \
-				-e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
-				configure.ac || die
-
-			# disable using security framework (GCC barfs on those headers)
-			sed -i \
-				-e 's/MAC_OS_X_VERSION_MIN_REQUIRED/_DISABLED_/' \
-				random.c || die
-		fi
 	fi
 
 	eapply_user
@@ -203,7 +186,10 @@ src_configure() {
 	# Provide an empty LIBPATHENV because we disable rpath but we do not
 	# need LD_LIBRARY_PATH by default since that breaks USE=multitarget
 	# #564272
-	INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
+	# except on Darwin, where we really need LIBPATHENV to set the right
+	# DYLD_ stuff during the invocation of miniruby for it to work
+	[[ ${CHOST} == *-darwin* ]] || export LIBPATHENV=""
+	INSTALL="${EPREFIX}/usr/bin/install -c" econf \
 		--program-suffix=${MY_SUFFIX} \
 		--with-soname=ruby${MY_SUFFIX} \
 		--with-readline-dir="${EPREFIX}"/usr \
@@ -257,10 +243,6 @@ src_install() {
 
 	local -x LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
 
-	if [[ ${CHOST} == *darwin* ]] ; then
-		local -x DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
-	fi
-
 	local -x RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
 	for d in $(find "${S}/ext" -type d) ; do
 		RUBYLIB="${RUBYLIB}:$d"

diff --git a/dev-lang/ruby/ruby-3.3.4-r1.ebuild b/dev-lang/ruby/ruby-3.3.4-r1.ebuild
index 8cf5cb51be15..cac3085b6240 100644
--- a/dev-lang/ruby/ruby-3.3.4-r1.ebuild
+++ b/dev-lang/ruby/ruby-3.3.4-r1.ebuild
@@ -122,23 +122,6 @@ src_prepare() {
 	if use prefix ; then
 		# Fix hardcoded SHELL var in mkmf library
 		sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
-
-		if [[ ${CHOST} == *darwin* ]] ; then
-			# avoid symlink loop on Darwin (?!)
-			sed -i \
-				-e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
-				configure.ac || die
-
-			# make ar/libtool hack for Darwin work
-			sed -i \
-				-e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
-				configure.ac || die
-
-			# disable using security framework (GCC barfs on those headers)
-			sed -i \
-				-e 's/MAC_OS_X_VERSION_MIN_REQUIRED/_DISABLED_/' \
-				random.c || die
-		fi
 	fi
 
 	eapply_user
@@ -206,7 +189,10 @@ src_configure() {
 	# Provide an empty LIBPATHENV because we disable rpath but we do not
 	# need LD_LIBRARY_PATH by default since that breaks USE=multitarget
 	# #564272
-	INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
+	# except on Darwin, where we really need LIBPATHENV to set the right
+	# DYLD_ stuff during the invocation of miniruby for it to work
+	[[ ${CHOST} == *-darwin* ]] || export LIBPATHENV=""
+	INSTALL="${EPREFIX}/usr/bin/install -c" econf \
 		--program-suffix=${MY_SUFFIX} \
 		--with-soname=ruby${MY_SUFFIX} \
 		--enable-shared \
@@ -258,10 +244,6 @@ src_install() {
 
 	local -x LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
 
-	if [[ ${CHOST} == *darwin* ]] ; then
-		local -x DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
-	fi
-
 	local -x RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
 	for d in $(find "${S}/ext" -type d) ; do
 		RUBYLIB="${RUBYLIB}:$d"

diff --git a/dev-lang/ruby/ruby-3.3.5.ebuild b/dev-lang/ruby/ruby-3.3.5.ebuild
index 8cf5cb51be15..cac3085b6240 100644
--- a/dev-lang/ruby/ruby-3.3.5.ebuild
+++ b/dev-lang/ruby/ruby-3.3.5.ebuild
@@ -122,23 +122,6 @@ src_prepare() {
 	if use prefix ; then
 		# Fix hardcoded SHELL var in mkmf library
 		sed -i -e "s#\(SHELL = \).*#\1${EPREFIX}/bin/sh#" lib/mkmf.rb || die
-
-		if [[ ${CHOST} == *darwin* ]] ; then
-			# avoid symlink loop on Darwin (?!)
-			sed -i \
-				-e '/LIBRUBY_ALIASES=/s/lib$(RUBY_INSTALL_NAME).$(SOEXT)//' \
-				configure.ac || die
-
-			# make ar/libtool hack for Darwin work
-			sed -i \
-				-e "s/ac_cv_prog_ac_ct_AR='libtool/ac_cv_prog_AR='${CHOST}-libtool/" \
-				configure.ac || die
-
-			# disable using security framework (GCC barfs on those headers)
-			sed -i \
-				-e 's/MAC_OS_X_VERSION_MIN_REQUIRED/_DISABLED_/' \
-				random.c || die
-		fi
 	fi
 
 	eapply_user
@@ -206,7 +189,10 @@ src_configure() {
 	# Provide an empty LIBPATHENV because we disable rpath but we do not
 	# need LD_LIBRARY_PATH by default since that breaks USE=multitarget
 	# #564272
-	INSTALL="${EPREFIX}/usr/bin/install -c" LIBPATHENV="" econf \
+	# except on Darwin, where we really need LIBPATHENV to set the right
+	# DYLD_ stuff during the invocation of miniruby for it to work
+	[[ ${CHOST} == *-darwin* ]] || export LIBPATHENV=""
+	INSTALL="${EPREFIX}/usr/bin/install -c" econf \
 		--program-suffix=${MY_SUFFIX} \
 		--with-soname=ruby${MY_SUFFIX} \
 		--enable-shared \
@@ -258,10 +244,6 @@ src_install() {
 
 	local -x LD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${LD_LIBRARY_PATH+:}${LD_LIBRARY_PATH}"
 
-	if [[ ${CHOST} == *darwin* ]] ; then
-		local -x DYLD_LIBRARY_PATH="${S}:${ED}/usr/$(get_libdir)${DYLD_LIBRARY_PATH+:}${DYLD_LIBRARY_PATH}"
-	fi
-
 	local -x RUBYLIB="${S}:${ED}/usr/$(get_libdir)/ruby/${RUBYVERSION}"
 	for d in $(find "${S}/ext" -type d) ; do
 		RUBYLIB="${RUBYLIB}:$d"