Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions configs/components/_base-rubygem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@
end

pkg.build_requires "runtime-#{settings[:runtime_project]}"
pkg.build_requires "ruby-#{settings[:ruby_version]}"
pkg.build_requires "pl-ruby-patch" if platform.is_cross_compiled?

if platform.is_windows?
pkg.environment "PATH", "$(shell cygpath -u #{settings[:gcc_bindir]}):$(shell cygpath -u #{settings[:ruby_bindir]}):$(shell cygpath -u #{settings[:bindir]}):/cygdrive/c/Windows/system32:/cygdrive/c/Windows:/cygdrive/c/Windows/System32/WindowsPowerShell/v1.0:$(PATH)"
end

if platform.is_macos?
pkg.environment 'CC', settings[:cc]
pkg.environment 'CXX', settings[:cxx]
pkg.environment 'LDFLAGS', settings[:ldflags]
pkg.environment 'CPPFLAGS', settings[:cppflags]
pkg.environment 'CFLAGS', settings[:cflags]
pkg.environment 'MACOSX_DEPLOYMENT_TARGET', settings[:deployment_target]
end

# When cross-compiling, we can't use the rubygems we just built.
# Instead we use the host gem installation and override GEM_HOME. Yay?
pkg.environment "GEM_HOME", settings[:gem_home]
Expand Down
6 changes: 1 addition & 5 deletions configs/components/augeas.rb
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,7 @@

# fix libtool linking on big sur
if platform.is_macos?
if platform.architecture == 'arm64'
pkg.configure { ["/opt/homebrew/bin/autoreconf --force --install"] }
else
pkg.configure { ["/usr/local/bin/autoreconf --force --install"] }
end
pkg.configure { ["/opt/homebrew/bin/autoreconf --force --install"] }
end


Expand Down
6 changes: 1 addition & 5 deletions configs/components/pl-ruby-patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
elsif platform.name =~ /solaris-10/
"sparc-solaris"
elsif platform.is_macos?
if ruby_version_y.start_with?('2')
"aarch64-darwin"
else
"arm64-darwin"
end
"x86_64-darwin"
else
"#{platform.architecture}-linux"
end
Expand Down
17 changes: 8 additions & 9 deletions configs/components/ruby-3.2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

if platform.is_cross_compiled?
pkg.apply_patch "#{base}/rbinstall_gem_path.patch"
pkg.apply_patch "#{base}/target_rbconfig.patch"
end

