guix-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug#49025] [PATCH core-updates 37/37] meson: Support cross-compilation.


From: Maxime Devos
Subject: [bug#49025] [PATCH core-updates 37/37] meson: Support cross-compilation.
Date: Mon, 14 Jun 2021 17:39:07 +0200
User-agent: Evolution 3.34.2

For cross-compilation, meson needs to be passed a
‘cross file’ with information on the architecture,
CPU type, endianness and operating system, and the
name of the cross-compiler binaries.

The new module (guix build meson-configuration) has
some utilities for writing these cross files, used
by 'make-cross-file' in a G-exp.  The values for
the cross file are generated by 'make-machine-alist'
and 'make-binaries-alist'.

'make-machine-alist' and 'make-binaries-alist' live
on the host side, such that new architectures and operating
systems can be added without causing rebuilds for old
architectures.

Currently, only GNU/Hurd, GNU/Linux, MinGW, x86-32 and
x86-64 are supported by 'make-machine-alist'. For other
architectures, someone needs to figure out what to
use as ‘CPU type’ first.  Only i686-linux-gnu has been
tested.

This has been tested with:

$ ./pre-inst-env guix build glib --target=i686-linux-gnu

on a x86_64-linux system.  ‘If it compiles, it should work.’

* guix/build/meson-configuration.scm
  (configuration-port): New parameter.
  (write-section-header): New procedure.
  (write-assignment): New procedure.
  (write-assignments): New procedure.
* guix/build-system/meson.scm
  (target-hurd?): New predicate.
  (make-machine-alist): New procedure.
  (make-binaries-alist): New procedure.
  (make-cross-file): New procedure.
  (meson-cross-build): New procedure.
  (lower)[build-inputs]: Add standard cross packages when cross-compiling.
  Do not include regular 'inputs' when cross-compiling.
  (lower)[host-inputs]: Include 'inputs' when cross-compiling.
  (lower)[target-inputs]: Add cross packages when cross-compiling.
  (lower)[build]: Call 'meson-cross-build' instead of 'cross-build'
  when cross-compiling.
  (lower)[target]: Set it.
  (lower)[private-keywords]: Do not remove #:target when cross-compiling.
---
 Makefile.am                        |   1 +
 guix/build-system/meson.scm        | 197 ++++++++++++++++++++++++++---
 guix/build/meson-configuration.scm |  71 +++++++++++
 3 files changed, 250 insertions(+), 19 deletions(-)
 create mode 100644 guix/build/meson-configuration.scm

Attachment: 0037-meson-Support-cross-compilation.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]