Files
chromebrew/packages/ruby.rb
Satadru Pramanik, DO, MPH, MEng cc3892199d ruby => 3.3.3 (#9962)
Signed-off-by: Satadru Pramanik <satadru@gmail.com>
2024-06-13 11:06:44 -05:00

72 lines
2.6 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.3.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: 'c7c01a3175c9eb125c4dd21e51f9426230b90f9dd9c4a15b96352c9c86828e34',
armv7l: 'c7c01a3175c9eb125c4dd21e51f9426230b90f9dd9c4a15b96352c9c86828e34',
i686: 'a01836b4ba2b3a7021b1f220419af6cc4348600f8608cafbf39464781a1bbe21',
x86_64: '3c612c6e39db6345756207a0f015cf7f5a62060b5daca5ca2c85d4a208ed5b65'
})
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 'zlibpkg' # R
conflicts_ok # Needed for successful build.
# at run-time, system's gmp, openssl, and zlibpkg 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}' \
mold -run ./configure #{CREW_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'
system "gem update #{silent} -N --system", exception: false
end
end