if platform.is_aix?
Expand Down Expand Up @@ -62,6 +63,7 @@
pkg.environment 'CXX', settings[:cxx]
pkg.environment 'MACOSX_DEPLOYMENT_TARGET', settings[:deployment_target]
pkg.environment 'PATH', '$(PATH):/opt/homebrew/bin:/usr/local/bin'
pkg.environment 'CROSS_COMPILING', 'true' if platform.is_cross_compiled?
elsif platform.is_windows?
optflags = cflags + ' -O3'
pkg.environment 'optflags', optflags
Expand Down Expand Up @@ -118,11 +120,6 @@
# This normalizes the build string to something like AIX 7.1.0.0 rather
# than AIX 7.1.0.2 or something
special_flags += " --build=#{settings[:platform_triple]} "
elsif platform.is_cross_compiled? && platform.is_macos?
# When the target arch is aarch64, ruby incorrectly selects the 'ucontext' coroutine
# implementation instead of 'arm64', so specify 'amd64' explicitly
# https://github.com/ruby/ruby/blob/c9c2245c0a25176072e02db9254f0e0c84c805cd/configure.ac#L2329-L2330
special_flags += " --with-coroutine=arm64 "
elsif platform.is_solaris? && platform.architecture == "sparc"
unless platform.is_cross_compiled?
# configure seems to enable dtrace because the executable is present,
Expand Down Expand Up @@ -230,6 +227,7 @@
'powerpc-ibm-aix7.1.0.0' => 'powerpc-aix7.1.0.0',
'powerpc-ibm-aix7.2.0.0' => 'powerpc-aix7.2.0.0',
'aarch64-redhat-linux' => 'aarch64-linux',
'x86_64-apple-darwin' => 'x86_64-darwin',
'ppc64-redhat-linux' => 'powerpc64-linux',
'ppc64le-redhat-linux' => 'powerpc64le-linux',
'powerpc64le-suse-linux' => 'powerpc64le-linux',
Expand Down Expand Up @@ -258,6 +256,9 @@
rbconfig_changes = {}
if platform.is_aix?
rbconfig_changes["CC"] = "gcc"
elsif platform.is_macos? && platform.is_cross_compiled?
rbconfig_changes["CC"] = settings[:cc]
rbconfig_changes["CXX"] = settings[:cxx]
elsif platform.is_cross_compiled? || (platform.is_solaris? && platform.architecture != 'sparc')
# REMIND: why are we overriding rbconfig for solaris intel?
rbconfig_changes["CC"] = 'gcc'
Expand All @@ -271,8 +272,6 @@
# the ancient gcc version on sles-12-ppc64le does not understand -fstack-protector-strong, so remove the `strong` part
rbconfig_changes["LDFLAGS"] = "-L. -Wl,-rpath=/opt/puppetlabs/puppet/lib -fstack-protector -rdynamic -Wl,-export-dynamic -L/opt/puppetlabs/puppet/lib"
end
elsif platform.is_macos?
rbconfig_changes["CC"] = "#{settings[:cc]} #{cflags}"
elsif platform.is_windows?
if platform.architecture == "x64"
rbconfig_changes["CC"] = "x86_64-w64-mingw32-gcc"
Expand Down Expand Up @@ -302,8 +301,8 @@
pkg.install do
[
"#{host_ruby} ../rbconfig-update.rb \"#{rbconfig_changes.to_s.gsub('"', '\"')}\" #{rbconfig_topdir}",
"cp original_rbconfig.rb #{settings[:datadir]}/doc/rbconfig-#{pkg.get_version}-orig.rb",
"cp new_rbconfig.rb #{rbconfig_topdir}/rbconfig.rb",
"cp original_rbconfig.rb #{settings[:datadir]}/doc/rbconfig-3.2-orig.rb",
"sudo cp new_rbconfig.rb #{rbconfig_topdir}/rbconfig.rb",
]
end
end
Expand Down
4 changes: 4 additions & 0 deletions configs/components/rubygem-CFPropertyList.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@
if settings[:ruby_version].to_f >= 3.2
pkg.version '3.0.7'
pkg.md5sum 'ed89ce5e7074a6f8e8b8e744eaf014d0'
pkg.build_requires 'base64'
else
pkg.version '2.3.6'
pkg.md5sum 'ae4086185992f293ffab1641b83286a5'
end

pkg.build_requires 'rubygem-rexml'
# Also requires nkf, part of the Ruby standard library (ext) as of 3.2

instance_eval File.read('configs/components/_base-rubygem.rb')
pkg.environment "GEM_HOME", settings[:gem_home]
end
3 changes: 3 additions & 0 deletions configs/components/rubygem-fast_gettext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
pkg.version '2.4.0'
pkg.sha256sum 'fd26c4c406aa10be34f0fd2847ce3ffdc1e9d9798de87538594757bbb9175fbf'

pkg.build_requires 'rubygem-prime'
# Also requires 'racc', part of the Ruby standard library as of 3.2

instance_eval File.read('configs/components/_base-rubygem.rb')

# Overwrite the base rubygem's default GEM_HOME with the vendor gem directory
Expand Down
171 changes: 51 additions & 120 deletions configs/components/rubygem-ffi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,66 +6,18 @@
# Read the comments in the code below carefully.
#####
component "rubygem-ffi" do |pkg, settings, platform|
if platform.is_cross_compiled? && (platform.is_linux? || platform.is_solaris?)
# Installing ffi >= 1.14.0 blows up horribly if we're cross compiling on Linux and Solaris.
# This is because we're using old rubies (2.1 and 2.0) to install gems which do not have
# methods like `append_ldflags`.
# (see https://github.com/ffi/ffi/commit/3aa6b25f5423a64ad4afa7f2a5a5855483bae3c2)
#
# A more long term solution would be to update the host rubies on those
# platforms to something newer (preferably the same API version as the ruby
# we're building for). We can probably avoid this until we start shipping Ruby 3.
pkg.version '1.13.1'
pkg.sha256sum '4e15f52ee45af7c5674d656041855448adbb5022618be252cd602d81b8e2978a'
else
pkg.version '1.17.2'
pkg.sha256sum '297235842e5947cc3036ebe64077584bff583cd7a4e94e9a02fdec399ef46da6'
end
pkg.version '1.17.2'
pkg.sha256sum '297235842e5947cc3036ebe64077584bff583cd7a4e94e9a02fdec399ef46da6'

