-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathjustfile
75 lines (57 loc) · 2.23 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
rootdir := ''
prefix := '/usr'
clean := '0'
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
name := 'cosmic-ext-applet-ollama'
targetdir := env('CARGO_TARGET_DIR', 'target')
sharedir := rootdir + prefix + '/share'
iconsdir := sharedir + '/icons/hicolor/scalable/apps'
prefixdir := prefix + '/bin'
bindir := rootdir + prefixdir
cosmic-applets-bin := prefixdir / 'cosmic-applets'
default: build-release
# Compiles with debug profile
build-debug *args:
cargo build {{args}}
# Compiles with release profile
build-release *args: (build-debug '--release' args)
# Compiles with release profile with wgpu disabled
build-no-wgpu *args: (build-debug '--release --no-default-features' args)
# Compile with a vendored tarball
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
_link_applet name:
ln -sf {{cosmic-applets-bin}} {{bindir}}/{{name}}
_install_icon:
install -Dm0644 'data/icons/scalable/apps/io.github.elevenhsoft.CosmicExtAppletOllama-symbolic.svg' {{iconsdir}}/io.github.elevenhsoft.CosmicExtAppletOllama-symbolic.svg
_install_desktop path:
install -Dm0644 {{path}} {{sharedir}}/applications/{{file_name(path)}}
_install_bin:
install -Dm0755 {{targetdir}}/{{target}}/{{name}} {{bindir}}/{{name}}
_install_applet id name: \
_install_icon \
(_install_desktop 'data/' + id + '.desktop') \
_install_bin
# Installs files into the system
install:(_install_applet 'io.github.elevenhsoft.CosmicExtAppletOllama' 'cosmic-ext-applet-ollama')
# Uninstall the application from the system
uninstall:
rm -f {{bindir}}/{{name}}
rm -f {{iconsdir}}/io.github.elevenhsoft.CosmicExtAppletOllama-symbolic.svg
rm -f {{sharedir}}/applications/io.github.elevenhsoft.CosmicExtAppletOllama.desktop
# Vendor Cargo dependencies locally
vendor:
mkdir -p .cargo
cargo vendor | 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