forked from zeroxoneafour/polonium
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
82 lines (60 loc) · 2.06 KB
/
Copy pathMakefile
File metadata and controls
82 lines (60 loc) · 2.06 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
NAME = polonium
VERSION = 1.2.2
PKGFILE = $(NAME).kwinscript
PKGDIR = pkg
CARGO_HOME ?= $(HOME)/.cargo
XDG_CONFIG_HOME ?= $(HOME)/.config
XDG_DATA_HOME ?= $(HOME)/.local/share
.NOTPARALLEL: all
all: build install cleanall
build: res src
zip -r $(PKGFILE) $(PKGDIR)
$(PKGFILE): build
install:
kpackagetool6 -t KWin/Script -s $(NAME) \
&& kpackagetool6 -t KWin/Script -u $(PKGFILE) \
|| kpackagetool6 -t KWin/Script -i $(PKGFILE)
install -m 644 -D -t $(XDG_DATA_HOME)/applications res/polonium-settings.desktop
clean: $(PKGDIR)
rm -r $(PKGDIR)
cleanpkg: $(PKGFILE)
rm $(PKGFILE)
cleanall: clean cleanpkg
lint: node_modules
npx prettier --check .
npx eslint
npx -w docs eslint
pretty: node_modules
npx prettier --check --write .
res: $(PKGDIR)
cp -f res/metadata.json $(PKGDIR)/
cp -f res/main.xml $(PKGDIR)/contents/config/
cp -f res/config.ui $(PKGDIR)/contents/ui/
cp -f res/main.js $(PKGDIR)/contents/code/
sed -i "s/%VERSION%/$(VERSION)/" $(PKGDIR)/metadata.json
sed -i "s/%NAME%/$(NAME)/" $(PKGDIR)/metadata.json
src: polonium.mjs $(PKGDIR)
mv -f polonium.mjs $(PKGDIR)/contents/code/main.mjs
cp -f src/qml/* $(PKGDIR)/contents/ui/
polonium.mjs: node_modules
npx esbuild --bundle src/index.ts --outfile=polonium.mjs --format=esm --platform=neutral
node_modules:
npm ci
$(PKGDIR):
mkdir -p $(PKGDIR)
mkdir -p $(PKGDIR)/contents/code
mkdir $(PKGDIR)/contents/config
mkdir $(PKGDIR)/contents/ui
dbus:
cd dbus-saver && cargo install --path .
install -m 644 -D -t $(XDG_CONFIG_HOME)/systemd/user dbus-saver/polonium-saver.service
sed -i 's|^ExecStart=polonium-saver$$|ExecStart=$(CARGO_HOME)/bin/polonium-saver|' $(XDG_CONFIG_HOME)/systemd/user/polonium-saver.service
install -m 644 -D -t $(XDG_DATA_HOME)/dbus-1/services dbus-saver/xyz.vaughanm.polonium.service
sed -i 's|^Exec=polonium-saver$$|Exec=$(CARGO_HOME)/bin/polonium-saver|' $(XDG_DATA_HOME)/dbus-1/services/xyz.vaughanm.polonium.service
dbus-build:
cd dbus-saver && cargo build --release
docs: docs-build
docs-build: node_modules
npm -w docs run build
docs-dev: node_modules
npm -w docs run dev