X-Git-Url: https://git.donarmstrong.com/?p=deb_pkgs%2Fautorandr.git;a=blobdiff_plain;f=Makefile;h=87b1b4dd0a9ac434d39e496bea4b826bc7a2205f;hp=e50dfb330c8a42b2183f33f6725d2c637b4ec110;hb=HEAD;hpb=2bc71d562765e2023b26a31c485769612e3eb91e diff --git a/Makefile b/Makefile index e50dfb3..f5f2485 100644 --- a/Makefile +++ b/Makefile @@ -66,12 +66,18 @@ DEFAULT_TARGETS+=autostart_config install_autostart_config: mkdir -p ${DESTDIR}/${XDG_AUTOSTART_DIR} install -m 644 contrib/etc/xdg/autostart/autorandr.desktop ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr.desktop + # KDE-specific autostart (workaround for https://github.com/systemd/systemd/issues/18791) + install -m 644 contrib/etc/xdg/autostart/autorandr.desktop ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-kde.desktop + desktop-file-edit --remove-key=X-GNOME-Autostart-Phase --add-only-show-in=KDE ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-kde.desktop + ifneq ($(PREFIX),/usr/) sed -i -re 's#/usr/bin/autorandr#$(subst #,\#,${PREFIX})/bin/autorandr#g' ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr.desktop + sed -i -re 's#/usr/bin/autorandr#$(subst #,\#,${PREFIX})/bin/autorandr#g' ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-kde.desktop endif uninstall_autostart_config: rm -f ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr.desktop + rm -f ${DESTDIR}/${XDG_AUTOSTART_DIR}/autorandr-kde.desktop # Rules for systemd SYSTEMD_UNIT_DIR:=$(shell pkg-config --variable=systemdsystemunitdir systemd 2>/dev/null) @@ -83,18 +89,21 @@ install_systemd: $(if $(SYSTEMD_UNIT_DIR),,$(error SYSTEMD_UNIT_DIR is not defined)) mkdir -p ${DESTDIR}/${SYSTEMD_UNIT_DIR} install -m 644 contrib/systemd/autorandr.service ${DESTDIR}/${SYSTEMD_UNIT_DIR}/autorandr.service + install -m 644 contrib/systemd/autorandr-lid-listener.service ${DESTDIR}/${SYSTEMD_UNIT_DIR}/autorandr-lid-listener.service ifneq ($(PREFIX),/usr/) sed -i -re 's#/usr/bin/autorandr#$(subst #,\#,${PREFIX})/bin/autorandr#g' ${DESTDIR}/${SYSTEMD_UNIT_DIR}/autorandr.service endif @echo - @echo "To activate the systemd unit, run this command as root:" + @echo "To activate the systemd units, run this command as root:" @echo " systemctl daemon-reload" @echo " systemctl enable autorandr.service" + @echo " systemctl enable autorandr-lid-listener.service" @echo uninstall_systemd: $(if $(SYSTEMD_UNIT_DIR),,$(error SYSTEMD_UNIT_DIR is not defined)) rm -f ${DESTDIR}/${SYSTEMD_UNIT_DIR}/autorandr.service + rm -f ${DESTDIR}/${SYSTEMD_UNIT_DIR}/autorandr-lid-listener.service # Rules for pmutils PM_SLEEPHOOKS_DIR:=$(shell pkg-config --variable=pm_sleephooks pm-utils 2>/dev/null) @@ -126,7 +135,7 @@ endif install_udev: $(if $(UDEV_RULES_DIR),,$(error UDEV_RULES_DIR is not defined)) mkdir -p ${DESTDIR}/${UDEV_RULES_DIR}/ - echo 'ACTION=="change", SUBSYSTEM=="drm", RUN+="$(if $(findstring systemd, $(TARGETS)),/bin/systemctl start --no-block autorandr.service,${PREFIX}/bin/autorandr --batch --change --default default)"' > ${DESTDIR}/${UDEV_RULES_DIR}/40-monitor-hotplug.rules + echo 'ACTION=="change", SUBSYSTEM=="drm", RUN+="$(if $(findstring systemd, $(DEFAULT_TARGETS)),/bin/systemctl start --no-block autorandr.service,${PREFIX}/bin/autorandr --batch --change --default default)"' > ${DESTDIR}/${UDEV_RULES_DIR}/40-monitor-hotplug.rules @echo @echo "To activate the udev rules, run this command as root:" @echo " udevadm control --reload-rules" @@ -152,8 +161,9 @@ LAUNCHER_LDLIBS=$(shell pkg-config --libs pkg-config xcb xcb-randr 2>/dev/null) ifneq (,$(LAUNCHER_LDLIBS)) CLEANUP_FILES+=contrib/autorandr_launcher/autorandr-launcher LAUNCHER_CFLAGS=$(shell pkg-config --cflags pkg-config xcb xcb-randr 2>/dev/null) +DEF_AUTORANDR_PATH="-DAUTORANDR_PATH=\"${DESTDIR}${PREFIX}/bin/autorandr\"" contrib/autorandr_launcher/autorandr-launcher: contrib/autorandr_launcher/autorandr_launcher.c - $(CC) $(CFLAGS) $(LAUNCHER_CFLAGS) -o $@ $+ $(LDFLAGS) $(LAUNCHER_LDLIBS) $(LDLIBS) + $(CC) $(CFLAGS) $(LAUNCHER_CFLAGS) $(DEF_AUTORANDR_PATH) -o $@ $+ $(LDFLAGS) $(LAUNCHER_LDLIBS) $(LDLIBS) install_launcher: contrib/autorandr_launcher/autorandr-launcher mkdir -p ${DESTDIR}${PREFIX}/bin