2022-10-03 18:37:28 +03:00
|
|
|
|
distributable:
|
2023-01-03 19:09:13 +03:00
|
|
|
|
url: https://cache.ruby-lang.org/pub/ruby/{{version.marketing}}/ruby-{{version}}.tar.xz
|
2022-10-03 18:37:28 +03:00
|
|
|
|
strip-components: 1
|
|
|
|
|
|
|
|
|
|
versions:
|
2023-06-16 16:33:37 +03:00
|
|
|
|
# ruby have *some* releases, but historically only have tags
|
|
|
|
|
# so if we want to build older releases we can only scan tags
|
2023-04-16 00:38:14 +03:00
|
|
|
|
github: ruby/ruby/tags
|
2022-10-03 18:37:28 +03:00
|
|
|
|
|
|
|
|
|
dependencies:
|
|
|
|
|
openssl.org: ^1.1
|
|
|
|
|
pyyaml.org: ^0.2
|
2023-01-15 22:34:19 +03:00
|
|
|
|
zlib.net: ^1
|
2022-10-03 18:37:28 +03:00
|
|
|
|
|
|
|
|
|
build:
|
|
|
|
|
dependencies:
|
|
|
|
|
freedesktop.org/pkg-config: ^0.29
|
|
|
|
|
gnu.org/gettext: ^0.21
|
2023-02-17 15:41:07 +03:00
|
|
|
|
gnu.org/patch: '*'
|
2023-06-13 18:15:14 +03:00
|
|
|
|
gnu.org/bison: ^3
|
|
|
|
|
gnu.org/autoconf: '*'
|
2023-12-21 11:22:42 +03:00
|
|
|
|
rust-lang.org: ^1 # required to build YJIT
|
2023-06-13 18:15:14 +03:00
|
|
|
|
linux:
|
2023-12-21 11:22:42 +03:00
|
|
|
|
ruby-lang.org: ^3 # ruby requires ruby to build
|
2023-06-16 16:33:37 +03:00
|
|
|
|
# ^^ only linux because we got issues on darwin currently and darwin provides ruby (for now)
|
2023-06-14 18:50:44 +03:00
|
|
|
|
script:
|
2023-12-28 12:21:15 +03:00
|
|
|
|
- patch -p1 -F5 < props/mkconfig.rb.diff
|
2023-06-14 18:50:44 +03:00
|
|
|
|
|
|
|
|
|
- ./configure $ARGS
|
2023-12-21 11:22:42 +03:00
|
|
|
|
|
2024-01-05 02:16:56 +03:00
|
|
|
|
# clang17 doesn't like [[maybe_unused]] on types
|
|
|
|
|
# fix cribbed from https://github.com/ruby/ruby/pull/4603/commits/fbdff085ef3c8a56e0a33404e8795879e3167549
|
2024-01-05 06:42:34 +03:00
|
|
|
|
- run: |
|
|
|
|
|
if test -f maybe_unused.h; then
|
|
|
|
|
sed -i -e 's/elif RBIMPL_HAS_C_ATTRIBUTE(maybe_unused)/elif RBIMPL_HAS_C_ATTRIBUTE(maybe_unused) \&\& (__STDC_VERSION__ >= 202000L)/' maybe_unused.h
|
|
|
|
|
fi
|
2024-01-05 02:16:56 +03:00
|
|
|
|
if: linux
|
|
|
|
|
working-directory: include/ruby/internal/attr
|
|
|
|
|
|
2024-06-22 01:10:24 +03:00
|
|
|
|
# ^3.1.4 can't find rubygems without help on linux
|
|
|
|
|
- run: |
|
|
|
|
|
if test "{{hw.platform}}" = "linux"; then
|
|
|
|
|
sed -i "s_^RUBYLIB.*=.*\$_RUBYLIB = ${RUBYLIB}_" uncommon.mk
|
|
|
|
|
fi
|
|
|
|
|
if: '>=3.1.4<3.2'
|
|
|
|
|
|
|
|
|
|
- make install
|
2022-11-02 23:38:19 +03:00
|
|
|
|
|
|
|
|
|
# we provide these as `rubygems.org`
|
2023-12-28 12:21:15 +03:00
|
|
|
|
- run: rm -f bundle bundler gem
|
2023-06-14 18:50:44 +03:00
|
|
|
|
working-directory: ${{prefix}}/bin
|
2022-11-02 23:38:19 +03:00
|
|
|
|
|
2023-06-14 18:50:44 +03:00
|
|
|
|
- fix-shebangs.ts ${{prefix}}/bin/*
|
2023-02-17 15:41:07 +03:00
|
|
|
|
|
2023-06-16 16:33:37 +03:00
|
|
|
|
# ruby itself provides the gems for these and we don’t want that
|
|
|
|
|
# we want to pkg them ourselves as part of rubygems.org
|
|
|
|
|
# to ensure the user gets a good ruby experience rubygems is marked as
|
|
|
|
|
# a companion which in most use means gems are automatically added to the
|
|
|
|
|
# pkgenv. Ruby behaves well if gems isn't around but the user may get
|
|
|
|
|
# unexpected errors in scenarios where they constructed an pkgenv manually
|
2023-11-30 01:34:38 +03:00
|
|
|
|
- working-directory: ${{prefix}}/lib/ruby/{{version.marketing}}.0
|
2023-06-16 16:33:37 +03:00
|
|
|
|
run: |
|
|
|
|
|
for x in bundler rubygems bundler.rb rubygems.rb; do
|
|
|
|
|
if test -d $x; then
|
|
|
|
|
rm -rf $x
|
|
|
|
|
else
|
2023-12-28 12:21:15 +03:00
|
|
|
|
rm -f $x
|
2023-06-16 16:33:37 +03:00
|
|
|
|
fi
|
|
|
|
|
done
|
|
|
|
|
rm -rf ../gems/3.2.0/gems/bundler-*.*.*
|
|
|
|
|
|
2023-06-14 18:50:44 +03:00
|
|
|
|
- run: |
|
|
|
|
|
rm -rf share/ri
|
|
|
|
|
rm -rf share/doc
|
|
|
|
|
rm -rf lib/ruby/site_ruby
|
|
|
|
|
rm -rf lib/ruby/vendor_ruby
|
2023-11-30 01:34:38 +03:00
|
|
|
|
working-directory: ${{prefix}}
|
2023-03-19 15:01:42 +03:00
|
|
|
|
|
|
|
|
|
# weirdly files get put here and we can't figure out how to stop it
|
2023-06-14 18:50:44 +03:00
|
|
|
|
- run: |
|
2023-11-30 01:34:38 +03:00
|
|
|
|
if test -d pkgconfig; then rm -rf pkgconfig; fi
|
2023-06-14 18:50:44 +03:00
|
|
|
|
mv *-{{hw.platform}}*/* .
|
|
|
|
|
rmdir *-{{hw.platform}}*
|
2023-11-30 01:34:38 +03:00
|
|
|
|
working-directory: ${{prefix}}/lib
|
2024-01-05 06:42:34 +03:00
|
|
|
|
if: '>=2.6'
|
2023-06-14 18:50:44 +03:00
|
|
|
|
|
2024-06-22 01:10:24 +03:00
|
|
|
|
- run: sed -i
|
2023-06-14 18:50:44 +03:00
|
|
|
|
-e 's|$(DESTDIR){{prefix}}|$(topdir)|g'
|
|
|
|
|
-e 's|CONFIG\["topdir"\] = .*|CONFIG\["topdir"\] = TOPDIR|g'
|
2024-01-18 23:16:26 +03:00
|
|
|
|
-e 's|CONFIG\["INSTALL"\] =.*|CONFIG\["INSTALL"\] = "/usr/bin/install"|g'
|
|
|
|
|
-e 's|CONFIG\["MJIT_CC"\] =.*|CONFIG\["MJIT_CC"\] = "/usr/bin/cc"|g'
|
2023-06-14 18:50:44 +03:00
|
|
|
|
rbconfig.rb
|
2023-11-30 01:34:38 +03:00
|
|
|
|
working-directory: ${{prefix}}/lib/ruby/{{version.marketing}}.0
|
2023-12-21 11:22:42 +03:00
|
|
|
|
env:
|
2024-01-05 06:42:34 +03:00
|
|
|
|
CFLAGS: $CFLAGS -Wno-implicit-function-declaration
|
2023-12-21 11:22:42 +03:00
|
|
|
|
ARGS:
|
|
|
|
|
- --prefix="{{prefix}}"
|
|
|
|
|
- --enable-load-relative # makes us relocatable
|
|
|
|
|
- --without-gmp
|
|
|
|
|
- --with-rubyarchprefix={{prefix}}/lib/ruby # no need for architecture specific crap
|
|
|
|
|
- --with-rubyhdrdir={{prefix}}/include # ^^
|
|
|
|
|
- --with-rubyarchhdrdir={{prefix}}/include # ^^
|
|
|
|
|
- --disable-multiarch # ^^
|
|
|
|
|
- --with-vendordir=no # is empty so don’t pollute
|
|
|
|
|
- --with-vendorarchdir=no # ^^
|
|
|
|
|
- --with-sitearchdir=no # ^^
|
|
|
|
|
- --enable-yjit # https://github.com/pkgxdev/pantry/issues/3538
|
2024-06-22 01:10:24 +03:00
|
|
|
|
- --disable-install-doc
|
2023-06-13 22:31:03 +03:00
|
|
|
|
|
2023-01-15 22:34:19 +03:00
|
|
|
|
test:
|
|
|
|
|
dependencies:
|
2023-12-21 11:22:42 +03:00
|
|
|
|
rubygems.org: '*' # is a companion __however__ brewkit doesn’t add companions to the test env automatically
|
2023-06-16 16:33:37 +03:00
|
|
|
|
script:
|
2023-12-21 11:22:42 +03:00
|
|
|
|
- ruby -e 'puts "Hello World!"'
|
|
|
|
|
|
|
|
|
|
# “The terminfo database could not be found.”
|
|
|
|
|
# all platforms but only happens in the test harness
|
|
|
|
|
# ie. you can run this locally and it will work
|
|
|
|
|
# - echo 'puts 1' | irb
|
2023-06-16 16:33:37 +03:00
|
|
|
|
|
|
|
|
|
# tests the libraries that come with Ruby can be utilized
|
2024-01-05 02:16:56 +03:00
|
|
|
|
- run: ruby $FIXTURE
|
2023-12-21 11:22:42 +03:00
|
|
|
|
fixture:
|
|
|
|
|
content: |
|
|
|
|
|
require 'date'
|
|
|
|
|
puts Date.today
|
|
|
|
|
extname: rb
|
2023-06-16 16:33:37 +03:00
|
|
|
|
|
|
|
|
|
# tests the gems that come with Ruby can be utilized
|
2024-01-05 02:16:56 +03:00
|
|
|
|
- run: ruby $FIXTURE
|
2023-12-21 11:22:42 +03:00
|
|
|
|
fixture:
|
|
|
|
|
content: |
|
|
|
|
|
require 'matrix'
|
|
|
|
|
matrix = Matrix[[1, 2], [3, 4]]
|
|
|
|
|
transpose_matrix = matrix.transpose
|
|
|
|
|
determinant = matrix.determinant
|
|
|
|
|
puts "Original matrix:\n#{matrix}"
|
|
|
|
|
puts "Transposed matrix:\n#{transpose_matrix}"
|
|
|
|
|
puts "Determinant of the matrix: #{determinant}"
|
|
|
|
|
extname: rb
|
|
|
|
|
|
2024-01-05 02:16:56 +03:00
|
|
|
|
- run: ruby --yjit $FIXTURE
|
|
|
|
|
if: ^3.1
|
2023-12-21 11:22:42 +03:00
|
|
|
|
fixture:
|
|
|
|
|
content: |
|
|
|
|
|
def fib(n)
|
|
|
|
|
return n if n <= 1
|
|
|
|
|
fib(n-1) + fib(n-2)
|
|
|
|
|
end
|
|
|
|
|
puts fib(35)
|
|
|
|
|
extname: rb
|
2022-11-02 23:38:19 +03:00
|
|
|
|
|
|
|
|
|
provides:
|
|
|
|
|
- bin/erb
|
|
|
|
|
- bin/irb
|
2023-03-19 15:01:42 +03:00
|
|
|
|
- bin/rake
|
2022-11-02 23:38:19 +03:00
|
|
|
|
- bin/rdoc
|
|
|
|
|
- bin/ri
|
|
|
|
|
- bin/ruby
|
|
|
|
|
|
2022-11-25 19:03:11 +03:00
|
|
|
|
interprets:
|
|
|
|
|
extensions: rb
|
|
|
|
|
args: ruby
|
|
|
|
|
|
2022-11-02 23:38:19 +03:00
|
|
|
|
companions:
|
|
|
|
|
rubygems.org: '*'
|