blob: 39e36d8737887664cd387565529bf321d36c11a5 [file] [log] [blame]
Andrew Geissler90fd73c2021-03-05 15:25:55 -06001meson: Allow source location to be configurable
2
3Hardcoding a build source path into a binary when cross compiling isn't
4appropriate and breaks build reproducibility. Allow the srcdir to be
5specified by an optional configuration option to meson.
6
7Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
8Upstream-Status: Submitted [https://lists.freedesktop.org/archives/igt-dev/2021-February/029443.html]
9
10Index: git/lib/meson.build
11===================================================================
12--- git.orig/lib/meson.build
13+++ git/lib/meson.build
14@@ -122,7 +122,11 @@ if chamelium.found()
15 lib_sources += 'igt_chamelium_stream.c'
16 endif
17
18-srcdir = join_paths(meson.source_root(), 'tests')
19+if get_option('srcdir') != ''
20+ srcdir = join_paths(get_option('srcdir'), 'tests')
21+else
22+ srcdir = join_paths(meson.source_root(), 'tests')
23+endif
24
25 lib_version = vcs_tag(input : 'version.h.in', output : 'version.h',
26 fallback : 'NO-GIT',
27Index: git/meson_options.txt
28===================================================================
29--- git.orig/meson_options.txt
30+++ git/meson_options.txt
31@@ -50,3 +50,7 @@ option('use_rpath',
32 type : 'boolean',
33 value : false,
34 description : 'Set runpath on installed executables for libigt.so')
35+
36+option('srcdir',
37+ type : 'string',
38+ description : 'Path to source code to be compiled into binaries (optional)')