From: Foo Chuan Wei <chuanwei.foo@hotmail.com>
To: Xinglu Chen <public@yoctocell.xyz>
Cc: help-guix@gnu.org
Subject: Re: How to add /bin/sh to the build environment
Date: Mon, 8 Nov 2021 20:19:27 +0000 [thread overview]
Message-ID: <PU1PR01MB215542A6FC3573244C89C7D28D919@PU1PR01MB2155.apcprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <87bl2u37wr.fsf@disroot.org>
On 2021-11-08 17:54 +0100, Xinglu Chen wrote:
> I would use ‘substitute*’ from (guix build utils) to patch the
> references to /bin/sh
>
> (lambda* (#:key inputs #:allow-other-keys)
> (let ((sh (assoc-ref inputs "bash")))
> (substitute* "some-file"
> (("\"/bin/sh\"") (string-append "\"" sh "/bin/sh\"")))))
>
> Hope that helps!
Thank you for the suggestion, but this will not work for packaging
SML/NJ. The build process depends on the existence of /bin/sh in a
fundamental way:
* Part of the build process relies on programs written in Standard ML.
* The part written in Standard ML uses a function from the SML Basis
Library: `OS.Process.system`.
* `OS.Process.system` will always use /bin/sh. This is hardcoded. I
cannot change it. If I change it, the behavior of `OS.Process.system`
would probably be wrong in the final product (the sml compiler).
I'm not even sure if I can use `substitute*`, since the build process
relies on binary "bootfiles" where /bin/sh is hardcoded.
Note that I've managed to work around the problem.
Before building:
* Create a symlink /tmp/sh that points to `(which "sh")`.
* Edit the binary bootfiles so that they use /tmp/sh instead of /bin/sh.
After building:
* Edit the resulting binaries so that they use /bin/sh instead of /tmp/sh.
Is there really no way to create /bin/sh in the build environment, so
that binary patching can be avoided?
next prev parent reply other threads:[~2021-11-08 20:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 9:25 How to add /bin/sh to the build environment Foo Chuan Wei
2021-11-08 16:54 ` Xinglu Chen
2021-11-08 20:19 ` Foo Chuan Wei [this message]
2021-11-08 22:23 ` Leo Famulari
2021-11-09 1:36 ` Philip McGrath
2021-11-09 3:51 ` Foo Chuan Wei
2021-11-10 1:41 ` Leo Famulari
2021-11-08 22:58 ` Philip McGrath
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=PU1PR01MB215542A6FC3573244C89C7D28D919@PU1PR01MB2155.apcprd01.prod.exchangelabs.com \
--to=chuanwei.foo@hotmail.com \
--cc=help-guix@gnu.org \
--cc=public@yoctocell.xyz \
/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.
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).