diff options
author | Kir Kolyshkin <kir@openvz.org> | 2016-12-17 14:22:16 +0300 |
---|---|---|
committer | Andrei Vagin <avagin@virtuozzo.com> | 2017-03-15 00:09:57 +0300 |
commit | ad2e322204d91af104eccbb1f0e6ea24afa6a5d3 (patch) | |
tree | b5653f1a65e4c01f64e419fe50d0795f86df9868 /compel/src | |
parent | 7ad7ee4d6cd8fa3b5fc8057f85f0e3983cf6e97e (diff) |
compel cli: add libs command, use it
Add "compel libs" that prints the list of libraries needed
to link the parasite loader.
Make compel/test/ and criu/ to use it.
travis-ci: success for More polishing for compel cli
Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Diffstat (limited to 'compel/src')
-rw-r--r-- | compel/src/main.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/compel/src/main.c b/compel/src/main.c index 2d2351753..2bfb37f8c 100644 --- a/compel/src/main.c +++ b/compel/src/main.c @@ -121,6 +121,7 @@ static int usage(int rc) { fprintf(out, "Usage:\n" " compel [--compat] includes | cflags | ldflags | plugins\n" +" compel [--compat] [--static] libs\n" " compel -f FILE -o FILE -p NAME [-l N] hgen\n" " -f, --file FILE input (parasite object) file name\n" " -o, --output FILE output (header) file name\n" @@ -194,17 +195,37 @@ static void print_plugins(const char *list[]) } } +static int print_libs(bool is_static) +{ + if (uninst_root) { + if (!is_static) { + fprintf(stderr, "Compel is not installed, can " + "only link with static libraries " + "(use --static)\n"); + return 1; + } + printf("%s/%s\n", uninst_root, STATIC_LIB); + } + else { + printf("%s/%s\n", LIBDIR, (is_static) ? STATIC_LIB : DYN_LIB); + } + + return 0; +} + int main(int argc, char *argv[]) { int log_level = DEFAULT_LOGLEVEL; bool compat = false; + bool is_static = false; int opt, idx; char *action; const char *plugins_list[] = { "std", NULL }; - static const char short_opts[] = "cf:o:p:hVl:"; + static const char short_opts[] = "csf:o:p:hVl:"; static struct option long_opts[] = { { "compat", no_argument, 0, 'c' }, + { "static", no_argument, 0, 's' }, { "file", required_argument, 0, 'f' }, { "output", required_argument, 0, 'o' }, { "prefix", required_argument, 0, 'p' }, @@ -225,6 +246,9 @@ int main(int argc, char *argv[]) case 'c': compat = true; break; + case 's': + is_static = true; + break; case 'f': opts.input_filename = optarg; break; @@ -280,6 +304,10 @@ int main(int argc, char *argv[]) return 0; } + if (!strcmp(action, "libs")) { + return print_libs(is_static); + } + if (!strcmp(action, "hgen")) { if (!opts.input_filename) { fprintf(stderr, "Error: option --file required\n"); |