Subject: Re: bug#54820: build-systems: inconsistent use of standard-packages

From: Maxime Devos <[email-masked]>
Date: Sat, 09 Apr 2022 19:52:48 +0200

Hartmut Goebel schreef op za 09-04-2022 om 18:24 [+0200]:
> Build-systems are adding „@(standard-packages)“ inconsistently to 
> „host-packages“ or „build-packages”. For one developing a new 
> build-system it is not clear which is the correct form.
> 
> Some (e.g. texlive, ruby, python) add it to „host-inputs“)

FWIW, the latest version of <https://issues.guix.gnu.org/54471>
corrects it for font-build-system.

> [...]
> Some add it to „build-inputs (e.g. gnu, cmake, qt):
> [...]

The reason in cross-compilation support:

  * host-inputs ≈ inputs  
  * build-inputs ≈ native-inputs 

There's also this comment from (guix build-system)

  ;; Here we use build/host/target in the sense of the GNU tool chain (info
  ;; "(autoconf) Specifying Target Triplets").
  (build-inputs  bag-build-inputs        ;list of packages
                 (default '()))
  (host-inputs   bag-host-inputs         ;list of packages
                 (default '()))

And (autoconf)Specifying Target Triplets:

'--build=BUILD-TYPE'
     the type of system on which the package is being configured and
     compiled.  It defaults to the result of running 'config.guess'.
     Specifying a BUILD-TYPE that differs from HOST-TYPE enables
     cross-compilation mode.

'--host=HOST-TYPE'
     the type of system on which the package runs.  By default it is the
     same as the build machine.  Specifying a HOST-TYPE that differs
     from BUILD-TYPE, when BUILD-TYPE was also explicitly specified,
     enables cross-compilation mode.

(standard-packages) contains a tar, gzip, awk ... which are typically only
needed as native-inputs, so they go in 'build-inputs'.

There's also the complication that the cross-compilation system of glibc
is apparently different from other packages:

    ;; The cross-libc is really a target package, but for bootstrapping
    ;; reasons, we can't put it in 'host-inputs'.  Namely, 'cross-gcc' is a
    ;; native package, so it would end up using a "native" variant of
    ;; 'cross-libc' (built with 'gnu-build'), whereas all the other packages
    ;; would use a target variant (built with 'gnu-cross-build'.)
    (target-inputs (if (and target implicit-cross-inputs?)
                       (standard-cross-packages target 'target)
                       '()))

Also, (standard-packages) only contains a non-cross-compiling gcc, so
(standard-cross-packages) (used when cross-compiling) adds a cross-compiling
gcc.

Greetings,
Maxime.