chore: Switch from Makefile to justfile
This commit is contained in:
parent
d17acbd9ce
commit
2c7af23323
3 changed files with 119 additions and 111 deletions
103
Makefile
103
Makefile
|
|
@ -1,103 +0,0 @@
|
|||
TARGET = debug
|
||||
DEBUG ?= 0
|
||||
|
||||
ifeq ($(DESTDIR),)
|
||||
BASE_PATH = $(HOME)/.local
|
||||
LIB_PATH = $(BASE_PATH)/share
|
||||
else
|
||||
BASE_PATH = $(DESTDIR)/usr
|
||||
LIB_PATH = $(BASE_PATH)/lib
|
||||
endif
|
||||
|
||||
LAUNCHER_DIR = $(LIB_PATH)/pop-launcher
|
||||
SCRIPTS_DIR = $(LAUNCHER_DIR)/scripts
|
||||
PLUGIN_DIR = $(LAUNCHER_DIR)/plugins
|
||||
BIN_DIR = $(BASE_PATH)/bin
|
||||
BIN = $(BIN_DIR)/pop-launcher
|
||||
|
||||
PLUGINS=calc desktop_entries files find pop_shell pulse recent scripts terminal web
|
||||
|
||||
.PHONY = all clean install uninstall vendor
|
||||
|
||||
ifeq ($(DEBUG),0)
|
||||
TARGET = release
|
||||
ARGS += --release
|
||||
endif
|
||||
|
||||
VENDOR ?= 0
|
||||
ifneq ($(VENDOR),0)
|
||||
ARGS += --frozen --offline
|
||||
endif
|
||||
|
||||
all: extract-vendor
|
||||
cargo build -p pop-launcher-bin $(ARGS)
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
distclean:
|
||||
rm -rf .cargo vendor vendor.tar target
|
||||
|
||||
vendor:
|
||||
mkdir -p .cargo
|
||||
cargo vendor --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
|
||||
|
||||
extract-vendor:
|
||||
ifeq ($(VENDOR),1)
|
||||
rm -rf vendor; tar pxf vendor.tar
|
||||
endif
|
||||
|
||||
install:
|
||||
for plugin in $(PLUGINS); do \
|
||||
dest=$(PLUGIN_DIR)/$${plugin}; \
|
||||
mkdir -p $${dest}; \
|
||||
install -Dm0644 plugins/src/$${plugin}/*.ron $${dest}; \
|
||||
done
|
||||
|
||||
install -Dm0755 target/$(TARGET)/pop-launcher-bin $(BIN)
|
||||
|
||||
# Pop Shell Windows plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/pop_shell/pop-shell
|
||||
|
||||
# Desktop Entries plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/desktop_entries/desktop-entries
|
||||
|
||||
# Find plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/find/find
|
||||
|
||||
# Scripts plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/scripts/scripts
|
||||
|
||||
# Web plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/web/web
|
||||
|
||||
# Calculator plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/calc/calc
|
||||
|
||||
# Files plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/files/files
|
||||
|
||||
# Recent plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/recent/recent
|
||||
|
||||
# Pulse plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/pulse/pulse
|
||||
|
||||
# Terminal plugin
|
||||
ln -sf $(BIN) $(PLUGIN_DIR)/terminal/terminal
|
||||
|
||||
# Scripts
|
||||
mkdir -p $(SCRIPTS_DIR)
|
||||
for script in $(PWD)/scripts/*; do \
|
||||
cp -r $${script} $(SCRIPTS_DIR); \
|
||||
done
|
||||
|
||||
release:
|
||||
sed -i "s/^version.*/version = \"${RELEASE}\"/g" Cargo.toml
|
||||
sed -i "s/^version.*/version = \"${RELEASE}\"/g" bin/Cargo.toml
|
||||
sed -i "s/^version.*/version = \"${RELEASE}\"/g" plugins/Cargo.toml
|
||||
sed -i "s/^version.*/version= \"${RELEASE}\"/g" service/Cargo.toml
|
||||
cargo update
|
||||
27
debian/rules
vendored
27
debian/rules
vendored
|
|
@ -1,6 +1,6 @@
|
|||
#!/usr/bin/make -f
|
||||
|
||||
export VENDOR ?= 1
|
||||
VENDOR ?= 1
|
||||
CLEAN ?= 1
|
||||
DESTDIR=debian/tmp
|
||||
|
||||
|
|
@ -8,15 +8,26 @@ DESTDIR=debian/tmp
|
|||
dh $@ --with=systemd
|
||||
|
||||
override_dh_auto_clean:
|
||||
ifeq ($(CLEAN),1)
|
||||
ischroot && make clean || make distclean
|
||||
endif
|
||||
ifeq ($(VENDOR),1)
|
||||
ischroot || make vendor
|
||||
endif
|
||||
if test "${CLEAN}" = "1"; then \
|
||||
cargo clean; \
|
||||
fi
|
||||
|
||||
if ! ischroot && test "${VENDOR}" = "1"; then \
|
||||
mkdir -p .cargo; \
|
||||
cargo vendor --sync plugins/Cargo.toml \
|
||||
--sync bin/Cargo.toml \
|
||||
--sync service/Cargo.toml \
|
||||
| head -n -1 > .cargo/config; \
|
||||
echo 'directory = "vendor"' >> .cargo/config; \
|
||||
tar pcf vendor.tar vendor; \
|
||||
rm -rf vendor; \
|
||||
fi
|
||||
|
||||
override_dh_auto_build:
|
||||
CARGO_HOME="$$(pwd)/target/cargo" make DESTDIR=$(DESTDIR)
|
||||
env CARGO_HOME="$$(pwd)/target/cargo" just rootdir=$(DESTDIR) debug=$(DEBUG) vendor=$(VENDOR)
|
||||
|
||||
override_dh_auto_install:
|
||||
just rootdir=$(DESTDIR) install
|
||||
|
||||
override_dh_fixperms:
|
||||
dh_fixperms
|
||||
|
|
|
|||
100
justfile
Normal file
100
justfile
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
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}/${plugin}
|
||||
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
|
||||
|
||||
# Increment version across workspace
|
||||
release:
|
||||
sed -i "s/^version.*/version = \"{{version}}\"/g" Cargo.toml
|
||||
sed -i "s/^version.*/version = \"{{version}}\"/g" bin/Cargo.toml
|
||||
sed -i "s/^version.*/version = \"{{version}}\"/g" plugins/Cargo.toml
|
||||
sed -i "s/^version.*/version= \"{{version}}\"/g" service/Cargo.toml
|
||||
cargo update
|
||||
|
||||
# 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue