[igt-dev] [PATCH i-g-t] meson: Allow source location to be configurable

Martin Peres martin.peres at mupuf.org
Sun Feb 28 10:06:42 UTC 2021



On 27/02/2021 16:49, Richard Purdie wrote:
> Hardcoding a build source path into a binary when cross compiling isn't
> appropriate and breaks build reproducibility. Allow the srcdir to be
> specified by an optional configuration option to meson.
> 
> Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
> ---
>   lib/meson.build   | 6 +++++-
>   meson_options.txt | 4 ++++
>   2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/meson.build b/lib/meson.build
> index 114eadde..672b4206 100644
> --- a/lib/meson.build
> +++ b/lib/meson.build
> @@ -125,7 +125,11 @@ if chamelium.found()
>   	lib_sources += 'igt_chamelium_stream.c'
>   endif
>   
> -srcdir = join_paths(meson.source_root(), 'tests')
> +if get_option('srcdir') != ''
> +    srcdir = join_paths(get_option('srcdir'), 'tests')
> +else
> +    srcdir = join_paths(meson.source_root(), 'tests')
> +endif
>   
>   lib_version = vcs_tag(input : 'version.h.in', output : 'version.h',
>   		      fallback : 'NO-GIT',
> diff --git a/meson_options.txt b/meson_options.txt
> index ff3abf08..a0a1aaed 100644
> --- a/meson_options.txt
> +++ b/meson_options.txt
> @@ -50,3 +50,7 @@ option('use_rpath',
>          type : 'boolean',
>          value : false,
>          description : 'Set runpath on installed executables for libigt.so')
> +
> +option('srcdir',
> +       type : 'string',
> +       description : 'Path to source code to be compiled into binaries (optional)')

Shouldn't this read: "Path to THE source code to be compiled 
(optional)"? Compiling into binaries is a little redundant, so I would 
drop it.

Other than this, the rationale seems sane, but I am not 
knowledgeable-enough about IGT's build system to comment more on it:

Acked-by: Martin Peres <martin.peres at mupuf.org>

> 


More information about the igt-dev mailing list