mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-08-01 22:33:30 +00:00
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>
This commit is contained in:
parent
7ad7ee4d6c
commit
ad2e322204
5 changed files with 36 additions and 6 deletions
|
|
@ -4,6 +4,9 @@ COMPEL_SO_VERSION := $(COMPEL_SO_VERSION_MAJOR)$(if $(COMPEL_SO_VERSION_MINOR),.
|
|||
COMPEL_SO_VERSION_CODE := $(shell expr $(COMPEL_SO_VERSION_MAJOR) \* 65536 \+ $(COMPEL_SO_VERSION_MINOR) \* 256 \+ $(COMPEL_SO_VERSION_SUBLEVEL))
|
||||
ccflags-y += -DINCLUDEDIR=\"$(INCLUDEDIR)\"
|
||||
ccflags-y += -DLIBEXECDIR=\"$(LIBEXECDIR)\"
|
||||
ccflags-y += -DLIBDIR=\"$(LIBDIR)\"
|
||||
ccflags-y += -DSTATIC_LIB=\"$(LIBCOMPEL_A)\"
|
||||
ccflags-y += -DDYN_LIB=\"$(LIBCOMPEL_SO).$(COMPEL_SO_VERSION_MAJOR)\"
|
||||
ccflags-y += -iquote compel/arch/$(ARCH)/src/lib/include
|
||||
ccflags-y += -iquote compel/include
|
||||
ccflags-y += -fno-strict-aliasing
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ CC := gcc
|
|||
CFLAGS ?= -O2 -g -Wall -Werror
|
||||
|
||||
COMPEL := ../../../compel/compel-host
|
||||
COMPEL_LIBRARY := ../../../compel/libcompel.a
|
||||
|
||||
all: victim spy
|
||||
|
||||
|
|
@ -17,7 +16,7 @@ victim: victim.c
|
|||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
spy: spy.c parasite.h
|
||||
$(CC) $(CFLAGS) $(shell $(COMPEL) includes) -o $@ $< $(COMPEL_LIBRARY)
|
||||
$(CC) $(CFLAGS) $(shell $(COMPEL) includes) -o $@ $< $(shell $(COMPEL) --static libs)
|
||||
|
||||
parasite.h: parasite.po
|
||||
$(COMPEL) hgen -f $^ -l 4 \
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ CC := gcc
|
|||
CFLAGS ?= -O2 -g -Wall -Werror
|
||||
|
||||
COMPEL := ../../../compel/compel-host
|
||||
COMPEL_LIBRARY := ../../../compel/libcompel.a
|
||||
|
||||
all: victim spy
|
||||
|
||||
|
|
@ -14,4 +13,4 @@ victim: victim.c
|
|||
$(CC) $(CFLAGS) -o $@ $^
|
||||
|
||||
spy: spy.c
|
||||
$(CC) $(CFLAGS) $(shell $(COMPEL) includes) -o $@ $^ $(COMPEL_LIBRARY)
|
||||
$(CC) $(CFLAGS) $(shell $(COMPEL) includes) -o $@ $^ $(shell $(COMPEL) --static libs)
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ export ARCH_DIR PIE_DIR
|
|||
ifeq ($(filter clean mrproper,$(MAKECMDGOALS)),)
|
||||
COMPEL_UAPI_INCLUDES := $(shell $(COMPEL_BIN) includes)
|
||||
export COMPEL_UAPI_INCLUDES
|
||||
COMPEL_LIBS := $(shell $(COMPEL_BIN) --static libs)
|
||||
endif
|
||||
|
||||
#
|
||||
|
|
@ -65,7 +66,7 @@ PROGRAM-BUILTINS += images/built-in.o
|
|||
PROGRAM-BUILTINS += $(obj)/built-in.o
|
||||
PROGRAM-BUILTINS += $(ARCH-LIB)
|
||||
PROGRAM-BUILTINS += soccr/libsoccr.a
|
||||
PROGRAM-BUILTINS += compel/libcompel.a
|
||||
PROGRAM-BUILTINS += $(COMPEL_LIBS)
|
||||
|
||||
$(obj)/built-in.o: pie
|
||||
$(Q) $(MAKE) $(call build-as,Makefile.crtools,criu) all
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue