efraim pushed a commit to branch wip-zig-bootstrap
in repository guix.

commit d82cb846072f964003e4eedec1629ffc2630e008
Author: Efraim Flashner <[email protected]>
AuthorDate: Mon Nov 11 20:03:47 2024 +0200

    SQUASH gnu: Add zig-0.10.0-610.
    
    (zig-source): New procedure.
    
    Change-Id: I5e01fdce510dfe0d290ba1f672e997122fa0f90b
---
 gnu/packages/zig.scm | 42 ++++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
index 981422aa54..5e7b6cb50a 100644
--- a/gnu/packages/zig.scm
+++ b/gnu/packages/zig.scm
@@ -204,19 +204,29 @@ toolchain.  Among other features it provides
 ;;; See also: <https://git.jakstys.lt/motiejus/zig-repro>.
 ;;;
 
+(define (zig-source version commit hash)
+  (origin
+    (method git-fetch)
+    (uri (git-reference
+           (url "https://github.com/ziglang/zig";)
+           (commit commit)))
+    (file-name (git-file-name "zig" version))
+    (sha256 (base32 hash))
+    (snippet
+     #~(begin (use-modules (guix build utils))
+              (for-each (lambda (file)
+                          (when (file-exists? file)
+                            (delete-file file)))
+                        '("stage1/zig1.wasm"
+                          "stage1/zig1.wasm.zst"))))))
+
 ;; Restore C++ stage 1 and build the initial zig1.wasm.
-;; TODO: Find a better way to prepare source.
 (define zig-0.10.0-538-source
   (let ((commit "bf316e550671cc71eb498b3cf799493627bb0fdc")
         (revision "538"))
-    (origin
-      (method git-fetch)
-      (uri (git-reference
-            (url "https://github.com/ziglang/zig";)
-            (commit commit)))
-      (file-name (git-file-name "zig" (git-version "0.10.0" revision commit)))
-      (sha256
-       (base32 "1dchc2bp842jlw0byssqzindv8cigpqcj2hk3752667jrrww13vv")))))
+    (zig-source
+      (git-version "0.10.0" revision commit)
+      commit "1dchc2bp842jlw0byssqzindv8cigpqcj2hk3752667jrrww13vv")))
 
 (define zig-0.10.0-539-patch
   (let ((commit "28514476ef8c824c3d189d98f23d0f8d23e496ea"))
@@ -224,6 +234,7 @@ toolchain.  Among other features it provides
       (method url-fetch)
       (uri (string-append
             "https://github.com/ziglang/zig/commit/"; commit ".patch"))
+      (file-name "zig-0.10.0-539.patch")
       (sha256
        (base32 "0qxxiafg2sd5rr4xhw0c12rygd7zh1rmf3x8hfialyxmsbi5pfxp")))))
 
@@ -233,6 +244,7 @@ toolchain.  Among other features it provides
       (method url-fetch)
       (uri (string-append
             "https://github.com/ziglang/zig/commit/"; commit ".patch"))
+      (file-name "zig-0.10.0-542.patch")
       (sha256
        (base32 "1l09gmbr3vqzinb63kvaskgs1d0mvm1m7w3ai3ngwg5zlabyya35")))))
 
@@ -245,15 +257,9 @@ toolchain.  Among other features it provides
       (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))
-                (sha256
-                 (base32
-                  "08pm3f4hh6djl3szhqgm7fa3qisdl2xh9jrp18m0z7bk2vd0bzw7"))
-                (snippet '(delete-file "stage1/zig1.wasm.zst"))))
+                (inherit (zig-source
+                           version commit
+                           
"08pm3f4hh6djl3szhqgm7fa3qisdl2xh9jrp18m0z7bk2vd0bzw7"))))
       (arguments
        (substitute-keyword-arguments (package-arguments base)
          ((#:phases phases '%standard-phases)

Reply via email to