unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Installing a wrapper guile script in <out>/bin
@ 2021-02-01 11:28 elaexuotee
  2021-02-01 16:04 ` Ludovic Courtès
  0 siblings, 1 reply; 9+ messages in thread
From: elaexuotee @ 2021-02-01 11:28 UTC (permalink / raw)
  To: guix-devel

Hello Guix,

Writing package definition, I have need of a non-trivial wrapper script that
decides how to execute the installed binary. How do I accomplish this?

With my vague understanding, I am envisioning writing a gexp directly in the
install phase and would like to somehow reify this into a guile script and
install that file under <out>/bin. Is this correct, at the high level?

More specifically, the package I have builds separate libraries for CPUs with
AVX, AVX2, and no AVX support. Since build-type isn't sufficiently specific to
distinguish such CPU features, I have, so far, opted to just build all three
libs and stuff them under <out>/lib/<foo>.

My idea is to have the linker script check CPU features at runtime (by parsing
/proc/cpuinfo or something) and executing the binary with the parameters to
load the correct binary.

Perhaps there is a better overall approach?

Appreciate your thoughts!


^ permalink raw reply	[flat|nested] 9+ messages in thread
* Installing a wrapper guile script in <out>/bin
@ 2021-02-01 12:16 Leo Prikler
  0 siblings, 0 replies; 9+ messages in thread
From: Leo Prikler @ 2021-02-01 12:16 UTC (permalink / raw)
  To: elaexuotee; +Cc: guix-devel

Hi elaexuotee,

> More specifically, the package I have builds separate libraries for
> CPUs with
> AVX, AVX2, and no AVX support. Since build-type isn't sufficiently
> specific to
> distinguish such CPU features, I have, so far, opted to just build
> all three
> libs and stuff them under <out>/lib/<foo>.
That's certainly one approach to solving the issue of not knowing which
CPU your code runs on.  Another approach is described in [1] under the
section "Dependency graph rewriting".  TL;DR, just offer the base
package with no AVX features, an AVX package and an AVX2 package.  Then
build any dependants against the base package.  Users can afterwards
decide to build against optimized versions on their own.

Regards,
Leo

[1] 
https://hpc.guix.info/blog/2018/01/pre-built-binaries-vs-performance/



^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-02-04  8:56 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

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).