Subject: bug#56322: [PATCH core-updates 3/3] gnu: ruby: regenerate parse.c

From: Remco van 't Veer <[email-masked]>
Date: Wed, 12 Oct 2022 15:35:29 +0200

* gnu/packages/ruby.scm (baseruby, ruby-2.7): Use bootstrap baseruby to regenerate parse.c
---
 gnu/packages/ruby.scm | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index bd55d5ac6d..497271f442 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -188,7 +188,23 @@ (define-public ruby-2.7
                             "test/ruby/test_process.rb"
                             "test/ruby/test_system.rb"
                             "tool/rbinstall.rb")
-               (("/bin/sh") (which "sh"))))))))))
+               (("/bin/sh") (which "sh"))))))))
+    (native-inputs (list autoconf automake baseruby bison))))
+
+(define baseruby ;; for bootstrapping ruby's parser generator
+  (package
+    (inherit ruby-2.7)
+    (name "baseruby")
+    (source (origin
+              (inherit (package-source ruby-2.7))
+              ;; override snippet to not include deletion of bundled parse.c
+              (snippet `(begin
+                          ;; Remove bundled libffi
+                          (delete-file-recursively "ext/fiddle/libffi-3.2.1")
+                          ;; Trigger bootstap
+                          (delete-file "configure")
+                          (delete-file "aclocal.m4")))))
+    (native-inputs (list autoconf automake))))
 
 (define-public ruby-3.0
   (package
-- 
2.37.3