Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
127 lines (114 loc) · 4.56 KB
/
Copy pathMakefile
File metadata and controls
127 lines (114 loc) · 4.56 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
.PHONY: all clean install uninstall deb deb-install deb-clean deps-install help i18n
PACKAGE_NAME = voice-keyboard-perlover
APPLET_UUID = voice-keyboard@perlover
VERSION = $(shell python3 -c "import json; print(json.load(open('applet/$(APPLET_UUID)/metadata.json'))['version'])")
PREFIX ?= /usr
DESTDIR ?=
APPLET_DIR = $(DESTDIR)$(PREFIX)/share/cinnamon/applets/$(APPLET_UUID)
BIN_DIR = $(DESTDIR)$(PREFIX)/bin
LOCALE_DIR = $(DESTDIR)$(PREFIX)/share/locale
all: help
i18n:
@echo "Compiling translations..."
@for po in applet/$(APPLET_UUID)/po/*.po; do \
lang=$$(basename "$$po" .po); \
mkdir -p applet/$(APPLET_UUID)/locale/$$lang/LC_MESSAGES; \
msgfmt -c "$$po" -o applet/$(APPLET_UUID)/locale/$$lang/LC_MESSAGES/$(APPLET_UUID).mo; \
echo " Compiled $$lang.po"; \
done
@echo "Translations compiled."
help:
@echo "Voice Keyboard Perlover - Makefile"
@echo ""
@echo "Available targets:"
@echo " make install - Install applet and script to system (manual)"
@echo " make uninstall - Remove applet and script from system"
@echo " make deb - Build .deb package"
@echo " make deb-install - Build and install .deb with all dependencies (RECOMMENDED)"
@echo " make deps-install - Install build dependencies (debhelper, dpkg-dev, gjs)"
@echo " make deb-clean - Clean build artifacts"
@echo " make clean - Clean all generated files"
@echo " make help - Show this help message"
@echo ""
install: i18n
@echo "Installing $(PACKAGE_NAME) v$(VERSION)..."
install -d $(APPLET_DIR)
cp -r applet/$(APPLET_UUID)/* $(APPLET_DIR)/
sed -i 's/@@VERSION@@/$(VERSION)/g' $(APPLET_DIR)/settings-schema.json
install -d $(BIN_DIR)
install -m 0755 scripts/whisper-voice-input $(BIN_DIR)/whisper-voice-input
@echo "Installing locale files..."
@for po in applet/$(APPLET_UUID)/po/*.po; do \
lang=$$(basename "$$po" .po); \
install -d $(LOCALE_DIR)/$$lang/LC_MESSAGES; \
install -m 0644 applet/$(APPLET_UUID)/locale/$$lang/LC_MESSAGES/$(APPLET_UUID).mo \
$(LOCALE_DIR)/$$lang/LC_MESSAGES/$(APPLET_UUID).mo; \
done
@echo ""
@echo "Installation complete!"
@echo "Restart Cinnamon or log out/in to see the applet in the Applets menu."
@echo ""
uninstall:
@echo "Uninstalling $(PACKAGE_NAME)..."
rm -rf $(APPLET_DIR)
rm -f $(BIN_DIR)/whisper-voice-input
@echo "Uninstallation complete!"
@echo ""
deb:
@echo "Building .deb package..."
@if ! command -v dpkg-buildpackage >/dev/null 2>&1; then \
echo "ERROR: dpkg-buildpackage not found. Install it with:"; \
echo " sudo apt-get install dpkg-dev debhelper"; \
exit 1; \
fi
dpkg-buildpackage -us -uc -b
@echo ""
@echo "Package built successfully!"
@echo "Install it with: make deb-install"
@echo "Or manually: sudo apt install ../$(PACKAGE_NAME)_$(VERSION)-1_all.deb"
@echo ""
deps-install:
@missing=""; \
command -v dpkg-buildpackage >/dev/null 2>&1 || missing="$$missing dpkg-dev"; \
command -v dh >/dev/null 2>&1 || missing="$$missing debhelper"; \
command -v gjs >/dev/null 2>&1 || missing="$$missing gjs"; \
if [ -n "$$missing" ]; then \
echo "Installing missing build dependencies:$$missing"; \
sudo apt-get install -y $$missing; \
echo "Build dependencies installed."; \
echo ""; \
fi
deb-install: deps-install deb
@echo "Installing package with dependencies..."
@if [ ! -f ../$(PACKAGE_NAME)_$(VERSION)-1_all.deb ]; then \
echo "ERROR: Package file not found!"; \
exit 1; \
fi
@echo "Using apt to install with automatic dependency resolution..."
sudo apt install -y ../$(PACKAGE_NAME)_$(VERSION)-1_all.deb
@echo ""
@echo "======================================================================"
@echo " ✓ Installation completed successfully!"
@echo "======================================================================"
@echo ""
@echo "Next steps:"
@echo " 1. Right-click on your Cinnamon panel"
@echo " 2. Select 'Applets'"
@echo " 3. Find 'Keyboard + Voice Input'"
@echo " 4. Click 'Add to panel'"
@echo ""
@echo "If the applet doesn't appear, restart Cinnamon (Ctrl+Alt+Esc)"
@echo ""
deb-clean:
@echo "Cleaning build artifacts..."
dh_clean
rm -rf debian/.debhelper debian/$(PACKAGE_NAME) debian/files debian/*.debhelper* debian/*.substvars
rm -f ../$(PACKAGE_NAME)_$(VERSION)-1_all.deb ../$(PACKAGE_NAME)_$(VERSION)-1_all.buildinfo ../$(PACKAGE_NAME)_$(VERSION)-1_all.changes
@echo "Clean complete!"
clean: deb-clean
@echo "Cleaning all generated files..."
rm -rf applet/$(APPLET_UUID)/locale/
find . -type f -name "*~" -delete
find . -type f -name "*.pyc" -delete
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
@echo "All clean!"