[igt-dev] [PATCH i-g-t 1/2] meson: Define all the rpath_dirs in one place
Petri Latvala
petri.latvala at intel.com
Mon Aug 13 10:30:16 UTC 2018
On Mon, Aug 13, 2018 at 01:26:12PM +0300, Arkadiusz Hiler wrote:
> So they are located close to the definitions of the corresponding
> install_dirs and can be reused easily.
>
> Cc: Petri Latvala <petri.latvala at intel.com>
> Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
For the series,
Reviewed-by: Petri Latvala <petri.latvala at intel.com>
> ---
> meson.build | 38 ++++++++++++++++++++++++++++++++++++++
> tests/amdgpu/meson.build | 26 +-------------------------
> tests/meson.build | 22 ----------------------
> tools/meson.build | 32 +++++---------------------------
> 4 files changed, 44 insertions(+), 74 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index d45db9ac..7278c438 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -221,9 +221,47 @@ datadir = join_paths(get_option('datadir'), 'igt-gpu-tools')
> includedir = get_option('includedir')
> libdir = get_option('libdir')
> libexecdir = join_paths(get_option('libexecdir'), 'igt-gpu-tools')
> +amdgpudir = join_paths(libexecdir, 'amdgpu')
> mandir = get_option('mandir')
> pkgconfigdir = join_paths(libdir, 'pkgconfig')
>
> +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 bindir are pathnames relative to prefix. meson
> + # enforces this.
> +
> + # 1. Start from the executable.
> + # 2. Executables are installed in certain dir. Add a .. for each
> + # directory name in it.
> + # 3. Add relative path to libdir.
> +
> + bindir_rpathdir = '$ORIGIN'
> + foreach p : bindir.split('/')
> + bindir_rpathdir = join_paths(bindir_rpathdir, '..')
> + endforeach
> + bindir_rpathdir = join_paths(bindir_rpathdir, libdir)
> +
> + libexecdir_rpathdir = '$ORIGIN'
> + foreach p : libexecdir.split('/')
> + libexecdir_rpathdir = join_paths(libexecdir_rpathdir, '..')
> + endforeach
> + libexecdir_rpathdir = join_paths(libexecdir_rpathdir, libdir)
> +
> + amdgpudir_rpathdir = '$ORIGIN'
> + foreach p : amdgpudir.split('/')
> + amdgpudir_rpathdir = join_paths(amdgpudir_rpathdir, '..')
> + endforeach
> + amdgpudir_rpathdir = join_paths(amdgpudir_rpathdir, libdir)
> +else
> + bindir_rpathdir = ''
> + libexecdir_rpathdir = ''
> + amdgpudir_rpathdir = ''
> +endif
> +
> subdir('lib')
> if _build_tests
> subdir('tests')
> diff --git a/tests/amdgpu/meson.build b/tests/amdgpu/meson.build
> index 15cfb2b5..566e851b 100644
> --- a/tests/amdgpu/meson.build
> +++ b/tests/amdgpu/meson.build
> @@ -9,35 +9,11 @@ if libdrm_amdgpu.found()
> amdgpu_deps += libdrm_amdgpu
> endif
>
> -amdgpudir = join_paths(libexecdir, 'amdgpu')
> -
> -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
> - amdgpu_rpathdir = '$ORIGIN'
> - # Executables are installed in amdgpudir. Add a .. for each
> - # directory name in it.
> - foreach p : amdgpudir.split('/')
> - amdgpu_rpathdir = join_paths(amdgpu_rpathdir, '..')
> - endforeach
> - # Add relative path to libdir
> - amdgpu_rpathdir = join_paths(amdgpu_rpathdir, libdir)
> -else
> - amdgpu_rpathdir = ''
> -endif
> -
> foreach prog : amdgpu_progs
> test_executables += executable(prog, prog + '.c',
> dependencies : amdgpu_deps,
> install_dir : amdgpudir,
> - install_rpath : amdgpu_rpathdir,
> + install_rpath : amdgpudir_rpathdir,
> install : true)
> test_progs += join_paths('amdgpu', prog)
> endforeach
> diff --git a/tests/meson.build b/tests/meson.build
> index bb6c7627..17deb945 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -239,28 +239,6 @@ if _build_audio and 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
> - libexecdir_rpathdir = '$ORIGIN'
> - # Executables are installed in libexecdir. Add a .. for each
> - # directory name in it.
> - foreach p : libexecdir.split('/')
> - libexecdir_rpathdir = join_paths(libexecdir_rpathdir, '..')
> - endforeach
> - # Add relative path to libdir
> - libexecdir_rpathdir = join_paths(libexecdir_rpathdir, libdir)
> -else
> - libexecdir_rpathdir = ''
> -endif
> -
> test_executables = []
>
> foreach prog : test_progs
> diff --git a/tools/meson.build b/tools/meson.build
> index ae9ba493..e4517d66 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -49,32 +49,10 @@ if libdrm_intel.found()
> tool_deps += zlib
> 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 bindir are pathnames relative to prefix. meson
> - # enforces this.
> -
> - # Start from the executable
> - tools_rpathdir = '$ORIGIN'
> - # Executables are installed in bindir. Add a .. for each
> - # directory name in it.
> - foreach p : bindir.split('/')
> - tools_rpathdir = join_paths(tools_rpathdir, '..')
> - endforeach
> - # Add relative path to libdir
> - tools_rpathdir = join_paths(tools_rpathdir, libdir)
> -else
> - tools_rpathdir = ''
> -endif
> -
> foreach prog : tools_progs
> executable(prog, prog + '.c',
> dependencies : tool_deps,
> - install_rpath : tools_rpathdir,
> + install_rpath : bindir_rpathdir,
> install : true)
> endforeach
>
> @@ -85,21 +63,21 @@ if libudev.found()
> ]
> executable('intel_dp_compliance', sources : intel_dp_compliance_src,
> dependencies : [tool_deps, libudev],
> - install_rpath : tools_rpathdir,
> + install_rpath : bindir_rpathdir,
> install : true)
> endif
>
> intel_l3_parity_src = [ 'intel_l3_parity.c', 'intel_l3_udev_listener.c' ]
> executable('intel_l3_parity', sources : intel_l3_parity_src,
> dependencies : tool_deps,
> - install_rpath : tools_rpathdir,
> + install_rpath : bindir_rpathdir,
> install : true)
>
> intel_reg_src = [ 'intel_reg.c', 'intel_reg_decode.c', 'intel_reg_spec.c' ]
> executable('intel_reg', sources : intel_reg_src,
> dependencies : tool_deps,
> install : true,
> - install_rpath : tools_rpathdir,
> + install_rpath : bindir_rpathdir,
> c_args : [
> '-DIGT_DATADIR="@0@"'.format(join_paths(prefix, datadir)),
> ])
> @@ -118,7 +96,7 @@ shared_library('intel_aubdump', 'aubdump.c',
>
> executable('intel_gpu_top', 'intel_gpu_top.c',
> install : true,
> - install_rpath : tools_rpathdir,
> + install_rpath : bindir_rpathdir,
> dependencies : tool_deps + [ lib_igt_perf ])
>
> conf_data = configuration_data()
> --
> 2.17.1
>
More information about the igt-dev
mailing list