Igor Sirotin d5d5a215ed refactor: build against the single liblogosdelivery library
logos-delivery#4012 unifies the node lifecycle on logosdelivery_* and ships the
full API — Messaging, Reliable Channels, and the low-level Kernel (waku_*) tier
— in one liblogosdelivery library, retiring the separate libwaku. Migrate the
bindings onto it.

- internal/ffi: collapse the two bridges into one internal/ffi/liblogosdelivery
  over the single library. The kernel wrappers keep calling waku_* (kernel
  header), the lifecycle now uses logosdelivery_create_node/start_node/
  stop_node/destroy (waku_new/start/stop/destroy are gone), events use
  logosdelivery_set_event_callback. Include liblogosdelivery_kernel.h (which
  re-exports the stable header) and link -llogosdelivery. Remove
  internal/ffi/libwaku.
- pkg/kernel: repoint at internal/ffi/liblogosdelivery; the Makefile links
  -llogosdelivery.
- CI: build only `make liblogosdelivery`, headers from library/, single
  -llogosdelivery. Pinned to logos-delivery#4012 until it merges (see the
  TODO/LOGOS_DELIVERY_REF in pr.yml).

The high-level MessagingClient (pkg/messaging) lands in a follow-up PR on top.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 17:28:50 +01:00

69 lines
2.2 KiB
Makefile

# Makefile for Waku Go Bindings
# Path to logos-delivery submodule
export LOGOS_DELIVERY_DIR ?= $(shell pwd)/../../vendor/logos-delivery
# Debugging output
print-paths:
@echo "LOGOS_DELIVERY_DIR: $(LOGOS_DELIVERY_DIR)"
@echo "HEADER_PATH: $(LIBWAKU_HEADER_PATH)"
@echo "LIB_PATH: $(LIBWAKU_LIB_PATH)"
# Default paths for libwaku library and headers (can be overridden)
export LIBWAKU_HEADER_PATH ?= $(LOGOS_DELIVERY_DIR)/library
export LIBWAKU_LIB_PATH ?= $(LOGOS_DELIVERY_DIR)/build
export CGO_CFLAGS := -I$(LIBWAKU_HEADER_PATH)/
export CGO_LDFLAGS := -L$(LIBWAKU_LIB_PATH)/ -llogosdelivery -Wl,-rpath,$(LIBWAKU_LIB_PATH)/
# Expected files
HEADER_FILE := $(LIBWAKU_HEADER_PATH)/liblogosdelivery.h
LIB_FILES := $(wildcard $(LIBWAKU_LIB_PATH)/liblogosdelivery.*)
.PHONY: all clean prepare build test build-auto test-auto build-libwaku
# Validate necessary folders and files
check-folders:
@echo Checking libwaku header directory ...
@if [ -z "$(LIBWAKU_HEADER_PATH)" ]; then \
echo "ERROR: LIBWAKU_HEADER_PATH not set"; exit 1; \
fi
@if [ ! -d "$(LIBWAKU_HEADER_PATH)" ]; then \
echo "ERROR: Header path does not exist: $(LIBWAKU_HEADER_PATH)"; exit 1; \
fi
@echo Checking libwaku lib directory ...
@if [ -z "$(LIBWAKU_LIB_PATH)" ]; then \
echo "ERROR: LIBWAKU_LIB_PATH not set"; exit 1; \
fi
@if [ ! -d "$(LIBWAKU_LIB_PATH)" ]; then \
echo "ERROR: Library path does not exist: $(LIBWAKU_LIB_PATH)"; exit 1; \
fi
@echo Checking for liblogosdelivery.h ...
@if [ ! -f "$(HEADER_FILE)" ]; then \
echo "ERROR: liblogosdelivery.h not found at: $(HEADER_FILE)"; exit 1; \
fi
@echo Checking for libwaku library file ...
@if [ -z "$(LIB_FILES)" ]; then \
echo "ERROR: No libwaku library file found in: $(LIBWAKU_LIB_PATH)"; exit 1; \
fi
build:
@echo "Building Logos Messaging Go Bindings (manual)..."
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -o kernel-bindings .
test: build
@echo "Running tests (manual)..."
@if [ -z "$(TEST)" ]; then \
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test .; \
else \
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go test . -count=1 -run $(TEST) -v; \
fi
# Clean up generated files
clean:
@echo "Cleaning up..."
@rm -f kernel-bindings