commit:     94d5a070729123284b72092743d5316d3563b9f7
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Sat Sep  2 17:00:55 2023 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Sep  2 18:01:00 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94d5a070

x11-misc/sddm: Backport some post-0.20 fixes

- greeter: Look at WAYLAND_DISPLAY for platform detection
- Ignore InputMethod=qtvirtualkeyboard on wayland
- Install dbus policy in /usr/share, not /etc

Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/sddm-0.20.0-dbus-policy-in-usr.patch     |  29 +++++
 .../sddm-0.20.0-greeter-platform-detection.patch   |  24 ++++
 ...dm-0.20.0-no-qtvirtualkeyboard-on-wayland.patch |  32 +++++
 x11-misc/sddm/sddm-0.20.0-r1.ebuild                | 136 +++++++++++++++++++++
 4 files changed, 221 insertions(+)

diff --git a/x11-misc/sddm/files/sddm-0.20.0-dbus-policy-in-usr.patch 
b/x11-misc/sddm/files/sddm-0.20.0-dbus-policy-in-usr.patch
new file mode 100644
index 000000000000..8926b8400430
--- /dev/null
+++ b/x11-misc/sddm/files/sddm-0.20.0-dbus-policy-in-usr.patch
@@ -0,0 +1,29 @@
+From 0823810ed1683e6dcb7d687795764e11ddb6ff8a Mon Sep 17 00:00:00 2001
+From: Gioele Barabucci <gio...@svario.it>
+Date: Sun, 16 Jul 2023 11:51:08 +0200
+Subject: [PATCH] CMakeLists.txt: Install dbus policy in /usr/share, not /etc
+
+From https://bugs.debian.org/1006631:
+
+> dbus supports policy files in both `/usr/share/dbus-1/system.d` and
+> `/etc/dbus-1/systemd`. [The] recently released dbus 1.14.0, officially
+> deprecates installing packages' default policies into `/etc/dbus-1/systemd`,
+> instead reserving it for the sysadmin. This is the same idea as the
+> difference between `/usr/lib/udev/rules.d` and `/etc/udev/rules.d`.
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 72c4086bb..44956e52d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -181,7 +181,7 @@ endif()
+ 
+ # Set constants
+ set(DATA_INSTALL_DIR            "${CMAKE_INSTALL_FULL_DATADIR}/sddm"          
      CACHE PATH      "System application data install directory")
+-set(DBUS_CONFIG_DIR             "${CMAKE_INSTALL_SYSCONFDIR}/dbus-1/system.d" 
      CACHE PATH      "DBus config files directory")
