packaging/macos/ holds the ES entitlement and two LaunchDaemons: the scanner (root, group strawberry, umask 027, XDG_DATA_HOME=/var/db so evidence lands in /var/db/strawberry) and the rule updater (daily, and on feeds/update-requested like strawberry-update.path). scripts/macos_install.sh creates the group with dseditgroup, the config (/run paths moved to /var/run), state directories, signs the binary with the entitlement and bootstraps both jobs. make macos-sign (IDENTITY=- ad hoc, or a Developer ID), make macos-install, and make macos-live-tests (signs and runs macos_es_live under sudo). An ad hoc signature carries the ES entitlement only with SIP disabled; the install script says so. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
154 lines
6.9 KiB
Makefile
154 lines
6.9 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
|
|
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: 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 perf-kpi fuzz 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 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 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"
|
|
|
|
setup:
|
|
@test -d $(BUILDDIR) || $(MESON) setup $(BUILDDIR) $(SETUP_ARGS)
|
|
|
|
reconfigure:
|
|
$(MESON) setup $(BUILDDIR) --reconfigure $(SETUP_ARGS)
|
|
|
|
build: setup
|
|
$(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
|
|
|
|
perf-kpi:
|
|
bash ./scripts/perf_kpi.sh $(or $(LABEL),run)
|
|
|
|
fuzz:
|
|
@[ -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)
|
|
|
|
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
|
|
$(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)
|
|
|
|
# ---- macOS (Endpoint Security) ------------------------------------------------
|
|
# ES needs root, the endpoint-security.client entitlement and Full Disk Access.
|
|
# An ad hoc signature (IDENTITY=-) carries the entitlement only with SIP off.
|
|
IDENTITY ?= -
|
|
BINARY ?= $(BUILDDIR)/src/strawberry
|
|
ES_ENTITLEMENTS ?= packaging/macos/strawberry.entitlements
|
|
|
|
macos-sign: build
|
|
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
|