diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
commit | 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch) | |
tree | 4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/native/5 install script | |
parent | Initial commit. (diff) | |
download | meson-upstream.tar.xz meson-upstream.zip |
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/native/5 install script')
-rw-r--r-- | test cases/native/5 install script/file.txt | 0 | ||||
-rw-r--r-- | test cases/native/5 install script/meson.build | 12 | ||||
-rw-r--r-- | test cases/native/5 install script/src/exe.c | 27 | ||||
-rw-r--r-- | test cases/native/5 install script/src/meson.build | 1 | ||||
-rw-r--r-- | test cases/native/5 install script/test.json | 8 | ||||
-rwxr-xr-x | test cases/native/5 install script/wrap.py | 6 |
6 files changed, 54 insertions, 0 deletions
diff --git a/test cases/native/5 install script/file.txt b/test cases/native/5 install script/file.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/native/5 install script/file.txt diff --git a/test cases/native/5 install script/meson.build b/test cases/native/5 install script/meson.build new file mode 100644 index 0000000..8a69a0d --- /dev/null +++ b/test cases/native/5 install script/meson.build @@ -0,0 +1,12 @@ +project('custom install script', 'c') + +# this is just to ensure that the install directory exists before exe is run +install_data('file.txt', install_dir: '.') + +subdir('src') + +meson.add_install_script(exe, 'generated.txt') +wrap = find_program('wrap.py') +# Yes, these are getting silly +meson.add_install_script(wrap, exe, 'wrapped.txt') +meson.add_install_script(wrap, wrap, exe, 'wrapped2.txt') diff --git a/test cases/native/5 install script/src/exe.c b/test cases/native/5 install script/src/exe.c new file mode 100644 index 0000000..2df3ee8 --- /dev/null +++ b/test cases/native/5 install script/src/exe.c @@ -0,0 +1,27 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +int main(int argc, char * argv[]) { + if (argc != 2) { + fprintf(stderr, "Takes exactly 2 arguments\n"); + return 1; + } + + char * dirname = getenv("MESON_INSTALL_DESTDIR_PREFIX"); + char * fullname = malloc(strlen(dirname) + 1 + strlen(argv[1]) + 1); + strcpy(fullname, dirname); + strcat(fullname, "/"); + strcat(fullname, argv[1]); + + FILE * fp = fopen(fullname, "w"); + if (!fp) + return 1; + + fputs("Some text\n", fp); + fclose(fp); + + free(fullname); + + return 0; +} diff --git a/test cases/native/5 install script/src/meson.build b/test cases/native/5 install script/src/meson.build new file mode 100644 index 0000000..f60c995 --- /dev/null +++ b/test cases/native/5 install script/src/meson.build @@ -0,0 +1 @@ +exe = executable('exe', 'exe.c', install : false, native : true) diff --git a/test cases/native/5 install script/test.json b/test cases/native/5 install script/test.json new file mode 100644 index 0000000..c41c27c --- /dev/null +++ b/test cases/native/5 install script/test.json @@ -0,0 +1,8 @@ +{ + "installed": [ + {"type": "file", "file": "usr/file.txt"}, + {"type": "file", "file": "usr/generated.txt"}, + {"type": "file", "file": "usr/wrapped.txt"}, + {"type": "file", "file": "usr/wrapped2.txt"} + ] +} diff --git a/test cases/native/5 install script/wrap.py b/test cases/native/5 install script/wrap.py new file mode 100755 index 0000000..87508e0 --- /dev/null +++ b/test cases/native/5 install script/wrap.py @@ -0,0 +1,6 @@ +#!/usr/bin/env python3 + +import subprocess +import sys + +subprocess.run(sys.argv[1:]) |