Hello,

> # Detailed Design

[..]

> ## Find the location of the current executable
>
> To find its search path configuration files when an executable is running,
> we can first find the location of the executable.  Conveniently, Linux
> provides a pseudo-file `/proc/self/exe` for this exact purpose, which works
> well for ELF executables.   But for an interpreter script, `/proc/self/exe`
> would return the file name of its interpreter instead of the script, so
> we patch interpreters to set 2 environment variables:
>
>   - `GUIX_INTERPRETER_FILE`: absolute file name of the interpreter
>   - `GUIX_MAIN_SCRIPT_FILE`: absolute file name of the script
>
> And when the executable's `/proc/self/exe` matches `GUIX_INTERPRETER_FILE`,
> we can get the script file name from `GUIX_MAIN_SCRIPT_FILE`.  Alternatively,
> we can try to construct the script file name from command line arguments, but
> that won't work when you run a script using a relative file name and its
> current working directory changed before we figure out the script file name.

Would this work with `guix pack' tarball archives, esp. think
cross-built `guix pack' archives for MinGW?

Greetings,
Janneke

-- 
Janneke Nieuwenhuizen <jann...@gnu.org>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com

Reply via email to