From: Maxime Devos <maximedevos@telenet.be>
To: elaexuotee@wilsonb.com
Cc: guix-devel@gnu.org, "Ludovic Courtès" <ludovic.courtes@inria.fr>
Subject: Re: Installing a wrapper guile script in <out>/bin
Date: Wed, 03 Feb 2021 13:12:25 +0100 [thread overview]
Message-ID: <b5b945d70316b7a01ab4c97b76ddc059e74ff08a.camel@telenet.be> (raw)
In-Reply-To: <3TT5JRKHCZ2E4.2VYCP49OAJARA@wilsonb.com>
[-- Attachment #1: Type: text/plain, Size: 2009 bytes --]
> The script contents are not what I'm confused about. I don't know how to turn
> my gexp script into a file under <out>/bin/. This is conceptually what I want:
>
> (package
> (name "foo")
> ...
> (arguments
> `(...
> #:phases
> (modify-phases %standard-phases
> ...
> (replace 'install
> (lambda* (#:key outputs #:allow-other-keys)
> (let ((out (assoc-ref outputs "out"))
> (wrapper-script #~(...)))
> ... ; Do normal install stuff
> (copy-file wrapper-script (string-append out "/bin/foo"))
> ... ; Finish install stuff
> )))))))
>
> Of course `copy-file` doesn't work here because `wrapper-script` is a gexp not
> a file. What code do I replace this with?
Three options I have in mind:
* forego representing `wrapper-script` as a gexp (using #~), instead represent
`wrapper-script` as something quasiquoted. Then write this expression to
a file (with 'write', and include an appropriate shebang line)
Something like this:
(let ((wrapper-script-contents `(exec* ,(string-append out "/bin/.foo-real") "--extra-library-stuff" other-arguments)))
rename-upstream-binary
write-wrapper-binary
)
* The procedure ‘program-file’ turns a gexp into a representation of a store item.
Write your script to accept arguments like this:
YOUR-SCRIPT REAL-BINARY ARGUMENTS
And write a small wrapper shell script to <out>/bin/foo. Maybe with something like this
(format PORT "#!~a~%exec ~a ~a #$@" bin-sh-something #$THE-SCRIPT-GEXP <out>/bin/.foo-real)
(Warning: the above shell script might be incorrect. I'm not very familiar
with using the shell as a programming language.)
* Define a wrapper package. See wrap-python3 in packages/python.scm
for an example. (This option probably has to be combined with one of the
first two options.)
Greetings,
Maxime
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 260 bytes --]
next prev parent reply other threads:[~2021-02-03 12:14 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-01 11:28 Installing a wrapper guile script in <out>/bin elaexuotee
2021-02-01 16:04 ` Ludovic Courtès
2021-02-03 5:50 ` elaexuotee
2021-02-03 10:00 ` Maxime Devos
2021-02-03 11:04 ` elaexuotee--- via Development of GNU Guix and the GNU System distribution.
2021-02-03 12:12 ` Maxime Devos [this message]
2021-02-03 19:17 ` elaexuotee
2021-02-04 8:56 ` Maxime Devos
-- strict thread matches above, loose matches on Subject: below --
2021-02-01 12:16 Leo Prikler
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=b5b945d70316b7a01ab4c97b76ddc059e74ff08a.camel@telenet.be \
--to=maximedevos@telenet.be \
--cc=elaexuotee@wilsonb.com \
--cc=guix-devel@gnu.org \
--cc=ludovic.courtes@inria.fr \
/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).