rb_major_minor_version = settings[:ruby_version].to_f

# Windows versions of the FFI gem have custom filenames, so we overwite the
# defaults that _base-rubygem provides here, just for Windows for Ruby < 3.2
if platform.is_windows? && rb_major_minor_version < 3.2
# Pin this if lower than Ruby 2.7
pkg.version '1.9.25' if rb_major_minor_version < 2.7
pkg.sha256sum 'c67b84b1bd54b680bcc23b516e87c96b4585cad3ca9e0afea953c9a9cb90243d'
pkg.url "https://rubygems.org/downloads/ffi-#{pkg.get_version}-x64-mingw32.gem"

instance_eval File.read('configs/components/_base-rubygem.rb')

# Vanagon's `pkg.mirror` is additive, and the _base_rubygem sets the
# non-Windows gem as the first mirror, which is incorrect. We need to unset
# the list of mirrors before adding the Windows-appropriate ones here:
@component.mirrors = []
# Same for install steps:
@component.install = []

if platform.architecture == "x64"
# NOTE: make sure to verify the shas for the x64-mingw32 gem!
case pkg.get_version
when '1.9.25'
pkg.sha256sum '5473ac958b78f271f53e9a88197c35cd3e990fbe625d21e525c56d62ae3750da'
when '1.17.2'
pkg.sha256sum 'c67b84b1bd54b680bcc23b516e87c96b4585cad3ca9e0afea953c9a9cb90243d'
end

pkg.url "https://rubygems.org/downloads/ffi-#{pkg.get_version}-x64-mingw32.gem"
pkg.mirror "#{settings[:buildsources_url]}/ffi-#{pkg.get_version}-x64-mingw32.gem"
else
# Note make sure to verify the shas from the x86-mingw32 gem!
case pkg.get_version
when '1.9.25'
pkg.sha256sum '43d357732a6a0e3e41dc7e28a9c9c5112ac66f4a6ed9e1de40afba9ffcb836c1'
when '1.17.2'
pkg.sha256sum '5052e800045e95acdcd2c404777d5296751e66553c12ff4bf20f29ddcc9e4139'
end

pkg.url "https://rubygems.org/downloads/ffi-#{pkg.get_version}-x86-mingw32.gem"
pkg.mirror "#{settings[:buildsources_url]}/ffi-#{pkg.get_version}-x86-mingw32.gem"
end

pkg.install do
"#{settings[:gem_install]} ffi-#{pkg.get_version}-#{platform.architecture}-mingw32.gem"
end
pkg.install { "#{settings[:gem_install]} ffi-#{pkg.get_version}-x64-mingw32.gem" }
else
# Prior to ruby 3.2, both ruby and the ffi gem vendored a version of libffi.
# If libffi happened to be installed in /usr/lib, then the ffi gem preferred
Expand All @@ -88,78 +40,57 @@
instance_eval File.read('configs/components/_base-rubygem.rb')
end

# due to contrib/make_sunver.pl missing on solaris 11 we cannot compile libffi, so we provide the opencsw library
pkg.environment "CPATH", "/opt/csw/lib/libffi-3.2.1/include" if platform.name =~ /solaris-11/ && (platform.is_cross_compiled? || platform.architecture != 'sparc')
pkg.environment "MAKE", platform[:make] if platform.is_solaris?

if platform.is_cross_compiled_linux?
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH)"
elsif platform.is_solaris?
if settings[:ruby_version] =~ /3\.\d+\.\d+/
if !platform.is_cross_compiled? && platform.architecture == 'sparc'
pkg.environment "PATH", "#{settings[:ruby_bindir]}:$(PATH)"
else
pkg.environment "PATH", "/opt/csw/bin:/opt/pl-build-tools/bin:$(PATH)"
end
else
pkg.environment "PATH", "/opt/pl-build-tools/bin:/opt/csw/bin:$(PATH)"
end
elsif platform.is_aix?
pkg.environment 'PATH', '/opt/freeware/bin:/opt/pl-build-tools/bin:$(PATH)'
elsif platform.name == 'sles-11-x86_64'
pkg.environment 'PATH', '/opt/pl-build-tools/bin:$(PATH)'
end

