All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
To: "Latvala, Petri" <petri.latvala@intel.com>
Cc: "igt-dev@lists.freedesktop.org" <igt-dev@lists.freedesktop.org>,
	"Sarvela, Tomi P" <tomi.p.sarvela@intel.com>
Subject: Re: [igt-dev] [PATCH 1/1] meson: Set up runpath for installed executables
Date: Mon, 12 Mar 2018 14:08:08 +0200	[thread overview]
Message-ID: <20180312120808.GL22044@ahiler-desk1.ger.corp.intel.com> (raw)
In-Reply-To: <20180119114407.25714-1-petri.latvala@intel.com>

On Fri, Jan 19, 2018 at 01:44:07PM +0200, Latvala, Petri wrote:
> Meson builds libigt as a shared library, and executables naturally
> have to find it at runtime. Using default options puts the library to
> a normal search paths, but any modifications to the directory options
> or a non-conventional prefix setting makes using LD_LIBRARY_PATH or
> other library search means mandatory.
> 
> Add a build option 'use_rpath' (default: false) that makes meson set
> up DT_RUNPATH at install time, pointing to the library with a path
> relative to the executable, using $ORIGIN. That way the installed
> executables find the library even when not installed to exactly the
> build-time configured prefix path, a setup CI occasionally uses.
> 
> Signed-off-by: Petri Latvala <petri.latvala@intel.com>
> Cc: Tomi Sarvela <tomi.p.sarvela@intel.com>
> Cc: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
> ---
>  meson_options.txt |  4 ++++
>  tests/meson.build | 26 ++++++++++++++++++++++++++
>  tools/meson.build | 26 ++++++++++++++++++++++++++
>  3 files changed, 56 insertions(+)
>  create mode 100644 meson_options.txt
> 
> diff --git a/meson_options.txt b/meson_options.txt
> new file mode 100644
> index 00000000..41be35e0
> --- /dev/null
> +++ b/meson_options.txt
> @@ -0,0 +1,4 @@
> +option('use_rpath',
> +       type : 'boolean',
> +       value : false,
> +       description : 'Set runpath on installed executables for libigt.so')
> diff --git a/tests/meson.build b/tests/meson.build
> index 2322217d..b764b7f7 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -255,24 +255,49 @@ if alsa.found() and gsl.found()
>  	test_deps += alsa
>  endif
>  
> +if get_option('use_rpath')
> +	# Set up runpath for the test executables towards libigt.so.
> +	# The path should be relative to $ORIGIN so the library is
> +	# still found properly even if installed to a path other than
> +	# prefix.
> +
> +	# libdir and libexecdir are pathnames relative to
> +	# prefix. meson enforces this.
> +
> +	# Start from the executable
> +	rpathdir = '$ORIGIN'
> +	# Executables are installed in libexecdir. Add a .. for each
> +	# directory name in it.
> +	foreach p : libexecdir.split('/')
> +		rpathdir = join_paths(rpathdir, '..')
> +	endforeach
> +	# Add relative path to libdir
> +	rpathdir = join_paths(rpathdir, libdir)

Theoretically there is $LIB which:
"They will be replaced by [...] or either lib - for 32-bit binaries - or
lib64 - for 64-bit binaries - in the case of $LIB"

But I think I like current soultion more.

Reviewed-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>
Tested-by: Arkadiusz Hiler <arkadiusz.hiler@intel.com>

I'll push it in a minute.

I've learend something today, thanks!

-- 
Cheers,
Arek
_______________________________________________
igt-dev mailing list
igt-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/igt-dev

      parent reply	other threads:[~2018-03-12 12:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19 11:44 [igt-dev] [PATCH 1/1] meson: Set up runpath for installed executables Petri Latvala
2018-01-19 12:20 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/1] " Patchwork
2018-01-19 15:52 ` [igt-dev] ✗ Fi.CI.IGT: failure " Patchwork
2018-01-20  0:03 ` [igt-dev] ✓ Fi.CI.BAT: success " Patchwork
2018-01-23 10:01 ` Patchwork
2018-01-30  7:55 ` [igt-dev] [PATCH 1/1] " Daniel Vetter
2018-03-12 12:08 ` Arkadiusz Hiler [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180312120808.GL22044@ahiler-desk1.ger.corp.intel.com \
    --to=arkadiusz.hiler@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    --cc=petri.latvala@intel.com \
    --cc=tomi.p.sarvela@intel.com \
    /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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.