Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Feb 2017 16:19:13 +0000 (UTC)
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r433888 - in head/x11-toolkits: . wcl wcl/files
Message-ID:  <201702111619.v1BGJDYY050963@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bapt
Date: Sat Feb 11 16:19:13 2017
New Revision: 433888
URL: https://svnweb.freebsd.org/changeset/ports/433888

Log:
  Wayland compositor library
  
  WWW: https://github.com/Cloudef/wlc

Added:
  head/x11-toolkits/wcl/
  head/x11-toolkits/wcl/Makefile   (contents, props changed)
  head/x11-toolkits/wcl/distinfo   (contents, props changed)
  head/x11-toolkits/wcl/files/
  head/x11-toolkits/wcl/files/patch-src_session_fd.c   (contents, props changed)
  head/x11-toolkits/wcl/files/patch-src_session_tty.c   (contents, props changed)
  head/x11-toolkits/wcl/pkg-descr   (contents, props changed)
  head/x11-toolkits/wcl/pkg-plist   (contents, props changed)
Modified:
  head/x11-toolkits/Makefile

Modified: head/x11-toolkits/Makefile
==============================================================================
--- head/x11-toolkits/Makefile	Sat Feb 11 16:10:17 2017	(r433887)
+++ head/x11-toolkits/Makefile	Sat Feb 11 16:19:13 2017	(r433888)
@@ -282,6 +282,7 @@
     SUBDIR += vte290
     SUBDIR += vte3
     SUBDIR += vtkfox
+    SUBDIR += wcl
     SUBDIR += wmapp
     SUBDIR += wxgtk28
     SUBDIR += wxgtk28-common

Added: head/x11-toolkits/wcl/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-toolkits/wcl/Makefile	Sat Feb 11 16:19:13 2017	(r433888)
@@ -0,0 +1,40 @@
+# $FreeBSD$
+
+PORTNAME=	wlc
+PORTVERSION=	0.0.5
+CATEGORIES=	x11-toolkits wayland
+
+MAINTAINER=	x11@FreeBSD.org
+COMMENT=	Wayland compositor library
+
+LICENSE=	MIT
+LICENSE_FILES=	${WRKSRC}/LISENSE
+
+BUILD_DEPENDS=	wayland-protocols>=0:graphics/wayland-protocols
+LIB_DEPENDS=	libxkbcommon.so:x11/libxkbcommon \
+		libxcb-ewmh.so:x11/xcb-util-wm \
+		libwayland-server.so:graphics/wayland \
+		libdrm.so:graphics/libdrm \
+		libudev.so:devel/libudev-devd \
+		libinput.so:x11/libinput \
+		libxcb-image.so:x11/xcb-util-image
+
+RUN_DEPENDS=	xkeyboard-config>=0:x11/xkeyboard-config
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	cloudef
+GH_TAGNAME=	fa780ce
+GH_TUPLE=	cloudef:chck:3f27d2a:chck
+
+USES=		cmake gnome localbase pkgconfig pathfix
+USE_XORG=	pixman x11 xcb xcursor xfixes
+USE_GL=		egl gbm glesv2
+USE_GNOME=	cairo
+
+USE_LDCONFIG=	yes
+
+post-extract:
+	@${RM} -r ${WRKSRC}/lib/chck
+	@${LN} -s ${WRKSRC_chck} ${WRKSRC}/lib/chck
+
+.include <bsd.port.mk>

Added: head/x11-toolkits/wcl/distinfo
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-toolkits/wcl/distinfo	Sat Feb 11 16:19:13 2017	(r433888)
@@ -0,0 +1,5 @@
+TIMESTAMP = 1486829262
+SHA256 (cloudef-wlc-0.0.5-fa780ce_GH0.tar.gz) = bf22b99b52cc2fb4ecc27da90ee47f516f8d5d1a02afdc495488c14d01788bc8
+SIZE (cloudef-wlc-0.0.5-fa780ce_GH0.tar.gz) = 120603
+SHA256 (cloudef-chck-3f27d2a_GH0.tar.gz) = fa3765dbaad52e968aae8b9a06a8ace24fab0d9ca53cc08a1f5543ff33959ebd
+SIZE (cloudef-chck-3f27d2a_GH0.tar.gz) = 119955

