forked from pop-os/launcher
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
97 lines (78 loc) · 2.31 KB
/
Copy pathjustfile
File metadata and controls
97 lines (78 loc) · 2.31 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
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
plugins := 'calc desktop_entries files find pop_shell pulse recent scripts terminal web'
ID := 'pop-launcher'
rootdir := ''
base_dir := if rootdir == '' {
env_var('HOME') + '/.local/'
} else {
rootdir + '/usr/'
}
lib_dir := if rootdir == '' {
base_dir + 'share/'
} else {
base_dir + 'lib/'
}
bin_dir := base_dir + 'bin/'
bin_path := bin_dir + ID
launcher_dir := lib_dir + ID + '/'
scripts_dir := launcher_dir + 'scripts/'
plugin_dir := launcher_dir + 'plugins/'
version := '0.0.0'
# Compile pop-launcher
all: _extract_vendor
cargo build -p pop-launcher-bin {{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: install_bin install_plugins install_scripts
# Install pop-launcher binary
install_bin:
install -Dm0755 target/{{target}}/pop-launcher-bin {{bin_path}}
# Install pop-launcher plugins
install_plugins:
#!/usr/bin/env sh
set -ex
for plugin in {{plugins}}; do
dest={{plugin_dir}}${plugin}
mkdir -p ${dest}
install -Dm0644 plugins/src/${plugin}/*.ron ${dest}
ln -sf {{bin_path}} {{plugin_dir}}${plugin}/$(echo ${plugin} | sed 's/_/-/')
done
# Install pop-launcher scripts
install_scripts:
#!/usr/bin/env sh
set -ex
mkdir -p {{scripts_dir}}
for script in {{justfile_directory()}}/scripts/*; do
cp -r ${script} {{scripts_dir}}
done
# Uninstalls everything (requires same arguments as given to install)
uninstall:
rm {{bin_path}}
rm -rf {{launcher_dir}}
# 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