-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
119 lines (95 loc) · 4.27 KB
/
Makefile
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
# Install to /usr unless otherwise specified, such as `make PREFIX=/app`
PREFIX=/usr
# What to run to install various files
INSTALL=install
# Run to install the actual binary
INSTALL_PROGRAM=$(INSTALL)
# Run to install application data, with differing permissions
INSTALL_DATA=$(INSTALL) -m 644
# Directories into which to install the various files
bindir=$(DESTDIR)$(PREFIX)/bin
sharedir=$(DESTDIR)$(PREFIX)/share
# These targets have no associated build files.
.PHONY : clean clean-all install uninstall
check-update: # cargo install cargo-update
cargo install-update -a
# Build the application
release : src
cargo build --release
# Compiling gResource
gresource:
glib-compile-resources data/uk.co.grumlimited.authenticator-rs.xml
test:
cargo test
run: gresource
cargo run
clippy:
cargo fmt
find src/ -name "*.rs" -exec touch {} \;
cargo clippy
release-version:
sed -i 's/#VERSION_NUMBER#/$(RELEASE_VERSION)/' ./data/resources/gtk/ui/main.ui
install-po: # dev only - run with sudo
msgfmt po/fr.po -o $(sharedir)/locale/fr/LC_MESSAGES/authenticator-rs.mo
msgfmt po/en_GB.po -o $(sharedir)/locale/en_GB/LC_MESSAGES/authenticator-rs.mo
install-gresource: gresource
# Install gResource
mkdir -p $(sharedir)/uk.co.grumlimited.authenticator-rs/
$(INSTALL_DATA) data/uk.co.grumlimited.authenticator-rs.gresource $(sharedir)/uk.co.grumlimited.authenticator-rs/uk.co.grumlimited.authenticator-rs.gresource
# Install icons
mkdir -p $(sharedir)/icons/hicolor/scalable/apps/
$(INSTALL_DATA) data/icons/hicolor/scalable/apps/uk.co.grumlimited.authenticator-rs.svg $(sharedir)/icons/hicolor/scalable/apps/uk.co.grumlimited.authenticator-rs.svg
mkdir -p $(sharedir)/icons/hicolor/64x64/apps/
$(INSTALL_DATA) data/icons/hicolor/64x64/apps/uk.co.grumlimited.authenticator-rs.64.png $(sharedir)/icons/hicolor/64x64/apps/uk.co.grumlimited.authenticator-rs.png
mkdir -p $(sharedir)/icons/hicolor/128x128/apps/
$(INSTALL_DATA) data/icons/hicolor/128x128/apps/uk.co.grumlimited.authenticator-rs.128.png $(sharedir)/icons/hicolor/128x128/apps/uk.co.grumlimited.authenticator-rs.png
# Force icon cache refresh
touch $(sharedir)/icons/hicolor
# Install application metadata
mkdir -p $(sharedir)/metainfo/
$(INSTALL_DATA) data/uk.co.grumlimited.authenticator-rs.appdata.xml $(sharedir)/metainfo/uk.co.grumlimited.authenticator-rs.appdata.xml
# Install desktop file
mkdir -p $(sharedir)/applications/
$(INSTALL_DATA) data/uk.co.grumlimited.authenticator-rs.desktop $(sharedir)/applications/uk.co.grumlimited.authenticator-rs.desktop
# Install gschema file
mkdir -p $(sharedir)/glib-2.0/schemas/
$(INSTALL_DATA) data/uk.co.grumlimited.authenticator-rs.gschema.xml $(sharedir)/glib-2.0/schemas/
# Install LOCALE files
rm -fr builddir/
meson setup builddir --prefix=$(PREFIX)
meson install -C builddir --destdir=$(DESTDIR)
# Install onto the system
install : release install-gresource
# Install binary
mkdir -p $(bindir)
$(INSTALL_PROGRAM) target/release/authenticator-rs $(bindir)/authenticator-rs
# Remove an existing install from the system
uninstall :
# Remove the desktop file
rm -f $(sharedir)/applications/uk.co.grumlimited.authenticator-rs.desktop
# Remove the application metadata
rm -f $(sharedir)/metainfo/uk.co.grumlimited.authenticator-rs.appdata.xml
# Remove gschema
rm -f $(sharedir)/glib-2.0/schemas/uk.co.grumlimited.authenticator-rs.gschema.xml
# Remove the icon
rm -f $(sharedir)/icons/hicolor/scalable/apps/uk.co.grumlimited.authenticator-rs.svg
rm -f $(sharedir)/icons/hicolor/64x64/apps/uk.co.grumlimited.authenticator-rs.png
rm -f $(sharedir)/icons/hicolor/128x128/apps/uk.co.grumlimited.authenticator-rs.png
# Remove the binary
rm -f $(bindir)/bin/authenticator-rs
# Remove LOCALE files
find $(sharedir)/locale/ -name authenticator-rs.mo -exec rm {} \;
# Remove all files
clean-all : clean
cargo clean
# Remove supplemental build files
clean :
rm -rf target/*
debian-pkg : install
mkdir -p $(DESTDIR)/DEBIAN
cp build-aux/debian/control $(DESTDIR)/DEBIAN/
echo "Version: $(RELEASE_VERSION)" >> $(DESTDIR)/DEBIAN/control
cp build-aux/debian/postinst $(DESTDIR)/DEBIAN/
chmod 775 $(DESTDIR)/DEBIAN/postinst
dpkg-deb --build $(DESTDIR) authenticator-rs-$(RELEASE_VERSION)-x86_64.deb
md5sum authenticator-rs-$(RELEASE_VERSION)-x86_64.deb > authenticator-rs-$(RELEASE_VERSION)-x86_64.deb.md5sum