Skip to content

Instantly share code, notes, and snippets.

@pocke
Created April 16, 2026 11:46
Show Gist options
  • Select an option

  • Save pocke/64204bc1a0583c79c54a89bb1c22d231 to your computer and use it in GitHub Desktop.

Select an option

Save pocke/64204bc1a0583c79c54a89bb1c22d231 to your computer and use it in GitHub Desktop.
PicoRuby all gem sig checker
require 'pathname'
PICO_ROOT = Pathname(File.expand_path("~/ghq/github.com/picoruby/picoruby/"))
dst = Pathname(__dir__) / 'build_config'
dst.rmtree
dst.mkpath
PICO_ROOT.glob('mrbgems/*').each do |gem|
if gem.directory?
name = gem.basename.to_s
dst.join("#{name}.rb").write <<~RUBY
MRuby::CrossBuild.new("#{name}") do |conf|
# conf.toolchain
# conf.cc.defines << "PICORB_PLATFORM_POSIX"
# conf.cc.defines << "PICORB_INT64"
# conf.cc.defines << "MRBC_TICK_UNIT=4"
# conf.cc.defines << "MRBC_TIMESLICE_TICK_COUNT=3"
# conf.picoruby(alloc_libc: true)
conf.gem core: "#{name}"
end
RUBY
else
name = gem.basename('.gembox').to_s
dst.join("#{name}.rb").write <<~RUBY
MRuby::CrossBuild.new("#{name}") do |conf|
# conf.toolchain
# conf.cc.defines << "PICORB_PLATFORM_POSIX"
# conf.cc.defines << "PICORB_INT64"
# conf.cc.defines << "MRBC_TICK_UNIT=4"
# conf.cc.defines << "MRBC_TIMESLICE_TICK_COUNT=3"
# conf.picoruby(alloc_libc: true)
conf.gembox "#{name}"
end
RUBY
end
end
require 'yaml'
y = YAML.load_file('steep-project.yaml')
fails = []
y['targets'].each do |t|
name = t['name']
next unless ARGV.empty? || ARGV.include?(name)
p name
opts = t['signature_pattern']['pattern'].flat_map { |p| ['-I', p] }
system('rbs', *opts, 'validate') or (fails << name)
end
require 'steep/picoruby'
D = Steep::Diagnostic
PICO_ROOT = Pathname(File.expand_path("~/ghq/github.com/picoruby/picoruby/"))
#build_configs = PICO_ROOT.glob('build_config/*')
build_configs = Pathname(__dir__).glob('build_config/*')
err = []
build_configs.each do |c|
name = c.basename('.rb').to_s
next if name == 'arm-linux-gnueabihf'
next if name == 'default'
next if name == 'femtoruby-test'
next if name == 'femtoruby'
next if name == 'mips-linux-gnu'
next if name == "picoruby-32bit"
next if name == 'picoruby-test'
next if name == 'picoruby-wasm'
next if name == 'posix-net-test'
next if name == "prk_firmware-cortex-m0plus"
next if name == "prk_firmware-cortex-m33"
next if name == "sqlite3-test"
name = 'host/mrbc' if name == 'mrbc' || name == 'picorbc'
target name do
signature "."
check '.'
picoruby_library target: name, picoruby_root: PICO_ROOT.to_s, build_config: c.to_s
end
rescue => ex
err << [name, ex]
end
$stderr.puts "skipped: #{err.map(&:first)}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment