unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Maxime Devos <maximedevos@telenet.be>
To: Leo Prikler <leo.prikler@student.tugraz.at>
Cc: guix-devel@gnu.org
Subject: Re: Question: wrap-program without #:sh can be ok even when cross-compiling?
Date: Sun, 06 Jun 2021 12:14:40 +0200	[thread overview]
Message-ID: <ca2f2ef3439c5b0aae412be9730b3835eac515fd.camel@telenet.be> (raw)
In-Reply-To: <e731725c99624cb17fb301804a1bb09d8c7ff548.camel@student.tugraz.at>

[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]

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 #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]

  reply	other threads:[~2021-06-06 10:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-06  7:39 Question: wrap-program without #:sh can be ok even when cross-compiling? Leo Prikler
2021-06-06 10:14 ` Maxime Devos [this message]
2021-06-06 10:57   ` Leo Prikler
  -- strict thread matches above, loose matches on Subject: below --
2021-06-05 18:39 Maxime Devos

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ca2f2ef3439c5b0aae412be9730b3835eac515fd.camel@telenet.be \
    --to=maximedevos@telenet.be \
    --cc=guix-devel@gnu.org \
    --cc=leo.prikler@student.tugraz.at \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).