From 1b6e593fa34c9d5c09485b209a5a47cba3134560 Mon Sep 17 00:00:00 2001 From: Josh Cooper Date: Thu, 20 Jul 2023 23:55:51 -0700 Subject: [PATCH] (PA-4867) Only override rbconfig when cross compiling The ruby-augeas gem's native extensions didn't work, because we were overriding rbconfig when native compiling. It is only necessary to do that when cross compiling, because the host ruby running on Solaris Intel needs to override CC, etc configuration when installing gems with native extensions. The ruby-shadow gem did work on SPARC, but it was relying on the rbconfig overrides to find gcc. Instead add pl-build-tools to the PATH and only override rbconfig when cross compiling. --- configs/components/_base-ruby-augeas.rb | 10 ++++++++-- configs/components/ruby-shadow.rb | 19 +++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/configs/components/_base-ruby-augeas.rb b/configs/components/_base-ruby-augeas.rb index deab8c8ad..c957dada9 100644 --- a/configs/components/_base-ruby-augeas.rb +++ b/configs/components/_base-ruby-augeas.rb @@ -36,10 +36,16 @@ pkg.environment "PKG_CONFIG_PATH", "#{File.join(settings[:libdir], 'pkgconfig')}:/usr/lib/pkgconfig" if platform.is_solaris? - if platform.architecture == 'sparc' + if platform.is_cross_compiled? pkg.environment "RUBY", host_ruby end - ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb" + + if platform.is_cross_compiled? || platform.architecture != 'sparc' + # This should really only be done when cross compiling but + # to avoid breaking solaris x86_64 in 7.x, only skip this + # when native compiling on sparc + ruby = "#{host_ruby} -r#{settings[:datadir]}/doc/rbconfig-#{ruby_version}-orig.rb" + end elsif platform.is_cross_compiled? if platform.is_linux? || platform.is_macos? pkg.environment "RUBY", host_ruby diff --git a/configs/components/ruby-shadow.rb b/configs/components/ruby-shadow.rb index 72b424172..0a1bcf4fe 100644 --- a/configs/components/ruby-shadow.rb +++ b/configs/components/ruby-shadow.rb @@ -3,14 +3,25 @@ pkg.ref "refs/tags/2.5.0" pkg.build_requires "ruby-#{settings[:ruby_version]}" - pkg.environment "PATH", "$(PATH):/usr/ccs/bin:/usr/sfw/bin" + if !platform.is_cross_compiled? && platform.architecture == 'sparc' + pkg.environment "PATH", "$(PATH):/opt/pl-build-tools/bin:/usr/ccs/bin:/usr/sfw/bin" + else + pkg.environment "PATH", "$(PATH):/usr/ccs/bin:/usr/sfw/bin" + end + pkg.environment "CONFIGURE_ARGS", '--vendor' if platform.is_solaris? - if platform.architecture == 'sparc' + if platform.is_cross_compiled? pkg.environment "RUBY", settings[:host_ruby] end - ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig-#{settings[:ruby_version]}-orig.rb" + + if platform.is_cross_compiled? || platform.architecture != 'sparc' + # This should really only be done when cross compiling but + # to avoid breaking solaris x86_64 in 7.x, only skip this + # when native compiling on sparc + ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig-#{settings[:ruby_version]}-orig.rb" + end elsif platform.is_cross_compiled? pkg.environment "RUBY", settings[:host_ruby] ruby = "#{settings[:host_ruby]} -r#{settings[:datadir]}/doc/rbconfig-#{settings[:ruby_version]}-orig.rb" @@ -18,7 +29,7 @@ ruby = File.join(settings[:ruby_bindir], 'ruby') end - matchdata = platform.settings[:ruby_version].match /(\d+)\.(\d+)\.\d+/ + matchdata = platform.settings[:ruby_version].match(/(\d+)\.(\d+)\.\d+/) ruby_major_version = matchdata[1].to_i if ruby_major_version >= 3 base = "resources/patches/ruby_32"