Let mjit-bindgen use BASERUBY and bundle/inline (#6740)

This commit is contained in:
Takashi Kokubun 2022-11-15 23:42:41 -08:00 коммит произвёл GitHub
Родитель cd2da09410
Коммит fca50abb7c
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
5 изменённых файлов: 28 добавлений и 45 удалений

36
.github/workflows/mjit-bindgen.yml поставляемый
Просмотреть файл

@ -28,8 +28,6 @@ jobs:
include:
- task: mjit-bindgen
fail-fast: false
env:
SETARCH: ${{ matrix.arch && format('setarch {0}', matrix.arch) }}
runs-on: ubuntu-20.04
if: ${{ !contains(github.event.head_commit.message, '[DOC]') && !contains(github.event.pull_request.labels.*.name, 'Documentation') }}
steps:
@ -39,20 +37,20 @@ jobs:
run: |
echo "GNUMAKEFLAGS=-j$((1 + $(nproc --all)))" >> $GITHUB_ENV
- name: Install libraries
env:
arch: ${{ matrix.arch }}
run: |
set -x
arch=${arch:+:${arch/i[3-6]86/i386}}
${arch:+sudo dpkg --add-architecture ${arch#:}}
sudo apt-get update -q || :
sudo apt-get install --no-install-recommends -q -y \
${arch:+cross}build-essential${arch/:/-} \
libssl-dev${arch} libyaml-dev${arch} libreadline6-dev${arch} \
zlib1g-dev${arch} libncurses5-dev${arch} libffi-dev${arch} \
libclang1-10${arch} \
bison autoconf ruby
sudo apt-get install -q -y pkg-config${arch} || :
build-essential \
libssl-dev libyaml-dev libreadline6-dev \
zlib1g-dev libncurses5-dev libffi-dev \
libclang1-10 \
bison autoconf
sudo apt-get install -q -y pkg-config || :
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
- name: git config
run: |
git config --global advice.detachedHead 0
@ -72,15 +70,11 @@ jobs:
- run: ./autogen.sh
working-directory: src
- name: Run configure
env:
arch: ${{ matrix.arch }}
run: >-
$SETARCH ../src/configure -C --disable-install-doc --prefix=$(pwd)/install --enable-yjit=dev_nodebug
${arch:+--target=$arch-$OSTYPE --host=$arch-$OSTYPE}
- run: $SETARCH make incs
- run: $SETARCH make
- run: $SETARCH make install
- run: $SETARCH make ${{ matrix.task }}
run: ../src/configure -C --disable-install-doc --prefix=$(pwd)/install --enable-yjit=dev_nodebug
- run: make incs
- run: make
- run: make install
- run: make ${{ matrix.task }}
- run: git diff --exit-code
working-directory: src
- uses: ruby/action-slack@v3.0.0

Просмотреть файл

@ -249,19 +249,7 @@ mjit_config.h: Makefile
.PHONY: mjit-bindgen
mjit-bindgen:
$(Q)$(XRUBY) -C $(srcdir) -Ilib \
-e 'ENV["GEM_HOME"] = File.expand_path(".bundle")' \
-e 'ENV["BUNDLE_APP_CONFIG"] = File.expand_path(".bundle")' \
-e 'ENV["BUNDLE_PATH__SYSTEM"] = "true"' \
-e 'ENV["BUNDLE_WITHOUT"] = "lint doc"' \
-e 'load "spec/bundler/support/bundle.rb"' -- install --gemfile=tool/mjit/Gemfile
$(Q)$(XRUBY) -C $(srcdir) -Ilib \
-e 'ENV["GEM_HOME"] = File.expand_path(".bundle")' \
-e 'ENV["BUNDLE_APP_CONFIG"] = File.expand_path(".bundle")' \
-e 'ENV["BUNDLE_GEMFILE"] = "tool/mjit/Gemfile"' \
-e 'ENV["BUNDLE_PATH__SYSTEM"] = "true"' \
-e 'ENV["BUNDLE_WITHOUT"] = "lint doc"' \
-e 'load "spec/bundler/support/bundle.rb"' -- exec tool/mjit/bindgen.rb $(CURDIR)
$(Q) $(BASERUBY) -rrubygems -C $(srcdir)/tool/mjit bindgen.rb $(CURDIR)
# These rules using MJIT_HEADER_SUFFIX must be in common.mk, not
# Makefile.in, in order to override the macro in defs/universal.mk.

1
tool/mjit/.gitignore поставляемый
Просмотреть файл

@ -1 +0,0 @@
/Gemfile.lock

Просмотреть файл

@ -1,3 +0,0 @@
source 'https://rubygems.org'
gem 'ffi-clang', git: 'https://github.com/ioquatix/ffi-clang', ref: 'c08ca683c4f4cf73f4dc38539c3180288b360ea1'

Просмотреть файл

@ -1,8 +1,18 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('./Gemfile', __dir__)
require 'bundler/setup'
ENV['GEM_HOME'] = File.expand_path('./.bundle', __dir__)
require 'rubygems/source'
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'ffi-clang', '0.7.0', require: false
end
# Help ffi-clang find libclang
# Hint: apt install libclang1
ENV['LIBCLANG'] ||= Dir.glob("/usr/lib/llvm-*/lib/libclang.so.1").grep_v(/-cpp/).sort.last
require 'ffi/clang'
require 'etc'
require 'fiddle/import'
@ -12,11 +22,6 @@ unless build_dir = ARGV.first
abort "Usage: #{$0} BUILD_DIR"
end
# Help ffi-clang find libclang
# Hint: apt install libclang1
ENV['LIBCLANG'] ||= Dir.glob("/lib/#{RUBY_PLATFORM}-gnu/libclang-*.so*").grep_v(/-cpp/).sort.last
require 'ffi/clang'
class Node < Struct.new(
:kind,
:spelling,