[Intel-gfx] [PATCH i-g-t v2 1/1] meson: Refactor get_option() calls for directories

Daniel Vetter daniel at ffwll.ch
Wed Jan 17 10:32:22 UTC 2018


On Mon, Jan 15, 2018 at 01:14:56PM +0200, Petri Latvala wrote:
> Fetch the configuration values in the toplevel meson.build for all
> subdirs to share.
> 
> v2: Also remember tests/intel-ci/meson.build
> 
> Signed-off-by: Petri Latvala <petri.latvala at intel.com>
> Cc: Daniel Vetter <daniel.vetter at ffwll.ch>

I haven't tried, but why exactly can we drop all the calls to get_option?
-Daniel

> ---
>  assembler/meson.build      |  8 +++-----
>  benchmarks/meson.build     |  6 ++++--
>  lib/meson.build            |  3 +--
>  man/meson.build            |  2 +-
>  meson.build                |  9 +++++++++
>  tests/intel-ci/meson.build |  2 +-
>  tests/meson.build          |  6 +-----
>  tools/meson.build          | 14 +++++---------
>  8 files changed, 25 insertions(+), 25 deletions(-)
> 
> diff --git a/assembler/meson.build b/assembler/meson.build
> index b5ac678d..7517d82f 100644
> --- a/assembler/meson.build
> +++ b/assembler/meson.build
> @@ -35,13 +35,11 @@ executable('intel-gen4asm', 'main.c', lfiles, pfiles,
>  executable('intel-gen4disasm', 'disasm-main.c',
>  	   link_with : lib_brw, install : true)
>  
> -pkgconfigdir = join_paths(get_option('libdir'), 'pgkconfig')
> -
>  conf_data = configuration_data()
> -conf_data.set('prefix', get_option('prefix'))
> +conf_data.set('prefix', prefix)
>  conf_data.set('exec_prefix', '${prefix}')
> -conf_data.set('libdir', join_paths('${prefix}', get_option('libdir')))
> -conf_data.set('includedir', join_paths('${prefix}', get_option('includedir')))
> +conf_data.set('libdir', join_paths('${prefix}', libdir))
> +conf_data.set('includedir', join_paths('${prefix}', includedir))
>  conf_data.set('VERSION', meson.project_version())
>  configure_file(input : 'intel-gen4asm.pc.in', output : 'intel-gen4asm.pc',
>  	       configuration : conf_data, install_dir : pkgconfigdir)
> diff --git a/benchmarks/meson.build b/benchmarks/meson.build
> index 26d65c4b..27836c1d 100644
> --- a/benchmarks/meson.build
> +++ b/benchmarks/meson.build
> @@ -27,16 +27,18 @@ if libdrm_intel.found()
>  	]
>  endif
>  
> +benchmarksdir = join_paths(libexecdir, 'benchmarks')
> +
>  foreach prog : benchmark_progs
>  	# FIXME meson doesn't like binaries with the same name
>  	# meanwhile just suffix with _bench
>  	executable(prog + '_bench', prog + '.c',
>  		   install : true,
> -		   install_dir : join_paths(get_option('libexecdir'), 'intel-gpu-tools', 'benchmarks'),
> +		   install_dir : benchmarksdir,
>  		   dependencies : test_deps)
>  endforeach
>  
>  executable('gem_wsim_bench', 'gem_wsim.c',
>  	   install : true,
> -	   install_dir : join_paths(get_option('libexecdir'), 'intel-gpu-tools', 'benchmarks'),
> +	   install_dir : benchmarksdir,
>  	   dependencies : test_deps + [ lib_igt_perf ])
> diff --git a/lib/meson.build b/lib/meson.build
> index 311e2342..b3bbc311 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -145,7 +145,6 @@ if chamelium.found()
>  	lib_sources += 'igt_chamelium.c'
>  endif
>  
> -pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'intel-gpu-tools')
>  srcdir = join_paths(meson.source_root(), 'tests')
>  
>  lib_version = vcs_tag(input : 'version.h.in', output : 'version.h',
> @@ -160,7 +159,7 @@ foreach f: lib_sources
>  	include_directories: inc,
>  	dependencies : lib_deps,
>  	c_args : [
> -	    '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
> +	    '-DIGT_DATADIR="@0@"'.format(datadir),
>  	    '-DIGT_SRCDIR="@0@"'.format(srcdir),
>  	    '-DIGT_LOG_DOMAIN="@0@"'.format(f.split('.')[0]),
>  	])
> diff --git a/man/meson.build b/man/meson.build
> index 351d025b..49b0686a 100644
> --- a/man/meson.build
> +++ b/man/meson.build
> @@ -34,6 +34,6 @@ if rst2man.found()
>  				input: manpage + '.rst',
>  				output : manpage + '.1.gz',
>  				install : true,
> -				install_dir : join_paths(get_option('mandir'), 'man1'))
> +				install_dir : join_paths(mandir, 'man1'))
>  	endforeach
>  endif
> diff --git a/meson.build b/meson.build
> index 0950d3c7..d403ba5b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -127,6 +127,15 @@ config.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())
>  
>  configure_file(output: 'config.h', install: false, configuration: config)
>  
> +prefix = get_option('prefix')
> +bindir = get_option('bindir')
> +datadir = join_paths(get_option('datadir'), 'intel-gpu-tools')
> +includedir = get_option('includedir')
> +libdir = get_option('libdir')
> +libexecdir = join_paths(get_option('libexecdir'), 'intel-gpu-tools')
> +mandir = get_option('mandir')
> +pkgconfigdir = join_paths(libdir, 'pkgconfig')
> +
>  subdir('lib')
>  subdir('tests')
>  subdir('benchmarks')
> diff --git a/tests/intel-ci/meson.build b/tests/intel-ci/meson.build
> index 5394a2ff..b3abb848 100644
> --- a/tests/intel-ci/meson.build
> +++ b/tests/intel-ci/meson.build
> @@ -5,4 +5,4 @@ intelci_files = [
>    'README',
>  ]
>  
> -install_data(sources : intelci_files, install_dir : pkgdatadir)
> +install_data(sources : intelci_files, install_dir : datadir)
> diff --git a/tests/meson.build b/tests/meson.build
> index 4c4bee1d..2322217d 100644
> --- a/tests/meson.build
> +++ b/tests/meson.build
> @@ -255,8 +255,6 @@ if alsa.found() and gsl.found()
>  	test_deps += alsa
>  endif
>  
> -libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'), 'intel-gpu-tools')
> -
>  test_executables = []
>  
>  foreach prog : test_progs
> @@ -278,8 +276,6 @@ executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
>  	   install : true)
>  test_progs += 'testdisplay'
>  
> -pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'intel-gpu-tools')
> -
>  gen_testlist = find_program('generate_testlist.sh')
>  test_list = custom_target('testlist',
>  	      output : 'test-list.txt',
> @@ -318,6 +314,6 @@ image_files = [
>    '1080p-right.png',
>    'pass.png',
>  ]
> -install_data(sources : image_files, install_dir : pkgdatadir)
> +install_data(sources : image_files, install_dir : datadir)
>  
>  subdir('intel-ci')
> diff --git a/tools/meson.build b/tools/meson.build
> index 7fc5390a..df65e0f8 100644
> --- a/tools/meson.build
> +++ b/tools/meson.build
> @@ -55,8 +55,6 @@ foreach prog : tools_progs
>  		   install : true)
>  endforeach
>  
> -pkgdatadir = join_paths(get_option('prefix'), get_option('datadir'), 'intel-gpu-tools')
> -
>  if libudev.found()
>  	intel_dp_compliance_src = [
>  		'intel_dp_compliance.c',
> @@ -77,14 +75,12 @@ executable('intel_reg', sources : intel_reg_src,
>  	   dependencies : tool_deps,
>  	   install : true,
>  	   c_args : [
> -	     '-DIGT_DATADIR="@0@"'.format(pkgdatadir),
> +	     '-DIGT_DATADIR="@0@"'.format(datadir),
>  	   ])
>  
> -bindir = join_paths(get_option('prefix'), get_option('bindir'))
> -
>  install_data('intel_gpu_abrt', install_dir : bindir)
>  
> -install_subdir('registers', install_dir : pkgdatadir,
> +install_subdir('registers', install_dir : datadir,
>  	       exclude_files : [
>  		 'Makefile', 'Makefile.in', 'Makefile.am',
>  	       ])
> @@ -95,10 +91,10 @@ shared_library('intel_aubdump', 'aubdump.c',
>  	       install : true)
>  
>  conf_data = configuration_data()
> -conf_data.set('prefix', get_option('prefix'))
> +conf_data.set('prefix', prefix)
>  conf_data.set('exec_prefix', '${prefix}')
> -conf_data.set('libdir', join_paths('${prefix}', get_option('libdir')))
> +conf_data.set('libdir', join_paths('${prefix}', libdir))
>  configure_file(input : 'intel_aubdump.in', output : 'intel_aubdump',
> -               configuration : conf_data, install_dir : get_option('bindir'))
> +               configuration : conf_data, install_dir : bindir)
>  
>  subdir('null_state_gen')
> -- 
> 2.14.1
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch


More information about the Intel-gfx mailing list