Added: head/x11-toolkits/wcl/files/patch-src_session_fd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-toolkits/wcl/files/patch-src_session_fd.c	Sat Feb 11 16:19:13 2017	(r433888)
@@ -0,0 +1,48 @@
+--- src/session/fd.c.orig	2016-08-19 13:28:50 UTC
++++ src/session/fd.c
+@@ -10,7 +10,9 @@
+ #include <sys/select.h>
+ #include <sys/socket.h>
+ #include <sys/types.h>
++#if !defined(__FreeBSD__)
+ #include <linux/major.h>
++#endif
+ #include <xf86drm.h>
+ #include "internal.h"
+ #include "macros.h"
+@@ -135,7 +137,7 @@ recv_fd(int sock, int *out_fd, void *out
+       return read;
+ 
+    if (message.msg_controllen == 0)
+-   	  return read;
++      return read;
+ 
+    if (!(cmsg = CMSG_FIRSTHDR(&message)))
+       return read;
+@@ -171,6 +173,7 @@ fd_open(const char *path, int flags, enu
+    }
+ 
+    /* we will only open allowed paths */
++#if !defined(__FreeBSD__)
+ #define FILTER(x, m) { x, (sizeof(x) > 32 ? 32 : sizeof(x)) - 1, m }
+    static struct {
+       const char *base;
+@@ -186,14 +189,15 @@ fd_open(const char *path, int flags, enu
+       wlc_log(WLC_LOG_WARN, "Denying open from: %s", path);
+       return -1;
+    }
++#endif
+ 
+    struct stat st;
+    if (stat(path, &st) < 0)
+-	  return -1;
++      return -1;
+ 
+-#ifdef __linux__
++#if !defined(__FreeBSD__)
+    if (major(st.st_rdev) != allow[type].major)
+-   	  return -1;
++      return -1;
+ #endif
+ 
+    int fd;

Added: head/x11-toolkits/wcl/files/patch-src_session_tty.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-toolkits/wcl/files/patch-src_session_tty.c	Sat Feb 11 16:19:13 2017	(r433888)
@@ -0,0 +1,165 @@
+--- src/session/tty.c.orig	2016-08-19 13:28:50 UTC
++++ src/session/tty.c
+@@ -9,27 +9,18 @@
+ #include "internal.h"
+ #include "tty.h"
+ 
+-#if defined(__linux__)
+-#  define TTY_BASENAME "/dev/tty"
+-#  define TTY_0        "/dev/tty0"
+-#  include <linux/kd.h>
+-#  include <linux/major.h>
+-#  include <linux/vt.h>
+-#elif defined(__FreeBSD__)
++#if defined(__FreeBSD__)
++#  include <termios.h>
+ #  include <sys/consio.h>
+ #  include <sys/kbio.h>
+ #  define TTY_BASENAME    "/dev/ttyv"
+ #  define TTY_0           "/dev/ttyv0"
+-#  define TTY_MAJOR       0
+-#  define VT_GETSTATE	  0x5603
+-#  define VT_ACTIVATE	  0x5606
+-#  define K_UNICODE       0x03
+-#  define K_OFF           0x04
+-struct vt_stat {
+-    unsigned short v_active;    /* active vt */
+-    unsigned short v_signal;	/* signal to send */
+-    unsigned short v_state;	/* vt bitmask */
+-};
++#else
++#  include <linux/kd.h>
++#  include <linux/major.h>
++#  include <linux/vt.h>
++#  define TTY_BASENAME "/dev/tty"
++#  define TTY_0        "/dev/tty0"
+ #endif
+ 
+ #ifndef KDSKBMUTE
+@@ -100,22 +91,22 @@ open_tty(int vt)
+ }
+ 
+ static bool
+-setup_tty(int fd, bool replace_vt)
++setup_tty(int fd, int vt, bool replace_vt)
+ {
+    if (fd < 0)
+       return false;
+ 
++#if defined(__FreeBSD__)
++   wlc.vt = vt+1;
++#else
+    struct stat st;
+    if (fstat(fd, &st) == -1)
+       die("Could not stat tty fd");
+-
+    wlc.vt = minor(st.st_rdev);
+-
+    if (major(st.st_rdev) != TTY_MAJOR || wlc.vt == 0)
+       die("Not a valid vt");
++#endif
+ 
+-/* FreeBSD's new vt is still missing some bits */
+-#if defined(__linux__)
+    if (!replace_vt) {
+       int kd_mode;
+       if (ioctl(fd, KDGETMODE, &kd_mode) == -1)
+@@ -125,18 +116,20 @@ setup_tty(int fd, bool replace_vt)
+          die("vt%d is already in graphics mode (%d). Is another display server running?", wlc.vt, kd_mode);
+    }
+ 
++#if defined(__FreeBSD__)
++   ioctl(fd, VT_GETACTIVE, &wlc.old_state.vt);
++#else
+    struct vt_stat state;
+    if (ioctl(fd, VT_GETSTATE, &state) == -1)
+       die("Could not get current vt");
+-
+    wlc.old_state.vt = state.v_active;
++#endif
+ 
+    if (ioctl(fd, VT_ACTIVATE, wlc.vt) == -1)
+       die("Could not activate vt%d", wlc.vt);
+ 
+    if (ioctl(fd, VT_WAITACTIVE, wlc.vt) == -1)
+       die("Could not wait for vt%d to become active", wlc.vt);
+-#endif
+ 
+    if (ioctl(fd, KDGKBMODE, &wlc.old_state.kb_mode) == -1)
+       die("Could not get keyboard mode");
+@@ -144,7 +137,19 @@ setup_tty(int fd, bool replace_vt)
+    // vt will be restored from now on
+    wlc.tty = fd;
+ 
+-#if defined(__linux__)
++#if defined(__FreeBSD__)
++   if (ioctl(fd, KDSKBMODE, K_CODE) == -1) {
++      wlc_tty_terminate();
++      die("Could not set keyboard mode to K_CODE");
++   }
++   /* Put the tty into raw mode */
++   struct termios tios;
++   if (tcgetattr(fd, &tios))
++      die("Failed to get terminal attribute");
++   cfmakeraw(&tios);
++   if (tcsetattr(fd, TCSANOW, &tios))
++      die("Failed to set terminal attribute");
++#else
+    if (ioctl(fd, KDSKBMUTE, 1) == -1 && ioctl(fd, KDSKBMODE, K_OFF) == -1) {
+       wlc_tty_terminate();
+       die("Could not set keyboard mode to K_OFF");
+@@ -156,18 +161,19 @@ setup_tty(int fd, bool replace_vt)
+       die("Could not set console mode to KD_GRAPHICS");
+    }
+ 
+-#if defined(__linux__)
+    struct vt_mode mode = {
+       .mode = VT_PROCESS,
+       .relsig = SIGUSR1,
+       .acqsig = SIGUSR2
+    };
++#if defined(__FreeBSD__)
++   mode.frsig = SIGIO; /* not used, but has to be set anyway */
++#endif
+ 
+    if (ioctl(fd, VT_SETMODE, &mode) == -1) {
+       wlc_tty_terminate();
+       die("Could not set vt%d mode", wlc.vt);
+    }
+-#endif
+ 
+    return true;
+ }
+@@ -230,13 +236,19 @@ wlc_tty_terminate(void)
+       // The ACTIVATE / WAITACTIVE may be potentially bad here.
+       // However, we need to make sure the vt we initially opened is also active on cleanup.
+       // We can't make sure this is synchronized due to unclean exits.
++
+       if (ioctl(wlc.tty, VT_ACTIVATE, wlc.vt) != -1 && ioctl(wlc.tty, VT_WAITACTIVE, wlc.vt) != -1) {
+          wlc_log(WLC_LOG_INFO, "Restoring vt %d (0x%lx) (fd %d)", wlc.vt, wlc.old_state.kb_mode, wlc.tty);
+ 
+-         if (ioctl(wlc.tty, KDSKBMUTE, 0) == -1 &&
+-             ioctl(wlc.tty, KDSKBMODE, wlc.old_state.kb_mode) == -1 &&
+-             ioctl(wlc.tty, KDSKBMODE, K_UNICODE) == -1)
+-            wlc_log(WLC_LOG_ERROR, "Failed to restore vt%d KDSKMODE", wlc.vt);
++#if defined(__FreeBSD__)
++         if (ioctl(wlc.tty, KDSKBMODE, wlc.old_state.kb_mode) == -1 &&
++             ioctl(wlc.tty, KDSKBMODE, K_XLATE) == -1)
++#else
++            if (ioctl(wlc.tty, KDSKBMUTE, 0) == -1 &&
++                ioctl(wlc.tty, KDSKBMODE, wlc.old_state.kb_mode) == -1 &&
++                ioctl(wlc.tty, KDSKBMODE, K_UNICODE) == -1)
++#endif
++               wlc_log(WLC_LOG_ERROR, "Failed to restore vt%d KDSKMODE", wlc.vt);
+ 
+          if (ioctl(wlc.tty, KDSETMODE, KD_TEXT) == -1)
+             wlc_log(WLC_LOG_ERROR, "Failed to restore vt%d mode to VT_AUTO", wlc.vt);
+@@ -271,7 +283,7 @@ wlc_tty_init(int vt)
+    if (!vt && !(vt = find_vt(getenv("XDG_VTNR"), &replace_vt)))
+       die("Could not find vt");
+ 
+-   if (!setup_tty(open_tty(vt), replace_vt))
++   if (!setup_tty(open_tty(vt), vt, replace_vt))
+       die("Could not open tty with vt%d", vt);
+ 
+    struct sigaction action = {

Added: head/x11-toolkits/wcl/pkg-descr
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-toolkits/wcl/pkg-descr	Sat Feb 11 16:19:13 2017	(r433888)
@@ -0,0 +1,3 @@
+Wayland compositor library
+
+WWW: https://github.com/Cloudef/wlc

Added: head/x11-toolkits/wcl/pkg-plist
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11-toolkits/wcl/pkg-plist	Sat Feb 11 16:19:13 2017	(r433888)
@@ -0,0 +1,9 @@
+include/wlc/defines.h
+include/wlc/geometry.h
+include/wlc/wlc-render.h
+include/wlc/wlc-wayland.h
+include/wlc/wlc.h
+lib/libwlc.so
+lib/libwlc.so.0
+lib/libwlc.so.0.0.5
+libdata/pkgconfig/wlc.pc



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201702111619.v1BGJDYY050963>