make docker-compiler-matrix builds and tests the working tree in throwaway containers per distro and compiler, ninja -k 0 so every compile error shows. Minutes per leg locally vs ~3 h for a ci/** run. The apt list moves to packaging/ci/build-deps.txt, read by build-release.sh and Dockerfile.matrix. noble's clang leg uses clang-19 + llvm-19: clang 18 cannot use libstdc++ 13's std::expected.
181 lines
8.4 KiB
Makefile
181 lines
8.4 KiB
Makefile
MESON ?= meson
|
|
BUILDDIR ?= builddir
|
|
SETUP_ARGS ?= -Denable_tests=true
|
|
RUN_CONFIG ?= config/strawberry.conf
|
|
DEMO_CONFIG ?= config/strawberry.demo.conf
|
|
export CCACHE_DIR ?= $(CURDIR)/.ccache
|
|
# /tmp is tmpfs (RAM) on the dev host; a large GCC LTO relink writing ltrans
|
|
# files there can exhaust memory and freeze the machine. Keep build temporaries
|
|
# on disk under build/. Override with BUILD_TMPDIR=... if you have a faster disk.
|
|
BUILD_TMPDIR ?= $(CURDIR)/build/tmp
|
|
export TMPDIR := $(BUILD_TMPDIR)
|
|
CONAN ?= conan
|
|
CONAN_OUTDIR ?= build/conan
|
|
CONAN_PROFILE ?= default
|
|
CONAN_INSTALL_ARGS ?= --build=missing
|
|
CONAN_CACHE_ARCHIVE ?= strawberry-conan-cache.tgz
|
|
CONAN_CACHE_PATTERN ?= openssl/*:*
|
|
CONAN_ENV_SCRIPT ?= $(CONAN_OUTDIR)/generators/conanbuild.sh
|
|
CONAN_NATIVE_FILE ?= $(CONAN_OUTDIR)/generators/conan_meson_native.ini
|
|
|
|
# macOS: Homebrew keeps libarchive keg-only (it would shadow the system copy),
|
|
# so pkg-config cannot see it unless told where it lives. Passed as a meson
|
|
# option because meson reads PKG_CONFIG_PATH only on the first setup.
|
|
ifeq ($(shell uname -s),Darwin)
|
|
BREW_PREFIX ?= $(shell brew --prefix 2>/dev/null)
|
|
ifneq ($(BREW_PREFIX),)
|
|
SETUP_ARGS += -Dpkg_config_path=$(BREW_PREFIX)/opt/libarchive/lib/pkgconfig
|
|
endif
|
|
endif
|
|
|
|
.PHONY: install macos-sign macos-install macos-live-tests help setup reconfigure build test run app demo live-bpf-smoke docker-live-bpf-smoke docker-live-bpf-pipeline-smoke docker-live-bpf-daemon-smoke docker-live-tests docker-compiler-matrix perf-kpi fuzz analyze clean conan-install conan-setup conan-build conan-test conan-cache-save conan-cache-restore
|
|
|
|
help:
|
|
@printf "Targets:\n"
|
|
@printf " make setup Configure $(BUILDDIR)\n"
|
|
@printf " make build Build Strawberry\n"
|
|
@printf " make test Build and run tests\n"
|
|
@printf " make run Run with RUN_CONFIG=$(RUN_CONFIG)\n"
|
|
@printf " make app Run the desktop app (strawberry-tray --show)\n"
|
|
@printf " make demo Seed demo evidence and open it in the desktop app (no daemon needed)\n"
|
|
@printf " make live-bpf-smoke Build and run the live libbpf smoke harness\n"
|
|
@printf " make docker-live-bpf-smoke Run the live libbpf smoke harness in a privileged Linux container\n"
|
|
@printf " make docker-live-bpf-pipeline-smoke Run the live libbpf-to-database smoke harness in a privileged Linux container\n"
|
|
@printf " make docker-live-bpf-daemon-smoke Run the daemon-level live libbpf smoke harness in a privileged Linux container\n"
|
|
@printf " make fuzz Build libFuzzer targets (clang) and run each for FUZZ_SECONDS (default 60), low priority\n"
|
|
@printf " make analyze Clang static analyzer (strict) on changed TUs (ANALYZE_ARGS=main|--all; ANALYZE_STRICT=0 to report)\n"
|
|
@printf " make perf-kpi Constrained-lane KPI: capped container, real rules, CPU/RSS/timings (LABEL=name)\n"
|
|
@printf " make docker-live-tests Run root-only tests (exec prevention, quarantine, behavior, memory scan) in a privileged container\n"
|
|
@printf " make docker-compiler-matrix Build + test in trixie/noble/forky x gcc/clang containers (LEGS=\"forky-gcc ...\")\n"
|
|
@printf " make install Install binaries, config and services (sudo; Linux or macOS)\n"
|
|
@printf " make macos-sign macOS: sign BINARY (default strawberry) with the ES entitlement (IDENTITY=- ad hoc)\n"
|
|
@printf " make macos-install macOS: install binaries + launchd jobs (sudo; SIGN_IDENTITY=...)\n"
|
|
@printf " make macos-live-tests macOS: Endpoint Security live test (sudo; ES entitlement, SIP off for ad hoc)\n"
|
|
@printf " make reconfigure Reconfigure an existing build dir\n"
|
|
@printf " make clean Clean compiled outputs in $(BUILDDIR)\n"
|
|
@printf " make conan-install Resolve dependencies with Conan 2\n"
|
|
@printf " make conan-build Configure/build via Conan-generated Meson files\n"
|
|
@printf " make conan-test Conan-backed build and test\n"
|
|
@printf " make conan-cache-save Save selected Conan cache refs to archive\n"
|
|
@printf " make conan-cache-restore Restore Conan cache archive\n"
|
|
@printf "Variables:\n"
|
|
@printf " BUILDDIR=<dir> Override build directory\n"
|
|
@printf " SETUP_ARGS='<args>' Extra meson setup args\n"
|
|
@printf " RUN_CONFIG=<path> Config passed to strawberry\n"
|
|
@printf " DEMO_CONFIG=<path> Config used by make demo (default: config/strawberry.demo.conf)\n"
|
|
@printf " CCACHE_DIR=<dir> Override compiler cache directory (default: ./.ccache)\n"
|
|
@printf " CONAN_OUTDIR=<dir> Conan output folder (default: build/conan)\n"
|
|
@printf " CONAN_INSTALL_ARGS=... Extra args for conan install\n"
|
|
@printf " CONAN_CACHE_PATTERN=... Pattern for conan cache save\n"
|
|
@printf " CONAN_CACHE_ARCHIVE=<file> Conan cache archive path\n"
|
|
|
|
$(BUILD_TMPDIR):
|
|
@mkdir -p $@
|
|
|
|
setup:
|
|
@test -d $(BUILDDIR) || $(MESON) setup $(BUILDDIR) $(SETUP_ARGS)
|
|
|
|
reconfigure:
|
|
$(MESON) setup $(BUILDDIR) --reconfigure $(SETUP_ARGS)
|
|
|
|
build: setup | $(BUILD_TMPDIR)
|
|
$(MESON) compile -C $(BUILDDIR)
|
|
|
|
test: build
|
|
$(MESON) test -C $(BUILDDIR) --verbose
|
|
|
|
run: build
|
|
./$(BUILDDIR)/src/strawberry $(RUN_CONFIG)
|
|
|
|
app: build
|
|
./$(BUILDDIR)/app/strawberry-tray --show
|
|
|
|
demo: build
|
|
./$(BUILDDIR)/src/strawberry --seed-demo-trace $(DEMO_CONFIG)
|
|
./$(BUILDDIR)/app/strawberry-tray --show --no-tray --db "$$(sed -n 's/^db_path=//p' $(DEMO_CONFIG))"
|
|
|
|
live-bpf-smoke:
|
|
bash ./scripts/run_live_bpf_smoke.sh
|
|
|
|
docker-live-bpf-smoke:
|
|
bash ./scripts/run_live_bpf_smoke_docker.sh
|
|
|
|
docker-live-bpf-pipeline-smoke:
|
|
bash ./scripts/run_live_bpf_pipeline_smoke_docker.sh
|
|
|
|
docker-live-bpf-daemon-smoke:
|
|
bash ./scripts/run_live_bpf_daemon_smoke_docker.sh
|
|
|
|
docker-live-tests:
|
|
bash ./scripts/run_live_tests_docker.sh
|
|
|
|
docker-compiler-matrix:
|
|
bash ./scripts/compiler_matrix.sh $(LEGS)
|
|
|
|
perf-kpi:
|
|
bash ./scripts/perf_kpi.sh $(or $(LABEL),run)
|
|
|
|
fuzz: | $(BUILD_TMPDIR)
|
|
@[ -f build/fuzz/build.ninja ] || CC=clang CXX=clang++ meson setup build/fuzz -Denable_fuzzing=true -Denable_app=disabled -Denable_tests=false -Db_lto=false
|
|
nice -n 19 ninja -C build/fuzz -j2
|
|
bash ./scripts/run_fuzzers.sh $(or $(FUZZ_SECONDS),60)
|
|
|
|
analyze:
|
|
bash ./scripts/analyze_changed.sh $(ANALYZE_ARGS)
|
|
|
|
clean:
|
|
@if [ -d $(BUILDDIR) ]; then \
|
|
$(MESON) compile -C $(BUILDDIR) --clean; \
|
|
else \
|
|
printf 'No build directory at %s\n' "$(BUILDDIR)"; \
|
|
fi
|
|
|
|
conan-install:
|
|
$(CONAN) install . -of $(CONAN_OUTDIR) -pr:h $(CONAN_PROFILE) -pr:b $(CONAN_PROFILE) $(CONAN_INSTALL_ARGS)
|
|
|
|
conan-setup: conan-install
|
|
@if [ -d $(BUILDDIR) ]; then \
|
|
/bin/sh -lc ' . "$(CONAN_ENV_SCRIPT)" && $(MESON) setup "$(BUILDDIR)" --reconfigure --native-file "$(CONAN_NATIVE_FILE)" $(SETUP_ARGS)'; \
|
|
else \
|
|
/bin/sh -lc ' . "$(CONAN_ENV_SCRIPT)" && $(MESON) setup "$(BUILDDIR)" --native-file "$(CONAN_NATIVE_FILE)" $(SETUP_ARGS)'; \
|
|
fi
|
|
|
|
conan-build: conan-setup | $(BUILD_TMPDIR)
|
|
$(MESON) compile -C $(BUILDDIR)
|
|
|
|
conan-test: conan-build
|
|
$(MESON) test -C $(BUILDDIR) --verbose
|
|
|
|
conan-cache-save:
|
|
$(CONAN) cache save $(CONAN_CACHE_PATTERN) --file $(CONAN_CACHE_ARCHIVE)
|
|
|
|
conan-cache-restore:
|
|
$(CONAN) cache restore $(CONAN_CACHE_ARCHIVE)
|
|
|
|
install: build
|
|
sudo SIGN_IDENTITY="$(IDENTITY)" bash ./scripts/install.sh
|
|
|
|
# ---- macOS (Endpoint Security) ------------------------------------------------
|
|
# ES needs root, the endpoint-security.client entitlement and Full Disk Access.
|
|
# An ad hoc signature (IDENTITY=-) carrying the entitlement is killed at
|
|
# launch unless SIP is disabled.
|
|
IDENTITY ?= -
|
|
BINARY ?= $(BUILDDIR)/src/strawberry
|
|
ES_ENTITLEMENTS ?= packaging/macos/strawberry.entitlements
|
|
SIP_ENABLED = $(shell csrutil status 2>/dev/null | grep -q enabled && echo yes)
|
|
|
|
macos-sign: build
|
|
@if [ "$(IDENTITY)" = "-" ] && [ "$(SIP_ENABLED)" = yes ] && [ "$(ES_ENTITLEMENTS)" = packaging/macos/strawberry.entitlements ]; then \
|
|
echo "SIP is enabled: an ad hoc signature with the ES entitlement would be killed at launch."; \
|
|
echo "Use IDENTITY='Developer ID Application: ...', or ES_ENTITLEMENTS=packaging/macos/strawberry-base.entitlements."; \
|
|
exit 1; \
|
|
fi
|
|
codesign --force --options runtime --entitlements $(ES_ENTITLEMENTS) --sign "$(IDENTITY)" $(BINARY)
|
|
codesign --display --entitlements - $(BINARY)
|
|
|
|
macos-install: build
|
|
sudo SIGN_IDENTITY="$(IDENTITY)" bash ./scripts/macos_install.sh
|
|
|
|
macos-live-tests: build
|
|
$(MAKE) macos-sign BINARY=$(BUILDDIR)/tests/macos_es_live
|
|
sudo nice -n 19 ./$(BUILDDIR)/tests/macos_es_live
|