Subject: Re: [bug#30761] [PATCH staging 4/9] build-system/meson: Add the output directory to RUNPATH.

From: [email-masked] (Ludovic Courtès)
Date: Sun, 11 Mar 2018 23:23:20 +0100

Marius Bakke <[email-masked]> skribis:

> * guix/build/meson-build-system.scm (configure): Set LDFLAGS before invoking meson.

[...]

>  guix/build/meson-build-system.scm | 9 +++++++++
>  1 file changed, 9 insertions(+)
>
> diff --git a/guix/build/meson-build-system.scm b/guix/build/meson-build-system.scm
> index 2b92240c5..e8cb5440e 100644
> --- a/guix/build/meson-build-system.scm
> +++ b/guix/build/meson-build-system.scm
> @@ -46,6 +46,15 @@
>                   ,(string-append "--buildtype=" build-type)
>                   ,@configure-flags
>                   ,source-dir)))
> +
> +    ;; Meson lacks good facilities for dealing with RUNPATH, so we
> +    ;; add the output "lib" directory here to avoid doing that in
> +    ;; many users.  Related issues:
> +    ;; * <https://github.com/mesonbuild/meson/issues/314>
> +    ;; * <https://github.com/mesonbuild/meson/issues/3038>
> +    ;; * <https://github.com/NixOS/nixpkgs/issues/31222>

Terrible…

> +    (setenv "LDFLAGS" (string-append "-Wl,-rpath=" out "/lib"))

Can we pass them as an argument to ‘meson’ somehow instead of defining a
global variable?

(For example Autoconf-generated configure scripts can read variable
definitions passed as arguments:

  ./configure LDFLAGS=foo

That way we don’t have to define the variable globally, which could have
unintended effects.)

If not, that’s fine.

Thanks,
Ludo’.