From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.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 sEX6CmydB2XAMAAA9RJhRA:P1 (envelope-from ) for ; Mon, 18 Sep 2023 02:44:28 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:478a::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id sEX6CmydB2XAMAAA9RJhRA (envelope-from ) for ; Mon, 18 Sep 2023 02:44:28 +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 AB4E65999E for ; Mon, 18 Sep 2023 02:44:27 +0200 (CEST) Authentication-Results: aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=Y6GhL5ES; 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=1694997868; 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: 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=J17DOp9WwPHDEC4JS6AlRMCCBGIV5yBTjqWgOeKyDDI=; b=aFowd+QoBEwx9Kqd1Va1NhCYkWfQyRc0BlyCT851BnN2v2av4kkZBAE/5LrLcajXb0Wt0Y 53BPV5C+INCnElb+F+j10sUyrOXeiMnMo4Q9uk+szaBTOq0Bq/OGdhBvu2n/IoD7TypgyM ymZPvYvzA8fRd1Ka9PunUxAk8tYTP57BFjWn/szqoXNUBLWOD07RIa3xHl4b5kkfx3XLtw fgsimhx13PFdDJqZKdjkMkypP7atwDq5RFJfAVRCD5TCB5S1DBE4ukLuGBE4yKFZabLxR+ 0wTO+WCXhBMICjrntspg7Y719JAZWFoOTjDsN2IZbfffxtzdby8hl+pt3lVlhQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1694997868; a=rsa-sha256; cv=none; b=nj2l9JDz20Wh5/OBVSw5YzUunnX1Czy2bphVvUiqzkOMGCmjujy4Lku1jgrR7NCGSmMTq7 23ZWvXvQPFgKEAzcU6x/raMahoPXIaE9ztiE9DIDekgDyPbXzK2pyIHLgsg2b8M2yYuQ/N 7QfOMPuZA/CBOjd4BvDKM9KDlN7+JZY/LULa/dy2VZu/ob1HwnJKVuXdmdTgX/AstdpdEt 97UgzPA7DYOv5BAK2o6VxN4DwjTZeshP7DoGIH7ozp6uW8H7vMmp54QmofGJl48aetxa0f tw8qvqq+lzPzj6vhsdXoW2wqJ7mZKgbZr0gD/LSe8Fu07hXwLH+ovtDGvrIwFQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("body hash did not verify") header.d=gmail.com header.s=20230601 header.b=Y6GhL5ES; 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 1qi2Mx-0003k0-Tw; Sun, 17 Sep 2023 20:44:07 -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 1qi2Mn-0003hp-G0 for guix-patches@gnu.org; Sun, 17 Sep 2023 20:43:57 -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 1qi2Mm-000101-JN; Sun, 17 Sep 2023 20:43:57 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qi2Mt-0001pX-CV; Sun, 17 Sep 2023 20:44:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#65860] [PATCH v2 2/3] gnu: embedded: Turn packages using top-level variables into procedures. 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:03 +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.16949978427028 (code B ref 65860); Mon, 18 Sep 2023 00:44:03 +0000 Received: (at 65860) by debbugs.gnu.org; 18 Sep 2023 00:44:02 +0000 Received: from localhost ([127.0.0.1]:51670 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi2Mp-0001om-JU for submit@debbugs.gnu.org; Sun, 17 Sep 2023 20:44:02 -0400 Received: from mail-qt1-x832.google.com ([2607:f8b0:4864:20::832]:51495) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qi2Ml-0001oF-Ks for 65860@debbugs.gnu.org; Sun, 17 Sep 2023 20:43:58 -0400 Received: by mail-qt1-x832.google.com with SMTP id d75a77b69052e-411f5dd7912so27053531cf.3 for <65860@debbugs.gnu.org>; Sun, 17 Sep 2023 17:43:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1694997822; x=1695602622; 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=YceUwOvZhcMmzMPEu3AXlYPaRmWJw1ZOBwqb9KcI1us=; b=Y6GhL5ESogGsyXnkog/E+YegZVpiIfM2qEWih6TQRrGAeMRjyeff+RwNq9kGgc0w/0 YW8neb6X/V0St+1KIEcqxDo0pDe7NvhbmCpx+T7EpkliU7zwJ5jDPqXVXV0V2WPqmLrL 84dZN91WdnPIbHNf+MEHVxWadxFloQSC5bcR5vN5HyDzJIn3npVnbzWrqqk9TGEioFBF 6vd9CZLX7Sujf9woQulLCnWxkHDEoUo4jwLsKOEoY6VvOqu01H2rJfR+UXumyxBMxfby EuZIiJciYC4YIZ+glC3sdaMjYhEwbNGb60B/VndXvRr7uvn5Eo98T12+CAGRd6x1lisb /83g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694997822; x=1695602622; 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=YceUwOvZhcMmzMPEu3AXlYPaRmWJw1ZOBwqb9KcI1us=; b=YrP9/knmoJ+p5gs0An2WnWF+ldPRzkuUEevUJIZWZn14IAXvKsHpeUbNZc2xwsYUMu Q6VTvgUUqKMDnHihZ4GRh5BSLeC72ORZUCY/aVL0zTcUHPfik0hI6jhlfRfBPWR7ztnD wjhku31xALhV5kOaJKa5ETCE6WrBokR/mLRhAd9dJO2tFQ30Q+EbnuSg5iYrzM/g3ZGm YzcBgAbQryzcqVQcwnMQUfQnSexeHMDb8LbaupyOYsvOvjzvfRvb4kfNRuiSFoNX95QM +qgw2cpDK4UexwxcvloYnkt4xaKWPqhhLEa1NSaF8xijlok1scfQD0/IKp4A++NCGCs8 enIQ== X-Gm-Message-State: AOJu0YwL9qwLRWSneuWc3pav1UyZDfWyRMZKIG9a9ldgPZFAeRD4rgZy 68CdONEtgfXoGepVT2g3nCV0iPnVaWM= X-Google-Smtp-Source: AGHT+IF7HBXSQIk9OPpeD7SMmkYkVBMaoZiZQWVeK6fCCg/dYKxKgyg/yL7dGWXyMwArae1rVHsAhA== X-Received: by 2002:ac8:5849:0:b0:410:60a4:ffc7 with SMTP id h9-20020ac85849000000b0041060a4ffc7mr11454581qth.10.1694997821451; Sun, 17 Sep 2023 17:43:41 -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.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 17:43:40 -0700 (PDT) From: Maxim Cournoyer Date: Sun, 17 Sep 2023 20:43:09 -0400 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 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.24 X-Spam-Score: 7.24 X-Migadu-Queue-Id: AB4E65999E X-Migadu-Scanner: mx0.migadu.com X-TUID: zMkfVbceq5uL Fixes . Before this change, simply adding the following import: modified gnu/packages/firmware.scm @@ -42,6 +42,7 @@ (define-module (gnu packages firmware) #:use-module (gnu packages admin) #:use-module (gnu packages autotools) #:use-module (gnu packages assembly) + #:use-module (gnu packages avr) #:use-module (gnu packages backup) #:use-module (gnu packages base) #:use-module (gnu packages bash) Would cause byte compilation and/or evaluation to fail due to a circular module dependency. * gnu/packages/embedded.scm: Add commentary. (gcc-arm-none-eabi-4.9, gcc-arm-none-eabi-6, newlib-arm-none-eabi) (newlib-nano-arm-none-eabi, gcc-arm-none-eabi-7-2018-q2-update) (newlib-arm-none-eabi-7-2018-q2-update) (newlib-nano-arm-none-eabi-7-2018-q2-update) (arm-none-eabi-toolchain-4.9, arm-none-eabi-nano-toolchain-4.9) (arm-none-eabi-toolchain-6, arm-none-eabi-nano-toolchain-6) (arm-none-eabi-toolchain-7-2018-q2-update, gdb-arm-none-eabi) (propeller-binutils, propeller-gcc-6, propeller-gcc-4) (propeller-gcc, propeller-toolchain, propeller-development-suite) (gcc-vc4): Turn into procedures, prefixing the procedure name with 'make-', and adjust all users. (make-libstdc++-arm-none-eabi) [arguments]: Avoid an unused warning. (arm-none-eabi-toolchain): Rename to... (make-arm-none-eabi-toolchain): ... this. * gnu/packages/raspberry-pi.scm (raspi-arm-chainloader) [native-inputs]: Replace gcc-arm-none-eabi-6 with (make-arm-none-eabi-toolchain). * gnu/packages/axoloti.scm (axoloti-runtime) [inputs]: Replace arm-none-eabi-nano-toolchain-4.9 with (make-arm-none-eabi-nano-toolchain-4.9). (axoloti-patcher): Likewise. (axoloti-patcher-next) [inputs]: Replace arm-none-eabi-nano-toolchain-7-2018-q2-update with (make-arm-none-eabi-nano-toolchain-7-2018-q2-update). --- Changes in v2: - Use mlambda for procedures gnu/packages/axoloti.scm | 6 +- gnu/packages/embedded.scm | 1227 ++++++++++++++++++--------------- gnu/packages/raspberry-pi.scm | 2 +- 3 files changed, 663 insertions(+), 572 deletions(-) diff --git a/gnu/packages/axoloti.scm b/gnu/packages/axoloti.scm index e0dd22c627c..7b369228603 100644 --- a/gnu/packages/axoloti.scm +++ b/gnu/packages/axoloti.scm @@ -199,7 +199,7 @@ (define-public axoloti-runtime ;; for compiling patches ("make" ,gnu-make) ;; for compiling firmware - ("cross-toolchain" ,arm-none-eabi-nano-toolchain-4.9) + ("cross-toolchain" ,(make-arm-none-eabi-nano-toolchain-4.9)) ;; for uploading compiled patches and firmware ("dfu-util" ,dfu-util-for-axoloti))) (native-inputs @@ -339,7 +339,7 @@ (define-public axoloti-patcher (assoc-ref ant:%standard-phases 'strip-jar-timestamps))))) (inputs `(("icedtea" ,icedtea "jdk") - ("cross-toolchain" ,arm-none-eabi-nano-toolchain-4.9) + ("cross-toolchain" ,(make-arm-none-eabi-nano-toolchain-4.9)) ("java-simple-xml" ,java-simple-xml) ("java-rsyntaxtextarea" ,java-rsyntaxtextarea) ("java-usb4java" ,java-usb4java) @@ -572,7 +572,7 @@ (define-public axoloti-patcher-next (assoc-ref ant:%standard-phases 'strip-jar-timestamps))))) (inputs `(("jdk" ,icedtea "jdk") - ("cross-toolchain" ,arm-none-eabi-nano-toolchain-7-2018-q2-update) + ("cross-toolchain" ,(make-arm-none-eabi-nano-toolchain-7-2018-q2-update)) ;; for compiling patches ("make" ,gnu-make) ;; for uploading compiled patches and firmware diff --git a/gnu/packages/embedded.scm b/gnu/packages/embedded.scm index 325013a627c..42abd3398f0 100644 --- a/gnu/packages/embedded.scm +++ b/gnu/packages/embedded.scm @@ -11,7 +11,7 @@ ;;; Copyright © 2020, 2021, 2022 Simon South ;;; Copyright © 2021 Morgan Smith ;;; Copyright © 2022 Mathieu Othacehe -;;; Copyright © 2022 Maxim Cournoyer +;;; Copyright © 2022, 2023 Maxim Cournoyer ;;; Copyright © 2023 Janneke Nieuwenhuizen ;;; ;;; This file is part of GNU Guix. @@ -34,6 +34,7 @@ (define-module (gnu packages embedded) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix gexp) + #:use-module (guix memoization) #:use-module (guix svn-download) #:use-module (guix git-download) #:use-module ((guix licenses) #:prefix license:) @@ -73,442 +74,519 @@ (define-module (gnu packages embedded) #:use-module (gnu packages tls) #:use-module (gnu packages version-control) #:use-module (gnu packages xorg) - #:use-module (srfi srfi-1)) + #:use-module (srfi srfi-1) + #:export (make-gcc-arm-none-eabi-4.9 + make-gcc-arm-none-eabi-6 + make-gcc-arm-none-eabi-7-2018-q2-update + + make-gcc-vc4 + + make-newlib-arm-none-eabi + make-newlib-arm-none-eabi-7-2018-q2-update + + make-newlib-nano-arm-none-eabi + make-newlib-nano-arm-none-eabi-7-2018-q2-update + + make-arm-none-eabi-toolchain-4.9 + make-arm-none-eabi-toolchain-6 + make-arm-none-eabi-toolchain-7-2018-q2-update + + make-arm-none-eabi-nano-toolchain-4.9 + make-arm-none-eabi-nano-toolchain-6 + make-arm-none-eabi-nano-toolchain-7-2018-q2-update + + make-gdb-arm-none-eabi + + make-propeller-gcc + make-propeller-gcc-4 + make-propeller-gcc-6 + make-propeller-toolchain + make-propeller-development-suite)) + +;;; Commentary: +;;; +;;; This modules contains toolchain generators as well as packages for use in +;;; embedded contexts. Note: the toolchain and specialized packages are +;;; procedures, so as to delay their references to top level bindings such as +;;; 'gcc' or 'cross-gcc', etc. +;;; ;; We must not use the released GCC sources here, because the cross-compiler ;; does not produce working binaries. Instead we take the very same SVN ;; revision from the branch that is used for a release of the "GCC ARM ;; embedded" project on launchpad. ;; See https://launchpadlibrarian.net/218827644/release.txt -(define-public gcc-arm-none-eabi-4.9 - (let ((xgcc (cross-gcc "arm-none-eabi" - #:xgcc gcc-4.9 - #:xbinutils (cross-binutils "arm-none-eabi"))) - (revision "1") - (svn-revision 227977)) - (package (inherit xgcc) - (version (string-append (package-version xgcc) "-" - revision "." (number->string svn-revision))) - (source - (origin - (method svn-fetch) - (uri (svn-reference - (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-4_9-branch/") - (revision svn-revision))) - (file-name (string-append "gcc-arm-embedded-" version "-checkout")) - (sha256 - (base32 - "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr")) +(define make-gcc-arm-none-eabi-4.9 + (mlambda () + (let ((xgcc (cross-gcc "arm-none-eabi" + #:xgcc gcc-4.9 + #:xbinutils (cross-binutils "arm-none-eabi"))) + (revision "1") + (svn-revision 227977)) + (package + (inherit xgcc) + (version (string-append (package-version xgcc) "-" + revision "." (number->string svn-revision))) + (source + (origin + (method svn-fetch) + (uri (svn-reference + (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/\ +embedded-4_9-branch/") + (revision svn-revision))) + (file-name (string-append "gcc-arm-embedded-" version "-checkout")) + (sha256 + (base32 + "113r98kygy8rrjfv2pd3z6zlfzbj543pq7xyq8bgh72c608mmsbr")) - (patches (cons (search-patch "gcc-4.9-inline.patch") - ;; Remove the one patch that doesn't apply to this 4.9 - ;; snapshot (the patch is for 4.9.4 and later but this - ;; svn snapshot is older). - (remove (lambda (patch) - (string=? (basename patch) - "gcc-arm-bug-71399.patch")) - (origin-patches (package-source xgcc))))))) - (native-inputs - `(("flex" ,flex) - ("gcc@5" ,gcc-5) - ,@(package-native-inputs xgcc))) - (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"))))) - (add-after 'unpack 'fix-genmultilib - (lambda _ - (substitute* "gcc/genmultilib" - (("#!/bin/sh") (string-append "#!" (which "sh")))))))) - ((#:configure-flags flags) - ;; The configure flags are largely identical to the flags used by the - ;; "GCC ARM embedded" project. - #~(append (list "--enable-multilib" - "--with-newlib" - "--with-multilib-list=armv6-m,armv7-m,armv7e-m" - "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" - "--enable-plugins" - "--disable-decimal-float" - "--disable-libffi" - "--disable-libgomp" - "--disable-libmudflap" - "--disable-libquadmath" - "--disable-libssp" - "--disable-libstdcxx-pch" - "--disable-nls" - "--disable-shared" - "--disable-threads" - "--disable-tls") - (delete "--disable-multilib" #$flags))))) - (native-search-paths - (list (search-path-specification - (variable "CROSS_C_INCLUDE_PATH") - (files '("arm-none-eabi/include"))) - (search-path-specification - (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("arm-none-eabi/include" - "arm-none-eabi/include/c++" - "arm-none-eabi/include/c++/arm-none-eabi"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (files '("arm-none-eabi/lib")))))))) + (patches (cons (search-patch "gcc-4.9-inline.patch") + ;; Remove the one patch that doesn't apply to this + ;; 4.9 snapshot (the patch is for 4.9.4 and later + ;; but this svn snapshot is older). + (remove (lambda (patch) + (string=? (basename patch) + "gcc-arm-bug-71399.patch")) + (origin-patches (package-source xgcc))))))) + (native-inputs + `(("flex" ,flex) + ("gcc@5" ,gcc-5) + ,@(package-native-inputs xgcc))) + (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"))))) + (add-after 'unpack 'fix-genmultilib + (lambda _ + (substitute* "gcc/genmultilib" + (("#!/bin/sh") (string-append "#!" (which "sh")))))))) + ((#:configure-flags flags) + ;; The configure flags are largely identical to the flags used by the + ;; "GCC ARM embedded" project. + #~(append (list "--enable-multilib" + "--with-newlib" + "--with-multilib-list=armv6-m,armv7-m,armv7e-m" + "--with-host-libstdcxx=-static-libgcc \ +-Wl,-Bstatic,-lstdc++,-Bdynamic -lm" + "--enable-plugins" + "--disable-decimal-float" + "--disable-libffi" + "--disable-libgomp" + "--disable-libmudflap" + "--disable-libquadmath" + "--disable-libssp" + "--disable-libstdcxx-pch" + "--disable-nls" + "--disable-shared" + "--disable-threads" + "--disable-tls") + (delete "--disable-multilib" #$flags))))) + (native-search-paths + (list (search-path-specification + (variable "CROSS_C_INCLUDE_PATH") + (files '("arm-none-eabi/include"))) + (search-path-specification + (variable "CROSS_CPLUS_INCLUDE_PATH") + (files '("arm-none-eabi/include" + "arm-none-eabi/include/c++" + "arm-none-eabi/include/c++/arm-none-eabi"))) + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (files '("arm-none-eabi/lib"))))))))) -(define-public gcc-arm-none-eabi-6 - (package - (inherit gcc-arm-none-eabi-4.9) - (version (package-version gcc-6)) - (source (origin (inherit (package-source gcc-6)) - (patches - (append - (origin-patches (package-source gcc-6)) - (search-patches "gcc-6-cross-environment-variables.patch" - "gcc-6-arm-none-eabi-multilib.patch"))))))) +(define make-gcc-arm-none-eabi-6 + (mlambda () + (package + (inherit (make-gcc-arm-none-eabi-4.9)) + (version (package-version gcc-6)) + (source (origin + (inherit (package-source gcc-6)) + (patches + (append + (origin-patches (package-source gcc-6)) + (search-patches "gcc-6-cross-environment-variables.patch" + "gcc-6-arm-none-eabi-multilib.patch")))))))) -(define-public newlib-arm-none-eabi - (package - (name "newlib") - (version "2.4.0") - (source (origin - (method url-fetch) - (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-" - version ".tar.gz")) - (sha256 - (base32 - "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl")))) - (build-system gnu-build-system) - (arguments - `(#:out-of-source? #t - ;; The configure flags are identical to the flags used by the "GCC ARM - ;; embedded" project. - #:configure-flags '("--target=arm-none-eabi" - "--enable-newlib-io-long-long" - "--enable-newlib-register-fini" - "--disable-newlib-supplied-syscalls" - "--disable-nls") - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'fix-references-to-/bin/sh - (lambda _ - (substitute* '("libgloss/arm/cpu-init/Makefile.in" - "libgloss/arm/Makefile.in" - "libgloss/libnosys/Makefile.in" - "libgloss/Makefile.in") - (("/bin/sh") (which "sh"))) - #t))))) - (native-inputs - `(("xbinutils" ,(cross-binutils "arm-none-eabi")) - ("xgcc" ,gcc-arm-none-eabi-4.9) - ("texinfo" ,texinfo))) - (home-page "https://www.sourceware.org/newlib/") - (synopsis "C library for use on embedded systems") - (description "Newlib is a C library intended for use on embedded +(define make-newlib-arm-none-eabi + (mlambda () + (package + (name "newlib") + (version "2.4.0") + (source (origin + (method url-fetch) + (uri (string-append "ftp://sourceware.org/pub/newlib/newlib-" + version ".tar.gz")) + (sha256 + (base32 + "01i7qllwicf05vsvh39qj7qp5fdifpvvky0x95hjq39mbqiksnsl")))) + (build-system gnu-build-system) + (arguments + `(#:out-of-source? #t + ;; The configure flags are identical to the flags used by the "GCC ARM + ;; embedded" project. + #:configure-flags '("--target=arm-none-eabi" + "--enable-newlib-io-long-long" + "--enable-newlib-register-fini" + "--disable-newlib-supplied-syscalls" + "--disable-nls") + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'fix-references-to-/bin/sh + (lambda _ + (substitute* '("libgloss/arm/cpu-init/Makefile.in" + "libgloss/arm/Makefile.in" + "libgloss/libnosys/Makefile.in" + "libgloss/Makefile.in") + (("/bin/sh") (which "sh"))) + #t))))) + (native-inputs + `(("xbinutils" ,(cross-binutils "arm-none-eabi")) + ("xgcc" ,(make-gcc-arm-none-eabi-4.9)) + ("texinfo" ,texinfo))) + (home-page "https://www.sourceware.org/newlib/") + (synopsis "C library for use on embedded systems") + (description "Newlib is a C library intended for use on embedded systems. It is a conglomeration of several library parts that are easily usable on embedded products.") - (license (license:non-copyleft - "https://www.sourceware.org/newlib/COPYING.NEWLIB")))) + (license (license:non-copyleft + "https://www.sourceware.org/newlib/COPYING.NEWLIB"))))) -(define-public newlib-nano-arm-none-eabi - (package (inherit newlib-arm-none-eabi) - (name "newlib-nano") - (arguments - (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi) - ;; The configure flags are identical to the flags used by the "GCC ARM - ;; embedded" project. They optimize newlib for use on small embedded - ;; systems with limited memory. - ((#:configure-flags flags) - ''("--target=arm-none-eabi" - "--enable-multilib" - "--disable-newlib-supplied-syscalls" - "--enable-newlib-reent-small" - "--disable-newlib-fvwrite-in-streamio" - "--disable-newlib-fseek-optimization" - "--disable-newlib-wide-orient" - "--enable-newlib-nano-malloc" - "--disable-newlib-unbuf-stream-opt" - "--enable-lite-exit" - "--enable-newlib-global-atexit" - "--enable-newlib-nano-formatted-io" - "--disable-nls")) - ((#:phases phases) - `(modify-phases ,phases - ;; XXX: Most arm toolchains offer both *.a and *_nano.a as newlib - ;; and newlib-nano respectively. The headers are usually - ;; arm-none-eabi/include/newlib.h for newlib and - ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano. We - ;; have two different toolchain packages for each which works but - ;; is a little strange. - (add-after 'install 'hardlink-newlib - (lambda* (#:key outputs #:allow-other-keys) - (let ((out (assoc-ref outputs "out"))) - ;; The nano.specs file says that newlib-nano files should end - ;; in "_nano.a" instead of just ".a". Note that this applies - ;; to all the multilib folders too. - (for-each - (lambda (file) - (link file - (string-append - ;; Strip ".a" off the end - (substring file 0 (- (string-length file) 2)) - ;; Add "_nano.a" onto the end - "_nano.a"))) - (find-files - out - "^(libc.a|libg.a|librdimon.a|libstdc\\+\\+.a|libsupc\\+\\+.a)$")) +(define make-newlib-nano-arm-none-eabi + (mlambda () + (let ((base (make-newlib-arm-none-eabi))) + (package + (inherit base) + (name "newlib-nano") + (arguments + (substitute-keyword-arguments (package-arguments base) + ;; The configure flags are identical to the flags used by the "GCC + ;; ARM embedded" project. They optimize newlib for use on small + ;; embedded systems with limited memory. + ((#:configure-flags _) + ''("--target=arm-none-eabi" + "--enable-multilib" + "--disable-newlib-supplied-syscalls" + "--enable-newlib-reent-small" + "--disable-newlib-fvwrite-in-streamio" + "--disable-newlib-fseek-optimization" + "--disable-newlib-wide-orient" + "--enable-newlib-nano-malloc" + "--disable-newlib-unbuf-stream-opt" + "--enable-lite-exit" + "--enable-newlib-global-atexit" + "--enable-newlib-nano-formatted-io" + "--disable-nls")) + ((#:phases phases) + `(modify-phases ,phases + ;; XXX: Most arm toolchains offer both *.a and *_nano.a as + ;; newlib and newlib-nano respectively. The headers are + ;; usually arm-none-eabi/include/newlib.h for newlib and + ;; arm-none-eabi/include/newlib-nano/newlib.h for newlib-nano. + ;; We have two different toolchain packages for each which + ;; works but is a little strange. + (add-after 'install 'hardlink-newlib + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + ;; The nano.specs file says that newlib-nano files should + ;; end in "_nano.a" instead of just ".a". Note that this + ;; applies to all the multilib folders too. + (for-each + (lambda (file) + (link file + (string-append + ;; Strip ".a" off the end + (substring file 0 (- (string-length file) 2)) + ;; Add "_nano.a" onto the end + "_nano.a"))) + (find-files + out + "^(libc.a|libg.a|librdimon.a|libstdc\\+\\+.a|\ +libsupc\\+\\+.a)$")) - ;; newlib.h is usually in this location instead so both - ;; newlib and newlib-nano can be in the toolchain at the same - ;; time - (mkdir (string-append out "/arm-none-eabi/include/newlib-nano")) - (symlink - "../newlib.h" - (string-append out "/arm-none-eabi/include/newlib-nano/newlib.h")) - #t))))))) - (synopsis "Newlib variant for small systems with limited memory"))) + ;; newlib.h is usually in this location instead so both + ;; newlib and newlib-nano can be in the toolchain at the + ;; same time + (mkdir (string-append + out "/arm-none-eabi/include/newlib-nano")) + (symlink + "../newlib.h" + (string-append + out + "/arm-none-eabi/include/newlib-nano/newlib.h"))))))))) + (synopsis "Newlib variant for small systems with limited memory"))))) ;;; The following definitions are for the "7-2018-q2-update" variant of the ;;; ARM cross toolchain as offered on https://developer.arm.com -(define-public gcc-arm-none-eabi-7-2018-q2-update - (let ((xgcc (cross-gcc "arm-none-eabi" - #:xgcc gcc-7 - #:xbinutils (cross-binutils "arm-none-eabi"))) - (revision "1") - (svn-revision 261907)) - (package (inherit xgcc) - (version (string-append "7-2018-q2-update-" - revision "." (number->string svn-revision))) - (source - (origin - (method svn-fetch) - (uri (svn-reference - (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/embedded-7-branch/") - (revision svn-revision))) - (file-name (string-append "gcc-arm-embedded-" version "-checkout")) - (sha256 - (base32 - "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5")) - (patches - (append - (origin-patches (package-source gcc-7)) - (search-patches "gcc-7-cross-environment-variables.patch"))))) - (native-inputs - (modify-inputs (package-native-inputs xgcc) - (delete "isl") - (prepend flex isl-0.18))) - (arguments - (substitute-keyword-arguments (package-arguments xgcc) - ((#:phases phases) - #~(modify-phases #$phases - (add-after 'unpack 'expand-version-string - (lambda _ - (make-file-writable "gcc/DEV-PHASE") - (with-output-to-file "gcc/DEV-PHASE" - (lambda () - (display "7-2018-q2-update"))))) - (add-after 'unpack 'fix-genmultilib - (lambda _ - (substitute* "gcc/genmultilib" - (("#!/bin/sh") (string-append "#!" (which "sh")))))) - (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"))))))) - ((#:configure-flags flags) - ;; The configure flags are largely identical to the flags used by the - ;; "GCC ARM embedded" project. - #~(append (list "--enable-multilib" - "--with-newlib" - "--with-multilib-list=rmprofile" - "--with-host-libstdcxx=-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm" - "--enable-plugins" - "--disable-decimal-float" - "--disable-libffi" - "--disable-libgomp" - "--disable-libmudflap" - "--disable-libquadmath" - "--disable-libssp" - "--disable-libstdcxx-pch" - "--disable-nls" - "--disable-shared" - "--disable-threads" - "--disable-tls") - (delete "--disable-multilib" #$flags))))) - (native-search-paths - (list (search-path-specification - (variable "CROSS_C_INCLUDE_PATH") - (files '("arm-none-eabi/include"))) - (search-path-specification - (variable "CROSS_CPLUS_INCLUDE_PATH") - (files '("arm-none-eabi/include" - "arm-none-eabi/include/c++" - "arm-none-eabi/include/c++/arm-none-eabi"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (files '("arm-none-eabi/lib")))))))) +(define make-gcc-arm-none-eabi-7-2018-q2-update + (mlambda () + (let ((xgcc (cross-gcc "arm-none-eabi" + #:xgcc gcc-7 + #:xbinutils (cross-binutils "arm-none-eabi"))) + (revision "1") + (svn-revision 261907)) + (package (inherit xgcc) + (version (string-append "7-2018-q2-update-" + revision "." + (number->string svn-revision))) + (source + (origin + (method svn-fetch) + (uri (svn-reference + (url "svn://gcc.gnu.org/svn/gcc/branches/ARM/\ +embedded-7-branch/") + (revision svn-revision))) + (file-name (string-append "gcc-arm-embedded-" version + "-checkout")) + (sha256 + (base32 + "192ggs63bixf3irpijgfkjks73yx1r3a4i6grk1y0i0iny76pmx5")) + (patches + (append + (origin-patches (package-source gcc-7)) + (search-patches + "gcc-7-cross-environment-variables.patch"))))) + (native-inputs + (modify-inputs (package-native-inputs xgcc) + (delete "isl") + (prepend flex isl-0.18))) + (arguments + (substitute-keyword-arguments (package-arguments xgcc) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'expand-version-string + (lambda _ + (make-file-writable "gcc/DEV-PHASE") + (with-output-to-file "gcc/DEV-PHASE" + (lambda () + (display "7-2018-q2-update"))))) + (add-after 'unpack 'fix-genmultilib + (lambda _ + (substitute* "gcc/genmultilib" + (("#!/bin/sh") + (string-append "#!" (which "sh")))))) + (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"))))))) + ((#:configure-flags flags) + ;; The configure flags are largely identical to the flags + ;; used by the "GCC ARM embedded" project. + #~(append (list "--enable-multilib" + "--with-newlib" + "--with-multilib-list=rmprofile" + "--with-host-libstdcxx=-static-libgcc \ +-Wl,-Bstatic,-lstdc++,-Bdynamic -lm" + "--enable-plugins" + "--disable-decimal-float" + "--disable-libffi" + "--disable-libgomp" + "--disable-libmudflap" + "--disable-libquadmath" + "--disable-libssp" + "--disable-libstdcxx-pch" + "--disable-nls" + "--disable-shared" + "--disable-threads" + "--disable-tls") + (delete "--disable-multilib" #$flags))))) + (native-search-paths + (list (search-path-specification + (variable "CROSS_C_INCLUDE_PATH") + (files '("arm-none-eabi/include"))) + (search-path-specification + (variable "CROSS_CPLUS_INCLUDE_PATH") + (files '("arm-none-eabi/include" + "arm-none-eabi/include/c++" + "arm-none-eabi/include/c++/arm-none-eabi"))) + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (files '("arm-none-eabi/lib"))))))))) -(define-public newlib-arm-none-eabi-7-2018-q2-update +(define make-newlib-arm-none-eabi-7-2018-q2-update ;; This is the same commit as used for the 7-2018-q2-update release ;; according to the release.txt. - (let ((commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4") - (revision "0")) - (package - (inherit newlib-arm-none-eabi) - (version (git-version "3.0.0" revision commit)) - (source - (origin - (method git-fetch) - (uri (git-reference - (url "http://sourceware.org/git/newlib-cygwin.git") - (commit commit))) - (file-name (git-file-name "newlib" commit)) - (sha256 - (base32 - "1dq23fqrk75g1a4v7569fvnnw5q440zawbxi3w0g05n8jlqsmvcy")))) - (arguments - (substitute-keyword-arguments (package-arguments newlib-arm-none-eabi) - ;; The configure flags are identical to the flags used by the "GCC ARM - ;; embedded" project. - ((#:configure-flags flags) - `(cons* "--enable-newlib-io-c99-formats" - "--enable-newlib-retargetable-locking" - "--with-headers=yes" - ,flags)))) - (native-inputs - `(("xbinutils" ,(cross-binutils "arm-none-eabi")) - ("xgcc" ,gcc-arm-none-eabi-7-2018-q2-update) - ("texinfo" ,texinfo)))))) + (mlambda () + (let ((base (make-newlib-arm-none-eabi)) + (commit "3ccfb407af410ba7e54ea0da11ae1e40b554a6f4") + (revision "0")) + (package + (inherit base) + (version (git-version "3.0.0" revision commit)) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "http://sourceware.org/git/newlib-cygwin.git") + (commit commit))) + (file-name (git-file-name "newlib" commit)) + (sha256 + (base32 + "1dq23fqrk75g1a4v7569fvnnw5q440zawbxi3w0g05n8jlqsmvcy")))) + (arguments + (substitute-keyword-arguments (package-arguments base) + ;; The configure flags are identical to the flags used by the "GCC + ;; ARM embedded" project. + ((#:configure-flags flags) + `(cons* "--enable-newlib-io-c99-formats" + "--enable-newlib-retargetable-locking" + "--with-headers=yes" + ,flags)))) + (native-inputs + `(("xbinutils" ,(cross-binutils "arm-none-eabi")) + ("xgcc" ,(make-gcc-arm-none-eabi-7-2018-q2-update)) + ("texinfo" ,texinfo))))))) -(define-public newlib-nano-arm-none-eabi-7-2018-q2-update - (package (inherit newlib-arm-none-eabi-7-2018-q2-update) - (name "newlib-nano") - (arguments - (package-arguments newlib-nano-arm-none-eabi)) - (synopsis "Newlib variant for small systems with limited memory"))) +(define-public make-newlib-nano-arm-none-eabi-7-2018-q2-update + (mlambda () + (let ((base (make-newlib-arm-none-eabi-7-2018-q2-update))) + (package + (inherit base) + (name "newlib-nano") + (arguments + (package-arguments base)) + (synopsis "Newlib variant for small systems with limited memory"))))) -(define (make-libstdc++-arm-none-eabi xgcc newlib) - (let ((libstdc++ (make-libstdc++ xgcc))) - (package (inherit libstdc++) - (name "libstdc++-arm-none-eabi") - (arguments - (substitute-keyword-arguments (package-arguments libstdc++) - ((#:configure-flags flags) - ``("--target=arm-none-eabi" - "--host=arm-none-eabi" - "--disable-libstdcxx-pch" - "--enable-multilib" - "--with-multilib-list=armv6-m,armv7-m,armv7e-m" - "--disable-shared" - "--disable-tls" - "--disable-plugin" - "--with-newlib" - ,(string-append "--with-gxx-include-dir=" - (assoc-ref %outputs "out") - "/arm-none-eabi/include/c++"))))) - (native-inputs - `(("newlib" ,newlib) - ("xgcc" ,xgcc) - ,@(package-native-inputs libstdc++)))))) +(define make-libstdc++-arm-none-eabi + (mlambda (xgcc newlib) + (let ((libstdc++ (make-libstdc++ xgcc))) + (package + (inherit libstdc++) + (name "libstdc++-arm-none-eabi") + (arguments + (substitute-keyword-arguments (package-arguments libstdc++) + ((#:configure-flags _) + ``("--target=arm-none-eabi" + "--host=arm-none-eabi" + "--disable-libstdcxx-pch" + "--enable-multilib" + "--with-multilib-list=armv6-m,armv7-m,armv7e-m" + "--disable-shared" + "--disable-tls" + "--disable-plugin" + "--with-newlib" + ,(string-append "--with-gxx-include-dir=" + (assoc-ref %outputs "out") + "/arm-none-eabi/include/c++"))))) + (native-inputs + `(("newlib" ,newlib) + ("xgcc" ,xgcc) + ,@(package-native-inputs libstdc++))))))) -(define (arm-none-eabi-toolchain xgcc newlib) - "Produce a cross-compiler toolchain package with the compiler XGCC and the C -library variant NEWLIB." - (let ((newlib-with-xgcc (package (inherit newlib) - (native-inputs - (alist-replace "xgcc" (list xgcc) - (package-native-inputs newlib)))))) - (package - (name (string-append "arm-none-eabi" - (if (string=? (package-name newlib-with-xgcc) - "newlib-nano") - "-nano" "") - "-toolchain")) - (version (package-version xgcc)) - (source #f) - (build-system trivial-build-system) - (arguments - '(#:modules ((guix build union)) - #:builder - (begin - (use-modules (ice-9 match) - (guix build union)) - (match %build-inputs - (((names . directories) ...) - (union-build (assoc-ref %outputs "out") - directories) - #t))))) - (propagated-inputs - `(("binutils" ,(cross-binutils "arm-none-eabi")) - ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc)) - ("gcc" ,xgcc) - ("newlib" ,newlib-with-xgcc))) - (synopsis "Complete GCC tool chain for ARM bare metal development") - (description "This package provides a complete GCC tool chain for ARM +(define make-arm-none-eabi-toolchain + (mlambda (xgcc newlib) + "Produce a cross-compiler toolchain package with the compiler XGCC and the +C library variant NEWLIB." + (let ((newlib-with-xgcc + (package + (inherit newlib) + (native-inputs + (alist-replace "xgcc" (list xgcc) + (package-native-inputs newlib)))))) + (package + (name (string-append "arm-none-eabi" + (if (string=? (package-name newlib-with-xgcc) + "newlib-nano") + "-nano" "") + "-toolchain")) + (version (package-version xgcc)) + (source #f) + (build-system trivial-build-system) + (arguments + '(#:modules ((guix build union)) + #:builder + (begin + (use-modules (ice-9 match) + (guix build union)) + (match %build-inputs + (((names . directories) ...) + (union-build (assoc-ref %outputs "out") + directories)))))) + (propagated-inputs + `(("binutils" ,(cross-binutils "arm-none-eabi")) + ("libstdc++" ,(make-libstdc++-arm-none-eabi xgcc newlib-with-xgcc)) + ("gcc" ,xgcc) + ("newlib" ,newlib-with-xgcc))) + (synopsis "Complete GCC tool chain for ARM bare metal development") + (description "This package provides a complete GCC tool chain for ARM bare metal development. This includes the GCC arm-none-eabi cross compiler and newlib (or newlib-nano) as the C library. The supported programming languages are C and C++.") - (home-page (package-home-page xgcc)) - (license (package-license xgcc))))) + (home-page (package-home-page xgcc)) + (license (package-license xgcc)))))) -(define-public arm-none-eabi-toolchain-4.9 - (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9 - newlib-arm-none-eabi)) +(define make-arm-none-eabi-toolchain-4.9 + (mlambda () + (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-4.9) + (make-newlib-arm-none-eabi)))) -(define-public arm-none-eabi-nano-toolchain-4.9 - (arm-none-eabi-toolchain gcc-arm-none-eabi-4.9 - newlib-nano-arm-none-eabi)) +(define make-arm-none-eabi-nano-toolchain-4.9 + (mlambda () + (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-4.9) + (make-newlib-nano-arm-none-eabi)))) -(define-public arm-none-eabi-toolchain-6 - (arm-none-eabi-toolchain gcc-arm-none-eabi-6 - newlib-arm-none-eabi)) +(define make-arm-none-eabi-toolchain-6 + (mlambda () + (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-6) + (make-newlib-arm-none-eabi)))) -(define-public arm-none-eabi-nano-toolchain-6 - (arm-none-eabi-toolchain gcc-arm-none-eabi-6 - newlib-nano-arm-none-eabi)) +(define make-arm-none-eabi-nano-toolchain-6 + (mlambda () + (make-arm-none-eabi-toolchain (make-gcc-arm-none-eabi-6) + (make-newlib-nano-arm-none-eabi)))) -(define-public arm-none-eabi-toolchain-7-2018-q2-update - (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update - newlib-arm-none-eabi-7-2018-q2-update)) +(define make-arm-none-eabi-toolchain-7-2018-q2-update + (mlambda () + (make-arm-none-eabi-toolchain + (make-gcc-arm-none-eabi-7-2018-q2-update) + (make-newlib-arm-none-eabi-7-2018-q2-update)))) -(define-public arm-none-eabi-nano-toolchain-7-2018-q2-update - (arm-none-eabi-toolchain gcc-arm-none-eabi-7-2018-q2-update - newlib-nano-arm-none-eabi-7-2018-q2-update)) +(define make-arm-none-eabi-nano-toolchain-7-2018-q2-update + (mlambda () + (make-arm-none-eabi-toolchain + (make-gcc-arm-none-eabi-7-2018-q2-update) + (make-newlib-nano-arm-none-eabi-7-2018-q2-update)))) -(define-public gdb-arm-none-eabi - (package - (inherit gdb) - (name "gdb-arm-none-eabi") - (arguments - `(#:configure-flags '("--target=arm-none-eabi" - "--enable-multilib" - "--enable-interwork" - "--enable-languages=c,c++" - "--disable-nls") - ,@(package-arguments gdb))))) +(define make-gdb-arm-none-eabi + (mlambda () + (package + (inherit gdb) + (name "gdb-arm-none-eabi") + (arguments + `(#:configure-flags '("--target=arm-none-eabi" + "--enable-multilib" + "--enable-interwork" + "--enable-languages=c,c++" + "--disable-nls") + ,@(package-arguments gdb)))))) (define-public libjaylink (package @@ -647,116 +725,123 @@ (define-public openocd ;; personal correspondence with the developers in July 2017, more recent ;; versions are currently incompatible with the "Simple Libraries". -(define propeller-binutils - (let ((xbinutils (cross-binutils "propeller-elf")) - (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3") - (revision "2")) - (package - (inherit xbinutils) - (name "propeller-binutils") - (version (string-append "0.0.0-" revision "." (string-take commit 9))) - (source (origin (inherit (package-source xbinutils)) - (method git-fetch) - (uri (git-reference - (url "https://github.com/parallaxinc/propgcc") - (commit commit))) - (file-name (string-append name "-" commit "-checkout")) - (sha256 - (base32 - "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck")) - (patches '()))) - (arguments - `(;; FIXME: For some reason there are many test failures. It's not - ;; obvious how to fix the failures. - #:tests? #f - #:phases - (modify-phases %standard-phases - (add-after 'unpack 'chdir - (lambda _ (chdir "binutils") #t))) - ,@(substitute-keyword-arguments (package-arguments xbinutils) - ((#:configure-flags flags) - `(cons "--disable-werror" ,flags))))) - (native-inputs - `(("bison" ,bison) - ("flex" ,flex) - ("texinfo" ,texinfo) - ("dejagnu" ,dejagnu) - ,@(package-native-inputs xbinutils)))))) +(define make-propeller-binutils + (mlambda () + (let ((xbinutils (cross-binutils "propeller-elf")) + (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3") + (revision "2")) + (package + (inherit xbinutils) + (name "propeller-binutils") + (version (string-append "0.0.0-" revision "." (string-take commit 9))) + (source (origin + (inherit (package-source xbinutils)) + (method git-fetch) + (uri (git-reference + (url "https://github.com/parallaxinc/propgcc") + (commit commit))) + (file-name (string-append name "-" commit "-checkout")) + (sha256 + (base32 + "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck")) + (patches '()))) + (arguments + `(;; FIXME: For some reason there are many test failures. It's not + ;; obvious how to fix the failures. + #:tests? #f + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'chdir + (lambda _ (chdir "binutils") #t))) + ,@(substitute-keyword-arguments (package-arguments xbinutils) + ((#:configure-flags flags) + `(cons "--disable-werror" ,flags))))) + (native-inputs + `(("bison" ,bison) + ("flex" ,flex) + ("texinfo" ,texinfo) + ("dejagnu" ,dejagnu) + ,@(package-native-inputs xbinutils))))))) -(define-public propeller-gcc-6 - (let ((xgcc (cross-gcc "propeller-elf" - #:xbinutils propeller-binutils)) - (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867") - (revision "1")) - (package (inherit xgcc) - (name "propeller-gcc") - (version (string-append "6.0.0-" revision "." (string-take commit 9))) - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/totalspectrum/gcc-propeller") - (commit commit))) - (file-name (string-append name "-" commit "-checkout")) - (sha256 - (base32 - "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb")) - (patches - (append - (origin-patches (package-source gcc-6)) - (search-patches "gcc-cross-environment-variables.patch"))))) - (native-inputs - (modify-inputs (package-native-inputs xgcc) - (prepend flex))) - ;; All headers and cross libraries of the propeller toolchain are - ;; installed under the "propeller-elf" prefix. - (native-search-paths - (list (search-path-specification - (variable "CROSS_C_INCLUDE_PATH") - (files '("propeller-elf/include"))) - (search-path-specification - (variable "CROSS_LIBRARY_PATH") - (files '("propeller-elf/lib"))))) - (home-page "https://github.com/totalspectrum/gcc-propeller") - (synopsis "GCC for the Parallax Propeller")))) +(define make-propeller-gcc-6 + (mlambda () + (let ((xgcc (cross-gcc "propeller-elf" + #:xbinutils (make-propeller-binutils))) + (commit "b4f45a4725e0b6d0af59e594c4e3e35ca4105867") + (revision "1")) + (package + (inherit xgcc) + (name "propeller-gcc") + (version (string-append "6.0.0-" revision "." (string-take commit 9))) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/totalspectrum/gcc-propeller") + (commit commit))) + (file-name (string-append name "-" commit "-checkout")) + (sha256 + (base32 + "0d9kdxm2fzanjqa7q5850kzbsfl0fqyaahxn74h6nkxxacwa11zb")) + (patches + (append + (origin-patches (package-source gcc-6)) + (search-patches "gcc-cross-environment-variables.patch"))))) + (native-inputs + (modify-inputs (package-native-inputs xgcc) + (prepend flex))) + ;; All headers and cross libraries of the propeller toolchain are + ;; installed under the "propeller-elf" prefix. + (native-search-paths + (list (search-path-specification + (variable "CROSS_C_INCLUDE_PATH") + (files '("propeller-elf/include"))) + (search-path-specification + (variable "CROSS_LIBRARY_PATH") + (files '("propeller-elf/lib"))))) + (home-page "https://github.com/totalspectrum/gcc-propeller") + (synopsis "GCC for the Parallax Propeller"))))) -(define-public propeller-gcc-4 - (let ((xgcc propeller-gcc-6) - (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3") - (revision "2")) - (package (inherit xgcc) - (name "propeller-gcc") - (version (string-append "4.6.1-" revision "." (string-take commit 9))) - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/parallaxinc/propgcc") - (commit commit))) - (file-name (string-append name "-" commit "-checkout")) - (sha256 - (base32 - "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck")) - (patch-flags (list "-p1" "--directory=gcc")) - (patches - (append - (origin-patches (package-source gcc-4.7)) - (search-patches "gcc-4.6-gnu-inline.patch" - "gcc-cross-environment-variables.patch"))))) - (arguments - (substitute-keyword-arguments (package-arguments propeller-gcc-6) - ((#:phases phases) - #~(modify-phases #$phases - (add-after 'unpack 'chdir - (lambda _ (chdir "gcc"))))))) - (native-inputs - (modify-inputs (package-native-inputs propeller-gcc-6) - (prepend gcc-4.9))) - (home-page "https://github.com/parallaxinc/propgcc") - (supported-systems (delete "aarch64-linux" %supported-systems))))) +(define make-propeller-gcc-4 + (mlambda () + (let ((xgcc (make-propeller-gcc-6)) + (commit "4c46ecbe79ffbecd2ce918497ace5b956736b5a3") + (revision "2")) + (package + (inherit xgcc) + (name "propeller-gcc") + (version (string-append "4.6.1-" revision "." (string-take commit 9))) + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/parallaxinc/propgcc") + (commit commit))) + (file-name (string-append name "-" commit "-checkout")) + (sha256 + (base32 + "0w0dff3s7wv2d9m78a4jhckiik58q38wx6wpbba5hzbs4yxz35ck")) + (patch-flags (list "-p1" "--directory=gcc")) + (patches + (append + (origin-patches (package-source gcc-4.7)) + (search-patches + "gcc-4.6-gnu-inline.patch" + "gcc-cross-environment-variables.patch"))))) + (arguments + (substitute-keyword-arguments (package-arguments xgcc) + ((#:phases phases) + #~(modify-phases #$phases + (add-after 'unpack 'chdir + (lambda _ (chdir "gcc"))))))) + (native-inputs + (modify-inputs (package-native-inputs xgcc) + (prepend gcc-4.9))) + (home-page "https://github.com/parallaxinc/propgcc") + (supported-systems (delete "aarch64-linux" %supported-systems)))))) ;; Version 6 is experimental and may not work correctly. This is why we ;; default to version 4, which is also used in the binary toolchain bundle ;; provided by Parallax Inc. -(define-public propeller-gcc propeller-gcc-4) +(define make-propeller-gcc make-propeller-gcc-4) ;; FIXME: We do not build the tiny library because that would require C++ @@ -814,7 +899,7 @@ (define-public proplib (lambda* (#:key make-flags #:allow-other-keys) (apply invoke "make" "install-includes" make-flags)))))) (native-inputs - (list propeller-gcc propeller-binutils perl)) + (list (make-propeller-gcc) (make-propeller-binutils) perl)) (home-page "https://github.com/parallaxinc/propgcc") (synopsis "C library for the Parallax Propeller") (description "This is a C library for the Parallax Propeller @@ -823,22 +908,24 @@ (define-public proplib ;; included code is public domain and some changes are BSD licensed. (license license:expat)))) -(define-public propeller-toolchain - (package - (name "propeller-toolchain") - (version (package-version propeller-gcc)) - (source #f) - (build-system trivial-build-system) - (arguments '(#:builder (begin (mkdir %output) #t))) - (propagated-inputs - `(("binutils" ,propeller-binutils) - ("libc" ,proplib) - ("gcc" ,propeller-gcc))) - (synopsis "Complete GCC tool chain for Propeller micro-controllers") - (description "This package provides a complete GCC tool chain for +(define make-propeller-toolchain + (mlambda () + (let ((propeller-gcc (make-propeller-gcc))) + (package + (name "propeller-toolchain") + (version (package-version propeller-gcc)) + (source #f) + (build-system trivial-build-system) + (arguments '(#:builder (begin (mkdir %output) #t))) + (propagated-inputs + `(("binutils" ,(make-propeller-binutils)) + ("libc" ,proplib) + ("gcc" ,propeller-gcc))) + (synopsis "Complete GCC tool chain for Propeller micro-controllers") + (description "This package provides a complete GCC tool chain for Propeller micro-controller development.") - (home-page (package-home-page propeller-gcc)) - (license (package-license propeller-gcc)))) + (home-page (package-home-page propeller-gcc)) + (license (package-license propeller-gcc)))))) (define-public openspin (package @@ -906,7 +993,7 @@ (define-public propeller-load (lambda _ (chdir "loader") #t)) (delete 'configure)))) (native-inputs - (list openspin propeller-toolchain)) + (list openspin (make-propeller-toolchain))) (home-page "https://github.com/parallaxinc/propgcc") (synopsis "Loader for Parallax Propeller micro-controllers") (description "This package provides the tool @code{propeller-load} to @@ -951,7 +1038,7 @@ (define-public spin2cpp '("testlex" "spin2cpp" "fastspin"))) #t))))) (native-inputs - (list bison propeller-load propeller-toolchain)) + (list bison propeller-load (make-propeller-toolchain))) (home-page "https://github.com/totalspectrum/spin2cpp") (synopsis "Convert Spin code to C, C++, or PASM code") (description "This is a set of tools for converting the Spin language for @@ -997,26 +1084,28 @@ (define-public spinsim two-thirds of the opcodes in the P2 instruction set.") (license license:expat)))) -(define-public propeller-development-suite - (package - (name "propeller-development-suite") - (version (package-version propeller-gcc)) - (source #f) - (build-system trivial-build-system) - (arguments '(#:builder (begin (mkdir %output) #t))) - (propagated-inputs - `(("toolchain" ,propeller-toolchain) - ("openspin" ,openspin) - ("propeller-load" ,propeller-load) - ("spin2cpp" ,spin2cpp) - ("spinsim" ,spinsim))) - (synopsis "Complete development suite for Propeller micro-controllers") - (description "This meta-package provides a complete environment for the +(define make-propeller-development-suite + (mlambda () + (let ((propeller-gcc (make-propeller-gcc))) + (package + (name "propeller-development-suite") + (version (package-version propeller-gcc)) + (source #f) + (build-system trivial-build-system) + (arguments '(#:builder (begin (mkdir %output) #t))) + (propagated-inputs + `(("toolchain" ,(make-propeller-toolchain)) + ("openspin" ,openspin) + ("propeller-load" ,propeller-load) + ("spin2cpp" ,spin2cpp) + ("spinsim" ,spinsim))) + (synopsis "Complete development suite for Propeller micro-controllers") + (description "This meta-package provides a complete environment for the development with Parallax Propeller micro-controllers. It includes the GCC toolchain, the loader, the Openspin compiler, the Spin2cpp tool, and the Spin simulator.") - (home-page (package-home-page propeller-gcc)) - (license (package-license propeller-gcc)))) + (home-page (package-home-page propeller-gcc)) + (license (package-license propeller-gcc)))))) (define-public binutils-vc4 (let ((commit "708acc851880dbeda1dd18aca4fd0a95b2573b36")) @@ -1070,32 +1159,34 @@ (define-public binutils-vc4 (license license:gpl3+) (home-page "https://github.com/puppeh/vc4-toolchain/")))) -(define-public gcc-vc4 - (let ((commit "0fe4b83897341742f9df65797474cb0feab4b377") - (xgcc (cross-gcc "vc4-elf" #:xgcc gcc-6 #:xbinutils binutils-vc4))) - (package (inherit xgcc) - (name "gcc-vc4") - (source (origin - (method git-fetch) - (uri (git-reference - (url "https://github.com/puppeh/gcc-vc4") - (commit commit))) - (file-name (string-append name - "-" - (package-version xgcc) - "-checkout")) - (sha256 - (base32 - "0kvaq4s0assvinmmicwqp07d0wwldcw0fv6f4k13whp3q5909jnr")) - (patches - (search-patches "gcc-6-fix-buffer-size.patch" - "gcc-6-fix-isl-includes.patch")))) - (native-inputs - (modify-inputs (package-native-inputs xgcc) - (prepend flex))) - (synopsis "GCC for VC4") - (description "This package provides @code{gcc} for VideoCore IV, -the Raspberry Pi chip.")))) +(define make-gcc-vc4 + (mlambda () + (let ((commit "0fe4b83897341742f9df65797474cb0feab4b377") + (xgcc (cross-gcc "vc4-elf" #:xgcc gcc-6 #:xbinutils binutils-vc4))) + (package + (inherit xgcc) + (name "gcc-vc4") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/puppeh/gcc-vc4") + (commit commit))) + (file-name (string-append name + "-" + (package-version xgcc) + "-checkout")) + (sha256 + (base32 + "0kvaq4s0assvinmmicwqp07d0wwldcw0fv6f4k13whp3q5909jnr")) + (patches + (search-patches "gcc-6-fix-buffer-size.patch" + "gcc-6-fix-isl-includes.patch")))) + (native-inputs + (modify-inputs (package-native-inputs xgcc) + (prepend flex))) + (synopsis "GCC for VC4") + (description "This package provides @code{gcc} for VideoCore IV, +the Raspberry Pi chip."))))) (define-public imx-usb-loader ;; There are no proper releases. diff --git a/gnu/packages/raspberry-pi.scm b/gnu/packages/raspberry-pi.scm index a866a7e4f29..80bfaf0896c 100644 --- a/gnu/packages/raspberry-pi.scm +++ b/gnu/packages/raspberry-pi.scm @@ -177,7 +177,7 @@ (define-public raspi-arm-chainloader #t)))))) (native-inputs `(("binutils" ,(cross-binutils "arm-none-eabi")) - ("gcc" ,gcc-arm-none-eabi-6))) + ("gcc" ,(make-gcc-arm-none-eabi-6)))) (inputs `()) (synopsis "Raspberry Pi ARM bootloader") -- 2.41.0