mirror of
https://github.com/outbackdingo/hyprcosmic-comp.git
synced 2026-08-25 14:53:22 +00:00
HyprCosmic is a fork of COSMIC, not an add-on to it, so cosmic-comp goes where a cosmic-comp goes: $(bindir)/cosmic-comp. This reverses the private $(libexecdir)/hyprcosmic layout. That bought a fallback -- both compositors on disk, both sessions bootable -- and cost coherence: a session that had to name absolute paths to find its own binary, and no answer to "which cosmic-comp is running". The fallback survives in a better form, because cosmic-session installs cosmic.desktop as well as hyprcosmic.desktop and both are now served by this binary. The consequence is stated rather than hidden: a package built from this conflicts with the distribution's cosmic-comp over /usr/bin/cosmic-comp. That is the honest relationship between two builds of the same program. libexecdir is dropped from the Makefile, having been added by this fork and used by nothing else. CI asserts the binary and both .ron defaults land at upstream's paths, and that nothing returns to the libexec directory -- a stray copy there is a second compositor that nothing runs and no uninstall removes.
93 lines
3.6 KiB
Makefile
93 lines
3.6 KiB
Makefile
export prefix ?= /usr
|
|
sysconfdir ?= /etc
|
|
bindir = $(prefix)/bin
|
|
libdir = $(prefix)/lib
|
|
sharedir = $(prefix)/share
|
|
|
|
BINARY = cosmic-comp
|
|
CARGO_TARGET_DIR ?= target
|
|
TARGET = debug
|
|
DEBUG ?= 0
|
|
|
|
.PHONY = all clean install uninstall vendor
|
|
|
|
ifeq ($(DEBUG),0)
|
|
TARGET = release
|
|
ARGS += --release
|
|
endif
|
|
|
|
VENDOR ?= 0
|
|
ifneq ($(VENDOR),0)
|
|
ARGS += --offline --locked
|
|
endif
|
|
|
|
# HyprCosmic is a fork of COSMIC, not an add-on to it, so this binary goes where
|
|
# a cosmic-comp goes: $(bindir)/cosmic-comp. It is the compositor on a machine
|
|
# that installs it, and a HyprCosmic package accordingly conflicts with the
|
|
# distribution's cosmic-comp over this path -- which is the honest relationship
|
|
# between two builds of the same program, and is how every other distro-level
|
|
# fork declares itself.
|
|
#
|
|
# This used to install to a private $(libexecdir)/hyprcosmic so both sessions
|
|
# could coexist. That bought a fallback and cost coherence: two compositors on
|
|
# disk, a session that had to name absolute paths to find its own, and no
|
|
# answer to "which cosmic-comp is running". The fallback survives in a better
|
|
# form -- cosmic-session installs cosmic.desktop as well as hyprcosmic.desktop,
|
|
# so the greeter still offers a stock COSMIC shell, now served by this binary.
|
|
TARGET_BIN="$(DESTDIR)$(bindir)/$(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"
|
|
|
|
all: extract-vendor
|
|
cargo build $(ARGS)
|
|
|
|
clean:
|
|
cargo clean
|
|
|
|
distclean:
|
|
rm -rf .cargo vendor vendor.tar target
|
|
|
|
vendor:
|
|
mkdir -p .cargo
|
|
cargo vendor | head -n -1 > .cargo/config
|
|
echo 'directory = "vendor"' >> .cargo/config
|
|
[ -n "$(SOURCE_GIT_HASH)" ] && printf '\n[env]\nGIT_HASH = "%s"\n' "$(SOURCE_GIT_HASH)" >> .cargo/config || true
|
|
tar pcf vendor.tar vendor
|
|
rm -rf vendor
|
|
|
|
extract-vendor:
|
|
ifeq ($(VENDOR),1)
|
|
rm -rf vendor; tar pxf vendor.tar
|
|
endif
|
|
|
|
# Upstream's install, restored. The two .ron files are the compositor's shared
|
|
# defaults and it will not find a shortcut or a tiling exception without them,
|
|
# so a build that means to be the only cosmic-comp on the machine has to place
|
|
# them. They were split out into `install-defaults` while this fork installed
|
|
# beside a COSMIC it could borrow them from; there is nothing to borrow from now.
|
|
#
|
|
# `bind` lines in cosmic.conf are still written to the Shortcuts *custom* key,
|
|
# which cosmic-comp merges over these defaults. That is unchanged and is what
|
|
# keeps `cosmic-conf apply` from having to edit the file installed here.
|
|
install:
|
|
install -Dm0755 "$(CARGO_TARGET_DIR)/$(TARGET)/$(BINARY)" "$(TARGET_BIN)"
|
|
install -Dm0644 "data/keybindings.ron" "$(KEYBINDINGS_CONF)"
|
|
install -Dm0644 "data/tiling-exceptions.ron" "$(TILING_EXCEPTIONS_CONF)"
|
|
|
|
install-bare-session: install
|
|
install -Dm0644 "data/cosmic.desktop" "$(DESTDIR)$(sharedir)/wayland-sessions/cosmic.desktop"
|
|
install -Dm0644 "data/cosmic-session.target" "$(DESTDIR)$(libdir)/systemd/user/cosmic-session.target"
|
|
install -Dm0644 "data/cosmic-session-pre.target" "$(DESTDIR)$(libdir)/systemd/user/cosmic-session-pre.target"
|
|
install -Dm0644 "data/cosmic-comp.service" "$(DESTDIR)$(libdir)/systemd/user/cosmic-comp.service"
|
|
install -Dm0755 "data/cosmic-service" "$(DESTDIR)/$(bindir)/cosmic-service"
|
|
|
|
# Upstream's uninstall, restored along with the install it undoes. It leaves
|
|
# TILING_EXCEPTIONS_CONF behind, which is upstream's omission rather than a
|
|
# decision of this fork's, and is left alone so the two files stay diffable.
|
|
uninstall:
|
|
rm "$(TARGET_BIN)" "$(KEYBINDINGS_CONF)"
|
|
|
|
uninstall-bare-session:
|
|
rm "$(DESTDIR)$(sharedir)/wayland-sessions/cosmic.desktop"
|