2023-02-06 19:26:39 +01:00
|
|
|
ID := 'pop-launcher'
|
2023-02-03 12:35:13 -05:00
|
|
|
plugins := 'calc desktop_entries files find pop_shell pulse recent scripts terminal web cosmic_toplevel'
|
2022-03-26 01:12:11 +01:00
|
|
|
|
2023-02-06 19:26:39 +01:00
|
|
|
x86-64-target := 'x86-64-v2'
|
|
|
|
|
|
|
|
|
|
export RUSTFLAGS := if arch() == 'x86_64' {
|
|
|
|
|
' -C target-cpu=' + x86-64-target
|
|
|
|
|
} else {
|
|
|
|
|
''
|
|
|
|
|
}
|
2022-03-26 01:12:11 +01:00
|
|
|
|
|
|
|
|
rootdir := ''
|
|
|
|
|
|
2023-02-06 19:26:39 +01:00
|
|
|
base-dir := if rootdir == '' {
|
|
|
|
|
env_var('HOME') / '.local'
|
2022-03-26 01:12:11 +01:00
|
|
|
} else {
|
2023-02-06 19:26:39 +01:00
|
|
|
rootdir / 'usr'
|
2022-03-26 01:12:11 +01:00
|
|
|
}
|
|
|
|
|
|
2023-02-06 19:26:39 +01:00
|
|
|
lib-dir := if rootdir == '' {
|
|
|
|
|
base-dir / 'share'
|
2022-03-26 01:12:11 +01:00
|
|
|
} else {
|
2023-02-06 19:26:39 +01:00
|
|
|
base-dir / 'lib'
|
2022-03-26 01:12:11 +01:00
|
|
|
}
|
|
|
|
|
|
2023-02-06 19:26:39 +01:00
|
|
|
bin-dir := base-dir / 'bin'
|
|
|
|
|
bin-path := bin-dir / ID
|
2022-03-26 01:12:11 +01:00
|
|
|
|
2023-02-06 19:26:39 +01:00
|
|
|
launcher-dir := lib-dir / ID
|
|
|
|
|
scripts-dir := launcher-dir / 'scripts/'
|
|
|
|
|
plugin-dir := launcher-dir / 'plugins/'
|
2022-03-26 01:12:11 +01:00
|
|
|
|
|
|
|
|
version := '0.0.0'
|
|
|
|
|
|
|
|
|
|
# Compile pop-launcher
|
2023-02-06 19:26:39 +01:00
|
|
|
all *args: (build-release args)
|
2022-03-26 01:12:11 +01:00
|
|
|
|
2023-02-06 19:26:39 +01:00
|
|
|
# Compile with debug profile
|
|
|
|
|
build-debug *args:
|
|
|
|
|
cargo build -p pop-launcher-bin {{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:
|
|
|
|
|
cargo clippy --all-features {{args}} -- -W clippy::pedantic
|
|
|
|
|
|
|
|
|
|
# Runs a check with JSON message format for IDE integration
|
|
|
|
|
check-json: (check '--message-format=json')
|
2022-11-07 17:07:45 +01:00
|
|
|
|
2022-03-26 01:12:11 +01:00
|
|
|
# Remove Cargo build artifacts
|
|
|
|
|
clean:
|
|
|
|
|
cargo clean
|
|
|
|
|
|
|
|
|
|
# Also remove .cargo and vendored dependencies
|
2023-02-06 19:26:39 +01:00
|
|
|
clean-dist:
|
2022-03-26 01:12:11 +01:00
|
|
|
rm -rf .cargo vendor vendor.tar target
|
|
|
|
|
|
|
|
|
|
# Install everything
|
2023-02-06 19:26:39 +01:00
|
|
|
install: install-bin install-plugins install-scripts
|
2022-03-26 01:12:11 +01:00
|
|
|
|
|
|
|
|
# Install pop-launcher binary
|
2023-02-06 19:26:39 +01:00
|
|
|
install-bin:
|
|
|
|
|
install -Dm0755 target/release/pop-launcher-bin {{bin-path}}
|
2022-03-26 01:12:11 +01:00
|
|
|
|
|
|
|
|
# Install pop-launcher plugins
|
2023-02-06 19:26:39 +01:00
|
|
|
install-plugins:
|
2022-03-26 01:12:11 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
set -ex
|
|
|
|
|
for plugin in {{plugins}}; do
|
2023-02-06 19:26:39 +01:00
|
|
|
dest={{plugin-dir}}${plugin}
|
2022-03-26 01:12:11 +01:00
|
|
|
mkdir -p ${dest}
|
|
|
|
|
install -Dm0644 plugins/src/${plugin}/*.ron ${dest}
|
2023-02-06 19:26:39 +01:00
|
|
|
ln -sf {{bin-path}} {{plugin-dir}}${plugin}/$(echo ${plugin} | sed 's/_/-/')
|
2022-03-26 01:12:11 +01:00
|
|
|
done
|
|
|
|
|
|
|
|
|
|
# Install pop-launcher scripts
|
2023-02-06 19:26:39 +01:00
|
|
|
install-scripts:
|
2022-03-26 01:12:11 +01:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
set -ex
|
2023-02-06 19:26:39 +01:00
|
|
|
mkdir -p {{scripts-dir}}
|
2022-03-26 01:12:11 +01:00
|
|
|
for script in {{justfile_directory()}}/scripts/*; do
|
2023-02-06 19:26:39 +01:00
|
|
|
cp -r ${script} {{scripts-dir}}
|
2022-03-26 01:12:11 +01:00
|
|
|
done
|
|
|
|
|
|
2022-03-29 23:51:52 +02:00
|
|
|
# Uninstalls everything (requires same arguments as given to install)
|
|
|
|
|
uninstall:
|
2023-02-06 19:26:39 +01:00
|
|
|
rm {{bin-path}}
|
|
|
|
|
rm -rf {{launcher-dir}}
|
2022-03-29 23:51:52 +02:00
|
|
|
|
2022-03-26 01:12:11 +01:00
|
|
|
# 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
|
2023-02-06 19:26:39 +01:00
|
|
|
_vendor-extract:
|
|
|
|
|
rm -rf vendor
|
|
|
|
|
tar pxf vendor.tar
|