Subject: [PATCH core-updates 00/37] Support cross-compilation with meson
From: Maxime Devos <[email-masked]>
To: [email-masked]
Date: Mon, 14 Jun 2021 17:22:11 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

This patch series adds cross-compilation support to meson-build-system.
meson-build-system is used by many gtk applications (sometimes directly,
sometimes because a dependency uses meson-build-system).

This has been tested with

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

on a x86_64-linux system. The build succeeds, and
"guix gc --references ..." looked reasonable to me.

Meson cross-compilation is implemented by the last patch.
The one-before-last patch works-around the brokenness of
GCC cross-compilers on current core-updates
(see <http://issues.guix.gnu.org/48913>;).

The first two patches define a few utilities target-linux?,
target-x86-32? and target-x86-64? which are used by the last patch,
but could be useful elsewhere as well. The third patch is used
in various cross-compilation fixes.

The other 34 patches are cross-compilation fixes for dependencies
of glib, and follow-up patches making the package definitions
somewhat nicer IMHO (like removing trailing #t from phases,
and computing derivation for some architecture-independent packages
when cross-compiling and compiling natively).

Maxime Devos (37):
  utils: Define target-linux? predicate.
  utils: Define a target-x86-32? and target-x86-64? predicate.
  packages: Define this-package-input and this-package-native-input.
  net-base: Make #:builder argument a G-expression.
  net-base: Fix cross-compilation, eliminating %build-inputs & friends
  net-base: Don't cross-compile.
  tzdata: Don't bother with cross-compiling.
  libgpg-error: Remove trailing #f from phases.
  libgpg-error: Prevent silent miscompilation some systems.
  libgpgerror: Maybe fix a cross-compilation bug.
  libgpg-error: Fix cross-compilation error.
  libgcrypt: Fix cross-compilation build error.
  wrap-python3: Make #:builder a G-exp instead of a raw S-exp.
  wrap-python3: Fix cross-compilation.
  python: Fix reference to input when cross-compiling.
  openssl: Remove trailing #t from phases.
  openssl: Make the #:phases argument a G-expression.
  openssl: Use G-exp machinery for referring to outputs.
  openssl: Move documentation instead of copying and deleting it.
  openssl: Move all man pages to separate output, not only man3.
  openssl: Find bin/env when cross-compiling.
  openssl: Extract logic for computing CONFIGURE_TARGET_ARCH.
  readline: Make #:configure-flags a G-expression.
  readline: Fix build error when cross-compiling.
  bash: Make #:configure-flags a G-expression.
  bash: Fix cross-compilation build error.
  fontconfig: Make the #:configure-flags argument a G-expression.
  fontconfig: Fix build error when cross-compiling.
  glib: Use a correct python in scripts when cross-compiling.
  glib: Verify the cross-compiled python is used in installed scripts.
  glib: Look up "tzdata" in 'native-inputs', not 'inputs'.
  tk: Make #:configure-flags a G-expression.
  tk: Do not use %build-inputs when cross-compiling.
  libelf: Use the cross-compiler when cross-compiling.
  opendht: Correct 'nettle' variable name in inputs.
  cross-base: Fix cross-compiler for i686-linux-gnu.
  meson: Support cross-compilation.

 Makefile.am                        |   1 +
 gnu/packages/admin.scm             |  44 ++++---
 gnu/packages/base.scm              |   9 ++
 gnu/packages/bash.scm              |  39 +++---
 gnu/packages/cross-base.scm        |  63 ++++++++-
 gnu/packages/elf.scm               |  48 ++++---
 gnu/packages/fontutils.scm         |   8 +-
 gnu/packages/glib.scm              |  34 ++++-
 gnu/packages/gnupg.scm             |  60 ++++++---
 gnu/packages/networking.scm        |   2 +-
 gnu/packages/python.scm            |  51 ++++----
 gnu/packages/readline.scm          |  27 ++--
 gnu/packages/tcl.scm               |  14 +-
 gnu/packages/tls.scm               | 142 ++++++++++----------
 guix/build-system/meson.scm        | 200 ++++++++++++++++++++++++++---
 guix/build/meson-configuration.scm |  71 ++++++++++
 guix/packages.scm                  |  29 +++++
 guix/utils.scm                     |  26 ++++
 tests/packages.scm                 |  34 +++++
 tests/utils.scm                    |  40 ++++++
 20 files changed, 728 insertions(+), 214 deletions(-)
 create mode 100644 guix/build/meson-configuration.scm

base-commit: 92803cbef5affa3dbbf049262e1fcf290d8d8622