Skip to content

Commit

Permalink
(PA-4867) Only override rbconfig when cross compiling
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joshcooper committed Aug 2, 2023
1 parent 849029c commit 0968bde
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
12 changes: 10 additions & 2 deletions configs/components/_base-ruby-augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,18 @@
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'
ruby = File.join(ruby_bindir, 'ruby')
else
# This should really only be done when cross compiling but
# to avoid breaking solaris x86_64 in 7.x continue preloading
# our hook.
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
Expand Down
21 changes: 17 additions & 4 deletions configs/components/ruby-shadow.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,35 @@
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'
ruby = File.join(settings[:ruby_bindir], 'ruby')
else
# This should really only be done when cross compiling but
# to avoid breaking solaris x86_64 in 7.x continue preloading
# our hook.
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"
else
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"
Expand Down

0 comments on commit 0968bde

Please sign in to comment.