[DRE-maint] Bug#970469: rbconfig.rb should contain triplet-prefixed tools

Helmut Grohne helmut at subdivi.de
Wed Sep 16 21:06:57 BST 2020


Package: libruby2.7
Version: 2.7.1-3
Tags: patch

I've looked into cross building ruby extensions again. With help from
Antonio Terceiro and Chris Hofstaedtler, we figured that we likely need
three changes to make this work:

 * gem2deb should pull a native ruby. Otherwise running ruby fails.
 * $something should cause ruby to use the host's rbconfig.rb.
 * The build should use cross compilers.

The last of these is a problem since the compilers used for building
extensions are those listed in rbconfig.rb. It currently lists CC -> gcc
and CXX -> g++. Since these are unqualified, they're unsuitable for
cross building.

If rbconfig.rb were mapping these to triplet-prefixed build tools (which
work both natively and during cross builds) and we were solving the
other aspects, we could likely cross build simple ruby extensions.

So here goes the patch that makes rbconfig.rb contain triplet-prefixed
tools. The hard part of making the build use the correct rbconfig.rb is
not yet solved.

Helmut
-------------- next part --------------
diff --minimal -Nru ruby2.7-2.7.1/debian/changelog ruby2.7-2.7.1/debian/changelog
--- ruby2.7-2.7.1/debian/changelog	2020-05-11 15:58:00.000000000 +0200
+++ ruby2.7-2.7.1/debian/changelog	2020-09-16 21:50:16.000000000 +0200
@@ -1,3 +1,10 @@
+ruby2.7 (2.7.1-3.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Place arch-qualified tools in rbconfig.rb. (Closes: #-1)
+
+ -- Helmut Grohne <helmut at subdivi.de>  Wed, 16 Sep 2020 21:50:16 +0200
+
 ruby2.7 (2.7.1-3) unstable; urgency=medium
 
   * Do not run TestJIT.rb test file on salsa and autopkgtest
diff --minimal -Nru ruby2.7-2.7.1/debian/rules ruby2.7-2.7.1/debian/rules
--- ruby2.7-2.7.1/debian/rules	2020-05-11 15:58:00.000000000 +0200
+++ ruby2.7-2.7.1/debian/rules	2020-09-16 21:50:16.000000000 +0200
@@ -33,6 +33,13 @@
 configure_options += --localstatedir=/var
 configure_options += --sysconfdir=/etc
 
+# These are embedded in rbconfig.rb and should be triplet-prefixed for cross
+# compilation.
+configure_options += AS=$(DEB_HOST_GNU_TYPE)-as
+configure_options += CC=$(DEB_HOST_GNU_TYPE)-gcc
+configure_options += CXX=$(DEB_HOST_GNU_TYPE)-g++
+configure_options += LD=$(DEB_HOST_GNU_TYPE)-ld
+
 ifneq ($(DEB_BUILD_GNU_TYPE), $(DEB_HOST_GNU_TYPE))
 # Cross-building. This is the same logic that debhelper's
 # lib/Debian/Debhelper/Buildsystem/autoconf.pm uses.


More information about the Pkg-ruby-extras-maintainers mailing list