From patchwork Fri Sep 29 09:13:33 2023 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: 1841 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 A351527BBE9; Fri, 29 Sep 2023 10:15:20 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable 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 9AF2527BBE2 for ; Fri, 29 Sep 2023 10:15:18 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qm9aG-0004Ik-RB; Fri, 29 Sep 2023 05:14:52 -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 1qm9aD-0004IK-NA for guix-patches@gnu.org; Fri, 29 Sep 2023 05:14:50 -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 1qm9aD-0002vt-F1 for guix-patches@gnu.org; Fri, 29 Sep 2023 05:14:49 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qm9aQ-0004a8-6Y; Fri, 29 Sep 2023 05:15:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#66263] [PATCH 00/23] guix: Add avr as a platform. Resent-From: Jean-Pierre De Jesus DIAZ Original-Sender: "Debbugs-submit" Resent-CC: efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Fri, 29 Sep 2023 09:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66263 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 66263@debbugs.gnu.org Cc: Jean-Pierre De Jesus DIAZ , efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: efraim@flashner.co.il, vagrant@debian.org, maxim.cournoyer@gmail.com Received: via spool by submit@debbugs.gnu.org id=B.169597886017534 (code B ref -1); Fri, 29 Sep 2023 09:15:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Sep 2023 09:14:20 +0000 Received: from localhost ([127.0.0.1]:55148 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9Zd-0004YZ-V6 for submit@debbugs.gnu.org; Fri, 29 Sep 2023 05:14:20 -0400 Received: from lists.gnu.org ([2001:470:142::17]:38066) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qm9ZX-0004Xr-QG for submit@debbugs.gnu.org; Fri, 29 Sep 2023 05:14:12 -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 1qm9ZB-00040B-5U for guix-patches@gnu.org; Fri, 29 Sep 2023 05:13:45 -0400 Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qm9Z8-0002bA-2u for guix-patches@gnu.org; Fri, 29 Sep 2023 05:13:44 -0400 Received: by mail-wm1-x32e.google.com with SMTP id 5b1f17b1804b1-4053c6f1087so131839375e9.0 for ; Fri, 29 Sep 2023 02:13:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foundationdevices.com; s=google; t=1695978818; x=1696583618; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=pJjYSNf1Yi9DBKyf+gJmuxdairWcsVYjirVfMSZo6Lc=; b=aUTyo7nYs9SMy5bq/rmHhmOcLqbRB8EGlXd4HwZ44ONW7ZRFkjnQLuCyLHRLAJaC+5 SL+5kQr9Lfpwd4aWAJLF1ye8G+RqHxYJVhKu/jECPS3M9reJxUQ/0665nHySBx1Fty0b EC23ug14avuu7NKagJADtZGOezEVvQVUxEuySnMPP55tD9buKA+6759/9eGdwQsgsMRm IEkNd5cDo9hsRzsUk1v24FSMf8pVf1+19ttydSPAHsHpTuz1po6brdmN4YfzwNKopMv3 HYEjudO+OMa8aaj2bIHIl+KrLF67H4EN4WrfABiJXRIlpVTFuEG3J90ia3BDVkV0BdpG i7Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695978818; x=1696583618; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=pJjYSNf1Yi9DBKyf+gJmuxdairWcsVYjirVfMSZo6Lc=; b=mWNGxjkJKDvK+LVOp/73wnLDch5ULtiXL6rByodTD5xnU8SI/s32SqCpwBwSW+AeAF KeeXi0JQNrIk+Ib7bZcQ3o+U63ieyq7rbG87NWe6RCKUjvxHmwiHNmc4SkwmgDuyThjf IigHHexZqs+70ftgSbKNDz6IoXffABBWg52y4KACh3LfffxNuC5VzeeSDInJcAQzclBH q/4lyjsqcp7VBLd72LaKoUQ8kq8j0uPibkXKQhh+Nmte3fE7+bdJMXxjNPfwv9I2N8fL iw6gIX9oscaSpGsrJ/MmACJtXUp57fdBqBjcsh9utgjjWuRJD+DaTJgXcmmrVXEJf7kd JbiA== X-Gm-Message-State: AOJu0YxWZlGYJNOq7w8IjYNAjAGLhXLEpsLIPK85sU6d+ZsHK5hMsR03 jebX9DC0uOTF78PbM9ibMtCynP/zL2e+PXLVlemmyA== X-Google-Smtp-Source: AGHT+IEBIL3qMMxU8qiknBqsF+Cei/jYlEmPZi5ADCuNyb2L4Rabwfbwhcl/rdeOi48+ktXqkyoVIg== X-Received: by 2002:a7b:cc8d:0:b0:3fe:5501:d284 with SMTP id p13-20020a7bcc8d000000b003fe5501d284mr3539675wma.11.1695978818158; Fri, 29 Sep 2023 02:13:38 -0700 (PDT) Received: from omen15.home ([89.131.29.87]) by smtp.gmail.com with ESMTPSA id 11-20020a05600c020b00b003fe2b081661sm986329wmi.30.2023.09.29.02.13.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 02:13:37 -0700 (PDT) Date: Fri, 29 Sep 2023 11:13:33 +0200 Message-Id: <20230929091333.7623-1-jean@foundationdevices.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::32e; envelope-from=jean@foundationdevices.com; helo=mail-wm1-x32e.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: 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 Hello Guixers, This adds avr as a platform to GNU Guix allowing to cross-compile packages to it. For the impatient, with this patch series one can build the provided unity package with this invocation: ./pre-inst-env guix build unity --target=avr It uses the AVR Libc as the default libc and fully builds a cross-compiler using the AVR Libc instead of building them separately like it's done currently. This could allow to use other of front-ends of GCC in the future if possible, however, Fortran and Objective-C front-ends don't build right now for AVR, haven't tested any other front-ends. This also adds the cross-toolchain module for instantiating cross-toolchain packages, this is to avoid each platform defining a module like avr to instantiate a toolchain, this helps in avoiding circular dependencies as cross-toolchain should depend only on cross-base and that'd be it. I think could've added cross-toolchains there for MinGW though, but I don't have a need for it but allows others to do so. Perhaps it could be a requirement that to add a platform one needs to add a cross-toolchain package. I enabled multilib support for AVR as most embedded platforms will need it, which makes me think, perhaps should the platform record contain a `mutlilib?' field? Information about individual patches: On [PATCH 05/23] I didn't find a better way of deleting the --disable-multilib flag from GCC configure flags, if anyone has a better idea let me know. The [PATCH 01/23] and [PATCH 02/23] are optional but there might be some platforms defined in the future that don't have a proper libc and it still should be fine to use these I think. The [PATCH 21/23] fixes a bug in the meson-configuration module and can be applied independently. Feel free to cherry pick the interesting/trivial patches. PS: I CC'ed the embedded team and Maxim Cournoyer as I saw his current work on QMK firmwares and could be of interest to him. Jean-Pierre De Jesus DIAZ (23): gnu: cross-libc: Return #f if no libc available. guix: gnu: Handle platforms without libc. gnu: Add avr platform. guix: utils: Add target-avr?. gnu: cross-gcc: Enable multilib for avr. gnu: microscheme: Move to avr-xyz. gnu: Add AVR phases to cross-gcc-build-phases. gnu: avr-libc: Convert to procedure. gnu: Add make-cross-gcc-toolchain. gnu: Add binutils-cross-avr. gnu: avr-binutils: Deprecate package. gnu: Remove various AVR packages. gnu: cross-libc: Add AVR Libc case. gnu: cross-gcc-arguments: Handle AVR target. guix: meson-configuration: Fix boolean assigment. gnu: cross-gcc-search-paths: Handle AVR target. gnu: cross-gcc: Handle inputs for AVR. gnu: Add avr-libc. gnu: Add gcc-cross-avr-toolchain. gnu: Add avr-toolchain. guix: meson-build-system: Support AVR. guix: meson-build-system: Disable PIC for AVR. gnu: Add unity. Makefile.am | 1 + doc/guix.texi | 6 + gnu/build/cross-toolchain.scm | 41 +++++- gnu/local.mk | 1 + gnu/packages/avr-xyz.scm | 41 ++++++ gnu/packages/avr.scm | 152 +++----------------- gnu/packages/check.scm | 41 ++++++ gnu/packages/cross-base.scm | 213 +++++++++++++++++++---------- gnu/packages/cross-toolchain.scm | 88 ++++++++++++ guix/build-system/gnu.scm | 12 +- guix/build-system/meson.scm | 14 +- guix/build/meson-configuration.scm | 4 +- guix/platforms/avr.scm | 29 ++++ guix/utils.scm | 4 + 14 files changed, 421 insertions(+), 226 deletions(-) create mode 100644 gnu/packages/cross-toolchain.scm create mode 100644 guix/platforms/avr.scm