+protobuf-c-text
This commit is contained in:
parent
b5e4f35906
commit
ad53e11e9b
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -1,3 +1,6 @@
|
|||||||
[submodule "kafel"]
|
[submodule "kafel"]
|
||||||
path = kafel
|
path = kafel
|
||||||
url = https://github.com/google/kafel.git
|
url = https://github.com/google/kafel.git
|
||||||
|
[submodule "protobuf-c-text"]
|
||||||
|
path = protobuf-c-text
|
||||||
|
url = https://github.com/protobuf-c/protobuf-c-text.git
|
||||||
|
31
Makefile
31
Makefile
@ -24,14 +24,15 @@ CFLAGS += -O2 -c -std=gnu11 \
|
|||||||
-fstack-protector-all -Wformat -Wformat=2 -Wformat-security -fPIE \
|
-fstack-protector-all -Wformat -Wformat=2 -Wformat-security -fPIE \
|
||||||
-Wno-format-nonliteral \
|
-Wno-format-nonliteral \
|
||||||
-Wall -Wextra -Werror \
|
-Wall -Wextra -Werror \
|
||||||
-Ikafel/include
|
-Ikafel/include \
|
||||||
|
-Iprotobuf-c-text/protobuf-c-text
|
||||||
|
|
||||||
LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie -Wl,-z,noexecstack
|
LDFLAGS += -Wl,-z,now -Wl,-z,relro -pie -Wl,-z,noexecstack
|
||||||
|
|
||||||
|
BIN = nsjail
|
||||||
|
LIBS = kafel/libkafel.a protobuf-c-text/protobuf-c-text/.libs/libprotobuf-c-text.a
|
||||||
SRCS = nsjail.c cmdline.c config.c contain.c log.c cgroup.c mount.c net.c pid.c sandbox.c subproc.c user.c util.c uts.c
|
SRCS = nsjail.c cmdline.c config.c contain.c log.c cgroup.c mount.c net.c pid.c sandbox.c subproc.c user.c util.c uts.c
|
||||||
OBJS = $(SRCS:.c=.o)
|
OBJS = $(SRCS:.c=.o)
|
||||||
BIN = nsjail
|
|
||||||
LIBS = kafel/libkafel.a
|
|
||||||
|
|
||||||
ifdef DEBUG
|
ifdef DEBUG
|
||||||
CFLAGS += -g -ggdb -gdwarf-4
|
CFLAGS += -g -ggdb -gdwarf-4
|
||||||
@ -46,23 +47,23 @@ ifeq ($(NL3_EXISTS), yes)
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
USE_PROTOBUFC ?= yes
|
USE_PROTOBUF ?= yes
|
||||||
ifeq ($(USE_PROTOBUFC), yes)
|
ifeq ($(USE_PROTOBUF), yes)
|
||||||
PROTOBUFC_EXISTS := $(shell pkg-config --exists libprotobuf-c && echo yes)
|
PROTOBUF_EXISTS := $(shell pkg-config --exists protobuf && echo yes)
|
||||||
ifeq ($(PROTOBUFC_EXISTS), yes)
|
ifeq ($(PROTOBUF_EXISTS), yes)
|
||||||
PROTO_DEPS = config.pb-c.h config.pb-c.c
|
PROTO_DEPS = config.pb-c.h config.pb-c.c
|
||||||
SRCS += config.pb-c.c
|
SRCS += config.pb-c.c
|
||||||
CFLAGS += -DNSJAIL_WITH_PROTOBUFC $(shell pkg-config --cflags libprotobuf-c)
|
CFLAGS += -DNSJAIL_WITH_PROTOBUF $(shell pkg-config --cflags libprotobuf-c)
|
||||||
LDFLAGS += $(shell pkg-config --libs libprotobuf-c)
|
LDFLAGS += $(shell pkg-config --libs libprotobuf-c)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: all clear depend indent kafel
|
.PHONY: all clear depend indent kafel protobuf-c-text
|
||||||
|
|
||||||
.c.o: %.c
|
.c.o: %.c
|
||||||
$(CC) $(CFLAGS) $< -o $@
|
$(CC) $(CFLAGS) $< -o $@
|
||||||
|
|
||||||
all: $(PROTO_DEPS) kafel $(BIN)
|
all: $(PROTO_DEPS) protobuf-c-text kafel $(BIN)
|
||||||
|
|
||||||
$(BIN): $(OBJS) $(LIBS)
|
$(BIN): $(OBJS) $(LIBS)
|
||||||
$(CC) -o $(BIN) $(OBJS) $(LIBS) $(LDFLAGS)
|
$(CC) -o $(BIN) $(OBJS) $(LIBS) $(LDFLAGS)
|
||||||
@ -72,9 +73,18 @@ ifeq ("$(wildcard kafel/Makefile)","")
|
|||||||
git submodule update --init
|
git submodule update --init
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
protobuf-c-text:
|
||||||
|
ifeq ("$(wildcard protobuf-c-text/configure)","")
|
||||||
|
git submodule update --init
|
||||||
|
endif
|
||||||
|
|
||||||
kafel/libkafel.a:
|
kafel/libkafel.a:
|
||||||
$(MAKE) -C kafel
|
$(MAKE) -C kafel
|
||||||
|
|
||||||
|
protobuf-c-text/protobuf-c-text/.libs/libprotobuf-c-text.a:
|
||||||
|
sh -c "cd protobuf-c-text; ./autogen.sh;"
|
||||||
|
$(MAKE) -C protobuf-c-text
|
||||||
|
|
||||||
$(PROTO_DEPS): config.proto
|
$(PROTO_DEPS): config.proto
|
||||||
protoc-c --c_out=. config.proto
|
protoc-c --c_out=. config.proto
|
||||||
|
|
||||||
@ -106,4 +116,3 @@ subproc.o: util.h
|
|||||||
user.o: user.h common.h log.h subproc.h util.h
|
user.o: user.h common.h log.h subproc.h util.h
|
||||||
util.o: util.h common.h log.h
|
util.o: util.h common.h log.h
|
||||||
uts.o: uts.h common.h log.h
|
uts.o: uts.h common.h log.h
|
||||||
config.pb-c.o: config.pb-c.h
|
|
||||||
|
6
config.c
6
config.c
@ -24,13 +24,13 @@
|
|||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#if !defined(NSJAIL_WITH_PROTOBUFC)
|
#if !defined(NSJAIL_WITH_PROTOBUF)
|
||||||
bool configParse(struct nsjconf_t * nsjconf UNUSED, const char *file UNUSED)
|
bool configParse(struct nsjconf_t * nsjconf UNUSED, const char *file UNUSED)
|
||||||
{
|
{
|
||||||
LOG_W("nsjail was not compiled with the protobuf-c library");
|
LOG_W("nsjail was not compiled with the protobuf-c library");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#else /* !defined(NSJAIL_WITH_PROTOBUFC) */
|
#else /* !defined(NSJAIL_WITH_PROTOBUF) */
|
||||||
|
|
||||||
#include "config.pb-c.h"
|
#include "config.pb-c.h"
|
||||||
|
|
||||||
@ -69,4 +69,4 @@ bool configParse(struct nsjconf_t * nsjconf, const char *file)
|
|||||||
nsjail__ns_jail_config__free_unpacked(njc, NULL);
|
nsjail__ns_jail_config__free_unpacked(njc, NULL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* !defined(NSJAIL_WITH_PROTOBUFC) */
|
#endif /* !defined(NSJAIL_WITH_PROTOBUF) */
|
||||||
|
1
protobuf-c-text
Submodule
1
protobuf-c-text
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit 198cfc0dbe159c75026600055f28e8b797bdac3b
|
Loading…
Reference in New Issue
Block a user