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

commit ba66fc1a358e9a94bfa5053df081fb264eb0f764
Author: Efraim Flashner <[email protected]>
AuthorDate: Thu Dec 12 09:19:24 2024 +0200

    gnu: zig: Set host triple.
    
    * gnu/packages/zig.scm (zig-0.10.0-675,zig-0.11)[arguments]<#:phases>: Set
    host triple in CMakeLists.txt.
    
    Change-Id: Ib05050d7e499b4336a01a140c73fb6c8bb450bd6
    Modified-by: Hilton Chain <[email protected]>
    Signed-off-by: Hilton Chain <[email protected]>
---
 gnu/packages/zig.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm
index 52ddf80c34..356665b0e7 100644
--- a/gnu/packages/zig.scm
+++ b/gnu/packages/zig.scm
@@ -2,7 +2,7 @@
 ;;; Copyright © 2021 Liliana Marie Prikler <[email protected]>
 ;;; Copyright © 2021 Sarah Morgensen <[email protected]>
 ;;; Copyright © 2021 Calum Irwin <[email protected]>
-;;; Copyright © 2022, 2023 Efraim Flashner <[email protected]>
+;;; Copyright © 2022-2024 Efraim Flashner <[email protected]>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -383,6 +383,13 @@ toolchain.  Among other features it provides
        (substitute-keyword-arguments (package-arguments base)
          ((#:phases phases '%standard-phases)
           #~(modify-phases #$phases
+              (add-after 'unpack 'set-host-triple
+                (lambda _
+                  (substitute* "CMakeLists.txt"
+                    (("\\$\\{(ZIG_)?HOST_TARGET_TRIPLE\\}")
+                     (zig-target
+                      #$(platform-target
+                         (lookup-platform-by-system (%current-system))))))))
               (replace 'prepare-source
                 (lambda* (#:key native-inputs inputs #:allow-other-keys)
                   (install-file (search-input-file
@@ -1125,6 +1132,13 @@ toolchain.  Among other features it provides
      (substitute-keyword-arguments (package-arguments zig-0.10)
        ((#:phases phases '%standard-phases)
         #~(modify-phases #$phases
+            (add-after 'unpack 'set-host-triple
+              (lambda _
+                (substitute* "CMakeLists.txt"
+                  (("\\$\\{ZIG_HOST_TARGET_TRIPLE\\}")
+                   (zig-target
+                    #$(platform-target
+                       (lookup-platform-by-system (%current-system))))))))
             (add-after 'unpack 'prepare-source
               (lambda* (#:key native-inputs inputs #:allow-other-keys)
                 (install-file (search-input-file

Reply via email to