guix-devel
[Top][All Lists]
Advanced

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

Re: Question: wrap-program without #:sh can be ok even when cross-compil


From: Maxime Devos
Subject: Re: Question: wrap-program without #:sh can be ok even when cross-compiling?
Date: Sun, 06 Jun 2021 12:14:40 +0200
User-agent: Evolution 3.34.2

Leo Prikler schreef op zo 06-06-2021 om 09:39 [+0200]:
> I think we might want to export a utility procedure
>     (patch-shebangs files inputs)

This procedure already exists, but is undocumented and
unexported. It is in (guix build gnu-build-system).

(define* (patch-shebangs #:key inputs outputs (patch-shebangs? #t)
                         #:allow-other-keys)
  [...])

> so that files used during build (e.g. configure, Makefile, etc.) can do
> (patch-shebangs build-stuff native-inputs) and the rest implicitly gets
> (patch-shebangs files inputs) during the patch-shebangs phase.  WDYT?

Looking at %standard-phases, we have

(define %standard-phases
  ;; Standard build phases, as a list of symbol/procedure pairs.
  [...]
    (phases [...] unpack bootstrap patch-usr-bin-file
            patch-source-shebangs configure patch-generated-file-shebangs
            build check install
            patch-shebangs [...]))

Here, patch-source-shebangs calls patch-shebang for every file
in the source code. As #:path is not set, $PATH is used. Thus,
when cross-compiling, native-inputs (+ some implicit inputs) is used,
and when compiling natively, the union of native-inputs and inputs (+
some implicit inputs) is used (*).

Thus, the files used during build (configure, Makefile, ...) already
get a ‘good’ interpreter. (Unless I'm mistaken, I didn't test this.)

(*) I looked into separating 'native-inputs' and 'inputs' even when compiling
    natively but it turned out to be more complicated than first expected.

Greetings,
Maxime.

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

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