--- b/graphics/wayland/Makefile +++ b/graphics/wayland/Makefile @@ -1,25 +1,8 @@ # Created by: kwm@FreeBSD.org # $FreeBSD$ -# NOTE -# Changes made by kwm to use kevent instead of epoll -# are still in place. However, since libinput depends -# on libepoll-shim the simplest to do was to have Wayland -# also use it. Currently build will fail if epoll-shim -# is not available but can be built without epoll-shim -# if EPOLLSHIM_LIBS is cleared (configure.ac) -# -# TODO: Add condition for this in configure -# -# If we want to build Wayland with kwm's kevent patches -# and use epoll-shim for libinput we have to change it -# so that Wayland ignore epoll headers installed by -# epoll-shim. -# Maybe best is to use epoll-shim if it is good enough -# and keep diff with upstream minimal. - PORTNAME= wayland -PORTVERSION= 1.13.0 +PORTVERSION= 1.14.0 CATEGORIES= graphics wayland MASTER_SITES= http://wayland.freedesktop.org/releases/ @@ -30,8 +13,8 @@ LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libexpat.so:textproc/expat2 \ - libffi.so:devel/libffi \ - libepoll-shim.so:devel/libepoll-shim + libffi.so:devel/libffi \ + libepoll-shim.so:devel/libepoll-shim CFLAGS+= "-I${LOCALBASE}/include/libepoll-shim" @@ -42,6 +25,7 @@ USE_GNOME= libxslt:build USE_LDCONFIG= yes GNU_CONFIGURE= yes CONFIGURE_ARGS= --disable-documentation +CONFIGURE_ENV= ac_cv_func_posix_fallocate=no # EINVAL for many FS on 12.0 INSTALL_TARGET= install-strip .include --- b/graphics/wayland/distinfo +++ b/graphics/wayland/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1493984926 -SHA256 (wayland-1.13.0.tar.xz) = 69b052c031a61e89af7cc8780893d0da1e301492352aa449dee9345043e6fe51 -SIZE (wayland-1.13.0.tar.xz) = 414508 +TIMESTAMP = 1507715269 +SHA256 (wayland-1.14.0.tar.xz) = ed80cabc0961a759a42092e2c39aabfc1ec9a13c86c98bbe2b812f008da27ab8 +SIZE (wayland-1.14.0.tar.xz) = 413960 --- b/graphics/wayland/files/patch-Makefile.am +++ b/graphics/wayland/files/patch-Makefile.am @@ -1,4 +1,4 @@ ---- Makefile.am.orig 2017-05-05 11:54:01 UTC +--- Makefile.am.orig 2017-12-09 20:53:25 UTC +++ Makefile.am @@ -73,7 +73,7 @@ nodist_include_HEADERS = \ protocol/wayland-client-protocol.h --- b/graphics/wayland/files/patch-configure.ac +++ b/graphics/wayland/files/patch-configure.ac @@ -1,16 +1,13 @@ ---- configure.ac.orig 2016-06-01 00:11:10 UTC +--- configure.ac.orig 2017-08-08 18:20:52 UTC +++ configure.ac -@@ -63,6 +63,28 @@ AC_SUBST(GCC_CFLAGS) +@@ -63,6 +63,25 @@ AC_SUBST(GCC_CFLAGS) AC_CHECK_FUNCS([accept4 mkostemp posix_fallocate]) +AC_CHECK_HEADERS([sys/signalfd.h sys/timerfd.h]) + -+# Use epoll on Linux or kqueue on BSD -+AC_CHECK_HEADERS([sys/epoll.h sys/event.h]) -+if test "x$ac_cv_header_sys_epoll_h" != "xyes" && test "x$ac_cv_header_sys_event_h" != "xyes"; then -+ AC_MSG_ERROR([Can't find sys/epoll.h or sys/event.h. Please ensure either epoll or kqueue is available.]) -+fi ++# Use epoll on Linux and epoll-shim (kqueue) on BSD ++AC_CHECK_HEADERS([sys/epoll.h]) + +# Credential support on FreeBSD +AC_CHECK_HEADERS([sys/ucred.h]) @@ -29,7 +26,7 @@ AC_ARG_ENABLE([libraries], [AC_HELP_STRING([--disable-libraries], [Disable compilation of wayland libraries])], -@@ -98,11 +120,12 @@ AC_SUBST([ICONDIR]) +@@ -98,17 +117,21 @@ AC_SUBST([ICONDIR]) if test "x$enable_libraries" = "xyes"; then PKG_CHECK_MODULES(FFI, [libffi]) @@ -44,13 +41,12 @@ [[#include ]]) AC_CHECK_DECL(CLOCK_MONOTONIC,[], [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile wayland libraries")], -@@ -110,6 +133,9 @@ if test "x$enable_libraries" = "xyes"; t + [[#include ]]) AC_CHECK_HEADERS([execinfo.h]) fi - ++ +EPOLLSHIM_LIBS="-lepoll-shim" +AC_SUBST(EPOLLSHIM_LIBS) -+ + PKG_CHECK_MODULES(EXPAT, [expat], [], [AC_CHECK_HEADERS(expat.h, [], - [AC_MSG_ERROR([Can't find expat.h. Please install expat.])]) --- b/graphics/wayland/files/patch-src_wayland-os.c +++ b/graphics/wayland/files/patch-src_wayland-os.c @@ -1,6 +1,6 @@ ---- src/wayland-os.c.orig 2015-07-06 19:38:51 UTC +--- src/wayland-os.c.orig 2017-08-08 18:20:52 UTC +++ src/wayland-os.c -@@ -25,14 +25,20 @@ +@@ -25,6 +25,8 @@ #define _GNU_SOURCE @@ -9,20 +9,15 @@ #include #include #include - #include +@@ -32,7 +34,6 @@ #include -+#ifdef HAVE_SYS_EPOLL_H #include -+#endif -+#ifdef HAVE_SYS_EVENT_H -+#include -+#endif -#include "../config.h" #include "wayland-os.h" static int -@@ -62,26 +68,50 @@ wl_os_socket_cloexec(int domain, int typ +@@ -62,26 +63,50 @@ wl_os_socket_cloexec(int domain, int type, int protoco { int fd; @@ -73,7 +68,7 @@ newfd = fcntl(fd, F_DUPFD, minfd); return set_cloexec_or_close(newfd); -@@ -123,15 +153,18 @@ wl_os_recvmsg_cloexec(int sockfd, struct +@@ -123,15 +148,18 @@ wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, { ssize_t len; @@ -92,22 +87,10 @@ int wl_os_epoll_create_cloexec(void) { -@@ -148,6 +181,19 @@ wl_os_epoll_create_cloexec(void) +@@ -148,6 +176,7 @@ wl_os_epoll_create_cloexec(void) fd = epoll_create(1); return set_cloexec_or_close(fd); } -+#endif -+ -+#ifdef HAVE_SYS_EVENT_H -+int -+wl_os_kqueue_create_cloexec(void) -+{ -+ int fd; -+ -+ fd = kqueue(); -+ -+ return set_cloexec_or_close(fd); -+} +#endif int --- b/graphics/wayland/files/patch-src_wayland-os.h +++ b/graphics/wayland/files/patch-src_wayland-os.h @@ -1,6 +1,6 @@ ---- src/wayland-os.h.orig 2015-07-06 19:38:51 UTC +--- src/wayland-os.h.orig 2017-08-08 18:20:52 UTC +++ src/wayland-os.h -@@ -30,13 +30,25 @@ int +@@ -30,6 +30,9 @@ int wl_os_socket_cloexec(int domain, int type, int protocol); int @@ -10,19 +10,3 @@ wl_os_dupfd_cloexec(int fd, long minfd); ssize_t - wl_os_recvmsg_cloexec(int sockfd, struct msghdr *msg, int flags); - -+/* FIXME? not sure if this will work in this header like this ... -+ though seems build only header perhaps? */ -+#ifdef HAVE_SYS_EPOLL_H - int - wl_os_epoll_create_cloexec(void); -+#endif -+ -+#ifdef HAVE_SYS_EVENT_H -+int -+wl_os_kqueue_create_cloexec(void); -+#endif - - int - wl_os_accept_cloexec(int sockfd, struct sockaddr *addr, socklen_t *addrlen); --- b/graphics/wayland/files/patch-src_wayland-server.c +++ b/graphics/wayland/files/patch-src_wayland-server.c @@ -1,4 +1,4 @@ ---- src/wayland-server.c.orig 2017-02-07 22:59:06 UTC +--- src/wayland-server.c.orig 2017-08-08 18:20:52 UTC +++ src/wayland-server.c @@ -25,6 +25,8 @@ @@ -21,7 +21,7 @@ #include "wayland-util.h" #include "wayland-private.h" #include "wayland-server.h" -@@ -79,7 +86,13 @@ struct wl_client { +@@ -77,7 +84,13 @@ struct wl_client { struct wl_list link; struct wl_map objects; struct wl_priv_signal destroy_signal; @@ -35,7 +35,7 @@ int error; struct wl_priv_signal resource_created_signal; }; -@@ -503,10 +516,20 @@ wl_client_create(struct wl_display *disp +@@ -501,10 +514,20 @@ wl_client_create(struct wl_display *display, int fd) if (!client->source) goto err_client; @@ -56,13 +56,13 @@ client->connection = wl_connection_create(fd); if (client->connection == NULL) -@@ -560,12 +583,23 @@ WL_EXPORT void +@@ -558,12 +581,23 @@ WL_EXPORT void wl_client_get_credentials(struct wl_client *client, pid_t *pid, uid_t *uid, gid_t *gid) { +#ifdef HAVE_SYS_UCRED_H + /* FreeBSD */ -+ if (pid) + if (pid) + *pid = 0; /* FIXME: not defined on FreeBSD */ + if (uid) + *uid = client->xucred.cr_uid; @@ -70,7 +70,7 @@ + *gid = client->xucred.cr_gid; +#else + /* Linux */ - if (pid) ++ if (pid) *pid = client->ucred.pid; if (uid) *uid = client->ucred.uid; --- b/graphics/wayland/files/patch-src_wayland-shm.c +++ b/graphics/wayland/files/patch-src_wayland-shm.c @@ -1,4 +1,4 @@ ---- src/wayland-shm.c.orig 2016-11-18 00:32:40 UTC +--- src/wayland-shm.c.orig 2017-08-08 18:20:52 UTC +++ src/wayland-shm.c @@ -30,6 +30,8 @@ @@ -45,7 +45,7 @@ if (data == MAP_FAILED) { wl_resource_post_error(pool->resource, WL_SHM_ERROR_INVALID_FD, -@@ -110,6 +124,10 @@ shm_pool_unref(struct wl_shm_pool *pool, +@@ -110,6 +124,10 @@ shm_pool_unref(struct wl_shm_pool *pool, bool external if (pool->internal_refcount + pool->external_refcount) return; @@ -56,7 +56,7 @@ munmap(pool->data, pool->size); free(pool); } -@@ -223,6 +241,73 @@ shm_pool_destroy(struct wl_client *clien +@@ -223,6 +241,73 @@ shm_pool_destroy(struct wl_client *client, struct wl_r wl_resource_destroy(resource); } @@ -130,7 +130,7 @@ static void shm_pool_resize(struct wl_client *client, struct wl_resource *resource, int32_t size) -@@ -284,7 +369,14 @@ shm_create_pool(struct wl_client *client +@@ -284,7 +369,14 @@ shm_create_pool(struct wl_client *client, struct wl_re "failed mmap fd %d", fd); goto err_free; } --- b/graphics/wayland/files/patch-tests_client-test.c +++ b/graphics/wayland/files/patch-tests_client-test.c @@ -1,4 +1,4 @@ ---- tests/client-test.c.orig 2015-07-06 19:38:51 UTC +--- tests/client-test.c.orig 2017-08-08 18:20:52 UTC +++ tests/client-test.c @@ -34,6 +34,7 @@ #include --- b/graphics/wayland/files/patch-tests_connection-test.c +++ b/graphics/wayland/files/patch-tests_connection-test.c @@ -1,4 +1,4 @@ ---- tests/connection-test.c.orig 2017-02-07 22:59:06 UTC +--- tests/connection-test.c.orig 2017-08-08 18:20:52 UTC +++ tests/connection-test.c @@ -37,6 +37,7 @@ #include --- b/graphics/wayland/files/patch-tests_event-loop-test.c +++ b/graphics/wayland/files/patch-tests_event-loop-test.c @@ -1,4 +1,4 @@ ---- tests/event-loop-test.c.orig 2016-10-22 16:23:10 UTC +--- tests/event-loop-test.c.orig 2017-08-08 18:20:52 UTC +++ tests/event-loop-test.c @@ -167,10 +167,10 @@ TEST(event_loop_signal) signal_callback, &got_it); @@ -14,7 +14,7 @@ assert(got_it == 1); wl_event_source_remove(source); -@@ -234,12 +234,20 @@ TEST(event_loop_timer) +@@ -234,11 +234,19 @@ TEST(event_loop_timer) source = wl_event_loop_add_timer(loop, timer_callback, &got_it); assert(source); @@ -29,12 +29,11 @@ + * See: http://unix.derkeiler.com/Mailing-Lists/FreeBSD/hackers/2012-07/msg00319.html */ + assert(wl_event_loop_dispatch(loop, 50) == 0); assert(got_it == 1); - ++ + /* Check it doesn't fire again. */ + got_it = 0; + assert(wl_event_loop_dispatch(loop, 20) == 0); + assert(!got_it); -+ + wl_event_source_remove(source); wl_event_loop_destroy(loop); - } --- b/graphics/wayland/files/patch-tests_os-wrappers-test.c +++ b/graphics/wayland/files/patch-tests_os-wrappers-test.c @@ -1,4 +1,4 @@ ---- tests/os-wrappers-test.c.orig 2016-10-22 16:23:10 UTC +--- tests/os-wrappers-test.c.orig 2017-08-08 18:20:52 UTC +++ tests/os-wrappers-test.c @@ -26,6 +26,8 @@ @@ -9,47 +9,7 @@ #include #include #include -@@ -38,7 +40,13 @@ - #include - #include - #include -+ -+#ifdef HAVE_SYS_EPOLL_H - #include -+#elif HAVE_SYS_EVENT_H -+#include -+#include -+#endif - - #include "wayland-private.h" - #include "test-runner.h" -@@ -55,8 +63,13 @@ static int wrapped_calls_fcntl; - static ssize_t (*real_recvmsg)(int, struct msghdr *, int); - static int wrapped_calls_recvmsg; - -+#ifdef HAVE_SYS_EPOLL_H - static int (*real_epoll_create1)(int); - static int wrapped_calls_epoll_create1; -+#elif HAVE_SYS_EVENT_H -+static int (*real_kqueue)(void); -+static int wrapped_calls_kqueue; -+#endif - - static void - init_fallbacks(int do_fallbacks) -@@ -65,7 +78,11 @@ init_fallbacks(int do_fallbacks) - real_socket = dlsym(RTLD_NEXT, "socket"); - real_fcntl = dlsym(RTLD_NEXT, "fcntl"); - real_recvmsg = dlsym(RTLD_NEXT, "recvmsg"); -+#ifdef HAVE_SYS_EPOLL_H - real_epoll_create1 = dlsym(RTLD_NEXT, "epoll_create1"); -+#elif HAVE_SYS_EVENT_H -+ real_kqueue = dlsym(RTLD_NEXT, "kqueue"); -+#endif - } - - __attribute__ ((visibility("default"))) int -@@ -73,10 +90,12 @@ socket(int domain, int type, int protoco +@@ -73,10 +75,12 @@ socket(int domain, int type, int protocol) { wrapped_calls_socket++; @@ -62,7 +22,7 @@ return real_socket(domain, type, protocol); } -@@ -89,10 +108,12 @@ fcntl(int fd, int cmd, ...) +@@ -89,10 +93,12 @@ fcntl(int fd, int cmd, ...) wrapped_calls_fcntl++; @@ -75,7 +35,7 @@ va_start(ap, cmd); arg = va_arg(ap, void*); -@@ -106,14 +127,17 @@ recvmsg(int sockfd, struct msghdr *msg, +@@ -106,10 +112,12 @@ recvmsg(int sockfd, struct msghdr *msg, int flags) { wrapped_calls_recvmsg++; @@ -88,28 +48,7 @@ return real_recvmsg(sockfd, msg, flags); } - -+#ifdef HAVE_SYS_EPOLL_H - __attribute__ ((visibility("default"))) int - epoll_create1(int flags) - { -@@ -127,6 +151,15 @@ epoll_create1(int flags) - - return real_epoll_create1(flags); - } -+#elif HAVE_SYS_EVENT_H -+__attribute__ ((visibility("default"))) int -+kqueue(void) -+{ -+ wrapped_calls_kqueue++; -+ -+ return real_kqueue(); -+} -+#endif - - static void - do_os_wrappers_socket_cloexec(int n) -@@ -156,12 +189,14 @@ TEST(os_wrappers_socket_cloexec) +@@ -156,12 +164,14 @@ TEST(os_wrappers_socket_cloexec) do_os_wrappers_socket_cloexec(0); } @@ -124,7 +63,7 @@ static void do_os_wrappers_dupfd_cloexec(int n) -@@ -195,11 +230,13 @@ TEST(os_wrappers_dupfd_cloexec) +@@ -195,11 +205,13 @@ TEST(os_wrappers_dupfd_cloexec) do_os_wrappers_dupfd_cloexec(0); } @@ -138,7 +77,7 @@ struct marshal_data { struct wl_connection *read_connection; -@@ -218,8 +255,7 @@ struct marshal_data { +@@ -218,8 +230,7 @@ struct marshal_data { static void setup_marshal_data(struct marshal_data *data) { @@ -148,7 +87,7 @@ data->read_connection = wl_connection_create(data->s[0]); assert(data->read_connection); -@@ -328,11 +364,13 @@ TEST(os_wrappers_recvmsg_cloexec) +@@ -328,11 +339,13 @@ TEST(os_wrappers_recvmsg_cloexec) do_os_wrappers_recvmsg_cloexec(0); } @@ -162,24 +101,3 @@ static void do_os_wrappers_epoll_create_cloexec(int n) -@@ -342,12 +380,20 @@ do_os_wrappers_epoll_create_cloexec(int - - nr_fds = count_open_fds(); - -+#ifdef HAVE_SYS_EPOLL_H - fd = wl_os_epoll_create_cloexec(); -+#elif HAVE_SYS_EVENT_H -+ fd = wl_os_kqueue_create_cloexec(); -+#endif - assert(fd >= 0); - - #ifdef EPOLL_CLOEXEC -+#ifdef HAVE_SYS_EPOLL_H - assert(wrapped_calls_epoll_create1 == n); - #else -+ assert(wrapped_calls_kqueue == n); -+#endif -+#else - printf("No epoll_create1.\n"); - #endif - --- b/graphics/wayland/files/patch-tests_queue-test.c +++ b/graphics/wayland/files/patch-tests_queue-test.c @@ -1,4 +1,4 @@ ---- tests/queue-test.c.orig 2016-10-22 16:23:10 UTC +--- tests/queue-test.c.orig 2017-08-08 18:20:52 UTC +++ tests/queue-test.c @@ -23,6 +23,8 @@ * SOFTWARE. --- b/graphics/wayland/files/patch-tests_sanity-test.c +++ b/graphics/wayland/files/patch-tests_sanity-test.c @@ -1,4 +1,4 @@ ---- tests/sanity-test.c.orig 2016-02-17 01:13:16 UTC +--- tests/sanity-test.c.orig 2017-08-08 18:20:52 UTC +++ tests/sanity-test.c @@ -92,7 +92,8 @@ FAIL_TEST(sanity_malloc_direct) TEST(disable_leak_checks) --- b/graphics/wayland/files/patch-tests_test-helpers.c +++ b/graphics/wayland/files/patch-tests_test-helpers.c @@ -1,4 +1,4 @@ ---- tests/test-helpers.c.orig 2015-07-06 19:38:51 UTC +--- tests/test-helpers.c.orig 2017-08-08 18:20:52 UTC +++ tests/test-helpers.c @@ -23,6 +23,12 @@ * SOFTWARE. --- b/graphics/wayland/files/patch-tests_test-runner.c +++ b/graphics/wayland/files/patch-tests_test-runner.c @@ -1,4 +1,4 @@ ---- tests/test-runner.c.orig 2016-11-18 00:32:40 UTC +--- tests/test-runner.c.orig 2017-08-08 18:20:52 UTC +++ tests/test-runner.c @@ -25,6 +25,12 @@ @@ -13,7 +13,7 @@ #include #include #include -@@ -37,18 +43,35 @@ +@@ -37,19 +43,36 @@ #include #include #include @@ -39,16 +39,17 @@ static void* (*sys_realloc)(void*, size_t); static void* (*sys_calloc)(size_t, size_t); +#endif -+ + +#ifdef __FreeBSD__ +/* XXX review ptrace() usage */ +#define PTRACE_ATTACH PT_ATTACH +#define PTRACE_CONT PT_CONTINUE +#define PTRACE_DETACH PT_DETACH +#endif - ++ /* when set to 1, check if tests are not leaking memory and opened files. * It is turned on by default. It can be turned off by + * WAYLAND_TEST_NO_LEAK_CHECK environment variable. */ @@ -57,7 +80,7 @@ int leak_check_enabled; /* when this var is set to 0, every call to test_set_timeout() is @@ -115,7 +116,7 @@ if (is_debugger_attached()) { leak_check_enabled = 0; timeouts_enabled = 0; -@@ -364,6 +393,16 @@ int main(int argc, char *argv[]) +@@ -364,7 +393,17 @@ int main(int argc, char *argv[]) leak_check_enabled = !getenv("WAYLAND_TEST_NO_LEAK_CHECK"); timeouts_enabled = !getenv("WAYLAND_TEST_NO_TIMEOUTS"); } @@ -125,13 +126,14 @@ + /* XXX review later */ + timeouts_enabled = 0; +#endif -+ + + if (isatty(fileno(stderr))) + is_atty = 1; + - ++ if (argc == 2 && strcmp(argv[1], "--help") == 0) usage(argv[0], EXIT_SUCCESS); + @@ -395,7 +434,8 @@ int main(int argc, char *argv[]) if (pid == 0) run_test(t); /* never returns */