forked from foss-desk/internet-speed-meter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
86 lines (70 loc) · 4.22 KB
/
Copy pathMakefile
File metadata and controls
86 lines (70 loc) · 4.22 KB
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
# ──────────────────────────────────────────────────────────────────────────────
# Internet Speed Meter — Build System
# ──────────────────────────────────────────────────────────────────────────────
#
# Targets:
# make — Clean, compile TypeScript, assemble dist/
# make install — Build + install to GNOME Shell extensions directory
# make pack — Build + create distributable .zip for extensions.gnome.org
# make test — Install + launch a nested GNOME Shell for testing
# make uninstall — Remove the extension from the local installation
# make clean — Remove build artifacts
#
# ──────────────────────────────────────────────────────────────────────────────
UUID := speed-meter@mojahid.lunecode.com
EXT_DIR := $(HOME)/.local/share/gnome-shell/extensions/$(UUID)
SRC_DIR := src
DIST_DIR := dist
SCHEMA_DIR := $(DIST_DIR)/schemas
.PHONY: all build install pack test uninstall clean
# ─── Default ──────────────────────────────────────────────────────────────────
all: clean build
# ─── Build ────────────────────────────────────────────────────────────────────
build:
@echo "▸ Installing dependencies…"
@npm install --silent
@echo "▸ Compiling TypeScript…"
@npm run build --silent
@echo "▸ Copying static assets…"
@cp $(SRC_DIR)/metadata.json $(DIST_DIR)/
@cp $(SRC_DIR)/stylesheet.css $(DIST_DIR)/
@mkdir -p $(SCHEMA_DIR)
@cp $(SRC_DIR)/schemas/*.xml $(SCHEMA_DIR)/
@echo "▸ Compiling GSettings schemas…"
@glib-compile-schemas $(SCHEMA_DIR)/
@echo "✔ Build complete → $(DIST_DIR)/"
# ─── Install ─────────────────────────────────────────────────────────────────
install: build
@rm -rf $(EXT_DIR)
@mkdir -p $(EXT_DIR)
@cp -r $(DIST_DIR)/* $(EXT_DIR)/
@echo "✔ Installed to $(EXT_DIR)"
@echo " Run: gnome-extensions enable $(UUID)"
# ─── Package ─────────────────────────────────────────────────────────────────
pack: build
@echo "▸ Running Shexli checker..."
@if command -v shexli >/dev/null 2>&1; then \
shexli $(DIST_DIR)/*.js; \
else \
echo "⚠️ Shexli not found, skipping checker."; \
fi
@echo "▸ Creating distribution archive…"
@rm -f $(UUID).zip
@cd $(DIST_DIR) && zip -r ../$(UUID).zip . -x "*.map" "schemas/gschemas.compiled"
@echo "✔ Package created → $(UUID).zip"
# ─── Test (Nested Shell) ─────────────────────────────────────────────────────
test: install
@echo "▸ Launching nested GNOME Shell…"
@dbus-run-session gnome-shell --nested --wayland &
@sleep 3
@gnome-extensions enable $(UUID)
@echo "✔ Extension enabled in nested session"
# ─── Uninstall ────────────────────────────────────────────────────────────────
uninstall:
@rm -rf $(EXT_DIR)
@echo "✔ Extension removed from $(EXT_DIR)"
# ─── Clean ────────────────────────────────────────────────────────────────────
clean:
@rm -rf $(DIST_DIR)
@rm -f $(UUID).zip
@echo "✔ Clean"