-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
148 lines (126 loc) · 4.24 KB
/
Makefile
File metadata and controls
148 lines (126 loc) · 4.24 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
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
NAME = gitlab-time-tracker
UUID = $(NAME)@gecka.nc
EXTENSION_PATH = $(HOME)/.local/share/gnome-shell/extensions/$(UUID)
.PHONY: build install pot clean remove test-shell test-prefs help
help:
@echo "GitLab Time Tracking Extension - Makefile"
@echo ""
@echo "Available targets:"
@echo " build - Build the extension package"
@echo " install - Install the extension"
@echo " pot - Update translation templates and merge with existing translations"
@echo " clean - Clean build artifacts"
@echo " remove - Remove installed extension"
@echo " test-shell - Test extension in nested GNOME Shell"
@echo " test-prefs - Test extension preferences"
@echo " help - Show this help message"
build: clean
@echo "Building $(UUID)..."
# Compile GSettings schema
@echo "Compiling GSettings schema..."
if [ -d "schemas" ]; then \
glib-compile-schemas schemas/; \
echo "✓ Schema compiled successfully"; \
else \
echo "Warning: schemas directory not found"; \
fi
# Compile translations
@echo "Compiling translations..."
if [ -d "po" ]; then \
for po_file in po/*.po; do \
if [ -f "$$po_file" ]; then \
lang=$(basename "$$po_file" .po); \
echo " Compiling $$lang..."; \
mkdir -p "locale/$$lang/LC_MESSAGES"; \
msgfmt "$$po_file" -o "locale/$$lang/LC_MESSAGES/$(UUID).mo"; \
fi; \
done; \
echo "✓ Translations compiled successfully"; \
else \
echo "Warning: po directory not found"; \
fi
# Create extension package
mkdir -p build/
gnome-extensions pack -f \
--extra-source=avatarLoader.js \
--extra-source=metadata.json \
--extra-source=LICENSE \
--extra-source=README.md \
--extra-source=icons \
--extra-source=extension.js \
--extra-source=issueSelector.js \
--extra-source=reportDialog.js \
--extra-source=prefs.js \
--extra-source=stylesheet.css \
--extra-source=locale \
--podir=po \
--schema=schemas/org.gnome.shell.extensions.$(NAME).gschema.xml \
-o build/
@echo "✓ Extension package created: build/$(UUID).shell-extension.zip"
install: build remove
@echo "Installing $(UUID)..."
gnome-extensions install -f build/$(UUID).shell-extension.zip
@echo "✓ Extension installed successfully"
@echo ""
@echo "To enable the extension, run:"
@echo " gnome-extensions enable $(UUID)"
@echo ""
@echo "To restart GNOME Shell:"
@echo " - X11: Press Alt+F2, type 'r', and press Enter"
@echo " - Wayland: Log out and log back in"
pot:
@echo "Updating translation templates..."
@# Extract strings from JavaScript files
xgettext --output=po/$(UUID).pot \
--from-code=utf-8 \
--package-name=$(UUID) \
--package-version=$(shell git describe --tags --always 2>/dev/null || echo "1.0.0") \
--msgid-bugs-address="https://github.com/Gecka-Apps/gitlab-time-tracker/issues" \
--keyword=_ \
--add-comments=TRANSLATORS \
extension.js issueSelector.js reportDialog.js prefs.js
@echo "✓ Template updated: po/$(UUID).pot"
@# Update LINGUAS file
@echo "Updating LINGUAS..."
rm -f po/LINGUAS
for l in $$(ls po/*.po 2>/dev/null); do \
basename $$l .po >> po/LINGUAS; \
done
@echo "✓ LINGUAS updated"
@# Merge with existing translations (simplified)
@echo "Merging translations..."
cd po && \
for lang in $$(cat LINGUAS 2>/dev/null); do \
echo " Merging $$lang..."; \
if [ -f $$lang.po ]; then \
msgmerge --update $$lang.po $(UUID).pot; \
else \
msginit --no-translator --locale=$$lang --input=$(UUID).pot -o $$lang.po; \
fi \
done
@echo "✓ Translations merged successfully"
test-shell: install
@echo "Starting nested GNOME Shell for testing..."
@echo "Press Ctrl+C to exit"
env GNOME_SHELL_SLOWDOWN_FACTOR=2 \
MUTTER_DEBUG_DUMMY_MODE_SPECS=1500x1000 \
MUTTER_DEBUG_DUMMY_MONITOR_SCALES=1 \
dbus-run-session -- gnome-shell --nested --wayland
test-prefs: install
@echo "Opening extension preferences..."
gnome-extensions prefs $(UUID)
remove:
@echo "Removing $(UUID)..."
@if [ -d "$(EXTENSION_PATH)" ]; then \
rm -rf $(EXTENSION_PATH); \
echo "✓ Extension removed"; \
else \
echo "Extension not installed"; \
fi
clean:
@echo "Cleaning build artifacts..."
rm -rf build/
rm -f po/*.mo
rm -f schemas/gschemas.compiled
rm -rf locale/
@echo "✓ Clean complete"