[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Installing a wrapper guile script in <out>/bin
From: |
elaexuotee |
Subject: |
Re: Installing a wrapper guile script in <out>/bin |
Date: |
Wed, 03 Feb 2021 20:04:19 +0900 |
User-agent: |
mblaze/1.1 |
Maxime Devos <maximedevos@telenet.be> wrote:
> Let's presume the binary is called $X.
>
> What I would do: add a build phase after the "install" phase that renames
> <out>/bin/$X to <out>/bin/.$X-real using the rename-file procedure. Create
> your wrapper script at <out>/bin/.$X-real with call-with-output-file, some
> I/O procedures and chmod (to make the wrapper script executable).
>
> I hope that helps, Maxime.
Thanks for the pointers.
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?
I am vaguely aware things like `build-expression->derivation` to reify a gexp
into a derivation; however, I'm not sure what to do with the derivation object
in this case or if this is even on the right track.
Cheers!