From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms9.migadu.com with LMTPS id EP1ZB1edB2WhOwAAG6o9tA:P1 (envelope-from ) for ; Mon, 18 Sep 2023 02:44:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id EP1ZB1edB2WhOwAAG6o9tA (envelope-from ) for ; Mon, 18 Sep 2023 02:44:07 +0200 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 BAECC59A8A for ; Mon, 18 Sep 2023 02:44:06 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=BPbm6+v4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1694997847; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=zwO2dzNNWv7qD8DUygWO0h5vAK9AGgtrLoa5cJdFFeU=; b=VKWBCZgbqFipWDrbLgs0F3MFbsb1bL4OwD2G3dZu+BipdV1p9K6Y7Yc5s/XniJJjDY0JTv 48TT8T9dS2haSi5lYo8BnFYir9CdnxPDEdJPsVK4DvqlKUC/lOSZOaLU4MfA2CecE7yytE GQS8/aUTg1Vv8z1OKm5w6PPgQfA8p3H+mf0s6K7MbMU0GaMUKjGuEUdWSOcW+GLmpam1Wb CXSiLniC9NjwAe3n4PfWI58U6X4+s2b2VAoa7Ij2is6uM/jnJVE65jnkglFESFxBB1J3RY WTPboK9keiLR9dBJb9g2iOFEIvQyY95tCHTD6DS3YAtKjh91WGObpnAnob9lcg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1694997847; a=rsa-sha256; cv=none; b=A9+N7vxMCF0QTXF0npnF+fJDylAcQhrsUUYV4nd6wIWw/Vl5pLStG01q4zMwiHXWgZjzHE jHJCOvflxH24jwuzqvc7NFrRwEXAJMITEU9eP/0/rzGcQrrkiiRByckW8L0GAYahOmvTOG cTQjkf60DEbw384ahgXM+c+rZ1z3cRpwNjj4Ucl5XMvAxuHPruL/YDdctVgf5miQxDvOVM 6o4CTmeahCsPLCq3qWZOCWHpyZhDF0lO2Ervhi0tkfPMK3PukCFOXTr2okBi2Q4LWX8ZGR CI/ijWewXQH/0qgJg55wiyX2YlFYRXMLVv18RCiiDhttsp6Ddjyh1LkDLXfNcA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=BPbm6+v4; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qi2Mp-0003hr-Ih; Sun, 17 Sep 2023 20:44:02 -0400 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 1qi2Mm-0003hU-2b for guix-patches@gnu.org; Sun, 17 Sep 2023 20:43:56 -0400 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 1qi2Ml-0000zq-3O; Sun, 17 Sep 2023 20:43:55 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qi2Ms-0001pO-VR; Sun, 17 Sep 2023 20:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65860] [PATCH v2 1/3] gnu: avr: Delay all cross compilation packages. Resent-From: Maxim Cournoyer Original-Sender: "Debbugs-submit" Resent-CC: maxim.cournoyer@gmail.com, ludo@gnu.org, guix-patches@gnu.org Resent-Date: Mon, 18 Sep 2023 00:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 65860 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 65860@debbugs.gnu.org Cc: Maxim Cournoyer , Maxim Cournoyer , Ludovic =?UTF-8?Q?Court=C3=A8s?= X-Debbugs-Original-Xcc: Maxim Cournoyer , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 65860-submit@debbugs.gnu.org id=B65860.16949978346977 (code B ref 65860); Mon, 18 Sep 2023 00:44:02 +0000 Received: (at 65860) by debbugs.gnu.org; 18 Sep 2023 00:43:54 +0000 Received: from localhost ([127.0.0.1]:51666 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi2Mj-0001oQ-PB for submit@debbugs.gnu.org; Sun, 17 Sep 2023 20:43:54 -0400 Received: from mail-qt1-x836.google.com ([2607:f8b0:4864:20::836]:46219) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi2Mg-0001ny-C2 for 65860@debbugs.gnu.org; Sun, 17 Sep 2023 20:43:52 -0400 Received: by mail-qt1-x836.google.com with SMTP id d75a77b69052e-410af8f75d9so25130921cf.0 for <65860@debbugs.gnu.org>; Sun, 17 Sep 2023 17:43:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694997816; x=1695602616; 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=zwO2dzNNWv7qD8DUygWO0h5vAK9AGgtrLoa5cJdFFeU=; b=BPbm6+v4vl/3Ns2KtidqjpBlwsX7S42XKSsggxYbo8lo/g8/rdUrKyXTlUfm6IoEM4 O+HFJTki25WvIhTszr9GJBcDVxazXkflr6FAoSs9AIRPb08dq2djb/dmE5Hvye+aKlaY DUOMNigiM9P4agk2IlRZ4lf+aPhIZ1V/d6cZ21G9rrvTan+DlYEJet1wpXRFQ+jpmvZx 7WM+GtCa8iysH01WQaHD+MSNID/APj2j9FJqCH339wRWVumIMsvEnEeNlk2MGsqHyr96 81XAtHbIjT69Qizu+8uNs4UcKnH4ZgIXN8ODXnkEub5VWwPJj1ZS5NuACA8z23M9HdmJ 61Bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694997816; x=1695602616; 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=zwO2dzNNWv7qD8DUygWO0h5vAK9AGgtrLoa5cJdFFeU=; b=NJqkX/1LLoILt8yC6Qx2oh4liTQ8HDijIR5mVUGUl/p3QcrexC72ZZb6UX744CalMl 3a28bFpOxcn9KnysZG8iqtWfu8WCTDSvCxfmoAwTrRe0SO7VY/KIn36O6dYq76NZ49RS 9LRdoehddOsCF1zKgOPB+JJ+TDEx83Kdg2Thfy1udQlhgNcjcmpe7Rjf/QTyktrurt1O I5xbSNKIXznMskEvgkNhnEr9l5XAV/5hPrwIiNsxbiufZyO4GIl48NvSDsgLjbaMt/RH Q7kjjIP+HiAh0bOj7i5AzU6B51JbE3zob54g0CRLDNijN6X8Z4JbjNetMlmoOOkyruEb sQIg== X-Gm-Message-State: AOJu0YyfJmHPdLpleyr/BYNOaZ1kmwl6WASOanziAM41Pt4U0WV/FYHp 93VyLnRDS4J7VmdD13nsWEgkNqUucCs= X-Google-Smtp-Source: AGHT+IEf+VB55YxfLdBc8J8afkU3yVPcufMEUeQcIRqk6HZSc9A3+fgFm7D5aJeCUXm1MLvFaeSosg== X-Received: by 2002:a05:622a:1822:b0:412:2513:fb6 with SMTP id t34-20020a05622a182200b0041225130fb6mr7286051qtc.5.1694997816579; Sun, 17 Sep 2023 17:43:36 -0700 (PDT) Received: from localhost.localdomain (dsl-10-149-131.b2b2c.ca. [72.10.149.131]) by smtp.gmail.com with ESMTPSA id cr8-20020a05622a428800b00403f1a7be90sm2662547qtb.88.2023.09.17.17.43.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 17:43:36 -0700 (PDT) From: Maxim Cournoyer Date: Sun, 17 Sep 2023 20:43:08 -0400 Message-ID: <9431a70a1d444c86ff64f8386740e40e036e6b0a.1694997755.git.maxim.cournoyer@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: 7.74 X-Spam-Score: 7.74 X-Migadu-Queue-Id: BAECC59A8A X-Migadu-Scanner: mx0.migadu.com X-TUID: W+FMbYIQMtgb Partially addresses . * gnu/packages/avr.scm: Add commentary comment. (avr-gcc): Turn into this... (make-avr-gcc): ... procedure. (avr-libc): Likewise, into... (make-avr-gcc): ... this. Adjust native-inputs accordingly. (avr-toolchain): Likewise, into... (make-avr-toolchain): ... this. * gnu/packages/avr-xyz.scm (simavr) [propagated-inputs]: replace avr-toolchain with a call to the 'make-avr-toolchain' procedure. --- Changes in v2: - Use mlambda for procedures - Fix ((make-avr-toolchain)) typo gnu/packages/avr-xyz.scm | 2 +- gnu/packages/avr.scm | 214 +++++++++++++++++++++------------------ 2 files changed, 119 insertions(+), 97 deletions(-) diff --git a/gnu/packages/avr-xyz.scm b/gnu/packages/avr-xyz.scm index a05157ede78..e8844b8d438 100644 --- a/gnu/packages/avr-xyz.scm +++ b/gnu/packages/avr-xyz.scm @@ -71,7 +71,7 @@ (define-public simavr (string-append "PREFIX=" #$output) (string-append "DESTDIR=" #$output)))) (propagated-inputs - (list avr-toolchain)) + (list (make-avr-toolchain))) (native-inputs (list autoconf which diff --git a/gnu/packages/avr.scm b/gnu/packages/avr.scm index b9bee5e624c..1277634ce5a 100644 --- a/gnu/packages/avr.scm +++ b/gnu/packages/avr.scm @@ -25,6 +25,7 @@ (define-module (gnu packages avr) #:use-module ((guix licenses) #:prefix license:) #:use-module (guix gexp) + #:use-module (guix memoization) #:use-module (guix utils) #:use-module (guix download) #:use-module (guix git-download) @@ -37,113 +38,134 @@ (define-module (gnu packages avr) #:use-module (gnu packages flashing-tools) #:use-module (gnu packages gcc) #:use-module (gnu packages llvm) - #:use-module (gnu packages vim)) + #:use-module (gnu packages vim) + #:export (make-avr-toolchain)) -(define-public avr-binutils +;;; Commentary: +;;; +;;; This module defines a procedure that can be used to create a complete +;;; avr-toolchain package. The procedure must not be used at the top level, +;;; to avoid cyclic module dependencies caused by the (gnu packages +;;; cross-base) module referring to top level bindings from (gnu packages +;;; gcc). +;;; +;;; It also contains packages for working with or targeting the AVR system. +;;; + +(define (make-avr-binutils) (package (inherit (cross-binutils "avr")) (name "avr-binutils"))) -(define avr-gcc - (let ((xgcc (cross-gcc "avr" #:xbinutils avr-binutils))) +(define make-avr-gcc + (mlambda () + (let ((xgcc (cross-gcc "avr" #:xbinutils (make-avr-binutils)))) + (package + (inherit xgcc) + (name "avr-gcc") + (arguments + (substitute-keyword-arguments (package-arguments xgcc) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH + (lambda* (#:key inputs #:allow-other-keys) + (let ((gcc (assoc-ref inputs "gcc"))) + ;; Remove the default compiler from CPLUS_INCLUDE_PATH + ;; to prevent header conflict with the GCC from + ;; native-inputs. + (setenv "CPLUS_INCLUDE_PATH" + (string-join + (delete (string-append gcc "/include/c++") + (string-split (getenv "CPLUS_INCLUDE_PATH") + #\:)) + ":")) + (format #t + "environment variable `CPLUS_INCLUDE_PATH' \ +changed to ~a~%" + (getenv "CPLUS_INCLUDE_PATH"))))) + ;; Without a working multilib build, the resulting GCC lacks + ;; support for nearly every AVR chip. + (add-after 'unpack 'fix-genmultilib + (lambda _ + ;; patch-shebang doesn't work here because there are + ;; actually several scripts inside this script, each with + ;; a #!/bin/sh that needs patching. + (substitute* "gcc/genmultilib" + (("#!/bin/sh") (string-append "#!" (which "sh")))))))) + ((#:configure-flags flags) + #~(delete "--disable-multilib" #$flags)))) + (native-search-paths + (list (search-path-specification + (variable "CROSS_C_INCLUDE_PATH") + (files '("avr/include"))) + (search-path-specification + (variable "CROSS_CPLUS_INCLUDE_PATH") + (files '("avr/include"))) + (search-path-specification + (variable "CROSS_OBJC_INCLUDE_PATH") + (files '("avr/include"))) + (search-path-specification + (variable "CROSS_OBJCPLUS_INCLUDE_PATH") + (files '("avr/include"))) + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (files '("avr/lib"))))) + (native-inputs + `(("gcc" ,gcc) + ,@(package-native-inputs xgcc))))))) + +(define make-avr-libc + (mlambda () (package - (inherit xgcc) - (name "avr-gcc") + (name "avr-libc") + (version "2.0.0") + (source (origin + (method url-fetch) + (uri (string-append "mirror://savannah//avr-libc/avr-libc-" + version ".tar.bz2")) + (sha256 + (base32 + "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj")))) + (build-system gnu-build-system) (arguments - (substitute-keyword-arguments (package-arguments xgcc) - ((#:phases phases) - #~(modify-phases #$phases - (add-after 'set-paths 'augment-CPLUS_INCLUDE_PATH - (lambda* (#:key inputs #:allow-other-keys) - (let ((gcc (assoc-ref inputs "gcc"))) - ;; Remove the default compiler from CPLUS_INCLUDE_PATH to - ;; prevent header conflict with the GCC from native-inputs. - (setenv "CPLUS_INCLUDE_PATH" - (string-join - (delete (string-append gcc "/include/c++") - (string-split (getenv "CPLUS_INCLUDE_PATH") - #\:)) - ":")) - (format #t - "environment variable `CPLUS_INCLUDE_PATH' changed to ~a~%" - (getenv "CPLUS_INCLUDE_PATH"))))) - ;; Without a working multilib build, the resulting GCC lacks - ;; support for nearly every AVR chip. - (add-after 'unpack 'fix-genmultilib - (lambda _ - ;; patch-shebang doesn't work here because there are actually - ;; several scripts inside this script, each with a #!/bin/sh - ;; that needs patching. - (substitute* "gcc/genmultilib" - (("#!/bin/sh") (string-append "#!" (which "sh")))))))) - ((#:configure-flags flags) - #~(delete "--disable-multilib" #$flags)))) - (native-search-paths - (list (search-path-specification - (variable "CROSS_C_INCLUDE_PATH") - (files '("avr/include"))) - (search-path-specification - (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("avr/include"))) - (search-path-specification - (variable "CROSS_OBJC_INCLUDE_PATH") - (files '("avr/include"))) - (search-path-specification - (variable "CROSS_OBJCPLUS_INCLUDE_PATH") - (files '("avr/include"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (files '("avr/lib"))))) - (native-inputs - `(("gcc" ,gcc) - ,@(package-native-inputs xgcc)))))) + '(#:out-of-source? #t + #:configure-flags '("--host=avr"))) + (native-inputs `(("avr-binutils" ,(make-avr-binutils)) + ("avr-gcc" ,(make-avr-gcc)))) + (home-page "https://www.nongnu.org/avr-libc/") + (synopsis "The AVR C Library") + (description + "AVR Libc is a project whose goal is to provide a high quality C +library for use with GCC on Atmel AVR microcontrollers.") + (license + (license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt"))))) -(define avr-libc - (package - (name "avr-libc") - (version "2.0.0") - (source (origin - (method url-fetch) - (uri (string-append "mirror://savannah//avr-libc/avr-libc-" - version ".tar.bz2")) - (sha256 - (base32 - "15svr2fx8j6prql2il2fc0ppwlv50rpmyckaxx38d3gxxv97zpdj")))) - (build-system gnu-build-system) - (arguments - '(#:out-of-source? #t - #:configure-flags '("--host=avr"))) - (native-inputs `(("avr-binutils" ,avr-binutils) - ("avr-gcc" ,avr-gcc))) - (home-page "https://www.nongnu.org/avr-libc/") - (synopsis "The AVR C Library") - (description - "AVR Libc is a project whose goal is to provide a high quality C library -for use with GCC on Atmel AVR microcontrollers.") - (license - (license:non-copyleft "http://www.nongnu.org/avr-libc/LICENSE.txt")))) - -(define-public avr-toolchain - ;; avr-libc checks the compiler version and passes "--enable-device-lib" for avr-gcc > 5.1.0. - ;; It wouldn't install the library for atmega32u4 etc if we didn't use the corret avr-gcc. - (package - (name "avr-toolchain") - (version (package-version avr-gcc)) - (source #f) - (build-system trivial-build-system) - (arguments '(#:builder (begin (mkdir %output) #t))) - (propagated-inputs - `(("avrdude" ,avrdude) - ("binutils" ,avr-binutils) - ("gcc" ,avr-gcc) - ("libc" ,avr-libc))) - (synopsis "Complete GCC tool chain for AVR microcontroller development") - (description "This package provides a complete GCC tool chain for AVR +(define make-avr-toolchain + (mlambda () + (let ((avr-binutils (make-avr-binutils)) + (avr-libc (make-avr-libc)) + (avr-gcc (make-avr-gcc))) + ;; avr-libc checks the compiler version and passes "--enable-device-lib" + ;; for avr-gcc > 5.1.0. It wouldn't install the library for atmega32u4 + ;; etc if we didn't use the corret avr-gcc. + (package + (name "avr-toolchain") + (version (package-version avr-gcc)) + (source #f) + (build-system trivial-build-system) + (arguments '(#:builder (begin (mkdir %output) #t))) + (propagated-inputs + `(("avrdude" ,avrdude) + ("binutils" ,avr-binutils) + ("gcc" ,avr-gcc) + ("libc" ,avr-libc))) + (synopsis "Complete GCC tool chain for AVR microcontroller development") + (description "This package provides a complete GCC tool chain for AVR microcontroller development. This includes the GCC AVR cross compiler and avrdude for firmware flashing. The supported programming languages are C and C++.") - (home-page (package-home-page avr-libc)) - (license (package-license avr-gcc)))) + (home-page (package-home-page avr-libc)) + (license (package-license avr-gcc)))))) (define-public microscheme (package -- 2.41.0