From patchwork Thu Jan 18 10:09:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Daniel Ziltener X-Patchwork-Id: 59094 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id F2D4A27BBE9; Thu, 18 Jan 2024 10:16:30 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=0.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,PP_MIME_FAKE_ASCII_TEXT, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,RCVD_IN_SBL_CSS,SPF_HELO_PASS, URIBL_BLOCKED,URIBL_CSS_A autolearn=no autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 987A727BBE2 for ; Thu, 18 Jan 2024 10:16:29 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQPRO-0005RF-1s; Thu, 18 Jan 2024 05:16:06 -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 1rQPRJ-0005QQ-KQ for guix-patches@gnu.org; Thu, 18 Jan 2024 05:16:03 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rQPRJ-00083Y-Bx for guix-patches@gnu.org; Thu, 18 Jan 2024 05:16:01 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQPRK-0003qS-Sg for guix-patches@gnu.org; Thu, 18 Jan 2024 05:16:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68564] [PATCH] build-system: fix the Chicken build system Resent-From: Daniel Ziltener Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 18 Jan 2024 10:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 68564 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68564@debbugs.gnu.org Cc: dziltener@lyrion.ch X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.17055729119631 (code B ref -1); Thu, 18 Jan 2024 10:16:02 +0000 Received: (at submit) by debbugs.gnu.org; 18 Jan 2024 10:15:11 +0000 Received: from localhost ([127.0.0.1]:54385 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQPQU-0002Ti-6t for submit@debbugs.gnu.org; Thu, 18 Jan 2024 05:15:11 -0500 Received: from lists.gnu.org ([2001:470:142::17]:51124) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQPQP-00025K-Kc for submit@debbugs.gnu.org; Thu, 18 Jan 2024 05:15:08 -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 1rQPQI-0005BD-Cd for guix-patches@gnu.org; Thu, 18 Jan 2024 05:14:58 -0500 Received: from 195-15-241-199.dc3-a.pub1.etik-cloud.com ([195.15.241.199] helo=lyrion.dc3-a.pub1.infomaniak.cloud) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rQPQE-0007ac-D2 for guix-patches@gnu.org; Thu, 18 Jan 2024 05:14:58 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lyrion.ch; s=; t=1705572886; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc; bh=eztiBr6Xyp4qBsJ0HASnKn1joTSzO2yaWcCRDCSDTlw=; b=pVSrBDe4MtqnvQMXoSPydl0M7TzAEVRDwXNdhdyGWGYOW6UBkNAoL49WJbiUQ4UYt3IeaZ lxLguu23hQ1lK/ZdaUvM5ml0NPb4XRiZBmnpU8Mhhh05ZhyN+JCDoO+6Yngcpyd0m9M2K4 827a8kCZifXNe2168HLp4ZFna2hc7Ywiuw3nR/FbrB8H80hcYl/q9/w5S7yNaIt9DtUv+S Fv7g3d6CO0vriL3wOK9YmPUBa6jWUOn4NFa2qBjEIx+uGuWPmIZJ91Xn9qH8OQsvdHUEbW 2WZjc1WpvwTdBGpMMj1BqhU1OIIbg+j+XfHGzbpn9FX7bzqY/xek9uvJdylogw== Received: from localhost (dslb-002-204-231-047.002.204.pools.vodafone-ip.de [2.204.231.47]) by lyrion.dc3-a.pub1.infomaniak.cloud (OpenSMTPD) with ESMTPSA id 9e96caaf (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Thu, 18 Jan 2024 10:14:46 +0000 (UTC) Message-ID: <5f79ce0097f1092706b65abd99940d06@lyrion.ch> Date: Thu, 18 Jan 2024 11:09:12 +0100 Received-SPF: pass client-ip=195.15.241.199; envelope-from=dziltener@lyrion.ch; helo=lyrion.dc3-a.pub1.infomaniak.cloud X-Spam_score_int: 27 X-Spam_score: 2.7 X-Spam_bar: ++ X-Spam_report: (2.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, PP_MIME_FAKE_ASCII_TEXT=0.001, RCVD_IN_SBL_CSS=3.335, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TVD_RCVD_IP=0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_CSS_A=0.1 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Daniel Ziltener X-ACL-Warn: , Daniel Ziltener via Guix-patches X-Patchwork-Original-From: Daniel Ziltener via Guix-patches via From: Daniel Ziltener Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches --- guix/build-system/chicken.scm | 68 +++++++++++++++++++---------- guix/build/chicken-build-system.scm | 17 +++----- 2 files changed, 50 insertions(+), 35 deletions(-) diff --git a/guix/build-system/chicken.scm b/guix/build-system/chicken.scm index 9f518e66e6..8c6b1f5e75 100644 --- a/guix/build-system/chicken.scm +++ b/guix/build-system/chicken.scm @@ -2,6 +2,7 @@ ;;; Copyright © 2020 raingloom ;;; Copyright © 2021 Ludovic Courtès ;;; Copyright © 2021 Xinglu Chen +;;; Copyright © 2024 Daniel Ziltener ;;; ;;; This file is part of GNU Guix. ;;; @@ -26,6 +27,8 @@ (define-module (guix build-system chicken) #:use-module (guix search-paths) #:use-module (guix build-system) #:use-module (guix build-system gnu) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) #:use-module (guix packages) #:export (%chicken-build-system-modules chicken-build @@ -40,15 +43,15 @@ (define* (egg-uri name version #:optional (extension ".tar.gz")) (define %chicken-build-system-modules ;; Build-side modules imported and used by default. - `((guix build chicken-build-system) + `((zilti build chicken-build-system) (guix build union) ,@%gnu-build-system-modules)) (define (default-chicken) + "Return the default Chicken package." ;; Lazily resolve the binding to avoid a circular dependency. - ;; TODO is this actually needed in every build system? (let ((chicken (resolve-interface '(gnu packages chicken)))) - (module-ref chicken 'chicken))) + (module-ref chicken 'chicken))) (define* (lower name #:key source inputs native-inputs outputs system target @@ -57,7 +60,7 @@ (define* (lower name #:rest arguments) "Return a bag for NAME." (define private-keywords - '(#:target #:chicken #:inputs #:native-inputs)) + '(#:target #:chicken #:inputs #:native-inputs #:outputs)) ;; TODO: cross-compilation support (and (not target) @@ -77,41 +80,58 @@ (define private-keywords ,@native-inputs)) (outputs outputs) (build chicken-build) - (arguments (strip-keyword-arguments private-keywords arguments))))) + (arguments + (substitute-keyword-arguments + (strip-keyword-arguments private-keywords arguments) + ((#:extra-directories extra-directories) + `(list ,@(append-map + (lambda (name) + (match (assoc name inputs) + ((_ pkg) + (match (package-transitive-propagated-inputs pkg) + (((propagated-names . _) ...) + (cons name propagated-names)))))) + extra-directories)))))))) (define* (chicken-build name inputs - #:key - source + #:key source + (tests? #t) + (parallel-build? #f) + (build-flags ''()) + (configure-flags ''()) + (extra-directories ''()) (phases '%standard-phases) - (outputs '("out")) + (outputs '("out" "static")) (search-paths '()) (egg-name "") (unpack-path "") - (build-flags ''()) - (tests? #t) (system (%current-system)) (guile #f) (imported-modules %chicken-build-system-modules) - (modules '((guix build chicken-build-system) + (modules '((zilti build chicken-build-system) (guix build union) (guix build utils)))) (define builder (with-imported-modules imported-modules #~(begin (use-modules #$@(sexp->gexp modules)) - (chicken-build #:name #$name - #:source #+source - #:system #$system - #:phases #$phases - #:outputs #$(outputs->gexp outputs) - #:search-paths '#$(sexp->gexp - (map search-path-specification->sexp - search-paths)) - #:egg-name #$egg-name - #:unpack-path #$unpack-path - #:build-flags #$build-flags - #:tests? #$tests? - #:inputs #$(input-tuples->gexp inputs))))) + #$(with-build-variables inputs outputs + #~(chicken-build #:name #$name + #:source #+source + #:system #$system + #:phases #$phases + #:configure-flags #$configure-flags + #:extra-directories #$extra-directories + #:parallel-build? #$parallel-build? + #:outputs #$(outputs->gexp outputs) + #:search-paths '#$(sexp->gexp + (map search-path-specification->sexp + search-paths)) + #:egg-name #$egg-name + #:unpack-path #$unpack-path + #:build-flags #$build-flags + #:tests? #$tests? + #:inputs #$(input-tuples->gexp inputs)))))) (mlet %store-monad ((guile (package->derivation (or guile (default-guile)) system #:graft? #f))) diff --git a/guix/build/chicken-build-system.scm b/guix/build/chicken-build-system.scm index 8f9f59cc25..6a4f0c43eb 100644 --- a/guix/build/chicken-build-system.scm +++ b/guix/build/chicken-build-system.scm @@ -42,13 +42,12 @@ (define (chicken-package? name) (define* (setup-chicken-environment #:key inputs outputs #:allow-other-keys) (setenv "CHICKEN_INSTALL_REPOSITORY" - (string-concatenate - ;; see TODO item about binary version above - (append (list (assoc-ref outputs "out") "/var/lib/chicken/11/") - (let ((oldenv (getenv "CHICKEN_INSTALL_REPOSITORY"))) - (if oldenv - (list ":" oldenv) - '()))))) + (string-append (assoc-ref outputs "out") "/var/lib/chicken/11/")) + (setenv "CHICKEN_INSTALL_PREFIX" + (string-append (assoc-ref outputs "out") "/bin/")) + (setenv "CHICKEN_REPOSITORY_PATH" + (string-append (getenv "CHICKEN_REPOSITORY_PATH") + ":" (getenv "CHICKEN_INSTALL_REPOSITORY"))) (setenv "CHICKEN_EGG_CACHE" (getcwd)) #t) @@ -104,10 +103,6 @@ (define* (check #:key egg-name tests? #:allow-other-keys) ;; there is no "-test-only" option, but we've already run install ;; so this just runs tests. ;; i think it's a fair assumption that phases won't be reordered. - (setenv "CHICKEN_REPOSITORY_PATH" - (string-append (getenv "CHICKEN_INSTALL_REPOSITORY") - ":" - (getenv "CHICKEN_REPOSITORY_PATH"))) (when tests? (invoke "chicken-install" "-cached" "-test" "-no-install" egg-name)))