forked from pop-os/system76-scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
justfile
85 lines (67 loc) · 2.5 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
binary := 'system76-scheduler'
id := 'com.system76.Scheduler'
rootdir := ''
prefix := '/usr'
sysconfdir := '/etc'
bindir := clean(rootdir / prefix) / 'bin'
libdir := clean(rootdir / prefix) / 'lib'
confdir := clean(rootdir / sysconfdir)
target-bin := bindir / binary
rustflags := env_var_or_default('RUSTFLAGS', '')
# Use the lld linker if it is available.
export RUSTFLAGS := if `which lld || true` != '' {
rustflags + ' -C link-arg=-fuse-ld=lld -C link-arg=-Wl,--build-id=sha1 -Clink-arg=-Wl,--no-rosegment'
} else {
rustflags
}
# Path to execsnoop binary.
execsnoop := `which execsnoop || which execsnoop-bpfcc || echo /usr/sbin/execsnoop-bpfcc`
[private]
default: build-release
# Remove Cargo build artifacts
clean:
cargo clean
# Also remove .cargo and vendored dependencies
distclean:
rm -rf .cargo vendor vendor.tar target
# Compile with debug profile
build-debug *args:
env EXECSNOOP_PATH={{execsnoop}} cargo build {{args}}
# Compile with release profile
build-release *args: (build-debug '--release' args)
# Compile with a vendored tarball
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
# Check for errors and linter warnings
check *args:
env EXECSNOOP_PATH={{execsnoop}} cargo clippy --all-features {{args}} -- -W clippy::pedantic
# Runs a check with JSON message format for IDE integration
check-json: (check '--message-format=json')
# Install everything
install:
mkdir -p {{confdir}}/system76-scheduler/process-scheduler
install -Dm0644 data/config.kdl {{confdir}}/system76-scheduler/config.kdl
install -Dm0644 data/pop_os.kdl {{confdir}}/system76-scheduler/process-scheduler/pop_os.kdl
install -Dm0755 target/release/{{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
[private]
vendor-extract:
rm -rf vendor
tar pxf vendor.tar