unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#67075] [PATCH] build: zig-build-system: Add CPU option
@ 2023-11-11 13:09 Ekaitz Zarraga
  2023-11-12 14:38 ` Efraim Flashner
  2023-11-18 16:52 ` Ekaitz Zarraga
  0 siblings, 2 replies; 5+ messages in thread
From: Ekaitz Zarraga @ 2023-11-11 13:09 UTC (permalink / raw)
  To: 67075

From a647a8ee689022cafef4bab05784b32b1c97bee7 Mon Sep 17 00:00:00 2001
Message-ID: <a647a8ee689022cafef4bab05784b32b1c97bee7.1699708101.git.ekaitz@elenq.tech>
From: Ekaitz Zarraga <ekaitz@elenq.tech>
Date: Sat, 11 Nov 2023 14:05:23 +0100
Subject: [PATCH] build: zig-build-system: Add CPU option

Zig packages are optimized by default, adding `-Dcpu=baseline` to the
build command builds them for an standard cpu that should work in every
machine.

This change sets that by default but also allows users to choose their
cpu by the `#:zig-cpu` argument.

* guix/build-system/zig.scm (build): add zig-cpu
* guix/build/zig-build-system.scm (zig-build) add zig-cpu

Change-Id: Ib4b2124179e7b5492e7c77c64e1f8336832032ea
---
 guix/build-system/zig.scm       | 2 ++
 guix/build/zig-build-system.scm | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/guix/build-system/zig.scm b/guix/build-system/zig.scm
index 16b8a712cc..f90e76104e 100644
--- a/guix/build-system/zig.scm
+++ b/guix/build-system/zig.scm
@@ -47,6 +47,7 @@ (define* (zig-build name inputs
                     source
                     (tests? #t)
                     (test-target #f)
+                    (zig-cpu #f)
                     (zig-build-flags ''())
                     (zig-test-flags ''())
                     (zig-release-type #f)
@@ -67,6 +68,7 @@ (define* (zig-build name inputs
                      #:source #+source
                      #:system #$system
                      #:test-target #$test-target
+                     #:zig-cpu #$zig-cpu
                      #:zig-build-flags #$zig-build-flags
                      #:zig-test-flags #$zig-test-flags
                      #:zig-release-type #$zig-release-type
diff --git a/guix/build/zig-build-system.scm b/guix/build/zig-build-system.scm
index d414ebfb17..99a81314d4 100644
--- a/guix/build/zig-build-system.scm
+++ b/guix/build/zig-build-system.scm
@@ -44,6 +44,7 @@ (define* (set-zig-global-cache-dir #:rest args)
   (setenv "ZIG_GLOBAL_CACHE_DIR" global-cache-dir))
 
 (define* (build #:key
+                zig-cpu
                 zig-build-flags
                 zig-release-type       ;; "safe", "fast" or "small" empty for a
                                        ;; debug build"
@@ -59,6 +60,7 @@ (define* (build #:key
                      ,@(if zig-release-type
                          (list (string-append "-Drelease-" zig-release-type))
                          '())
+                     ,(string-append "-Dcpu=" (or zig-cpu "baseline"))
                      ,@zig-build-flags)))
   (format #t "running: ~s~%" call)
   (apply invoke call)))

base-commit: af6105afc67a15a491a0a4fd18a28c9f801a0b94
-- 
2.41.0






^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-11-18 16:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-11 13:09 [bug#67075] [PATCH] build: zig-build-system: Add CPU option Ekaitz Zarraga
2023-11-12 14:38 ` Efraim Flashner
2023-11-12 16:38   ` Ekaitz Zarraga
2023-11-12 16:41     ` Ekaitz Zarraga
2023-11-18 16:52 ` Ekaitz Zarraga

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).