Fix build env issues with manual build
This commit is contained in:
13
Makefile
13
Makefile
@@ -20,20 +20,29 @@ OBJS_TEST := $(addprefix $(BUILD)/,$(addsuffix .o,config log net proto json ser
|
||||
|
||||
PYTHON ?= python3
|
||||
|
||||
.PHONY: all test test-c test-web install clean docker-test
|
||||
.PHONY: all test test-c test-web install clean docker-test check-deps
|
||||
|
||||
all: $(BUILD)/patchbayd
|
||||
|
||||
$(BUILD):
|
||||
mkdir -p $(BUILD)
|
||||
|
||||
# Fails early with a hint instead of a missing-header compiler error.
|
||||
check-deps:
|
||||
@pkg-config --exists $(PKGS) || { \
|
||||
echo "missing build dependencies (pkg-config cannot find: $(PKGS))" >&2; \
|
||||
echo " APT: sudo apt-get install build-essential pkg-config libssh2-1-dev libsqlite3-dev" >&2; \
|
||||
echo " XBPS: sudo xbps-install base-devel pkg-config libssh2-devel sqlite-devel" >&2; \
|
||||
echo " or: sudo ./install.sh --role client|target (keeps an existing config)" >&2; \
|
||||
exit 1; }
|
||||
|
||||
# Embed schema.sql as a C string so the daemon has no runtime file dependency.
|
||||
$(BUILD)/schema.h: schema.sql | $(BUILD)
|
||||
{ printf 'static const char pb_schema_sql[] =\n'; \
|
||||
sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$$/\\n"/' $<; \
|
||||
printf ';\n'; } > $@
|
||||
|
||||
$(BUILD)/%.o: $(SRC)/%.c $(wildcard $(SRC)/*.h) $(BUILD)/schema.h | $(BUILD)
|
||||
$(BUILD)/%.o: $(SRC)/%.c $(wildcard $(SRC)/*.h) $(BUILD)/schema.h | $(BUILD) check-deps
|
||||
$(CC) $(CFLAGS) $(PKG_CFLAGS) -I$(BUILD) -c -o $@ $<
|
||||
|
||||
$(BUILD)/patchbayd: $(OBJS_ALL)
|
||||
|
||||
@@ -45,7 +45,7 @@ struct route {
|
||||
int sink_id;
|
||||
int sink_type;
|
||||
int sink_client;
|
||||
char bind[64];
|
||||
char bind[256];
|
||||
char sink_iface[IFNAMSIZ];
|
||||
int port;
|
||||
int proto;
|
||||
@@ -80,7 +80,7 @@ struct tsink {
|
||||
struct ev ev;
|
||||
struct tsink *next;
|
||||
int sink_id;
|
||||
char bind[64];
|
||||
char bind[256];
|
||||
char iface[IFNAMSIZ];
|
||||
unsigned ifindex; // detects a recreated tun interface
|
||||
int port;
|
||||
@@ -1144,7 +1144,7 @@ static void apply_target_sinks(void)
|
||||
int fd = net_listen(r->bind, r->port, r->proto, r->sink_iface);
|
||||
if (fd < 0) {
|
||||
char msg[128];
|
||||
snprintf(msg, sizeof(msg), "bind %s:%d failed: %s", r->bind, r->port, strerror(errno));
|
||||
snprintf(msg, sizeof(msg), "bind %.64s:%d failed: %s", r->bind, r->port, strerror(errno));
|
||||
if (strcmp(r->state_err, msg))
|
||||
log_warn("sink %d: %s", r->sink_id, msg);
|
||||
snprintf(r->state_err, sizeof(r->state_err), "%s", msg);
|
||||
|
||||
Reference in New Issue
Block a user