# sl0ppi — build, stage and package the whole environment. # # `make` with no target prints this file's documented targets. SHELL := /bin/bash .DEFAULT_GOAL := help VERSION := $(shell cat VERSION) # Release artifacts are static musl: a gnu build inherits this box's glibc floor # (2.39 as measured), which would fail on Debian 12 / Ubuntu 22.04 / RHEL 9 -- # i.e. exactly the machines this repo exists to install on. TARGET := x86_64-unknown-linux-musl PKG := sl0ppi-$(VERSION)-x86_64-linux ROOT := $(CURDIR) FORK := $(ROOT)/sl0ppij STATUS := $(ROOT)/sl0pstatus CLI := $(ROOT)/cli STAGE := $(ROOT)/packaging/stage/$(PKG) OUT := $(ROOT)/packaging/out VENDOR := $(ROOT)/vendor/cache # The fork builds a binary named sl0ppij (via [[bin]] in sl0ppij/Cargo.toml) # while the cargo *package* is still called zellij -- see zellij-utils/src/branding.rs. # Hence: build with `-p zellij`, ship `sl0ppij`. BIN_NAME := sl0ppij CARGO_PKG := zellij CARGO_BIN := sl0ppij # Pins — keep in sync with FORKS.md. PI_VERSION := 0.84.1 BUN_VERSION := 1.3.14 ##@ General .PHONY: help help: ## Show this help @awk 'BEGIN {FS=":.*##"; printf "\nsl0ppi $(VERSION)\n\nUsage: make \n"} \ /^[a-zA-Z0-9_-]+:.*?##/ { printf " \033[36m%-18s\033[0m %s\n", $$1, $$2 } \ /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) }' $(MAKEFILE_LIST) @echo .PHONY: version version: ## Print the sl0ppi version and what it is built from @echo "sl0ppi $(VERSION)" @echo "sl0ppij $$(grep -m1 '^version = ' $(FORK)/Cargo.toml | cut -d'"' -f2)" @echo "sl0pstatus $$(grep -m1 '^version = ' $(STATUS)/Cargo.toml | cut -d'"' -f2)" @echo "pi (pinned) $(PI_VERSION)" @echo "bun (pinned) $(BUN_VERSION)" ##@ Build .PHONY: dev dev: ## Fast non-LTO build of sl0ppij (~5s incremental) for local testing cd $(FORK) && cargo build --profile fastdev -p $(CARGO_PKG) @echo "-> $(FORK)/target/fastdev/$(BIN_NAME)" .PHONY: build build: check-zig ## Static musl release build of sl0ppij (LTO, ~5min — not for the edit loop) cd $(FORK) && cargo zigbuild --release -p $(CARGO_PKG) --target $(TARGET) @echo "-> $(FORK)/target/$(TARGET)/release/$(BIN_NAME)" .PHONY: check-zig check-zig: @command -v cargo-zigbuild >/dev/null || { \ echo "need cargo-zigbuild: cargo install cargo-zigbuild" >&2; exit 1; } @python3 -c 'import ziglang' 2>/dev/null || command -v zig >/dev/null || { \ echo "need zig: pip install ziglang (or install zig)" >&2; exit 1; } @# zig supplies the musl C toolchain that libz-sys/libnghttp2-sys (pulled in @# unconditionally via isahc/curl) need to cross-compile. .PHONY: build-gnu build-gnu: ## Non-portable glibc build (faster, for local use only) cd $(FORK) && cargo build --release -p $(CARGO_PKG) .PHONY: plugins plugins: ## Build the in-tree wasm plugins (pane-finder, sl0pstatus) cd $(FORK)/sl0p/zj-pane-finder && cargo build --release --target wasm32-wasip1 cd $(STATUS) && cargo build --release --target wasm32-wasip1 .PHONY: cli cli: ## Bundle the sl0ppi CLI to a single file (runs on the bundled bun) cd $(CLI) && bun build src/index.ts --target=bun --outfile=dist/sl0ppi.js .PHONY: cli-test cli-test: ## Run the CLI test suite cd $(CLI) && bun test .PHONY: check check: ## Cheap compile gate cd $(FORK) && cargo check -p zellij-server # the root package pulls in `plugins_from_target`, which wants debug wasm # plugins; check against the prebuilt asset plugins instead cd $(FORK) && cargo check -p $(CARGO_PKG) --no-default-features \ --features vendored_curl,web_server_capability .PHONY: test test: cli-test ## All tests: the CLI, plus the crates we actually modify cd $(FORK) && cargo test -p zellij-server --lib && cargo test -p zellij-utils --lib @# sl0pstatus builds for wasm and its configured test runner is wasmtime, @# which we do not ship or install -- so run its tests against the host, @# or the bar's logic (margins, click routing, widgets) is gated by nothing. cd $(STATUS) && cargo test --lib --target x86_64-unknown-linux-gnu .PHONY: check-live check-live: dev ## Drive real sessions and check what the UI actually does @# twice: once with just the frame settings, once with the real config, whose @# stacks and plugins are what the minimal one kept missing packaging/checks/split-button-live.py $(FORK)/target/fastdev/$(BIN_NAME) packaging/checks/split-button-live.py $(FORK)/target/fastdev/$(BIN_NAME) config/config.kdl packaging/checks/plugin-permissions-live.py $(FORK)/target/fastdev/$(BIN_NAME) packaging/checks/status-bar-live.py $(FORK)/target/fastdev/$(BIN_NAME) packaging/checks/sl0ppi-up-live.py $(FORK)/target/fastdev/$(BIN_NAME) ##@ Package .PHONY: vendor vendor: ## Fetch pinned bun + pi into vendor/cache (network) packaging/fetch-vendor.sh "$(VENDOR)" "$(BUN_VERSION)" "$(PI_VERSION)" .PHONY: stage stage: build plugins cli vendor ## Assemble the install tree under packaging/stage SL0PPI_TARGET="$(TARGET)" packaging/stage.sh "$(STAGE)" "$(VERSION)" "$(BIN_NAME)" "$(CARGO_BIN)" .PHONY: package package: stage ## Produce the redistributable tarball @mkdir -p $(OUT) tar -C $(dir $(STAGE)) -czf $(OUT)/$(PKG).tar.gz $(PKG) @cd $(OUT) && sha256sum $(PKG).tar.gz > $(PKG).tar.gz.sha256 @echo "-> $(OUT)/$(PKG).tar.gz" ##@ Release .PHONY: release release: test package ## Full gate: tests, then a fresh tarball @echo "-> $(OUT)/$(PKG).tar.gz (publish with 'make publish')" .PHONY: publish publish: ## Upload the built release to sl0ppi.sl0p.foo packaging/publish.sh .PHONY: publish-dry publish-dry: ## Show what publish would upload, without touching the box packaging/publish.sh --dry-run ##@ Dev box .PHONY: install-config install-config: ## Sync config/ into the live sl0ppij config dir packaging/install-config.sh .PHONY: install-ext install-ext: ## Install pi-ext into the live pi extensions dir cd pi-ext && ./install.sh .PHONY: clean clean: ## Remove staged package trees and tarballs (not cargo artifacts) rm -rf packaging/stage packaging/out .PHONY: clean-all clean-all: clean ## Also drop cargo artifacts (frees many GB) rm -rf $(FORK)/target