Enable YJIT; Fixes #3538

This commit is contained in:
Max Howell 2023-12-21 08:22:42 +00:00
parent c2b37c4509
commit 341d7803aa
2 changed files with 55 additions and 38 deletions

View file

@ -218,7 +218,7 @@ jobs:
if: ${{ ! inputs.dry-run }}
complain:
needs: [build, test, bottle]
needs: bottle
if: failure() && !inputs.dry-run
runs-on: ubuntu-latest
permissions:
@ -228,4 +228,3 @@ jobs:
- uses: ./.github/actions/complain
with:
pkg: ${{ fromJSON(inputs.pkg).project }}=${{ fromJSON(inputs.pkg).version.value }}
platform: ${{ inputs.name }}

View file

@ -19,26 +19,15 @@ build:
gnu.org/patch: '*'
gnu.org/bison: ^3
gnu.org/autoconf: '*'
rust-lang.org: ^1 # required to build YJIT
linux:
ruby-lang.org: '*' # ruby requires ruby to build
ruby-lang.org: ^3 # ruby requires ruby to build
# ^^ only linux because we got issues on darwin currently and darwin provides ruby (for now)
env:
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 dont pollute
- --with-vendorarchdir=no # ^^
- --with-sitedir=no # ^^
- --with-sitearchdir=no # ^^
script:
- patch -p1 < props/mkconfig.rb.diff
- ./configure $ARGS
- make --jobs {{hw.concurrency}} install
# we provide these as `rubygems.org`
@ -83,36 +72,65 @@ build:
-e 's|CONFIG\["topdir"\] = .*|CONFIG\["topdir"\] = TOPDIR|g'
rbconfig.rb
working-directory: ${{prefix}}/lib/ruby/{{version.marketing}}.0
env:
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 dont pollute
- --with-vendorarchdir=no # ^^
- --with-sitedir=no # ^^
- --with-sitearchdir=no # ^^
- --enable-yjit # https://github.com/pkgxdev/pantry/issues/3538
test:
dependencies:
rubygems.org: '*' # is a companion __however__ brewkit doesnt add companions to the env automatically
rubygems.org: '*' # is a companion __however__ brewkit doesnt add companions to the test env automatically
script:
- |
ruby -e 'puts "Hello World!"'
# echo 'puts 1' | irb
# ^^ FIXME `The terminfo database could not be found`
- 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
# tests the libraries that come with Ruby can be utilized
- run: |
mv $FIXTURE a.rb
ruby a.rb
fixture: |
require 'date'
puts Date.today
- run:
ruby $FIXTURE
fixture:
content: |
require 'date'
puts Date.today
extname: rb
# tests the gems that come with Ruby can be utilized
- run: |
mv $FIXTURE a.rb
ruby a.rb
fixture: |
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}"
- run:
ruby $FIXTURE
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
- run:
ruby --yjit $FIXTURE
fixture:
content: |
def fib(n)
return n if n <= 1
fib(n-1) + fib(n-2)
end
puts fib(35)
extname: rb
provides:
- bin/erb