1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# 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 <target>\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 (~3s 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
.PHONY: check-live
check-live: dev ## Drive a real session and check the mouse affordances are drawn where they are clicked
packaging/checks/split-button-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
|