Introduce weston-launch

weston-launch starts weston and provides mechanism
for weston to set/drop drm master, open a tty,
and read input devices without being root.

Execution is allowed for local-active sessions
or users in the group weston-launch.
diff --git a/src/compositor-drm.c b/src/compositor-drm.c
index 5747662..27533ba 100644
--- a/src/compositor-drm.c
+++ b/src/compositor-drm.c
@@ -39,6 +39,7 @@
 
 #include "compositor.h"
 #include "evdev.h"
+#include "launcher-util.h"
 
 struct drm_compositor {
 	struct weston_compositor base;
@@ -1449,7 +1450,8 @@
 
 	gbm_device_destroy(d->gbm);
 	destroy_sprites(d);
-	drmDropMaster(d->drm.fd);
+	if (weston_launcher_drm_set_master(&d->base, d->drm.fd, 0) < 0)
+		fprintf(stderr, "failed to drop master: %m\n");
 	tty_destroy(d->tty);
 
 	free(d);
@@ -1489,7 +1491,7 @@
 	switch (event) {
 	case TTY_ENTER_VT:
 		compositor->focus = 1;
-		if (drmSetMaster(ec->drm.fd)) {
+		if (weston_launcher_drm_set_master(&ec->base, ec->drm.fd, 1)) {
 			fprintf(stderr, "failed to set master: %m\n");
 			wl_display_terminate(compositor->wl_display);
 		}
@@ -1529,7 +1531,7 @@
 		wl_list_for_each(input, &compositor->input_device_list, link)
 			evdev_remove_devices(input);
 
-		if (drmDropMaster(ec->drm.fd) < 0)
+		if (weston_launcher_drm_set_master(&ec->base, ec->drm.fd, 0) < 0)
 			fprintf(stderr, "failed to drop master: %m\n");
 
 		break;