++set(DBUS_CONFIG_DIR             
"${CMAKE_INSTALL_FULL_DATADIR}/dbus-1/system.d"       CACHE PATH      "DBus 
config files directory")
+ set(STATE_DIR                   
"${CMAKE_INSTALL_FULL_LOCALSTATEDIR}/lib/sddm"      CACHE PATH      "State 
directory")
+ set(RUNTIME_DIR                 "${RUNTIME_DIR_DEFAULT}"                      
      CACHE PATH      "Runtime data storage directory")
+ set(QML_INSTALL_DIR             "${QT_IMPORTS_DIR}"                           
      CACHE PATH      "QML component installation directory")

diff --git a/x11-misc/sddm/files/sddm-0.20.0-greeter-platform-detection.patch 
b/x11-misc/sddm/files/sddm-0.20.0-greeter-platform-detection.patch
new file mode 100644
index 000000000000..57d138875bea
--- /dev/null
+++ b/x11-misc/sddm/files/sddm-0.20.0-greeter-platform-detection.patch
@@ -0,0 +1,24 @@
+From e27b70957505dc7b986ab2fa68219af546c63344 Mon Sep 17 00:00:00 2001
+From: Fabian Vogt <fab...@ritter-vogt.de>
+Date: Fri, 30 Jun 2023 09:42:58 +0200
+Subject: [PATCH] greeter: Look at WAYLAND_DISPLAY for platform detection
+
+When running sddm-greeter manually in a wayland session, it otherwise
+misdetects that as xcb.
+---
+ src/greeter/GreeterApp.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
+index c2978d67e..4e4f65301 100644
+--- a/src/greeter/GreeterApp.cpp
++++ b/src/greeter/GreeterApp.cpp
+@@ -319,7 +319,7 @@ int main(int argc, char **argv)
+         platform = QString::fromUtf8(qgetenv("QT_QPA_PLATFORM"));
+     }
+     if (platform.isEmpty()) {
+-        platform = QStringLiteral("xcb");
++        platform = qEnvironmentVariableIsSet("WAYLAND_DISPLAY") ? 
QStringLiteral("wayland") : QStringLiteral("xcb");
+     }
+ 
+     // Install message handler

diff --git 
a/x11-misc/sddm/files/sddm-0.20.0-no-qtvirtualkeyboard-on-wayland.patch 
b/x11-misc/sddm/files/sddm-0.20.0-no-qtvirtualkeyboard-on-wayland.patch
new file mode 100644
index 000000000000..0081f3d4e8a3
--- /dev/null
+++ b/x11-misc/sddm/files/sddm-0.20.0-no-qtvirtualkeyboard-on-wayland.patch
@@ -0,0 +1,32 @@
+From 07631f2ef00a52d883d0fd47ff7d1e1a6bc6358f Mon Sep 17 00:00:00 2001
+From: Fabian Vogt <fab...@ritter-vogt.de>
+Date: Fri, 30 Jun 2023 09:44:37 +0200
+Subject: [PATCH] Ignore InputMethod=qtvirtualkeyboard on wayland
+
+Using QT_IM_MODULE=qtvirtualkeyboard in wayland client applications is not
+supported by Qt, but is sddm's builtin default. Avoid setting that.
+---
+ src/greeter/GreeterApp.cpp | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+diff --git a/src/greeter/GreeterApp.cpp b/src/greeter/GreeterApp.cpp
+index 4e4f65301..01613cc66 100644
+--- a/src/greeter/GreeterApp.cpp
++++ b/src/greeter/GreeterApp.cpp
+@@ -351,8 +351,14 @@ int main(int argc, char **argv)
+     qputenv("KDE_DEBUG", "1");
+ 
+     // Qt IM module
+-    if (!SDDM::mainConfig.InputMethod.get().isEmpty())
+-        qputenv("QT_IM_MODULE", 
SDDM::mainConfig.InputMethod.get().toLocal8Bit().constData());
++    QString inputMethod = SDDM::mainConfig.InputMethod.get();
++    // Using qtvirtualkeyboard as IM on wayland doesn't really work,
++    // it has to be done by the compositor instead.
++    if (platform.startsWith(QStringLiteral("wayland")) && inputMethod == 
QStringLiteral("qtvirtualkeyboard"))
++        inputMethod = QString{};
++
++    if (!inputMethod.isEmpty())
++        qputenv("QT_IM_MODULE", inputMethod.toLocal8Bit());
+ 
+     QGuiApplication app(argc, argv);
+     SDDM::SignalHandler s;

diff --git a/x11-misc/sddm/sddm-0.20.0-r1.ebuild 
b/x11-misc/sddm/sddm-0.20.0-r1.ebuild
new file mode 100644
index 000000000000..63babd63cc42
--- /dev/null
+++ b/x11-misc/sddm/sddm-0.20.0-r1.ebuild
@@ -0,0 +1,136 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+if [[ ${PV} == *9999* ]]; then
+       inherit git-r3
+       EGIT_REPO_URI="https://github.com/${PN}/${PN}.git";
+else
+       SRC_URI="https://github.com/${PN}/${PN}/archive/refs/tags/v${PV}.tar.gz 
-> ${P}.tar.gz"
+       KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
+fi
+
+QTMIN=5.15.2
+inherit cmake linux-info optfeature systemd tmpfiles
+
+DESCRIPTION="Simple Desktop Display Manager"
+HOMEPAGE="https://github.com/sddm/sddm";
+
+LICENSE="GPL-2+ MIT CC-BY-3.0 CC-BY-SA-3.0 public-domain"
+SLOT="0"
+IUSE="+elogind systemd test"
+
+REQUIRED_USE="^^ ( elogind systemd )"
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="
+       acct-group/sddm
+       acct-user/sddm
+       >=dev-qt/qtcore-${QTMIN}:5
+       >=dev-qt/qtdbus-${QTMIN}:5
+       >=dev-qt/qtdeclarative-${QTMIN}:5
+       >=dev-qt/qtgui-${QTMIN}:5
+       >=dev-qt/qtnetwork-${QTMIN}:5
+       sys-libs/pam
+       x11-libs/libXau
+       x11-libs/libxcb:=
+       elogind? ( sys-auth/elogind[pam] )
+       systemd? ( sys-apps/systemd:=[pam] )
+       !systemd? ( sys-power/upower )
+"
+DEPEND="${COMMON_DEPEND}
+       test? ( >=dev-qt/qttest-${QTMIN}:5 )
+"
+RDEPEND="${COMMON_DEPEND}
+       x11-base/xorg-server
+       !systemd? ( gui-libs/display-manager-init )
+"
+BDEPEND="
+       dev-python/docutils
+       >=dev-qt/linguist-tools-${QTMIN}:5
+       kde-frameworks/extra-cmake-modules:5
+       virtual/pkgconfig
+"
+
+PATCHES=(
+       # Downstream patches
+       "${FILESDIR}/${P}-respect-user-flags.patch"
+       "${FILESDIR}/${PN}-0.18.1-Xsession.patch" # bug 611210
+       "${FILESDIR}/${P}-sddm.pam-use-substack.patch" # bug 728550
+       "${FILESDIR}/${P}-disable-etc-debian-check.patch"
+       "${FILESDIR}/${P}-no-default-pam_systemd-module.patch" # bug 669980
+       # git master
+       "${FILESDIR}/${P}-fix-use-development-sessions.patch"
+       "${FILESDIR}/${P}-greeter-platform-detection.patch"
+       "${FILESDIR}/${P}-no-qtvirtualkeyboard-on-wayland.patch"
+       "${FILESDIR}/${P}-dbus-policy-in-usr.patch"
+)
+
+pkg_setup() {
+       local CONFIG_CHECK="~DRM"
+       use kernel_linux && linux-info_pkg_setup
+}
+
+src_prepare() {
+       touch 01gentoo.conf || die
+
+cat <<-EOF >> 01gentoo.conf
+[General]
+# Remove qtvirtualkeyboard as InputMethod default
+InputMethod=
+EOF
+
+       cmake_src_prepare
+
+       if ! use test; then
+               sed -e "/^find_package/s/ Test//" -i CMakeLists.txt || die
+               cmake_comment_add_subdirectory test
+       fi
+}
+
+src_configure() {
+       local mycmakeargs=(
+               -DBUILD_MAN_PAGES=ON
+               -DDBUS_CONFIG_FILENAME="org.freedesktop.sddm.conf"
+               -DRUNTIME_DIR=/run/sddm
+               -DSYSTEMD_TMPFILES_DIR="/usr/lib/tmpfiles.d"
+               -DNO_SYSTEMD=$(usex !systemd)
+               -DUSE_ELOGIND=$(usex elogind)
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       insinto /etc/sddm.conf.d/
+       doins "${S}"/01gentoo.conf
+}
+
+pkg_postinst() {
+       tmpfiles_process "${PN}.conf"
+
+       elog "NOTE: If SDDM startup appears to hang then entropy pool is too 
low."
+       elog "This can be fixed by configuring one of the following:"
+       elog "  - Enable CONFIG_RANDOM_TRUST_CPU in linux kernel"
+       elog "  - # emerge sys-apps/haveged && rc-update add haveged boot"
+       elog "  - # emerge sys-apps/rng-tools && rc-update add rngd boot"
+       elog
+       elog "SDDM example config can be shown with:"
+       elog "  ${EROOT}/usr/bin/sddm --example-config"
+       elog "Use ${EROOT}/etc/sddm.conf.d/ directory to override specific 
options."
+       elog
+       elog "For more information on how to configure SDDM, please visit the 
wiki:"
+       elog "  https://wiki.gentoo.org/wiki/SDDM";
+       if has_version x11-drivers/nvidia-drivers; then
+               elog
+               elog "  Nvidia GPU owners in particular should pay attention"
+               elog "  to the troubleshooting section."
+       fi
+
+       optfeature "Weston DisplayServer support (EXPERIMENTAL)" dev-libs/weston
+       optfeature "KWin DisplayServer support (EXPERIMENTAL)" kde-plasma/kwin
+
+       systemd_reenable sddm.service
+}

Reply via email to