From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id 6DkqNvgom2NWhgAAbAwnHQ (envelope-from ) for ; Thu, 15 Dec 2022 15:02:32 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id IC36Nfgom2OQ7AAAauVa8A (envelope-from ) for ; Thu, 15 Dec 2022 15:02:32 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 2AE5924976 for ; Thu, 15 Dec 2022 15:02:32 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p5ooU-0000hd-8o; Thu, 15 Dec 2022 09:02:18 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p5ooJ-0000hE-4P for guix-devel@gnu.org; Thu, 15 Dec 2022 09:02:09 -0500 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p5ooE-0008BO-PZ for guix-devel@gnu.org; Thu, 15 Dec 2022 09:02:05 -0500 Received: by mail-lf1-x130.google.com with SMTP id bf43so2508580lfb.6 for ; Thu, 15 Dec 2022 06:02:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender:from:to :cc:subject:date:message-id:reply-to; bh=+NgC+5UB8tyX3odA2+rNgzwQyGdbKLXopqdLVt/xX38=; b=hMHHc5mq2+LDYTCVtY/gfG8dX6plg1988/end+fUHKxWgcTCjjIAWZcEtIWoa4zfhm CMmUNt3YQb9XJ4ZSV9OS6jKXgq913ijY9feV9UJM1EZjPFfNYW3HBlw0IHiCB3CiVjPy LMCST+tGwGvt3YFh5i/zt8qFTIgdmRIPi0sG5q8YoLXYp6Uz6q3cHzZQ0pe9MpoSMyTT c45EPno5k9Jm5KrLeLCiYe1dll3dQP8BTiquDlg0eX5hYDxQNZwZmJOCkGshKUlWW8K6 5/0ImbJ+NZR4RGSKKPjjgaJtZwDTYm1wINT7jbH0dJL5lhM+mWJ7xq+D7MspX43ZVuxh PjWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=+NgC+5UB8tyX3odA2+rNgzwQyGdbKLXopqdLVt/xX38=; b=U1qprRYMldcp7WlxKS8HmIpQIZRg96proDCGrspjpLQwj5FE7xDrp6aY3UViH1ikfm zIcsAZEDc3RALhFQHAWJ4dGDU41pBg9DKaNBu/9OuI4bQkHiJ2UPxe7iUYSxjz9nokc5 9yiqIGMNFhZTNPWqhERqY0GaISTONuo2LUMBqau0A/+D6ZS316FIWCnxAP5I+bXd+nkZ 7Y8F+cQ8qaSNxnK+3SAXaUT622aisNYnYjmLcGMwqE1rvEngUp0DJuRryKPQSUneMRLA 8PowLy0ClFX1WNWocg+k7hI9eS92Hew43Pmb6lmXumnhmRPS4I3bYwf2JbZd/a02VHE5 DM0Q== X-Gm-Message-State: ANoB5pkYKmxtVfDKB2lZ9pIMZFZBt4LFe6aA5UK8XfBDdEuA614xxGrb 0fGnapZEH9KCDR08p7bjoAJX0ejsi0FH6A== X-Google-Smtp-Source: AA0mqf51eLbvwp4BnweWthfxLZXIbma7tky0D650tAPDS3SRPdJmOkhvaZt+q5cR/i067h/ythPcRQ== X-Received: by 2002:a05:6512:1397:b0:4a4:68b8:f4f0 with SMTP id p23-20020a056512139700b004a468b8f4f0mr10067611lfa.54.1671112918968; Thu, 15 Dec 2022 06:01:58 -0800 (PST) Received: from localhost ([2a02:ed3:914:7800:b62e:99ff:fef0:7bc0]) by smtp.gmail.com with ESMTPSA id bd18-20020a05600c1f1200b003d069fc7372sm6671779wmb.1.2022.12.15.06.01.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Dec 2022 06:01:58 -0800 (PST) Date: Thu, 15 Dec 2022 16:01:56 +0200 From: Efraim Flashner To: Ekaitz Zarraga Cc: "guix-devel\\@gnu.org" Subject: Re: WIP: zig-build-system Message-ID: Mail-Followup-To: Ekaitz Zarraga , "guix-devel\\@gnu.org" References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Z3Zl5Z6yFtgcBRpo" Content-Disposition: inline In-Reply-To: X-PGP-Key-ID: 0x41AAE7DCCA3D8351 X-PGP-Key: https://flashner.co.il/~efraim/efraim_flashner.asc X-PGP-Fingerprint: A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Received-SPF: pass client-ip=2a00:1450:4864:20::130; envelope-from=efraim.flashner@gmail.com; helo=mail-lf1-x130.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1671112952; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=+NgC+5UB8tyX3odA2+rNgzwQyGdbKLXopqdLVt/xX38=; b=orCjqRUoZQzlMXhYae6/ZJwl1pS/jnGk94n/nYDQNuCE1FACEdiL+v9vghs93xqHXetqqI N3dyI7C3qphLjG3JWPWrXVz7C6kDkVCfedYvC0XGIsur3n0Sz9liFKopO2IopDe9tkBTvk 4bAvUN5+0+TbBrzRwiJJL03IubfwhBAlGvI3YYhpP2N0uVMqAainRZX9bK5jkt0cPMu+ly yc83a+FmKi6F+Gjd2unAyiXrK2kX86Xtd0izXpxP3dznYj1MbHRv3suDdt+VSa3jPVPZSm AJ1BNL6xDce8DH21Djo5XFkYvpQVLPag7s7EVARA3Q/J4YBDMhFdh/ga868lfg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=hMHHc5mq; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1671112952; a=rsa-sha256; cv=none; b=Le0R9CG0jDukDQlFf/uvaT8OUGJNElmEXj9qN9lB4Zih8/SDEfGmKXJDKmpwCLrILVILF3 77TBXE6YArHB3qAMGNAeIRo68QYq0hu0VUJHokV5pLroEdoRA1k/mv8cDcWQV+dKphZSO9 XOKHkTFdRvERNaMfUgtA+rDeppHiRAusDce9qGzP5Fb45mM/bwo5xwAYV8gT4ffjHR+IQl ffv6R87vB/x16c42qMjJoondMWG+Cv50tPkkOmm3gQz5XJMSQr34G7wo667cjuyk31s2CZ 233bS31eWg8DsbJKmmWJob18vG959ZpSXYwMqBrNUOJWOn0wno6sOv6PT+l3MQ== X-Spam-Score: 1.12 X-Migadu-Queue-Id: 2AE5924976 X-Migadu-Scanner: scn1.migadu.com Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=hMHHc5mq; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.12 X-TUID: n1r9jp61BZ5N --Z3Zl5Z6yFtgcBRpo Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I'm going to add my comments while reading through instead of reading through, digesting, and then commenting. On Thu, Dec 15, 2022 at 12:12:59PM +0000, Ekaitz Zarraga wrote: > Hi all, >=20 > I'm working on a zig-build-system and I have something working. >=20 > I'd like to discuss some of the problems I found because I don't > know what's the best solution: >=20 > - I don't know how to configure the cross-compilation cross-compilation can come later. It's not uncommon when writing new build systems. > - The `zig` command uses a compiler to find the libc it needs to use > we should be able to remove the `gcc-toolchain` from the > dependencies if we just add the libc to the build system properly > (this point is mixed with the point above) Are you sure about removing gcc-toolchain? I don't have a problem with it if it is possible, especially since zig does provide a 'zig cc' command. We'd still likely need to use something like the make-gcc-toolchain to properly use ld-wrapper, unless we somehow wouldn't need that either. > I need suggestions on these... >=20 > I attach two patches, one for the current build system I made and > a second one for an example package that actually works but has > some weird needs you can find in the comments. >=20 > Cheers, > Ekaitz > From c19c7161cf0864be5ffee12e8baac248d2d9874a Mon Sep 17 00:00:00 2001 > From: Ekaitz Zarraga > Date: Thu, 15 Dec 2022 13:02:25 +0100 > Subject: [PATCH 2/2] Add a sample package for testing the zig build system >=20 > --- > gnu/packages/zig.scm | 43 ++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 42 insertions(+), 1 deletion(-) >=20 > diff --git a/gnu/packages/zig.scm b/gnu/packages/zig.scm > index cda93bed2e..7bce76ed51 100644 > --- a/gnu/packages/zig.scm > +++ b/gnu/packages/zig.scm > @@ -25,7 +25,9 @@ (define-module (gnu packages zig) > #:use-module ((guix licenses) #:prefix license:) > #:use-module (guix build-system cmake) > #:use-module (gnu packages) > - #:use-module (gnu packages llvm)) > + #:use-module (gnu packages llvm) > + #:use-module (guix build-system zig) > + #:use-module (gnu packages commencement)) > =20 > (define-public zig > (package > @@ -104,3 +106,42 @@ (define-public zig > ;; https://github.com/ziglang/zig/issues/6485 > (supported-systems %64bit-supported-systems) > (license license:expat))) > + I'm not looking at the actual package definition itself, that can be left to another time as needed. > +(define-public tigerbeetle > + (let ((commit-id "2022-12-12-weekly") > + (revision "0")) > + (package > + (name "tigerbeetle") > + (version (string-append revision "-" commit-id)) > + (source > + (origin > + (method git-fetch) > + (uri (git-reference > + (url "https://github.com/tigerbeetledb/tigerbeetle.git") > + (commit commit-id))) > + (file-name (git-file-name name version)) > + (sha256 > + (base32 "18rawl8rhyplw8hpa3fzbq9fqg088x0calz688c7zdff6y6f6mc= r")))) > + (build-system zig-build-system) > + (inputs (list gcc-toolchain)) Isn't gcc-toolchain part of %standard-packages in a build-system? Did I miss it not being there or does it also need to be added here for the reason you listed below? > + (arguments > + `(#:phases > + (modify-phases %standard-phases > + ;; TODO: Zig needs the gcc-toolchain in order to find the libc. > + ;; we need to think about how to solve this in the build= system > + ;; directly: --libc by default glibc is named 'libc' in the build system, and when cross-compiling 'libc' is generally the correct libc that you'd be looking for. Also I'd be curious about reusing the libc vendored in zig itself or if that's not actually possible/only for embedded uses. Also if you just need libc you could import glibc-final for the non-cross-build as a standard native-input (input?) and then you'd have it available. > + (add-before 'build 'set-env > + (lambda _ > + (setenv "CC" "gcc")))))) If you really don't need gcc by default you could consider something like what we have in the cargo-build-system: (when (assoc-ref inputs "openssl") (setenv "OPENSSL_DIR" (assoc-ref inputs "openssl"))) could be: (cond ((assoc-ref inputs "gcc") (setenv "CC" "gcc")) ((assoc-ref inputs "clang") (setenv "CC" "llvm")) (_ (setenv "CC" "zig cc"))) > + (synopsis "Distributed financial accounting database designed for = mission > +criti cal safety and performance") > + > + (description "Financial accounting database designed for mission c= ritical > +safet y and performance to power the future of financial > +servi ces.") > + (home-page "https://github.com/tigerbeetledb/tigerbeetle.git") > + (supported-systems %64bit-supported-systems) > + (license license:asl2.0)))) > --=20 > 2.38.0 >=20 > From 4dd02f0ea421bc1f4081380e847f048998131873 Mon Sep 17 00:00:00 2001 > From: Ekaitz Zarraga > Date: Thu, 15 Dec 2022 13:01:23 +0100 > Subject: [PATCH 1/2] WIP: Add a zig-build-system >=20 > --- > Makefile.am | 2 + > etc/snippets/yas/scheme-mode/guix-package | 5 +- > guix/build-system/zig.scm | 119 ++++++++++++++++++++++ > guix/build/zig-build-system.scm | 82 +++++++++++++++ > 4 files changed, 206 insertions(+), 2 deletions(-) > create mode 100644 guix/build-system/zig.scm > create mode 100644 guix/build/zig-build-system.scm >=20 > diff --git a/Makefile.am b/Makefile.am > index b54288c0fc..4cc7c2e5cf 100644 > --- a/Makefile.am > +++ b/Makefile.am > @@ -179,6 +179,7 @@ MODULES =3D \ > guix/build-system/scons.scm \ > guix/build-system/texlive.scm \ > guix/build-system/trivial.scm \ > + guix/build-system/zig.scm \ > guix/ftp-client.scm \ > guix/http-client.scm \ > guix/gnupg.scm \ > @@ -263,6 +264,7 @@ MODULES =3D \ > guix/build/graft.scm \ > guix/build/bournish.scm \ > guix/build/qt-utils.scm \ > + guix/build/zig-build-system.scm \ > guix/build/make-bootstrap.scm \ > guix/search-paths.scm \ > guix/packages.scm \ > diff --git a/etc/snippets/yas/scheme-mode/guix-package b/etc/snippets/yas= /scheme-mode/guix-package > index 724a392f81..3bb6307659 100644 > --- a/etc/snippets/yas/scheme-mode/guix-package > +++ b/etc/snippets/yas/scheme-mode/guix-package > @@ -43,8 +43,9 @@ > "scons-build-system" > "texlive-build-system" > "trivial-build-system" > - "waf-build-system")}) > + "waf-build-system" > + "zig-build-system")}) > (home-page "$4") > (synopsis "$5") > (description "$6") > - (license $7))) > \ No newline at end of file > + (license $7))) > diff --git a/guix/build-system/zig.scm b/guix/build-system/zig.scm > new file mode 100644 > index 0000000000..77010f1bed > --- /dev/null > +++ b/guix/build-system/zig.scm > @@ -0,0 +1,119 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright =C2=A9 2022 Ekaitz Zarraga > +;;; > +;;; This file is part of GNU Guix. > +;;; > +;;; GNU Guix is free software; you can redistribute it and/or modify it > +;;; under the terms of the GNU General Public License as published by > +;;; the Free Software Foundation; either version 3 of the License, or (at > +;;; your option) any later version. > +;;; > +;;; GNU Guix is distributed in the hope that it will be useful, but > +;;; WITHOUT ANY WARRANTY; without even the implied warranty of > +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +;;; GNU General Public License for more details. > +;;; > +;;; You should have received a copy of the GNU General Public License > +;;; along with GNU Guix. If not, see . > + > +(define-module (guix build-system zig) > + #:use-module (guix search-paths) > + #:use-module (guix store) > + #:use-module (guix utils) > + #:use-module (guix gexp) > + #:use-module (guix monads) > + #:use-module (guix packages) > + #:use-module (guix build-system) > + #:use-module (guix build-system gnu) > + #:use-module (ice-9 match) > + #:use-module (srfi srfi-26) > + #:export (zig-build-system)) > + > + > +(define (default-zig) > + "Return the default zig package." > + ;; Lazily resolve the binding to avoid a circular dependency. > + (let ((zig (resolve-interface '(gnu packages zig)))) > + (module-ref zig 'zig))) > + > +(define %zig-build-system-modules > + ;; Build-side modules imported by default. > + `((guix build zig-build-system) > + (guix build syscalls) > + ,@%gnu-build-system-modules)) > + > +(define* (zig-build name inputs > + #:key > + source > + (tests? #t) > + (test-target #f) > + (zig-build-flags ''()) Is it possible to pass flags during the test phase also? If it is then having a zig-test-flags keyword would also be good. I would also suggest a 'zig' flag, to allow choosing a different zig binary to be used for a build. > + (phases '%standard-phases) > + (outputs '("out")) > + (search-paths '()) > + (system (%current-system)) > + (guile #f) > + (imported-modules %zig-build-system-modules) > + (modules '((guix build zig-build-system) > + (guix build utils)))) > + "Build SOURCE using Zig, and with INPUTS." > + (define builder > + (with-imported-modules imported-modules > + #~(begin > + (use-modules #$@(sexp->gexp modules)) > + (zig-build #:name #$name > + #:source #+source > + #:system #$system > + #:test-target #$test-target > + #:zig-build-flags #$zig-build-flags > + #:tests? #$tests? > + #:phases #$phases > + #:outputs #$(outputs->gexp outputs) > + #:search-paths '#$(sexp->gexp > + (map search-path-specification->= sexp > + search-paths)) > + #:inputs #$(input-tuples->gexp inputs))))) > + > + (mlet %store-monad ((guile (package->derivation (or guile (default-gui= le)) > + system #:graft? #f))) > + (gexp->derivation name builder > + #:system system > + #:guile-for-build guile))) > + > +(define* (lower name > + #:key source inputs native-inputs outputs system target > + (zig (default-zig)) > + #:allow-other-keys > + #:rest arguments) > + "Return a bag for NAME." > + > + (define private-keywords > + '(#:target #:zig #:inputs #:native-inputs #:outputs)) > + > + ;; TODO: support cross-compilation > + ;; It's as simple as adding some build flags to `zig-build-flags` > + (and (not target) > + (bag > + (name name) > + (system system) > + (target target) > + (host-inputs `(,@(if source > + `(("source" ,source)) > + '()) > + ,@inputs > + > + ;; Keep the standard inputs of 'gnu-build-system' > + ;; TODO: do we need this? > + ,@(standard-packages))) > + (build-inputs `(("zig" ,zig) > + ,@native-inputs)) > + (outputs outputs) > + (build zig-build) > + (arguments (strip-keyword-arguments private-keywords arguments)= )))) > + > +(define zig-build-system > + (build-system > + (name 'zig) > + (description > + "Zig build system, to build Zig packages") > + (lower lower))) > diff --git a/guix/build/zig-build-system.scm b/guix/build/zig-build-syste= m.scm > new file mode 100644 > index 0000000000..de006770ee > --- /dev/null > +++ b/guix/build/zig-build-system.scm > @@ -0,0 +1,82 @@ > +;;; GNU Guix --- Functional package management for GNU > +;;; Copyright =C2=A9 2022 Ekaitz Zarraga > +;;; > +;;; This file is part of GNU Guix. > +;;; > +;;; GNU Guix is free software; you can redistribute it and/or modify it > +;;; under the terms of the GNU General Public License as published by > +;;; the Free Software Foundation; either version 3 of the License, or (at > +;;; your option) any later version. > +;;; > +;;; GNU Guix is distributed in the hope that it will be useful, but > +;;; WITHOUT ANY WARRANTY; without even the implied warranty of > +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > +;;; GNU General Public License for more details. > +;;; > +;;; You should have received a copy of the GNU General Public License > +;;; along with GNU Guix. If not, see . > + > +(define-module (guix build zig-build-system) > + #:use-module ((guix build gnu-build-system) #:prefix gnu:) > + #:use-module (guix build utils) > + #:use-module (ice-9 popen) > + #:use-module (ice-9 rdelim) > + #:use-module (ice-9 ftw) > + #:use-module (ice-9 format) > + #:use-module (ice-9 match) > + #:use-module (rnrs io ports) > + #:use-module (srfi srfi-1) > + #:use-module (srfi srfi-26) > + #:export (%standard-phases > + zig-build)) > + > +;; Commentary: > +;; > +;; Builder side code of the Zig build system > +;; > +;; Code: > + > +;; Interesting guide here: > +;; https://github.com/riverwm/river/blob/master/PACKAGING.md I would define a global-cache-dir and use ZIG_GLOBAL_CACHE_DIR to refer to it and not pass it around to all the phases. > +(define* (build #:key (zig-build-flags '()) > + #:allow-other-keys) > + "Build a given Zig package." > + (setenv "DESTDIR" "out") > + (apply invoke > + `("zig" "build" > + "--global-cache-dir" "zig-cache" > + "-p" "" ;; Don't add /usr If '-p' is the short form of '--prefix' or something then use the long form. > + "--prefix-lib-dir" "lib" > + "--prefix-exe-dir" "bin" > + "--prefix-include-dir" "include" > + ,@zig-build-flags))) > + ;; Let the build flags decide if it needs `-Drelease-safe` or > + ;; `-Drelease-fast` or any other. cmake-build-system has an option to determine Release or Debug (or to leave it as RelWithDebInfo) named 'build-type'. I think that should be added here. > + > +(define* (check #:key tests? #:allow-other-keys) > + "Run all the tests" > + (when tests? > + (setenv "DESTDIR" "test-out") I assume this is to prevent overwriting the actual binary with the tests enabled binary? I would consider unsetting it at the end of the phase. Or storing its previous value and setting it back to that, we have seen packages which use DESTDIR and I wouldn't want any surprises. > + (apply invoke > + `("zig" "build" "test" > + "--global-cache-dir" "zig-cache")))) What's the difference between 'zig test build.zig' and 'zig build test'? > +(define* (install #:key inputs outputs #:allow-other-keys) > + "Install a given Zig package." > + (let* ((out (assoc-ref outputs "out"))) > + (copy-recursively "out" out))) Beware of copy-pasting :). You don't use inputs, don't need let* vs let, and could probably directly (copy-recursively #$output out). Or rely on 'make install'. 'make install' was available for ncdu2, not sure about other zig projects. > +(define %standard-phases > + (modify-phases gnu:%standard-phases > + (delete 'bootstrap) > + (delete 'configure) > + (replace 'build build) > + (replace 'check check) > + (replace 'install install))) > + > + > +(define* (zig-build #:key inputs (phases %standard-phases) > + #:allow-other-keys #:rest args) > + "Build the given Zig package, applying all of PHASES in order." > + (apply gnu:gnu-build #:inputs inputs #:phases phases args)) > --=20 > 2.38.0 >=20 --=20 Efraim Flashner =D7=90=D7=A4=D7=A8=D7=99=D7=9D = =D7=A4=D7=9C=D7=A9=D7=A0=D7=A8 GPG key =3D A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351 Confidentiality cannot be guaranteed on emails sent or received unencrypted --Z3Zl5Z6yFtgcBRpo Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmObKNEACgkQQarn3Mo9 g1HiQw//VjHgEwhOmwVqlRwBQKLzuC0y2MLdYC8mvaa/ivTQleDtutiykSTgSFbY CnMrQUalBcaTh7XL1Ndhv3EH97P9thkjD+XDaw7NZVSJLBqieY9MKdCGuVg2s+ql o2Qe8TqKn0Iw+AJSt223v/qPvQghPWYR1kwqaw/Pwkb27J9k7gHvOrjSRJMb9Lgr /EplsSM1ZHcqYmpA+T4gdZZ4qoqRnpYYWh64K7+AwX8qx9j2e0ERuFZ5PSdiq5F6 mdhS0iW/l/qyAw/MpmrpB0nbj8nkxJ7TunQ4Nk7slogEuCxngMVumSGOW3GOll42 JYum7RkkG3XaWzxwnzYqPEFWoFevS92UoIUhJ1HdeAdRAlxJ8MKO7hdDDzYTU85o UzefwqwTtV8abrye1DicAsulBzmgT42dzmmpqI8HAFpJoyIBZVNi0h3wXAxR8W2q +qjOEdG6FYDdGSeILZQXDFwSg+xCTayVUd0FNIocneOAeaERFve2I5vnZZ3GSN1g y07xQujzpqaffCq/WzHSFSvjo06sgjr3etiQQiJlcXc0d9PhdXY3w0NQ4XNR+qhK 9PyX1DFkF/R/cS6+b4qE5INbfJafazOeXBWvj7e9RJsh14LV3K2xbw3UpKLgfw0P kcf11P6m7Ry+x2BN6R3Fhw1hlZE+/o6rCyz7G2XQGIXem4PTPaY= =K1BT -----END PGP SIGNATURE----- --Z3Zl5Z6yFtgcBRpo--