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"

Reply via email to