Subject: [PATCH 2/4] gnu: Add samu-as-ninja-wrapper.

From: Maxim Cournoyer <[email-masked]>
Date: Fri, 23 May 2025 15:38:25 +0900

* gnu/packages/ninja.scm (samu-as-ninja-wrapper): New variable.

Change-Id: I8227fc23ebb2bf9cdc9a6729be9f00ff10b196ca
---
 gnu/packages/ninja.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/ninja.scm b/gnu/packages/ninja.scm
index 7b517b9837..398c4be10f 100644
--- a/gnu/packages/ninja.scm
+++ b/gnu/packages/ninja.scm
@@ -27,6 +27,7 @@ (define-module (gnu packages ninja)
   #:use-module (guix packages)
   #:use-module (guix git-download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix build-system trivial)
   #:use-module (guix utils)
   #:use-module (gnu packages)
   #:use-module (gnu packages bash)
@@ -116,3 +117,21 @@ (define-public samurai
     (license (list asl2.0               ;for the most part
                    expat))))            ;htab.h, htab.c and tree.c
 
+(define-public samu-as-ninja-wrapper
+  (package/inherit samurai
+    (name "samu-as-ninja-wrapper")
+    (build-system trivial-build-system)
+    (arguments
+     (list #:builder
+           (with-imported-modules '((guix build utils))
+             #~(begin
+                 (use-modules (guix build utils))
+                 (let ((bindir (string-append #$output "/bin"))
+                       (samu (string-append #$(this-package-input "samurai")
+                                            "/bin/samu")))
+                   (mkdir-p bindir)
+                   (symlink samu (string-append bindir "/ninja")))))))
+    (inputs (list samurai))
+    (description "This package provides the @command{ninja} command,
+implemented as a symbolic link to the @command{samu} command of @code{samurai}
+package.")))
-- 
2.49.0