pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Add sddm.



Module Name:	pkgsrc-wip
Committed By:	nia <nia%netbsd.org@localhost>
Pushed By:	nee
Date:		Sat May 16 13:15:19 2020 +0100
Changeset:	07e950494d606676d2cacfae03e584ea24965ef6

Modified Files:
	Makefile
Added Files:
	sddm/DESCR
	sddm/Makefile
	sddm/PLIST
	sddm/TODO
	sddm/distinfo
	sddm/patches/patch-CMakeLists.txt
	sddm/patches/patch-src_daemon_CMakeLists.txt
	sddm/patches/patch-src_daemon_DaemonApp.cpp
	sddm/patches/patch-src_daemon_VirtualTerminal.cpp
	sddm/patches/patch-src_daemon_VirtualTerminal__FreeBSD.cpp
	sddm/patches/patch-src_daemon_VirtualTerminal__NetBSD.cpp
	sddm/patches/patch-src_greeter_UserModel.cpp
	sddm/patches/patch-src_helper_UserSession.cpp

Log Message:
Add sddm.

SDDM is a modern display manager for X11 and Wayland aiming to be fast,
simple and beautiful. It uses modern technologies like QtQuick, which in
turn gives the designer the ability to create smooth, animated user interfaces.

SDDM is extremely themeable. We put no restrictions on the user interface
design, it is completely up to the designer. We simply provide a few callbacks
to the user interface which can be used for authentication, suspend etc.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=07e950494d606676d2cacfae03e584ea24965ef6

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 Makefile                                           |   1 +
 sddm/DESCR                                         |   7 +
 sddm/Makefile                                      |  43 +++++
 sddm/PLIST                                         | 177 +++++++++++++++++++++
 sddm/TODO                                          |   3 +
 sddm/distinfo                                      |  14 ++
 sddm/patches/patch-CMakeLists.txt                  |  25 +++
 sddm/patches/patch-src_daemon_CMakeLists.txt       |  26 +++
 sddm/patches/patch-src_daemon_DaemonApp.cpp        |  27 ++++
 sddm/patches/patch-src_daemon_VirtualTerminal.cpp  |  32 ++++
 .../patch-src_daemon_VirtualTerminal__FreeBSD.cpp  |  44 +++++
 .../patch-src_daemon_VirtualTerminal__NetBSD.cpp   |  44 +++++
 sddm/patches/patch-src_greeter_UserModel.cpp       |  15 ++
 sddm/patches/patch-src_helper_UserSession.cpp      |  46 ++++++
 14 files changed, 504 insertions(+)

diffs:
diff --git a/Makefile b/Makefile
index 205b65b905..66127967c0 100644
--- a/Makefile
+++ b/Makefile
@@ -4475,6 +4475,7 @@ SUBDIR+=	scummvm-git
 SUBDIR+=	scx
 SUBDIR+=	scythe
 SUBDIR+=	sdd
+SUBDIR+=	sddm
 SUBDIR+=	sdict-tools
 SUBDIR+=	sdif-git
 SUBDIR+=	sdl-hercules-crypto
