diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2019-07-27 17:25:38 +0400 |
---|---|---|
committer | Jussi Pakkanen <jpakkane@gmail.com> | 2019-09-30 22:17:50 +0300 |
commit | 01569fee2e8130b3ac54659c119e73180d3dafee (patch) | |
tree | 7fc3b94f3aa921e548455caca7f118ad42b0f677 /test cases | |
parent | e32b0f8fbbd16b6cdd795a9a596eb56813620055 (diff) | |
download | meson-01569fee2e8130b3ac54659c119e73180d3dafee.zip meson-01569fee2e8130b3ac54659c119e73180d3dafee.tar.gz meson-01569fee2e8130b3ac54659c119e73180d3dafee.tar.bz2 |
Add depfile to configure_file()
In qemu, minikconf generates a depfile that meson could use to
automatically reconfigure on dependency change.
Note: someone clever can perhaps find a way to express this with a
ninja rule & depfile=. I didn't manage, so I wrote a simple depfile
parser.
Diffstat (limited to 'test cases')
-rw-r--r-- | test cases/common/14 configure file/depfile | 0 | ||||
-rwxr-xr-x | test cases/common/14 configure file/generator-deps.py | 19 | ||||
-rw-r--r-- | test cases/common/14 configure file/meson.build | 11 |
3 files changed, 30 insertions, 0 deletions
diff --git a/test cases/common/14 configure file/depfile b/test cases/common/14 configure file/depfile new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/common/14 configure file/depfile diff --git a/test cases/common/14 configure file/generator-deps.py b/test cases/common/14 configure file/generator-deps.py new file mode 100755 index 0000000..376ddb2 --- /dev/null +++ b/test cases/common/14 configure file/generator-deps.py @@ -0,0 +1,19 @@ +#!/usr/bin/env python3 + +import sys, os +from pathlib import Path + +if len(sys.argv) != 3: + print("Wrong amount of parameters.") + +build_dir = Path(os.environ['MESON_BUILD_ROOT']) +subdir = Path(os.environ['MESON_SUBDIR']) +outputf = Path(sys.argv[1]) + +with outputf.open('w') as ofile: + ofile.write("#define ZERO_RESULT 0\n") + +depf = Path(sys.argv[2]) +if not depf.exists(): + with depf.open('w') as ofile: + ofile.write("{}: depfile\n".format(outputf.name)) diff --git a/test cases/common/14 configure file/meson.build b/test cases/common/14 configure file/meson.build index d0f3d54..4a2f15a 100644 --- a/test cases/common/14 configure file/meson.build +++ b/test cases/common/14 configure file/meson.build @@ -57,6 +57,17 @@ if ret.returncode() != 0 error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) endif +genscript2deps = '@0@/generator-deps.py'.format(meson.current_source_dir()) +ofile2deps = '@0@/config2deps.h'.format(meson.current_build_dir()) +outf = configure_file( + output : 'config2deps.h', + depfile : 'depfile.d', + command : [genprog, genscript2deps, ofile2deps, '@DEPFILE@']) +ret = run_command(check_file, outf) +if ret.returncode() != 0 + error('Error running command: @0@\n@1@'.format(ret.stdout(), ret.stderr())) +endif + found_script = find_program('generator.py') # More configure_file tests in here subdir('subdir') |