From patchwork Fri Jan 19 13:54:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Pierre De Jesus DIAZ X-Patchwork-Id: 59126 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 8A50027BBEA; Fri, 19 Jan 2024 13:56:24 +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=-3.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham 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 306A527BBE2 for ; Fri, 19 Jan 2024 13:56:19 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rQpLt-0003Sp-Jr; Fri, 19 Jan 2024 08:56:09 -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 1rQpLm-0003RG-Cs for guix-patches@gnu.org; Fri, 19 Jan 2024 08:56:02 -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 1rQpLm-0007xD-1M for guix-patches@gnu.org; Fri, 19 Jan 2024 08:56:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rQpLn-0001w5-Ug; Fri, 19 Jan 2024 08:56:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#68355] [PATCH v2 5/9] gnu: make-crust-package: Memoize. Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, vagrant@debian.org, guix-patches@gnu.org Resent-Date: Fri, 19 Jan 2024 13:56:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 68355 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 68355@debbugs.gnu.org Cc: othacehe@gnu.org, Jean-Pierre De Jesus DIAZ , Efraim Flashner , Vagrant Cascadian X-Debbugs-Original-Xcc: Efraim Flashner , Vagrant Cascadian Received: via spool by 68355-submit@debbugs.gnu.org id=B68355.17056725347330 (code B ref 68355); Fri, 19 Jan 2024 13:56:03 +0000 Received: (at 68355) by debbugs.gnu.org; 19 Jan 2024 13:55:34 +0000 Received: from localhost ([127.0.0.1]:57874 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQpLJ-0001u7-2q for submit@debbugs.gnu.org; Fri, 19 Jan 2024 08:55:34 -0500 Received: from mail-wm1-x32d.google.com ([2a00:1450:4864:20::32d]:45179) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rQpLF-0001tV-44 for 68355@debbugs.gnu.org; Fri, 19 Jan 2024 08:55:29 -0500 Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-40e86a9fc4bso9889045e9.2 for <68355@debbugs.gnu.org>; Fri, 19 Jan 2024 05:55:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1705672521; x=1706277321; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=at124O61Kdi5F8ekMPWejJ1/EkTdIOq5CCKZdSQOvxQ=; b=A5f5fkE2LA2rCqkkmacZ1d5iPdoLu5gR3Fvwzkdatgmbv04UVPwF9uXBaGkC/7SaqZ Ryj+QflallzxAQzMPQKYKrAx47oImO5kiAnJHHsshXl8eo52XGR1vzJYmITu5sWssfB8 DSqwaK/rZVKFo6e+oTcSl7wgEReA+npnEOaQ7zgVtyExtky1janAJfO5IAglFwJ0TNTq kpy7EpgnWTpOhhp6G7Mj+lEc7oPxdmwkWd7NusgYnkJVvHguE6PMxkKn5MPuNdcDgTtb kjs3yu8KA3TfmS/C/4ZPU7N8RhjIcWjEh6p8VFULfGnS5o1Yip4vkTcGrrbyrLNrBoEs pgHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705672521; x=1706277321; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=at124O61Kdi5F8ekMPWejJ1/EkTdIOq5CCKZdSQOvxQ=; b=Xc42Flw+t1U81d4p49BBo3ctQoXaPQr923V5rDUsgU4D4LCX1FEtqTI4TSkEs6NVSp geMIyrmlC0TvpH35a7fo2OonP9kjFUNiI2kISsze2EPgWiQrFNww16yrB5TKDuBwUbuW n+sMxxbf5li8bsgqKK0sFDBpdNUeGearmJyLyIUrOrtLHgMFDi0izWbcS5YAGZzpqbon t7+yPf5rgYIW1cAgIr1f7BGdGbOXQjr+Prt0fXF7cUkRZImSVMDijWH+7+FVn9lKfIRP Yy5pEQYX8YRMT1TkG02LKCzP/NeFo2JaYT7aVuRX0Fj1Tj9+aPHTOb3Tv9uC7E7auV7L 2hpg== X-Gm-Message-State: AOJu0YymCRmiArTRpILHiCdiMmzVxbc5sPNJbe61w37kcx+50wg67Zs0 tLK10liF+sx5/5H6tzWBvAO4g2RVTu0mgjj5in+uAXgQygZKlTrWcKfp5JaabGsi9HmZ6yDHJ4a /xkk= X-Google-Smtp-Source: AGHT+IHfwAnt2O4j4KD99V7tHEaSMYrBImk45Tgfi4efN2SMn6lCXvoPfEjnEGYBsTSinLY4vp8ehw== X-Received: by 2002:a05:600c:4686:b0:40e:52d8:c0c8 with SMTP id p6-20020a05600c468600b0040e52d8c0c8mr1503110wmo.129.1705672521001; Fri, 19 Jan 2024 05:55:21 -0800 (PST) Received: from jeandudey.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id s8-20020a05600c45c800b0040e527602c8sm33314846wmo.9.2024.01.19.05.55.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 05:55:20 -0800 (PST) Date: Fri, 19 Jan 2024 14:54:44 +0100 Message-ID: <43f09e1afdcc3cb1dbaf44fb7e6cdea24c41bd1d.1705672190.git.jean@foundationdevices.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <4e6b129a26d38305073c392c04707498a2ddfe69.1705672190.git.jean@foundationdevices.com> References: <4e6b129a26d38305073c392c04707498a2ddfe69.1705672190.git.jean@foundationdevices.com> MIME-Version: 1.0 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: Jean-Pierre De Jesus DIAZ X-ACL-Warn: , Jean-Pierre De Jesus DIAZ via Guix-patches X-Patchwork-Original-From: Jean-Pierre De Jesus DIAZ via Guix-patches via From: Jean-Pierre De Jesus DIAZ 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 * gnu/packages/firmware.scm (make-crust-package): Use mlambda. Change-Id: I2d916b96bc650f3731a69505e086cf8f8f470809 --- gnu/packages/firmware.scm | 155 +++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 77 deletions(-) diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm index 533cbca550..eb5251de5e 100644 --- a/gnu/packages/firmware.scm +++ b/gnu/packages/firmware.scm @@ -1197,81 +1197,82 @@ (define-public arm-trusted-firmware-imx8mq ;; Adding debug symbols causes the size to exceed limits. #~(delete "DEBUG=1" #$flags))))))) -(define (make-crust-package platform) - (package - (name (string-append "crust-" - (string-replace-substring platform "_" "-"))) - (version "0.5") - (source - (origin - (method git-fetch) - (uri (git-reference - ;; There are only GitHub generated release snapshots. - (url "https://github.com/crust-firmware/crust") - (commit (string-append "v" version)))) - (file-name (git-file-name "crust" version)) - (sha256 - (base32 - "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz")))) - (build-system gnu-build-system) - (arguments - (list - #:tests? #f ;no test suite - #:make-flags - (let ((triplet-without-vendor - (and (%current-target-system) - ;; TODO: Is there a use case for allowing this? - (not (target-avr?)) - (match (string-split (nix-system->gnu-triplet - (%current-target-system)) #\-) - ((arch vendor os ..1) - (string-join `(,arch ,@os) "-")))))) - #~(list "CROSS_COMPILE=or1k-elf-" - "V=1" - #$@(if triplet-without-vendor - ;; We are cross-compiling the tools, intended to be - ;; executable for the target system. - (list (string-append "HOSTAR=" triplet-without-vendor - "-ar") - (string-append "HOSTCC=" triplet-without-vendor - "-gcc")) - ;; Not cross-compiling. - (list "HOSTAR=ar" - "HOSTCC=gcc")) - "LEX=flex")) - #:phases - #~(modify-phases %standard-phases - (add-after 'unpack 'do-not-build-tests - (lambda _ - ;; Attempting to build the tools test binary on a non-aarch64 - ;; architecture fails with: "No cache cleaning implementation - ;; available for this architecture". Avoid building it (see: - ;; https://github.com/crust-firmware/crust/issues/182). - (substitute* "tools/Makefile" - (("tools-y \\+= test") "")))) - (delete 'configure) - (add-before 'build 'defconfig - (lambda* (#:key make-flags #:allow-other-keys) - (let ((config-name (string-append #$platform "_defconfig"))) - (apply invoke "make" (cons config-name make-flags))))) - (replace 'install - (lambda _ - (for-each (lambda (file) - (install-file file (string-append #$output - "/libexec"))) - (find-files "." "(scp\\.bin|\\.config)$")) - (install-file "build/tools/load" - (string-append #$output "/bin"))))))) - ;; The firmware is cross-compiled using a "bare bones" compiler (no libc). - ;; Use our own tool chain for that. - (native-inputs - (list bison - (cross-gcc "or1k-elf") - (cross-binutils "or1k-elf") - flex)) - (home-page "https://github.com/crust-firmware/crust") - (synopsis "Firmware for Allwinner sunxi SoCs") - (description "Crust improves battery life and thermal performance by +(define make-crust-package + (mlambda (platform) + (package + (name (string-append "crust-" + (string-replace-substring platform "_" "-"))) + (version "0.5") + (source + (origin + (method git-fetch) + (uri (git-reference + ;; There are only GitHub generated release snapshots. + (url "https://github.com/crust-firmware/crust") + (commit (string-append "v" version)))) + (file-name (git-file-name "crust" version)) + (sha256 + (base32 + "0xgbbhifg3miwd3yp6jq9kp7nqgz5gzy00w95vba45j8jk5vjvvz")))) + (build-system gnu-build-system) + (arguments + (list + #:tests? #f ;no test suite + #:make-flags + (let ((triplet-without-vendor + (and (%current-target-system) + ;; TODO: Is there a use case for allowing this? + (not (target-avr?)) + (match (string-split (nix-system->gnu-triplet + (%current-target-system)) #\-) + ((arch vendor os ..1) + (string-join `(,arch ,@os) "-")))))) + #~(list "CROSS_COMPILE=or1k-elf-" + "V=1" + #$@(if triplet-without-vendor + ;; We are cross-compiling the tools, intended to be + ;; executable for the target system. + (list (string-append "HOSTAR=" triplet-without-vendor + "-ar") + (string-append "HOSTCC=" triplet-without-vendor + "-gcc")) + ;; Not cross-compiling. + (list "HOSTAR=ar" + "HOSTCC=gcc")) + "LEX=flex")) + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'do-not-build-tests + (lambda _ + ;; Attempting to build the tools test binary on a non-aarch64 + ;; architecture fails with: "No cache cleaning implementation + ;; available for this architecture". Avoid building it (see: + ;; https://github.com/crust-firmware/crust/issues/182). + (substitute* "tools/Makefile" + (("tools-y \\+= test") "")))) + (delete 'configure) + (add-before 'build 'defconfig + (lambda* (#:key make-flags #:allow-other-keys) + (let ((config-name (string-append #$platform "_defconfig"))) + (apply invoke "make" (cons config-name make-flags))))) + (replace 'install + (lambda _ + (for-each (lambda (file) + (install-file file (string-append #$output + "/libexec"))) + (find-files "." "(scp\\.bin|\\.config)$")) + (install-file "build/tools/load" + (string-append #$output "/bin"))))))) + ;; The firmware is cross-compiled using a "bare bones" compiler (no libc). + ;; Use our own tool chain for that. + (native-inputs + (list bison + (cross-gcc "or1k-elf") + (cross-binutils "or1k-elf") + flex)) + (home-page "https://github.com/crust-firmware/crust") + (synopsis "Firmware for Allwinner sunxi SoCs") + (description "Crust improves battery life and thermal performance by implementing a deep sleep state. During deep sleep, the CPU cores, the DRAM controller, and most onboard peripherals are powered down, reducing power consumption by 80% or more compared to an idle device. On boards without a @@ -1280,8 +1281,8 @@ (define (make-crust-package platform) dedicated always-on microprocessor called a System Control Processor (SCP). Crust is designed to run on a specific SCP implementation, Allwinner's AR100.") - ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only. - (license (list license:bsd-3 license:gpl2)))) + ;; Most files are dual-licensed "BSD-3 OR GPL2", a few are GPL2 only. + (license (list license:bsd-3 license:gpl2))))) (define-public crust-pinebook (make-crust-package "pinebook"))