# With Ruby 3.2 on Solaris-11 we install OpenSCW's libffi, no need to copy over the system libffi
if platform.name =~ /solaris-11-i386/ && rb_major_minor_version < 3.2
pkg.install_file "/usr/lib/libffi.so.5.0.10", "#{settings[:libdir]}/libffi.so"
elsif platform.name =~ /solaris-10-i386/
# If we ever support Solaris-11 on Ruby 3.2, then we won't want to do this
pkg.install_file "/opt/csw/lib/libffi.so.6", "#{settings[:libdir]}/libffi.so.6"
end

pkg.environment 'PKG_CONFIG_PATH', '/opt/puppetlabs/puppet/lib/pkgconfig:$(PKG_CONFIG_PATH)'

if platform.is_cross_compiled? && !platform.is_macos?
base_ruby = case platform.name
when /solaris-10/
"/opt/csw/lib/ruby/2.0.0"
else
"/opt/pl-build-tools/lib/ruby/2.1.0"
end
if platform.is_solaris?
ver, arch = platform.match(/^\w+-(\d+)-(\w+)$/).captures
cross = platform.is_cross_compiled?

# force compilation without system libffi in order to have a statically linked ffi_c.so
if platform.name =~ /solaris-11-sparc/
sed_exp = 's|CONFIG\["LDFLAGS"\].*|CONFIG["LDFLAGS"] = "-Wl,-rpath-link,/opt/pl-build-tools/sparc-sun-solaris2.11/sysroot/lib:/opt/pl-build-tools/sparc-sun-solaris2.11/sysroot/usr/lib -L. -Wl,-rpath=/opt/puppetlabs/puppet/lib -fstack-protector"|'
pkg.environment "MAKE", platform[:make]
pkg.environment "PATH", "/opt/pl-build-tools/bin:/opt/csw/bin:$(PATH)"

