Files
chromebrew/packages/ruby.rb
github-actions[bot] 833daddbb4 AutoBuild: ruby started at 2025-04-21-01UTC (#11792)
* Ruby => 3.4.3

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add built packages for linux/386 to ruby

* Lint crew, source bashrc after every postinstall during resolve_dependencies_and_build.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust reload ~/.bashrc logic for builds.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Set Crew Linker for ruby build.

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* libffi => 3.4.8

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Adjust libffi build

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* libffi => 3.4.8

Signed-off-by: Satadru Pramanik <satadru@gmail.com>

* Add built packages for linux/386 to ruby

* Add built packages for linux/amd64 to ruby

* Add built packages for linux/arm/v7 to ruby

* Update packages/libffi.rb

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

---------

Signed-off-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: Satadru Pramanik <satadru@gmail.com>
Co-authored-by: satmandu <satmandu@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2025-04-21 10:41:18 +00:00

76 lines
2.7 KiB
Ruby

require 'package'
class Ruby < Package
description 'Ruby is a dynamic, open source programming language with a focus on simplicity and productivity.'
homepage 'https://www.ruby-lang.org/en/'
version '3.4.3' # Do not use @_ver here, it will break the installer.
license 'Ruby-BSD and BSD-2'
compatibility 'all'
source_url 'https://github.com/ruby/ruby.git'
git_hashtag "v#{version.gsub('.', '_')}"
binary_compression 'tar.zst'
binary_sha256({
aarch64: 'd222312065f090f1393ae5290294595f854fe0766630ebb3feb847b2a4306f70',
armv7l: 'd222312065f090f1393ae5290294595f854fe0766630ebb3feb847b2a4306f70',
i686: '89d3e147f13c64242c45416edc6212f5947b50c70c8903c468b80274cdc52e11',
x86_64: 'fff153d663b037df66255127eb1ae0f1c7e3b7cd595962c71ff19faee416ad06'
})
depends_on 'ca_certificates' # L
depends_on 'filecmd' # L (This is to enable file command use in package files.)
depends_on 'gcc_lib' # R
depends_on 'glibc' # R
depends_on 'gmp' # R
depends_on 'libffi' # R
depends_on 'libyaml' # R
depends_on 'openssl' # R
depends_on 'rust' => :build
depends_on 'zlib' # R
conflicts_ok # Needed for successful build.
# at run-time, system's gmp, openssl, and zlib can be used
def self.build
system '[ -x configure ] || autoreconf -fiv'
system "RUBY_TRY_CFLAGS='stack_protector=no' \
RUBY_TRY_LDFLAGS='stack_protector=no' \
optflags='-flto=auto -fuse-ld=#{CREW_LINKER}' \
LD=#{CREW_LINKER} \
mold -run ./configure #{CREW_CONFIGURE_OPTIONS} \
--enable-shared \
#{ARCH == 'x86_64' ? '--enable-yjit' : ''} \
--disable-fortify-source"
system "MAKEFLAGS='--jobs #{CREW_NPROC}' make"
end
def self.check
# Do not run checks if rebuilding current ruby version.
# RUBY_VERSION is a built-in ruby constant.
system "MAKEFLAGS='--jobs #{CREW_NPROC}' make check || true" unless version.split('-')[0] == RUBY_VERSION
end
def self.install
system 'make', "DESTDIR=#{CREW_DEST_DIR}", 'install'
# See https://stackoverflow.com/questions/1844118/ruby-split-string-at-character-counting-from-the-right-side.
@ruby_ver = version.split(/\.([^.]*)$/).first
# Gems are stored in a ruby majorversion.minorversion.0 folder.
@gemrc = <<~GEMRCEOF
gem: --no-document
gempath: #{CREW_LIB_PREFIX}/ruby/gems/#{@ruby_ver}.0
GEMRCEOF
FileUtils.mkdir_p CREW_DEST_HOME
File.write("#{CREW_DEST_HOME}/.gemrc", @gemrc)
end
def self.postinstall
puts 'Updating ruby gems. This may take a while...'
silent = @opt_verbose ? '' : '--silent'
# install for Ruby 3.4
system 'gem uninstall resolv-replace', exception: false
system 'gem install highline ptools'
system "gem update #{silent} -N --system", exception: false
end
end