Subject: [PATCH 1/2] gnu: ruby: trigger autotools bootstrap

From: Remco van 't Veer <[email-masked]>
Date: Wed, 24 Aug 2022 17:27:46 +0200

* gnu/packages/ruby.scm (ruby-2.6, ruby-2.7): Remove autotools artifacts
---
 gnu/packages/ruby.scm | 129 ++++++++++++++++++++----------------------
 1 file changed, 62 insertions(+), 67 deletions(-)

diff --git a/gnu/packages/ruby.scm b/gnu/packages/ruby.scm
index cc95bd8d6e..ad8ef3d390 100644
--- a/gnu/packages/ruby.scm
+++ b/gnu/packages/ruby.scm
@@ -29,6 +29,7 @@
 ;;; Copyright © 2020 Tomás Ortín Fernández <[email-masked]>
 ;;; Copyright © 2021 Giovanni Biscuolo <[email-masked]>
 ;;; Copyright © 2022 Philip McGrath <[email-masked]>
+;;; Copyright © 2022 Remco van 't Veer <[email-masked]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -101,45 +102,44 @@ (define-public ruby-2.6
   (package
     (name "ruby")
     (version "2.6.5")
-    (source
-     (origin
-       (method url-fetch)
-       (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.xz"))
-       (sha256
-        (base32
-         "0qhsw2mr04f3lqinkh557msr35pb5rdaqy4vdxcj91flgxqxmmnm"))
-       (modules '((guix build utils)))
-       (snippet `(begin
-                   ;; Remove bundled libffi
-                   (delete-file-recursively "ext/fiddle/libffi-3.2.1")
-                   #t))))
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.xz"))
+              (sha256
+               (base32
+                "0qhsw2mr04f3lqinkh557msr35pb5rdaqy4vdxcj91flgxqxmmnm"))
+              (modules '((guix build utils)))
+              (snippet `(begin
+                          ;; Remove bundled libffi
+                          (delete-file-recursively "ext/fiddle/libffi-3.2.1")
+                          ;; Trigger bootstap
+                          (delete-file "configure")
+                          (delete-file "aclocal.m4")
+                          #t))))
     (build-system gnu-build-system)
     (arguments
      `(#:test-target "test"
-       #:configure-flags '("--enable-shared") ; dynamic linking
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'replace-bin-sh-and-remove-libffi
-           (lambda _
-             (substitute* '("Makefile.in"
-                            "ext/pty/pty.c"
-                            "io.c"
-                            "lib/mkmf.rb"
-                            "process.c"
-                            "test/rubygems/test_gem_ext_configure_builder.rb"
-                            "test/rdoc/test_rdoc_parser.rb"
-                            "test/ruby/test_rubyoptions.rb"
-                            "test/ruby/test_process.rb"
-                            "test/ruby/test_system.rb"
-                            "tool/rbinstall.rb")
-               (("/bin/sh") (which "sh")))
-             #t)))))
-    (inputs
-     (list readline openssl libffi gdbm))
-    (propagated-inputs
-     (list zlib))
+       #:configure-flags '("--enable-shared") ;dynamic linking
+       #:phases (modify-phases %standard-phases
+                  (add-before 'configure 'replace-bin-sh-and-remove-libffi
+                    (lambda _
+                      (substitute* '("Makefile.in" "ext/pty/pty.c"
+                                     "io.c"
+                                     "lib/mkmf.rb"
+                                     "process.c"
+                                     "test/rubygems/test_gem_ext_configure_builder.rb"
+                                     "test/rdoc/test_rdoc_parser.rb"
+                                     "test/ruby/test_rubyoptions.rb"
+                                     "test/ruby/test_process.rb"
+                                     "test/ruby/test_system.rb"
+                                     "tool/rbinstall.rb")
+                        (("/bin/sh")
+                         (which "sh"))) #t)))))
+    (inputs (list readline openssl libffi gdbm))
+    (propagated-inputs (list zlib))
+    (native-inputs (list autoconf automake))
     (native-search-paths
      (list (search-path-specification
             (variable "GEM_PATH")
@@ -154,39 +154,34 @@ (define-public ruby-2.7
   (package
     (inherit ruby-2.6)
     (version "2.7.4")
-    (source
-     (origin
-       (inherit (package-source ruby-2.6))
-       (uri (string-append "https://cache.ruby-lang.org/pub/ruby/"
-                           (version-major+minor version)
-                           "/ruby-" version ".tar.gz"))
-       (sha256
-        (base32
-         "0nxwkxh7snmjqf787qsp4i33mxd1rbf9yzyfiky5k230i680jhrh"))))
+    (source (origin
+              (inherit (package-source ruby-2.6))
+              (uri (string-append "https://cache.ruby-lang.org/pub/ruby/"
+                                  (version-major+minor version) "/ruby-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "0nxwkxh7snmjqf787qsp4i33mxd1rbf9yzyfiky5k230i680jhrh"))))
     (arguments
      `(#:test-target "test"
-       #:configure-flags '("--enable-shared") ; dynamic linking
-       #:phases
-       (modify-phases %standard-phases
-         (add-before 'configure 'replace-bin-sh-and-remove-libffi
-           (lambda _
-             (substitute* '("configure.ac"
-                            "template/Makefile.in"
-                            "lib/rubygems/installer.rb"
-                            "ext/pty/pty.c"
-                            "io.c"
-                            "lib/mkmf.rb"
-                            "process.c"
-                            "test/rubygems/test_gem_ext_configure_builder.rb"
-                            "test/rdoc/test_rdoc_parser.rb"
-                            "test/ruby/test_rubyoptions.rb"
-                            "test/ruby/test_process.rb"
-                            "test/ruby/test_system.rb"
-                            "tool/rbinstall.rb")
-               (("/bin/sh") (which "sh")))
-             #t)))))
-    (native-inputs
-     (list autoconf))))
+       #:configure-flags '("--enable-shared") ;dynamic linking
+       #:phases (modify-phases %standard-phases
+                  (add-before 'configure 'replace-bin-sh-and-remove-libffi
+                    (lambda _
+                      (substitute* '("configure.ac" "template/Makefile.in"
+                                     "lib/rubygems/installer.rb"
+                                     "ext/pty/pty.c"
+                                     "io.c"
+                                     "lib/mkmf.rb"
+                                     "process.c"
+                                     "test/rubygems/test_gem_ext_configure_builder.rb"
+                                     "test/rdoc/test_rdoc_parser.rb"
+                                     "test/ruby/test_rubyoptions.rb"
+                                     "test/ruby/test_process.rb"
+                                     "test/ruby/test_system.rb"
+                                     "tool/rbinstall.rb")
+                        (("/bin/sh")
+                         (which "sh"))) #t)))))))
 
 (define-public ruby-3.0
   (package
-- 
2.37.2