Subject: [bug#36477] [PATCH 08/31] gnu: python: Fix cross-compilation.

From: Ludovic Courtès <[email-masked]>
Date: Mon, 15 Jul 2019 22:29:00 +0200

This is the second patch in this series with this subject, which
suggests the subject could be adjusted.  :-)

Mathieu Othacehe <[email-masked]> skribis:

> * gnu/packages/patches/python-2.7-search-paths.patch: Add cross-compilation
> support.
> * gnu/packages/patches/python-3-search-paths.patch: Ditto.
> * gnu/packages/patches/python-cross-compile.patch: New patch.
> * gnu/local.mk (dist_patch_DATA): Add above new patch.
> * gnu/packages/python.scm (python-2.7)[patches]: Add new patch above,
> [arguments]: Set _PYTHON_HOST_PLATFORM env variable when cross compiling.

[...]

> +++ b/gnu/packages/patches/python-cross-compile.patch
> @@ -0,0 +1,145 @@
> +Patch taken from https://bugs.python.org/issue22724 and augmented with
> +following Nix patch
> +https://github.com/NixOS/nixpkgs/blob/master/pkgs/development/interpreters/python/cpython/2.7/cross-compile.patch
> +to fix the whole cross-compilation circus.
> +
> +---
> + Makefile.pre.in | 14 +++++++-------
> + configure       |  5 ++++-
> + setup.py        |  9 ++++++---
> + 3 files changed, 17 insertions(+), 11 deletions(-)

Heh, a non trivial patch!

> --- a/gnu/packages/python.scm
> +++ b/gnu/packages/python.scm
> @@ -109,7 +109,8 @@
>                                 "python-2-deterministic-build-info.patch"
>                                 "python-2.7-site-prefixes.patch"
>                                 "python-2.7-source-date-epoch.patch"
> -                               "python-2.7-adjust-tests.patch"))
> +                               "python-2.7-adjust-tests.patch"
> +                               "python-cross-compile.patch"))

Note that this triggers a full rebuild, so we’ll probably have to wait
for the next ‘core-updates’ branch, which we’ll hopefully open soonish.

>             'configure 'patch-lib-shells
>             (lambda _
> +             ,@(if (%current-target-system)
> +                   '((setenv "_PYTHON_HOST_PLATFORM" ""))
> +                   '())

It would be great if you could add a comment saying what component
consumes this environment variable.

Otherwise LGTM.

Thanks!

Ludo’.