Subject: [PATCH 00/23] guix: Add avr as a platform.

From: Jean-Pierre De Jesus DIAZ <[email-masked]>
Date: Fri, 29 Sep 2023 11:13:33 +0200

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

-- 
2.34.1