Subject: [bug#65012] [PATCH] gnu: Add picket.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 11 Sep 2023 23:50:41 +0200

Sergio Pastor Pérez <[email-masked]> skribis:

> * gnu/packages/image.scm (mini): New variable.
> ---
> This patch bundles the mINI header library. This library includes a series of
> tests which have g++, linux-header, and a few other dependencies that get
> satisfied with `gcc-toolchain'. For an unknown reason adding the module `gnu
> packages commencement` breaks Guile. This patches have been tested under
> `GUIX_PACKAGE_PATH` successfully. Also, adding this package definition under a
> module which already includes the commencement module does not present the
> issue.
>
> For this reason I submit this 2 patches as a proposal. Any further info
> regarding the issue described would be appreciated.

As you found out, the (gnu packages commencement) module cannot be
imported directly.

The solution here is to use ‘gnu-build-system’, which has GCC & co. as
implicit inputs, and adjust the relevant phases.

I made the change below and applied this patch.

Thanks!

Ludo’.

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 4332a7ead8..403409975a 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -68,7 +68,6 @@ (define-module (gnu packages image)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages curl)
   #:use-module (gnu packages compression)
-  #:use-module (gnu packages commencement)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages fontutils)
   #:use-module (gnu packages freedesktop)
@@ -1945,24 +1944,30 @@ (define-public mini
               (sha256
                (base32
                 "01wn7h9rjz9h6cr11dd62jsb3315d1h6c33pdmwi2l7d8a4n3h8d"))))
-    (build-system copy-build-system)
+    (build-system gnu-build-system)
     (arguments
-     (list #:install-plan ''(("src/mini/ini.h" "include/mini/ini.h"))
-           #:phases #~(modify-phases %standard-phases
-                        (add-before 'install 'check
-                          (lambda _
-                            (with-directory-excursion "tests"
-                              (for-each (lambda (test)
-                                          (let ((test-name (basename test
-                                                                     ".cpp")))
-                                            (invoke "./build.sh" test-name)
-                                            (invoke "./run.sh" test-name)))
-                                        (find-files "." ".cpp"))))))))
-    (native-inputs (list gcc-toolchain))
+     (list #:phases
+           #~(modify-phases %standard-phases
+               (delete 'build)
+               (delete 'configure)
+               (replace 'check
+                 (lambda* (#:key tests? #:allow-other-keys)
+                   (when tests?
+                     (with-directory-excursion "tests"
+                       (for-each (lambda (test)
+                                   (let ((test-name (basename test
+                                                              ".cpp")))
+                                     (invoke "./build.sh" test-name)
+                                     (invoke "./run.sh" test-name)))
+                                 (find-files "." ".cpp"))))))
+               (replace 'install
+                 (lambda _
+                   (install-file "src/mini/ini.h"
+                                 (string-append #$output "/include/mini")))))))
     (home-page "https://github.com/pulzed/mINI")
     (synopsis "INI file reader and writer header library")
     (description
-     "This is a tiny, header only C++ library for manipulating INI files.")
+     "This is a tiny, header-only C++ library for manipulating INI files.")
     (license license:expat)))
 
 (define-public picket