pkg.configure do
[
# libtool always uses the system/solaris ld even if we
# configure it to use the GNU ld, causing some flag
# mismatches, so just temporarily move the system ld
# somewhere else
%(mv /usr/bin/ld /usr/bin/ld1),
%(#{platform[:sed]} -i '#{sed_exp}' /opt/puppetlabs/puppet/share/doc/rbconfig-#{settings[:ruby_version]}-orig.rb)
]
end

# move ld back after the gem is installed
pkg.install { "mv /usr/bin/ld1 /usr/bin/ld" }

elsif platform.name =~ /solaris-10-sparc/
sed_exp = 's|CONFIG\["LDFLAGS"\].*|CONFIG["LDFLAGS"] = "-Wl,-rpath-link,/opt/pl-build-tools/sparc-sun-solaris2.10/sysroot/lib:/opt/pl-build-tools/sparc-sun-solaris2.10/sysroot/usr/lib -L. -Wl,-rpath=/opt/puppetlabs/puppet/lib -fstack-protector"|'
pkg.configure do
[
%(#{platform[:sed]} -i '#{sed_exp}' /opt/puppetlabs/puppet/share/doc/rbconfig-#{settings[:ruby_version]}-orig.rb)
]
if rb_major_minor_version >= 3.0
pkg.environment "PATH", "/opt/csw/bin:/opt/pl-build-tools/bin:$(PATH)"
pkg.environment "PATH", "#{settings[:ruby_bindir]}:$(PATH)" if !cross && arch == 'sparc'
end

if ver == '11'
# due to contrib/make_sunver.pl missing on solaris 11 we cannot compile libffi, so we provide the opencsw library
pkg.environment "CPATH", "/opt/csw/lib/libffi-3.2.1/include" if cross || arch != 'sparc'
# With Ruby 3.2 on Solaris-11 we install OpenSCW's libffi, no need to copy over the system libffi
pkg.install_file "/usr/lib/libffi.so.5.0.10", "#{settings[:libdir]}/libffi.so" if arch == 'i386' && rb_major_minor_version < 3.2
base_ruby = '/opt/pl-build-tools/lib/ruby/2.1.0' if cross
if arch == 'sparc'
sed_exp = 's|CONFIG\["LDFLAGS"\].*|CONFIG["LDFLAGS"] = "-Wl,-rpath-link,/opt/pl-build-tools/sparc-sun-solaris2.11/sysroot/lib:/opt/pl-build-tools/sparc-sun-solaris2.11/sysroot/usr/lib -L. -Wl,-rpath=/opt/puppetlabs/puppet/lib -fstack-protector"|'
pkg.configure do
[
# libtool always uses the system/solaris ld even if we
# configure it to use the GNU ld, causing some flag
# mismatches, so just temporarily move the system ld
# somewhere else
%(mv /usr/bin/ld /usr/bin/ld1),
%(#{platform[:sed]} -i '#{sed_exp}' /opt/puppetlabs/puppet/share/doc/rbconfig-#{settings[:ruby_version]}-orig.rb)
]
end
# move ld back after the gem is installed
pkg.install { "mv /usr/bin/ld1 /usr/bin/ld" }
end
end

# FFI 1.13.1 forced the minimum required ruby version to ~> 2.3
# In order to be able to install the gem using pl-ruby(2.1.9)
# we need to remove the required ruby version check
pkg.configure do
%(#{platform[:sed]} -i '0,/ensure_required_ruby_version_met/b; /ensure_required_ruby_version_met/d' #{base_ruby}/rubygems/installer.rb)
if ver == '10'
pkg.install_file "/opt/csw/lib/libffi.so.6", "#{settings[:libdir]}/libffi.so.6" if arch == 'i386' && rb_major_minor_version < 3.2
base_ruby = '/opt/csw/lib/ruby/2.0.0' if cross
if arch == 'sparc'
sed_exp = 's|CONFIG\["LDFLAGS"\].*|CONFIG["LDFLAGS"] = "-Wl,-rpath-link,/opt/pl-build-tools/sparc-sun-solaris2.10/sysroot/lib:/opt/pl-build-tools/sparc-sun-solaris2.10/sysroot/usr/lib -L. -Wl,-rpath=/opt/puppetlabs/puppet/lib -fstack-protector"|'
pkg.configure do
[
%(#{platform[:sed]} -i '#{sed_exp}' /opt/puppetlabs/puppet/share/doc/rbconfig-#{settings[:ruby_version]}-orig.rb)
]
end
end
end
end

pkg.environment 'PATH', '/opt/freeware/bin:/opt/pl-build-tools/bin:$(PATH)' if platform.is_aix?
pkg.environment "PATH", "/opt/pl-build-tools/bin:$(PATH)" if platform.is_cross_compiled_linux?

pkg.environment 'PKG_CONFIG_PATH', '/opt/puppetlabs/puppet/lib/pkgconfig:$(PKG_CONFIG_PATH)'
end
6 changes: 6 additions & 0 deletions configs/components/rubygem-gettext.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@
pkg.version '3.5.1'
pkg.sha256sum '03ec7f71ea7e2cf1fdcd5e08682e98b81601922fdbee890b7bc6f63b0e1a512a'

pkg.build_requires 'rubygem-erubi'
pkg.build_requires 'rubygem-locale'
pkg.build_requires 'rubygem-prime'
pkg.build_requires 'rubygem-text'
# Also requires 'racc', part of the Ruby standard library as of 3.2

instance_eval File.read('configs/components/_base-rubygem.rb')

# Overwrite the base rubygem's default GEM_HOME with the vendor gem directory
Expand Down
2 changes: 2 additions & 0 deletions configs/components/rubygem-highline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
pkg.sha256sum 'd63d7f472f8ffaa143725161ae6fb06895b5cb7527e0b4dac5ad1e4902c80cb9'
end

# Requires 'reline', part of the Ruby standard library as of 3.2

instance_eval File.read('configs/components/_base-rubygem.rb')

# Overwrite the base rubygem's default GEM_HOME with the vendor gem directory
Expand Down
13 changes: 0 additions & 13 deletions configs/components/rubygem-mini_portile2.rb

This file was deleted.

Loading