Subject: [PATCH 2/2] gnu: Add zig-0.10.0-610.

From: Hilton Chain <[email-masked]>
Date: Sat, 9 Nov 2024 01:44:07 +0800

*  gnu/packages/zig.scm (zig-0.10.0-610): New variable.

Change-Id: I277a7f5e9781e89d7ad7cd108fec9afcf8cd23d9
---
 gnu/packages/zig.scm | 46 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
index 68907fd04e..4174dba38b 100644
--- a/gnu/packages/zig.scm
+++ b/gnu/packages/zig.scm
@@ -299,4 +299,50 @@ (define zig-0.10.0-610-bootstrap
          (prepend binaryen)))
       (outputs '("out" "zig1")))))
 
+;; Bootstrap with our zig1.wasm.
+(define zig-0.10.0-610
+  (let ((commit "e7d28344fa3ee81d6ad7ca5ce1f83d50d8502118")
+        (revision "610"))
+    (package
+      (inherit zig-0.10)
+      (name "zig")
+      (version (git-version "0.10.0" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/ziglang/zig")
+                      (commit commit)))
+                (file-name (git-file-name name version))
+                (modules '((guix build utils)))
+                (snippet '(delete-file "stage1/zig1.wasm.zst"))
+                (sha256
+                 (base32
+                  "08pm3f4hh6djl3szhqgm7fa3qisdl2xh9jrp18m0z7bk2vd0bzw7"))))
+      (arguments
+       (substitute-keyword-arguments (package-arguments zig-0.10)
+         ((#:phases phases '%standard-phases)
+          #~(modify-phases #$phases
+              (add-after 'unpack 'unpack-zig1
+                (lambda* (#:key native-inputs inputs #:allow-other-keys)
+                  (install-file (search-input-file
+                                 (or native-inputs inputs) "bin/zig1.wasm.zst")
+                                "stage1")))
+              (add-after 'install 'update-zig1
+                (lambda _
+                  (invoke (string-append #$output "/bin/zig")
+                          "build" "update-zig1" "--verbose")))
+              (add-after 'update-zig1 'install-zig1
+                (lambda _
+                  (install-file "stage1/zig1.wasm.zst"
+                                (string-append #$output:zig1 "/bin"))))
+              (replace 'check
+                (lambda* (#:key tests? #:allow-other-keys)
+                  (when tests?
+                    (invoke (string-append #$output "/bin/zig")
+                            "test" "-I" "test" "test/behavior.zig"))))))))
+      (native-inputs
+       (modify-inputs (package-native-inputs zig-0.10)
+         (prepend binaryen `(,zig-0.10.0-610-bootstrap "zig1"))))
+      (outputs '("out" "zig1")))))
+
 (define-public zig zig-0.10)
-- 
2.46.0