-
Notifications
You must be signed in to change notification settings - Fork 31
/
justfile
69 lines (58 loc) · 2.06 KB
/
justfile
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
rootdir := ''
prefix := '/usr'
sysconfdir := '/etc'
root := rootdir + prefix
debug := '0'
vendor := '0'
target := if debug == '1' { 'debug' } else { 'release' }
vendor_args := if vendor == '1' { '--frozen --offline' } else { '' }
debug_args := if debug == '1' { '' } else { '--release' }
cargo_args := vendor_args + ' ' + debug_args
binary := 'system76-scheduler'
id := 'com.system76.Scheduler'
bindir := root + '/bin'
libdir := root + '/lib'
confdir := rootdir + sysconfdir
target_bin := bindir + '/' + binary
# Compile pop-launcher
all: _extract_vendor
cargo build {{cargo_args}}
# Remove Cargo build artifacts
clean:
cargo clean
# Also remove .cargo and vendored dependencies
distclean:
rm -rf .cargo vendor vendor.tar target
# Install everything
install:
mkdir -p {{confdir}}/system76-scheduler/assignments \
{{confdir}}/system76-scheduler/exceptions
install -Dm0644 data/config.ron {{confdir}}/system76-scheduler/config.ron
install -Dm0644 data/assignments.ron {{confdir}}/system76-scheduler/assignments/default.ron
install -Dm0644 data/exceptions.ron {{confdir}}/system76-scheduler/exceptions/default.ron
install -Dm04755 target/{{target}}/{{binary}} {{target_bin}}
install -Dm0644 data/{{id}}.service {{libdir}}/systemd/system/{{id}}.service
install -Dm0644 data/{{id}}.conf {{confdir}}/dbus-1/system.d/{{id}}.conf
# Uninstalls everything (requires same arguments as given to install)
uninstall:
rm -rf {{confdir}}/system76-scheduler \
{{confdir}}/dbus-1/system.d/{{id}}.conf \
{{libdir}}/systemd/system/{{id}}.service \
{{target_bin}}
# Vendor Cargo dependencies locally
vendor:
mkdir -p .cargo
cargo vendor --sync bin/Cargo.toml \
--sync plugins/Cargo.toml \
--sync service/Cargo.toml \
| head -n -1 > .cargo/config
echo 'directory = "vendor"' >> .cargo/config
tar pcf vendor.tar vendor
rm -rf vendor
# Extracts vendored dependencies if vendor=1
_extract_vendor:
#!/usr/bin/env sh
if test {{vendor}} = 1; then
rm -rf vendor
tar pxf vendor.tar
fi