From 5be605fabd3861504d330c6e9048d3d38ca8ade9 Mon Sep 17 00:00:00 2001 From: soloturn Date: Thu, 25 Jul 2024 14:33:13 +0200 Subject: [PATCH] build with justfile fixes #652 --- debian/rules | 7 ++++--- justfile | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 justfile diff --git a/debian/rules b/debian/rules index 5a266947..21c3fce5 100755 --- a/debian/rules +++ b/debian/rules @@ -9,14 +9,15 @@ CLEAN ?= 1 override_dh_auto_clean: ifeq ($(CLEAN),1) - ischroot && make clean || make distclean + just clean endif ifeq ($(VENDOR),1) - ischroot || make vendor + ischroot || just rootdir=debian/cosmic-comp debug=$(DEBUG) vendor=$(VENDOR) endif override_dh_installinit: dh_installinit -r override_dh_systemd_start: - dh_systemd_start -r \ No newline at end of file + dh_systemd_start -r + diff --git a/justfile b/justfile new file mode 100644 index 00000000..d96da86e --- /dev/null +++ b/justfile @@ -0,0 +1,53 @@ +rootdir := '' +prefix := rootdir + '/usr' +clean := '0' +debug := '0' +vendor := '0' +cargo-target-dir := env('CARGO_TARGET_DIR', 'target') +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 + +bindir := prefix + '/bin' +libdir := prefix + '/lib' +sharedir := prefix + '/share' + +all: _extract_vendor build + +build: + cargo build {{cargo_args}} + +# Installs files into the system +install: + install -Dm0755 {{cargo-target-dir}}/release/cosmic-comp {{bindir}}/cosmic-comp + install -Dm0644 "data/keybindings.ron" {{sharedir}}/cosmic/com.system76.CosmicSettings.Shortcuts/v1/defaults + +install-bare-session: install + install -Dm0644 "data/cosmic.desktop" {{sharedir}}/wayland-sessions/cosmic.desktop + install -Dm0644 "data/cosmic-session.target" {{libdir}}/systemd/user/cosmic-session.target + install -Dm0644 "data/cosmic-session-pre.target" {{libdir}}/systemd/user/cosmic-session-pre.target + install -Dm0644 "data/cosmic-comp.service" {{libdir}}/systemd/user/cosmic-comp.service + install -Dm0755 "data/cosmic-service" {{bindir}}/cosmic-service + +uninstall: + rm {{bindir}}/cosmic-comp + rm {{sharedir}}/cosmic/com.system76.CosmicSettings.Shortcuts/v1/defaults + + +uninstall-bare-session: + rm {{sharedir}}/wayland-sessions/cosmic.desktop" + +clean_vendor: + rm -rf vendor vendor.tar .cargo/config + +clean: clean_vendor + cargo clean + +# 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 +