Index: sysutils/consolekit2/Makefile =================================================================== --- sysutils/consolekit2/Makefile +++ sysutils/consolekit2/Makefile @@ -15,10 +15,13 @@ LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libdbus-1.so:devel/dbus \ - libpolkit-gobject-1.so:sysutils/polkit + libpolkit-gobject-1.so:sysutils/polkit \ + libdrm.so:graphics/libdrm \ + libevdev.so:devel/libevdev \ + libudev.so:devel/libudev-devd WRKSRC= ${WRKDIR}/ConsoleKit2-${PORTVERSION} -USES= gettext gmake libtool localbase pathfix pkgconfig tar:bzip2 +USES= gettext gnome gmake libtool localbase pathfix pkgconfig tar:bzip2 USE_CSTD= gnu99 USE_XORG= x11 USE_GNOME= glib20 libxslt introspection:build @@ -30,12 +33,12 @@ --localstatedir=/var \ --enable-polkit \ --enable-introspection \ + --enable-libdrm \ + --enable-libevdev \ + --enable-libudev \ --without-html-dir \ --disable-udev-acl \ --disable-libcgmanager \ - --disable-libdrm \ - --disable-libevdev \ - --disable-libudev \ --without-systemdsystemunitdir INSTALL_TARGET= install-strip Index: sysutils/consolekit2/files/patch-src_ck-device-udev.c =================================================================== --- /dev/null +++ sysutils/consolekit2/files/patch-src_ck-device-udev.c @@ -0,0 +1,30 @@ +How CK sees our drm devices: +major 1 minor 104 subsystem # sysname 0 devnode /dev/drm/0 active ? TRUE + +(seems like symlinks get resolved) + +--- src/ck-device-udev.c.orig 2017-06-02 01:31:44 UTC ++++ src/ck-device-udev.c +@@ -391,13 +391,16 @@ ck_device_new (guint major, + /* Start with other device as a default, we have special things + * we do with DRM and EVDEV devices so find and tag them */ + device->category = DEVICE_OTHER; +- if (g_strcmp0 (subsystem, "drm") == 0) ++ if ((g_strcmp0 (subsystem, "drm") == 0 && g_str_has_prefix (sysname, "card")) ++#ifndef __linux__ ++ /* on BSD, the dri/card0 -> drm/0 symlink gets resolved, ++ * and subsystem is not emulated by libudev-devd */ ++ || strstr (device->devnode, "drm") != NULL ++#endif ++ ) + { +- if (g_str_has_prefix (sysname, "card")) +- { +- g_debug ("DEVICE_DRM"); +- device->category = DEVICE_DRM; +- } ++ g_debug ("DEVICE_DRM"); ++ device->category = DEVICE_DRM; + } + else if (g_strcmp0 (subsystem, "input") == 0) + { Index: sysutils/consolekit2/files/patch-src_ck-session.c =================================================================== --- /dev/null +++ sysutils/consolekit2/files/patch-src_ck-session.c @@ -0,0 +1,68 @@ +See https://github.com/ConsoleKit2/ConsoleKit2/pull/116 + +--- src/ck-session.c.orig 2017-07-24 14:47:48 UTC ++++ src/ck-session.c +@@ -54,6 +54,10 @@ + #include + #endif + ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++#include ++#endif ++ + #include + #include + #include +@@ -1482,6 +1486,16 @@ ck_session_setup_vt_signal (CkSession *session, + return; + } + ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++ /* Put the tty into raw mode */ ++ struct termios tios; ++ if (tcgetattr (session->priv->tty_fd, &tios)) ++ g_warning ("Failed to get terminal attributes"); ++ cfmakeraw (&tios); ++ if (tcsetattr (session->priv->tty_fd, TCSAFLUSH, &tios)) ++ g_warning ("Failed to set terminal attributes"); ++#endif ++ + session->priv->sig_watch_s1 = g_unix_signal_add_full (G_PRIORITY_HIGH, + SIGUSR1, + (GSourceFunc)vt_leave_handler, +@@ -1551,6 +1565,19 @@ ck_session_controller_cleanup (CkSession *session) + } + #endif /* defined(KDSKBMODE) */ + ++#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) ++ /* Restore sane mode */ ++ struct termios tios; ++ if (tcgetattr (session->priv->tty_fd, &tios)) { ++ g_warning ("Failed to get terminal attributes"); ++ } else { ++ cfmakesane (&tios); ++ if (tcsetattr (session->priv->tty_fd, TCSAFLUSH, &tios)) { ++ g_warning ("Failed to set terminal attributes"); ++ } ++ } ++#endif ++ + if (ioctl (session->priv->tty_fd, VT_SETMODE, &mode) < 0) { + g_warning ("failed to return control of vt handling"); + } +@@ -1701,6 +1728,15 @@ ck_session_get_device (CkSession *session, + for (iter = session->priv->devices; iter != NULL; iter = g_list_next (iter)) { + if (ck_device_compare (iter->data, major, minor)) { + g_debug ("found device"); ++ CkDevice *device = CK_DEVICE (iter->data); ++ if (ck_device_get_category(device) == DEVICE_EVDEV) { ++ struct stat st; ++ if (fstat(ck_device_get_fd(device), &st) == -1 && errno == EBADF) { ++ g_debug ("but it was a dead input device, removing"); ++ session->priv->devices = g_list_remove (session->priv->devices, device); ++ return NULL; ++ } ++ } + return iter->data; + } + }