Hi,

After a long time, I was able to finish a first version of this. The
solution has two parts:

1) Per Ruby version, per architecture rbconfig.rb provided by
ruby-all-dev:

$ dpkg -L ruby-all-dev:amd64 ruby-all-dev:arm64 | grep rbconfig
/usr/lib/x86_64-linux-gnu/ruby-crossbuild/3.0.0/rbconfig.rb
/usr/lib/aarch64-linux-gnu/ruby-crossbuild/3.0.0/rbconfig.rb

Packages that use Ruby by hand should add the corresponding directory to
the Ruby load path when calling ruby, like this (examples from an amd64
system):

$ ruby -e 'puts RbConfig::CONFIG["rubyarchhdrdir"]'
/usr/include/x86_64-linux-gnu/ruby-3.0.0
$ ruby -I/usr/lib/aarch64-linux-gnu/ruby-crossbuild/3.0.0 -e 'puts 
RbConfig::CONFIG["rubyarchhdrdir"]'
/usr/include/aarch64-linux-gnu/ruby-3.0.0

This will cause the rbconfig.rb of the desired host architecture to have
precedence over the native one, and things should generally work.

2) For standard Ruby packages, gem2deb 2.0 (about to be uploaded) should
handle the cross building itself automatically out of the box.

Most build dependencies in Ruby packages are used to run the tests, but
anotating them with <!nocheck> <!nodoc> is still needed in other to
optimize bootstrapping.

Attachment: signature.asc
Description: PGP signature

Reply via email to