diff --git a/sddm/DESCR b/sddm/DESCR
new file mode 100644
index 0000000000..bf87b6cebd
--- /dev/null
+++ b/sddm/DESCR
@@ -0,0 +1,7 @@
+SDDM is a modern display manager for X11 and Wayland aiming to be fast,
+simple and beautiful. It uses modern technologies like QtQuick, which in
+turn gives the designer the ability to create smooth, animated user interfaces.
+
+SDDM is extremely themeable. We put no restrictions on the user interface
+design, it is completely up to the designer. We simply provide a few callbacks
+to the user interface which can be used for authentication, suspend etc.
diff --git a/sddm/Makefile b/sddm/Makefile
new file mode 100644
index 0000000000..dd5da820ea
--- /dev/null
+++ b/sddm/Makefile
@@ -0,0 +1,43 @@
+# $NetBSD$
+
+DISTNAME=	sddm-0.18.1
+CATEGORIES=	x11
+MASTER_SITES=	${MASTER_SITE_GITHUB:=sddm/}
+GITHUB_RELEASE=	v${PKGVERSION_NOREV}
+EXTRACT_SUFX=	.tar.xz
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://github.com/sddm/sddm
+COMMENT=	QML based X11 and Wayland display manager
+LICENSE=	gnu-gpl-v2
+
+BUILD_DEPENDS+=	extra-cmake-modules-[0-9]*:../../devel/extra-cmake-modules
+
+USE_CMAKE=	yes
+USE_LANGUAGES=	c c++
+USE_TOOLS+=	pkg-config
+
+.if !exists(/etc/login.defs)
+CMAKE_ARGS+=	-DUID_MIN=1000
+CMAKE_ARGS+=	-DUID_MAX=65000
+.endif
+
+SUBST_CLASSES+=		paths
+SUBST_STAGE.paths=	pre-configure
+SUBST_MESSAGE.paths=	Fixing absolute paths.
+SUBST_FILES.paths+=	src/common/Configuration.h
+SUBST_FILES.paths+=	data/man/sddm.conf.rst.in
+SUBST_SED.paths+=	-e 's,/usr/bin/X,${X11BASE}/bin/X,g'
+SUBST_SED.paths+=	-e 's,/usr/bin/Xephyr,${X11BASE}/bin/Xephyr,g'
+SUBST_SED.paths+=	-e 's,/usr/bin/xauth,${X11BASE}/bin/xauth,g'
+SUBST_SED.paths+=	-e 's,/usr/share/xsessions,${PREFIX}/share/xsessions,g'
+SUBST_SED.paths+=	-e 's,/usr/share/wayland-sessions,${PREFIX}/share/wayland-sessions,g'
+SUBST_SED.paths+=	-e 's,/usr/local/bin,${PREFIX}/bin:/usr/local/bin,g'
+
+LDFLAGS.FreeBSD+=	-lutil
+LDFLAGS.NetBSD+=	-lutil
+
+.include "../../x11/libxcb/buildlink3.mk"
+.include "../../x11/qt5-qtbase/buildlink3.mk"
+.include "../../x11/qt5-qtdeclarative/buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/sddm/PLIST b/sddm/PLIST
new file mode 100644
index 0000000000..36a984cc6c
--- /dev/null
+++ b/sddm/PLIST
@@ -0,0 +1,177 @@
+@comment $NetBSD$
+bin/sddm
+bin/sddm-greeter
+libexec/sddm-helper
+qt5/qml/SddmComponents/Background.qml
+qt5/qml/SddmComponents/Button.qml
+qt5/qml/SddmComponents/Clock.qml
+qt5/qml/SddmComponents/ComboBox.qml
+qt5/qml/SddmComponents/ImageButton.qml
+qt5/qml/SddmComponents/LayoutBox.qml
+qt5/qml/SddmComponents/Menu.qml
+qt5/qml/SddmComponents/PasswordBox.qml
+qt5/qml/SddmComponents/PictureBox.qml
+qt5/qml/SddmComponents/TextBox.qml
+qt5/qml/SddmComponents/TextConstants.qml
+qt5/qml/SddmComponents/qmldir
+qt5/qml/SddmComponents/warning.png
+share/sddm/faces/.face.icon
+share/sddm/faces/root.face.icon
+share/sddm/flags/ae.png
+share/sddm/flags/am.png
+share/sddm/flags/ar.png
+share/sddm/flags/at.png
+share/sddm/flags/az.png
+share/sddm/flags/be.png
+share/sddm/flags/bg.png
+share/sddm/flags/bh.png
+share/sddm/flags/br.png
+share/sddm/flags/by.png
+share/sddm/flags/ca.png
+share/sddm/flags/ch.png
+share/sddm/flags/cu.png
+share/sddm/flags/cz.png
+share/sddm/flags/de.png
+share/sddm/flags/dj.png
+share/sddm/flags/dk.png
+share/sddm/flags/dz.png
+share/sddm/flags/ee.png
+share/sddm/flags/eg.png
+share/sddm/flags/es.png
+share/sddm/flags/eu.png
+share/sddm/flags/fi.png
+share/sddm/flags/fr.png
+share/sddm/flags/gb.png
+share/sddm/flags/ge.png
+share/sddm/flags/gr.png
+share/sddm/flags/hr.png
+share/sddm/flags/hu.png
+share/sddm/flags/il.png
+share/sddm/flags/in.png
+share/sddm/flags/iq.png
+share/sddm/flags/is.png
+share/sddm/flags/it.png
+share/sddm/flags/jo.png
+share/sddm/flags/jp.png
+share/sddm/flags/km.png
+share/sddm/flags/kr.png
+share/sddm/flags/kw.png
+share/sddm/flags/la.png
+share/sddm/flags/lb.png
+share/sddm/flags/lt.png
+share/sddm/flags/lv.png
+share/sddm/flags/ly.png
+share/sddm/flags/ma.png
+share/sddm/flags/mk.png
+share/sddm/flags/mn.png
+share/sddm/flags/mx.png
+share/sddm/flags/nl.png
+share/sddm/flags/no.png
+share/sddm/flags/om.png
+share/sddm/flags/pl.png
+share/sddm/flags/ps.png
+share/sddm/flags/pt.png
+share/sddm/flags/qa.png
+share/sddm/flags/qc.png
+share/sddm/flags/ro.png
+share/sddm/flags/ru.png
+share/sddm/flags/sa.png
+share/sddm/flags/sd.png
+share/sddm/flags/se.png
+share/sddm/flags/si.png
+share/sddm/flags/sk.png
+share/sddm/flags/so.png
+share/sddm/flags/sr.png
+share/sddm/flags/sy.png
+share/sddm/flags/th.png
+share/sddm/flags/tn.png
+share/sddm/flags/tr.png
+share/sddm/flags/ua.png
+share/sddm/flags/uk.png
+share/sddm/flags/un.png
+share/sddm/flags/us.png
+share/sddm/flags/uy.png
+share/sddm/flags/vn.png
+share/sddm/flags/ye.png
+share/sddm/flags/yu.png
+share/sddm/flags/zz.png
+share/sddm/scripts/Xsession
+share/sddm/scripts/Xsetup
+share/sddm/scripts/Xstop
+share/sddm/scripts/wayland-session
+share/sddm/themes/elarun/Main.qml
+share/sddm/themes/elarun/README
+share/sddm/themes/elarun/angle-down.png
+share/sddm/themes/elarun/elarun.jpg
+share/sddm/themes/elarun/images/background.png
+share/sddm/themes/elarun/images/lock.png
+share/sddm/themes/elarun/images/login_active.png
+share/sddm/themes/elarun/images/login_normal.png
+share/sddm/themes/elarun/images/rectangle.png
+share/sddm/themes/elarun/images/rectangle_overlay.png
+share/sddm/themes/elarun/images/session_normal.png
+share/sddm/themes/elarun/images/system_hibernate.png
+share/sddm/themes/elarun/images/system_reboot.png
+share/sddm/themes/elarun/images/system_shutdown.png
+share/sddm/themes/elarun/images/system_suspend.png
+share/sddm/themes/elarun/metadata.desktop
+share/sddm/themes/elarun/theme.conf
+share/sddm/themes/maldives/LICENSE
+share/sddm/themes/maldives/Main.qml
+share/sddm/themes/maldives/README
+share/sddm/themes/maldives/angle-down.png
+share/sddm/themes/maldives/background.jpg
+share/sddm/themes/maldives/maldives.jpg
+share/sddm/themes/maldives/metadata.desktop
+share/sddm/themes/maldives/rectangle.png
+share/sddm/themes/maldives/theme.conf
+share/sddm/themes/maya/LICENSE
+share/sddm/themes/maya/Main.qml
+share/sddm/themes/maya/README
+share/sddm/themes/maya/components/SpButton.qml
+share/sddm/themes/maya/components/SpClock.qml
+share/sddm/themes/maya/fonts/OpenSans_CondLight.ttf
+share/sddm/themes/maya/images/ic_arrow_drop_down_white_24px.svg
+share/sddm/themes/maya/images/ic_power_settings_new_white_24px.svg
+share/sddm/themes/maya/images/ic_refresh_white_24px.svg
+share/sddm/themes/maya/images/ic_warning_white_24px.svg
+share/sddm/themes/maya/metadata.desktop
+share/sddm/themes/maya/screenshots/hi_IN.png
+share/sddm/themes/maya/theme.conf
+share/sddm/translations/ar.qm
+share/sddm/translations/bn.qm
+share/sddm/translations/ca.qm
+share/sddm/translations/cs.qm
+share/sddm/translations/da.qm
+share/sddm/translations/de.qm
+share/sddm/translations/es.qm
+share/sddm/translations/et.qm
+share/sddm/translations/fi.qm
+share/sddm/translations/fr.qm
+share/sddm/translations/hi_IN.qm
+share/sddm/translations/hu.qm
+share/sddm/translations/is.qm
+share/sddm/translations/it.qm
+share/sddm/translations/ja.qm
+share/sddm/translations/kk.qm
+share/sddm/translations/ko.qm
+share/sddm/translations/lt.qm
+share/sddm/translations/lv.qm
+share/sddm/translations/nb.qm
+share/sddm/translations/nl.qm
+share/sddm/translations/nn.qm
+share/sddm/translations/pl.qm
+share/sddm/translations/pt_BR.qm
+share/sddm/translations/pt_PT.qm
+share/sddm/translations/ro.qm
+share/sddm/translations/ru.qm
+share/sddm/translations/sk.qm
+share/sddm/translations/sr.qm
+share/sddm/translations/sr%ijekavian.qm@localhost
+share/sddm/translations/sr%ijekavianlatin.qm@localhost
+share/sddm/translations/sr%latin.qm@localhost
+share/sddm/translations/sv.qm
+share/sddm/translations/tr.qm
+share/sddm/translations/uk.qm
+share/sddm/translations/zh_CN.qm
+share/sddm/translations/zh_TW.qm
diff --git a/sddm/TODO b/sddm/TODO
new file mode 100644
index 0000000000..3b7bd71ed1
--- /dev/null
+++ b/sddm/TODO
@@ -0,0 +1,3 @@
+It builds then dumps you into an empty X session with no ability to exit it.
+
+I can't debug this because I currently only have one computer.
diff --git a/sddm/distinfo b/sddm/distinfo
new file mode 100644
index 0000000000..ff54d06b7d
--- /dev/null
+++ b/sddm/distinfo
@@ -0,0 +1,14 @@
+$NetBSD$
+
+SHA1 (sddm-0.18.1.tar.xz) = ca4f453fd32e68faca437d66d9fbad59258c505c
+RMD160 (sddm-0.18.1.tar.xz) = bcd59920e4db4f263604cd47fb362e9b502983f5
+SHA512 (sddm-0.18.1.tar.xz) = ff0637600cda2f4da1f643f047f8ee822bd9651ae4ccbb614b9804175c97360ada7af93e07a7b63832f014ef6e7d1b5380ab2b8959f8024ea520fa5ff17efd60
+Size (sddm-0.18.1.tar.xz) = 3402972 bytes
+SHA1 (patch-CMakeLists.txt) = 03f41795b978eb186b61537fa7c63604127de16d
+SHA1 (patch-src_daemon_CMakeLists.txt) = 42c47a49f18b81eda28466a5919697b5aa7581e6
+SHA1 (patch-src_daemon_DaemonApp.cpp) = 12d86d2985cc3e96411d307ca4d724aae6494f13
+SHA1 (patch-src_daemon_VirtualTerminal.cpp) = ab1ea7a4543d47f6203c749f16dbd10a03d85b3a
+SHA1 (patch-src_daemon_VirtualTerminal__FreeBSD.cpp) = abaf6b2b21a8f4fc410714f9a0677733606b94c3
+SHA1 (patch-src_daemon_VirtualTerminal__NetBSD.cpp) = 1ddec9550a311dd602b913b288045e4819982fd7
+SHA1 (patch-src_greeter_UserModel.cpp) = 5e4deb3bc4d383d55c2125c058fadaf537ef80fb
+SHA1 (patch-src_helper_UserSession.cpp) = 4da90793d4d1b535562273a5f85c14e156973a9b
diff --git a/sddm/patches/patch-CMakeLists.txt b/sddm/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..30c90c0f7c
--- /dev/null
+++ b/sddm/patches/patch-CMakeLists.txt
@@ -0,0 +1,25 @@
+$NetBSD$
+
+shutdown commands are different on non-Linux.
+
+--- CMakeLists.txt.orig	2020-05-16 10:59:08.837532317 +0000
++++ CMakeLists.txt
+@@ -167,8 +167,16 @@ add_feature_info("elogind" ELOGIND_FOUND
+ 
+ # Default behaviour if neither systemd nor elogind is used
+ if (NOT ELOGIND_FOUND AND NOT SYSTEMD_FOUND)
+-    set(MINIMUM_VT 7)
+-    set(HALT_COMMAND "/sbin/shutdown -h -P now")
++    if (${CMAKE_SYSTEM} MATCHES "FreeBSD")
++        set(MINIMUM_VT 9)
++        set(HALT_COMMAND "/sbin/shutdown -p now")
++    elseif (${CMAKE_SYSTEM} MATCHES "NetBSD")
++        set(MINIMUM_VT 7)
++        set(HALT_COMMAND "/sbin/shutdown -p now")
++    else()
++        set(MINIMUM_VT 7)
++        set(HALT_COMMAND "/sbin/shutdown -h -P now")
++    endif()
+     set(REBOOT_COMMAND "/sbin/shutdown -r now")
+ endif()
+ 
diff --git a/sddm/patches/patch-src_daemon_CMakeLists.txt b/sddm/patches/patch-src_daemon_CMakeLists.txt
new file mode 100644
index 0000000000..fef8a9c23d
--- /dev/null
+++ b/sddm/patches/patch-src_daemon_CMakeLists.txt
@@ -0,0 +1,26 @@
+$NetBSD$
+
+Support FreeBSD and NetBSD.
+
+--- src/daemon/CMakeLists.txt.orig	2019-03-31 07:59:59.000000000 +0000
++++ src/daemon/CMakeLists.txt
+@@ -29,9 +29,18 @@ set(DAEMON_SOURCES
+     SeatManager.cpp
+     SignalHandler.cpp
+     SocketServer.cpp
+-    VirtualTerminal.cpp
+ )
+ 
++# Different implementations of the VT switching code
++# (where the FreeBSD version does nothing).
++if(${CMAKE_SYSTEM} MATCHES "FreeBSD")
++    list(APPEND DAEMON_SOURCES VirtualTerminal_FreeBSD.cpp)
++elseif(${CMAKE_SYSTEM} MATCHES "FreeBSD")
++    list(APPEND DAEMON_SOURCES VirtualTerminal_NetBSD.cpp)
++else()
++    list(APPEND DAEMON_SOURCES VirtualTerminal.cpp)
++endif()
++
+ qt5_add_dbus_adaptor(DAEMON_SOURCES "${CMAKE_SOURCE_DIR}/data/interfaces/org.freedesktop.DisplayManager.xml"          "DisplayManager.h" SDDM::DisplayManager)
+ qt5_add_dbus_adaptor(DAEMON_SOURCES "${CMAKE_SOURCE_DIR}/data/interfaces/org.freedesktop.DisplayManager.Seat.xml"     "DisplayManager.h" SDDM::DisplayManagerSeat)
+ qt5_add_dbus_adaptor(DAEMON_SOURCES "${CMAKE_SOURCE_DIR}/data/interfaces/org.freedesktop.DisplayManager.Session.xml"  "DisplayManager.h" SDDM::DisplayManagerSession)
diff --git a/sddm/patches/patch-src_daemon_DaemonApp.cpp b/sddm/patches/patch-src_daemon_DaemonApp.cpp
new file mode 100644
index 0000000000..a265383cbc
--- /dev/null
+++ b/sddm/patches/patch-src_daemon_DaemonApp.cpp
@@ -0,0 +1,27 @@
+$NetBSD$
+
+ConsoleKit is not started by the init system, so try to do it here.
+
+--- src/daemon/DaemonApp.cpp.orig	2019-03-31 07:59:59.000000000 +0000
++++ src/daemon/DaemonApp.cpp
+@@ -28,6 +28,9 @@
+ 
+ #include "MessageHandler.h"
+ 
++#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
++#include <QDBusConnectionInterface>
++#endif
+ #include <QDebug>
+ #include <QHostInfo>
+ #include <QTimer>
+@@ -49,6 +52,10 @@ namespace SDDM {
+         // set testing parameter
+         m_testing = (arguments().indexOf(QStringLiteral("--test-mode")) != -1);
+ 
++#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
++        QDBusConnection::systemBus().interface()->startService(QStringLiteral("org.freedesktop.ConsoleKit"));
++#endif
++
+         // create display manager
+         m_displayManager = new DisplayManager(this);
+ 
diff --git a/sddm/patches/patch-src_daemon_VirtualTerminal.cpp b/sddm/patches/patch-src_daemon_VirtualTerminal.cpp
new file mode 100644
index 0000000000..2f9d1eb21d
--- /dev/null
+++ b/sddm/patches/patch-src_daemon_VirtualTerminal.cpp
@@ -0,0 +1,32 @@
+$NetBSD$
+
+NetBSD support
+
+--- src/daemon/VirtualTerminal.cpp.orig	2018-09-26 19:03:47.000000000 +0000
++++ src/daemon/VirtualTerminal.cpp
+@@ -27,8 +27,12 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <signal.h>
++#if defined(Q_OS_NETBSD)
++#include <dev/wscons/wsdisplay_usl_io.h>
++#else
+ #include <linux/vt.h>
+ #include <linux/kd.h>
++#endif
+ #include <sys/ioctl.h>
+ 
+ #define RELEASE_DISPLAY_SIGNAL (SIGRTMAX)
+@@ -81,10 +85,12 @@ namespace SDDM {
+             if (getmodeReply.mode != VT_AUTO)
+                 goto out;
+ 
++#ifdef KDGETMODE
+             if (ioctl(fd, KDGETMODE, &kernelDisplayMode) < 0) {
+                 qWarning() << "Failed to query kernel display mode:" << strerror(errno);
+                 ok = false;
+             }
++#endif
+ 
+             if (kernelDisplayMode == KD_TEXT)
+                 goto out;
diff --git a/sddm/patches/patch-src_daemon_VirtualTerminal__FreeBSD.cpp b/sddm/patches/patch-src_daemon_VirtualTerminal__FreeBSD.cpp
new file mode 100644
index 0000000000..db31c6c786
--- /dev/null
+++ b/sddm/patches/patch-src_daemon_VirtualTerminal__FreeBSD.cpp
@@ -0,0 +1,44 @@
+$NetBSD$
+
+FreeBSD VirtualTerminal support.
+
+--- src/daemon/VirtualTerminal_FreeBSD.cpp.orig	2020-05-16 11:31:00.832245350 +0000
++++ src/daemon/VirtualTerminal_FreeBSD.cpp
+@@ -0,0 +1,37 @@
++/***************************************************************************
++* Copyright (c) 2015 Pier Luigi Fiorini <pierluigi.fiorini%gmail.com@localhost>
++*
++* This program is free software; you can redistribute it and/or modify
++* it under the terms of the GNU General Public License as published by
++* the Free Software Foundation; either version 2 of the License, or
++* (at your option) any later version.
++*
++* This program is distributed in the hope that it will be useful,
++* but WITHOUT ANY WARRANTY; without even the implied warranty of
++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++* GNU General Public License for more details.
++*
++* You should have received a copy of the GNU General Public License
++* along with this program; if not, write to the
++* Free Software Foundation, Inc.,
++* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++***************************************************************************/
++
++#include <QDebug>
++#include <QString>
++
++#include "VirtualTerminal.h"
++
++
++namespace SDDM {
++    namespace VirtualTerminal {
++        int setUpNewVt() {
++            qDebug() << "New VT is unsupported on FreeBSD";
++            return -1;
++        }
++
++        void jumpToVt(int vt, bool vt_auto) {
++            qDebug() << "Jumping to VT" << vt << "is unsupported on FreeBSD";
++        }
++    }
++}
diff --git a/sddm/patches/patch-src_daemon_VirtualTerminal__NetBSD.cpp b/sddm/patches/patch-src_daemon_VirtualTerminal__NetBSD.cpp
new file mode 100644
index 0000000000..c18bf97778
--- /dev/null
+++ b/sddm/patches/patch-src_daemon_VirtualTerminal__NetBSD.cpp
@@ -0,0 +1,44 @@
+$NetBSD$
+
+NetBSD VirtualTerminal support.
+
+--- src/daemon/VirtualTerminal_NetBSD.cpp.orig	2020-05-16 11:31:03.601398986 +0000
++++ src/daemon/VirtualTerminal_NetBSD.cpp
+@@ -0,0 +1,37 @@
++/***************************************************************************
++* Copyright (c) 2015 Pier Luigi Fiorini <pierluigi.fiorini%gmail.com@localhost>
++*
++* This program is free software; you can redistribute it and/or modify
++* it under the terms of the GNU General Public License as published by
++* the Free Software Foundation; either version 2 of the License, or
++* (at your option) any later version.
++*
++* This program is distributed in the hope that it will be useful,
++* but WITHOUT ANY WARRANTY; without even the implied warranty of
++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++* GNU General Public License for more details.
++*
++* You should have received a copy of the GNU General Public License
++* along with this program; if not, write to the
++* Free Software Foundation, Inc.,
++* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
++***************************************************************************/
++
++#include <QDebug>
++#include <QString>
++
++#include "VirtualTerminal.h"
++
++
++namespace SDDM {
++    namespace VirtualTerminal {
++        int setUpNewVt() {
++            qDebug() << "New VT is unsupported on NetBSD";
++            return -1;
++        }
++
++        void jumpToVt(int vt, bool vt_auto) {
++            qDebug() << "Jumping to VT" << vt << "is unsupported on NetBSD";
++        }
++    }
++}
diff --git a/sddm/patches/patch-src_greeter_UserModel.cpp b/sddm/patches/patch-src_greeter_UserModel.cpp
new file mode 100644
index 0000000000..c841ecd1d3
--- /dev/null
+++ b/sddm/patches/patch-src_greeter_UserModel.cpp
@@ -0,0 +1,15 @@
+$NetBSD$
+
+Rewind to the start of the password database.
+
+--- src/greeter/UserModel.cpp.orig	2019-03-31 07:59:59.000000000 +0000
++++ src/greeter/UserModel.cpp
+@@ -60,6 +60,8 @@ namespace SDDM {
+                 QFile::exists(themeDefaultFace) ? themeDefaultFace : defaultFace);
+ 
+         struct passwd *current_pw;
++
++        setpwent();
+         while ((current_pw = getpwent()) != nullptr) {
+ 
+             // skip entries with uids smaller than minimum uid
diff --git a/sddm/patches/patch-src_helper_UserSession.cpp b/sddm/patches/patch-src_helper_UserSession.cpp
new file mode 100644
index 0000000000..c4d56aa478
--- /dev/null
+++ b/sddm/patches/patch-src_helper_UserSession.cpp
@@ -0,0 +1,46 @@
+$NetBSD$
+
+Support FreeBSD and NetBSD.
+
+--- src/helper/UserSession.cpp.orig	2019-03-09 18:26:56.000000000 +0000
++++ src/helper/UserSession.cpp
+@@ -33,6 +33,9 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ #include <sched.h>
++#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
++#include <login_cap.h>
++#endif /* defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) */
+ 
+ namespace SDDM {
+     UserSession::UserSession(HelperApp *parent)
+@@ -130,6 +133,21 @@ namespace SDDM {
+ 
+         // switch user
+         const QByteArray username = qobject_cast<HelperApp*>(parent())->user().toLocal8Bit();
++#if defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD)
++        struct passwd *pw = getpwnam(username.constData());
++        /* execve() uses the environment prepared in Backend::openSession(),
++           therefore environment variables which are set here are ignored. */
++        if (setusercontext(NULL, pw, pw->pw_uid, LOGIN_SETALL) != 0) {
++            qCritical() << "setusercontext(NULL, *, " << pw->pw_uid << ", LOGIN_SETALL) failed for user: " << username;
++            exit(Auth::HELPER_OTHER_ERROR);
++        }
++        if (chdir(pw->pw_dir) != 0) {
++            qCritical() << "chdir(" << pw->pw_dir << ") failed for user: " << username;
++            qCritical() << "verify directory exist and has sufficient permissions";
++            exit(Auth::HELPER_OTHER_ERROR);
++        }
++        const QString homeDir = QString::fromLocal8Bit(pw->pw_dir);
++#else /* defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) */
+         struct passwd pw;
+         struct passwd *rpw;
+         long bufsize = sysconf(_SC_GETPW_R_SIZE_MAX);
+@@ -221,6 +239,7 @@ namespace SDDM {
+             exit(Auth::HELPER_OTHER_ERROR);
+         }
+         const QString homeDir = QString::fromLocal8Bit(pw.pw_dir);
++#endif /* defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) */
+ 
+         //we cannot use setStandardError file as this code is run in the child process
+         //we want to redirect after we setuid so that the log file is owned by the user


Home | Main Index | Thread Index | Old Index