Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame^] | 1 | meson: Allow source location to be configurable |
| 2 | |
| 3 | Hardcoding a build source path into a binary when cross compiling isn't |
| 4 | appropriate and breaks build reproducibility. Allow the srcdir to be |
| 5 | specified by an optional configuration option to meson. |
| 6 | |
| 7 | Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org> |
| 8 | Upstream-Status: Submitted [https://lists.freedesktop.org/archives/igt-dev/2021-February/029443.html] |
| 9 | |
| 10 | Index: 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', |
| 27 | Index: 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)') |