diff --git a/Makefile b/Makefile index 16f59ee..b5c74ed 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ export prefix ?= /usr sysconfdir ?= /etc bindir = $(prefix)/bin libdir = $(prefix)/lib +libexecdir ?= $(prefix)/libexec sharedir = $(prefix)/share BINARY = cosmic-comp @@ -9,7 +10,7 @@ CARGO_TARGET_DIR ?= target TARGET = debug DEBUG ?= 0 -.PHONY = all clean install uninstall vendor +.PHONY = all clean install install-defaults uninstall vendor ifeq ($(DEBUG),0) TARGET = release @@ -21,7 +22,15 @@ ifneq ($(VENDOR),0) ARGS += --offline --locked endif -TARGET_BIN="$(DESTDIR)$(bindir)/$(BINARY)" +# HyprCosmic installs *beside* the distro's COSMIC rather than over it. Both +# sessions stay on the greeter's menu -- /usr/share/wayland-sessions holds +# cosmic.desktop and hyprcosmic.desktop at the same time -- which only works +# while this binary stays out of $(bindir)/cosmic-comp, where it would replace +# the compositor the stock session runs. A private directory is what keeps +# installing HyprCosmic from being a one-way door: if the fork misbehaves, the +# stock session is still there to log into and fix it from. +compdir ?= $(libexecdir)/hyprcosmic +TARGET_BIN="$(DESTDIR)$(compdir)/$(BINARY)" KEYBINDINGS_CONF="$(DESTDIR)$(sharedir)/cosmic/com.system76.CosmicSettings.Shortcuts/v1/defaults" TILING_EXCEPTIONS_CONF="$(DESTDIR)$(sharedir)/cosmic/com.system76.CosmicSettings.WindowRules/v1/tiling_exception_defaults" @@ -48,8 +57,19 @@ ifeq ($(VENDOR),1) rm -rf vendor; tar pxf vendor.tar endif +# The binary only. The two .ron files are COSMIC's *shared* defaults, and they +# sit at paths the distro's own cosmic-comp package already owns, so installing +# them from here would make a HyprCosmic package conflict with that one over two +# files it has no reason to change. The fork reads the stock copies instead -- +# which is honest, because a HyprCosmic session needs the rest of COSMIC present +# anyway for the greeter, the portals and the settings daemon. +# +# `install-defaults` keeps them reachable for anyone building this fork on its +# own, without a COSMIC install to borrow them from. install: install -Dm0755 "$(CARGO_TARGET_DIR)/$(TARGET)/$(BINARY)" "$(TARGET_BIN)" + +install-defaults: install -Dm0644 "data/keybindings.ron" "$(KEYBINDINGS_CONF)" install -Dm0644 "data/tiling-exceptions.ron" "$(TILING_EXCEPTIONS_CONF)" @@ -60,8 +80,11 @@ install-bare-session: install install -Dm0644 "data/cosmic-comp.service" "$(DESTDIR)$(libdir)/systemd/user/cosmic-comp.service" install -Dm0755 "data/cosmic-service" "$(DESTDIR)/$(bindir)/cosmic-service" +# Only what `install` placed. Removing KEYBINDINGS_CONF here would delete a file +# belonging to the distro's cosmic-comp, breaking the stock session on the way +# out -- the exact failure the private compdir above exists to prevent. uninstall: - rm "$(TARGET_BIN)" "$(KEYBINDINGS_CONF)" + rm "$(TARGET_BIN)" uninstall-bare-session: rm "$(DESTDIR)$(sharedir)/wayland-sessions/cosmic.desktop"