Index: head/graphics/wayland/Makefile =================================================================== --- head/graphics/wayland/Makefile (revision 527043) +++ head/graphics/wayland/Makefile (revision 527044) @@ -1,30 +1,34 @@ # Created by: kwm@FreeBSD.org # $FreeBSD$ PORTNAME= wayland PORTVERSION= 1.18.0 PORTREVISION= 1 CATEGORIES= graphics wayland MASTER_SITES= https://wayland.freedesktop.org/releases/ +PATCH_SITES= https://gitlab.freedesktop.org/${PORTNAME}/${PORTNAME}/commit/ +PATCHFILES+= 0fc00fff3015.patch:-p1 # https://gitlab.freedesktop.org/wayland/wayland/merge_requests/60 + MAINTAINER= x11@FreeBSD.org COMMENT= Wayland composite "server" LICENSE= MIT LICENSE_FILE= ${WRKSRC}/COPYING LIB_DEPENDS= libexpat.so:textproc/expat2 \ libffi.so:devel/libffi \ libepoll-shim.so:devel/libepoll-shim CFLAGS+= "-I${LOCALBASE}/include/libepoll-shim" -USES= autoreconf gmake gnome libtool localbase pathfix pkgconfig tar:xz +USES= meson pkgconfig tar:xz USE_GNOME= libxslt:build USE_LDCONFIG= yes -GNU_CONFIGURE= yes -CONFIGURE_ARGS= --disable-documentation -CONFIGURE_ENV= ac_cv_func_posix_fallocate=no # EINVAL on ZFS since FreeBSD 12.0 -INSTALL_TARGET= install-strip +MESON_ARGS= -Ddocumentation=false + +post-patch: +# posix_fallocate returns EINVAL on ZFS since FreeBSD 12.0 + @${REINPLACE_CMD} '/posix_fallocate/d' ${WRKSRC}/meson.build .include Index: head/graphics/wayland/distinfo =================================================================== --- head/graphics/wayland/distinfo (revision 527043) +++ head/graphics/wayland/distinfo (revision 527044) @@ -1,3 +1,5 @@ TIMESTAMP = 1581464763 SHA256 (wayland-1.18.0.tar.xz) = 4675a79f091020817a98fd0484e7208c8762242266967f55a67776936c2e294d SIZE (wayland-1.18.0.tar.xz) = 453968 +SHA256 (0fc00fff3015.patch) = 5e36dc6d5b28bb2062afe8e66e8069555701b3bbf4c7e233903761346e8b3432 +SIZE (0fc00fff3015.patch) = 3868 Index: head/graphics/wayland/files/patch-configure.ac =================================================================== --- head/graphics/wayland/files/patch-configure.ac (revision 527043) +++ head/graphics/wayland/files/patch-configure.ac (nonexistent) @@ -1,51 +0,0 @@ ---- configure.ac.orig 2020-02-11 23:46:03 UTC -+++ configure.ac -@@ -71,6 +71,25 @@ WESTON_SEARCH_LIBS([DL], [dl], [dlsym]) - # OpenBSD doesn't have librt, but it has its functions in libc - WESTON_SEARCH_LIBS([RT], [rt], [clock_gettime]) - -+AC_CHECK_HEADERS([sys/signalfd.h sys/timerfd.h]) -+ -+# 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]) -+ -+# dlopen() -+AC_CHECK_LIB([dl], [dlsym], [DL_LIBS=-ldl]) -+AC_SUBST([DL_LIBS]) -+ -+# Defines __FreeBSD__ if we're on FreeBSD -+AC_CHECK_HEADERS([sys/param.h]) -+ -+# waitid() and signal.h are needed for the test suite. -+AC_CHECK_FUNCS([waitid]) -+AC_CHECK_HEADERS([signal.h]) -+ - AC_ARG_ENABLE([libraries], - [AC_HELP_STRING([--disable-libraries], - [Disable compilation of wayland libraries])], -@@ -106,16 +125,20 @@ AC_SUBST([ICONDIR]) - - if test "x$enable_libraries" = "xyes"; then - PKG_CHECK_MODULES(FFI, [libffi]) -+dnl convert SFD_CLOEXEC and TFD_CLOEXEC to warning while figuring out how to do this. - AC_CHECK_DECL(SFD_CLOEXEC,[], -- [AC_MSG_ERROR("SFD_CLOEXEC is needed to compile wayland libraries")], -+ [AC_MSG_WARN("SFD_CLOEXEC is needed to compile wayland libraries")], - [[#include ]]) - AC_CHECK_DECL(TFD_CLOEXEC,[], -- [AC_MSG_ERROR("TFD_CLOEXEC is needed to compile wayland libraries")], -+ [AC_MSG_WARN("TFD_CLOEXEC is needed to compile wayland libraries")], - [[#include ]]) - AC_CHECK_DECL(CLOCK_MONOTONIC,[], - [AC_MSG_ERROR("CLOCK_MONOTONIC is needed to compile wayland libraries")], - [[#include ]]) - fi -+ -+EPOLLSHIM_LIBS="-lepoll-shim" -+AC_SUBST(EPOLLSHIM_LIBS) - - PKG_CHECK_MODULES(EXPAT, [expat]) - Property changes on: head/graphics/wayland/files/patch-configure.ac ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/graphics/wayland/files/patch-Makefile.am =================================================================== --- head/graphics/wayland/files/patch-Makefile.am (revision 527043) +++ head/graphics/wayland/files/patch-Makefile.am (nonexistent) @@ -1,29 +0,0 @@ ---- Makefile.am.orig 2020-02-11 23:46:03 UTC -+++ Makefile.am -@@ -73,7 +73,7 @@ nodist_include_HEADERS = \ - protocol/wayland-client-protocol.h - - libwayland_server_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread --libwayland_server_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm -+libwayland_server_la_LIBADD = $(FFI_LIBS) $(EPOLLSHIM_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm - libwayland_server_la_LDFLAGS = -version-info 1:0:1 - libwayland_server_la_SOURCES = \ - src/wayland-server.c \ -@@ -85,7 +85,7 @@ nodist_libwayland_server_la_SOURCES = \ - protocol/wayland-protocol.c - - libwayland_client_la_CFLAGS = $(FFI_CFLAGS) $(AM_CFLAGS) -pthread --libwayland_client_la_LIBADD = $(FFI_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm -+libwayland_client_la_LIBADD = $(FFI_LIBS) $(EPOLLSHIM_LIBS) libwayland-private.la libwayland-util.la $(RT_LIBS) -lm - libwayland_client_la_LDFLAGS = -version-info 3:0:3 - libwayland_client_la_SOURCES = \ - src/wayland-client.c -@@ -230,7 +230,7 @@ libtest_runner_la_LIBADD = \ - libwayland-client.la \ - libwayland-server.la \ - libtest-helpers.la \ -- $(RT_LIBS) $(DL_LIBS) $(FFI_LIBS) -+ $(RT_LIBS) $(DL_LIBS) $(FFI_LIBS) $(EPOLLSHIM_LIBS) - - array_test_SOURCES = tests/array-test.c - array_test_LDADD = libtest-runner.la Property changes on: head/graphics/wayland/files/patch-Makefile.am ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -yes \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/graphics/wayland/files/patch-meson.build =================================================================== --- head/graphics/wayland/files/patch-meson.build (nonexistent) +++ head/graphics/wayland/files/patch-meson.build (revision 527044) @@ -0,0 +1,33 @@ +--- meson.build.orig 2020-02-11 23:46:03 UTC ++++ meson.build +@@ -26,7 +26,14 @@ add_project_arguments( + language: 'c' + ) + +-foreach h: [ 'sys/prctl.h' ] ++have_headers = [ ++ 'signal.h', ++ 'sys/epoll.h', ++ 'sys/prctl.h', ++ 'sys/ucred.h', ++] ++ ++foreach h: have_headers + config_h.set('HAVE_' + h.underscorify().to_upper(), cc.has_header(h)) + endforeach + +@@ -37,12 +44,14 @@ have_funcs = [ + 'prctl', + 'memfd_create', + 'strndup', ++ 'waitid', + ] + foreach f: have_funcs + config_h.set('HAVE_' + f.underscorify().to_upper(), cc.has_function(f)) + endforeach + + if get_option('libraries') ++ epoll_dep = dependency('epoll-shim', required: false) + ffi_dep = dependency('libffi') + + decls = [ Property changes on: head/graphics/wayland/files/patch-meson.build ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/graphics/wayland/files/patch-src_meson.build =================================================================== --- head/graphics/wayland/files/patch-src_meson.build (nonexistent) +++ head/graphics/wayland/files/patch-src_meson.build (revision 527044) @@ -0,0 +1,36 @@ +--- src/meson.build.orig 2020-02-11 23:46:03 UTC ++++ src/meson.build +@@ -71,7 +71,7 @@ if get_option('libraries') + 'connection.c', + 'wayland-os.c' + ], +- dependencies: [ ffi_dep, ] ++ dependencies: [ epoll_dep, ffi_dep, ] + ) + + wayland_private_dep = declare_dependency( +@@ -145,6 +145,7 @@ if get_option('libraries') + ], + version: '0.1.0', + dependencies: [ ++ epoll_dep, + ffi_dep, + wayland_private_dep, + wayland_util_dep, +@@ -158,7 +159,7 @@ if get_option('libraries') + wayland_server_dep = declare_dependency( + link_with: wayland_server, + include_directories: [ root_inc, include_directories('.') ], +- dependencies: [ ffi_dep, mathlib_dep, threads_dep ], ++ dependencies: [ epoll_dep, ffi_dep, mathlib_dep, threads_dep ], + sources: [ + wayland_server_protocol_core_h, + wayland_server_protocol_h +@@ -187,6 +188,7 @@ if get_option('libraries') + ], + version: '0.3.0', + dependencies: [ ++ epoll_dep, + ffi_dep, + wayland_private_dep, + wayland_util_dep, Property changes on: head/graphics/wayland/files/patch-src_meson.build ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +yes \ No newline at end of property Added: svn:eol-style ## -0,0 +1 ## +native \ No newline at end of property Added: svn:mime-type ## -0,0 +1 ## +text/plain \ No newline at end of property Index: head/graphics/wayland/files/patch-tests_test-helpers.c =================================================================== --- head/graphics/wayland/files/patch-tests_test-helpers.c (revision 527043) +++ head/graphics/wayland/files/patch-tests_test-helpers.c (revision 527044) @@ -1,52 +1,48 @@ --- tests/test-helpers.c.orig 2020-02-11 23:46:03 UTC +++ tests/test-helpers.c -@@ -25,6 +25,12 @@ +@@ -25,6 +25,8 @@ #include "config.h" +#include "../config.h" + -+#ifdef HAVE_SYS_PARAM_H -+#include -+#endif -+ #include #include #include -@@ -41,6 +47,16 @@ +@@ -41,6 +43,16 @@ #include "test-runner.h" +#ifdef __FreeBSD__ +/* FreeBSD uses fdescfs (which must be mounted using: + * mount -t fdescfs fdescfs /dev/fd + * before the test suite can be run). */ +#define OPEN_FDS_DIR "/dev/fd" +#else +/* Linux. */ +#define OPEN_FDS_DIR "/proc/self/fd" +#endif + int count_open_fds(void) { -@@ -48,8 +64,8 @@ count_open_fds(void) +@@ -48,8 +60,8 @@ count_open_fds(void) struct dirent *ent; int count = 0; - dir = opendir("/proc/self/fd"); - assert(dir && "opening /proc/self/fd failed."); + dir = opendir(OPEN_FDS_DIR); + assert(dir && "opening " OPEN_FDS_DIR " failed."); errno = 0; while ((ent = readdir(dir))) { -@@ -58,7 +74,7 @@ count_open_fds(void) +@@ -58,7 +70,7 @@ count_open_fds(void) continue; count++; } - assert(errno == 0 && "reading /proc/self/fd failed."); + assert(errno == 0 && "reading " OPEN_FDS_DIR " failed."); closedir(dir); Index: head/graphics/wayland/files/patch-tests_test-runner.c =================================================================== --- head/graphics/wayland/files/patch-tests_test-runner.c (revision 527043) +++ head/graphics/wayland/files/patch-tests_test-runner.c (revision 527044) @@ -1,132 +1,128 @@ --- tests/test-runner.c.orig 2020-02-11 23:46:03 UTC +++ tests/test-runner.c -@@ -25,6 +25,12 @@ +@@ -25,6 +25,8 @@ #define _GNU_SOURCE +#include "../config.h" + -+#ifdef HAVE_SYS_PARAM_H -+#include -+#endif -+ #include #include #include -@@ -37,13 +43,23 @@ +@@ -37,13 +39,23 @@ #include #include #include +#ifdef HAVE_SYS_PRCTL_H #include +#endif #ifndef PR_SET_PTRACER # define PR_SET_PTRACER 0x59616d61 #endif +#include #include "test-runner.h" +#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 opened files. * It is turned on by default. It can be turned off by * WAYLAND_TEST_NO_LEAK_CHECK environment variable. */ -@@ -51,7 +67,7 @@ int fd_leak_check_enabled; +@@ -51,7 +63,7 @@ int fd_leak_check_enabled; /* when this var is set to 0, every call to test_set_timeout() is * suppressed - handy when debugging the test. Can be set by - * WAYLAND_TEST_NO_TIMEOUTS environment variable. */ + * WAYLAND_TESTS_NO_TIMEOUTS evnironment var */ static int timeouts_enabled = 1; /* set to one if the output goes to the terminal */ -@@ -239,6 +255,8 @@ is_debugger_attached(void) +@@ -239,6 +251,8 @@ is_debugger_attached(void) return 0; } + +// xxx start here pid = fork(); if (pid == -1) { perror("fork"); -@@ -259,13 +277,14 @@ is_debugger_attached(void) +@@ -259,13 +273,14 @@ is_debugger_attached(void) _exit(1); if (!waitpid(-1, NULL, 0)) _exit(1); - ptrace(PTRACE_CONT, NULL, NULL); + ptrace(PTRACE_CONT, ppid, NULL, NULL); ptrace(PTRACE_DETACH, ppid, NULL, NULL); _exit(0); } else { close(pipefd[0]); /* Enable child to ptrace the parent process */ +#if defined(HAVE_PRCTL) rc = prctl(PR_SET_PTRACER, pid); if (rc != 0 && errno != EINVAL) { /* An error prevents us from telling if a debugger is attached. -@@ -275,7 +294,9 @@ is_debugger_attached(void) +@@ -275,7 +290,9 @@ is_debugger_attached(void) */ perror("prctl"); write(pipefd[1], "-", 1); - } else { + } else +#endif + { /* Signal to client that parent is ready by passing '+' */ write(pipefd[1], "+", 1); } -@@ -293,7 +314,11 @@ int main(int argc, char *argv[]) +@@ -293,7 +310,11 @@ int main(int argc, char *argv[]) const struct test *t; pid_t pid; int total, pass; +#ifdef HAVE_WAITID siginfo_t info; +#else + int status; +#endif if (isatty(fileno(stderr))) is_atty = 1; -@@ -336,7 +361,8 @@ int main(int argc, char *argv[]) +@@ -336,7 +357,8 @@ int main(int argc, char *argv[]) if (pid == 0) run_test(t); /* never returns */ - if (waitid(P_PID, pid, &info, WEXITED)) { +#ifdef HAVE_WAITID + if (waitid(P_PID, 0, &info, WEXITED)) { stderr_set_color(RED); fprintf(stderr, "waitid failed: %s\n", strerror(errno)); -@@ -368,6 +394,25 @@ int main(int argc, char *argv[]) +@@ -368,6 +390,25 @@ int main(int argc, char *argv[]) break; } +#else + if (waitpid(-1, &status, 0) == -1) { + fprintf(stderr, "waitpid failed: %s\n", + strerror(errno)); + abort(); + } + + fprintf(stderr, "test \"%s\":\t", t->name); + if (WIFEXITED(status)) { + fprintf(stderr, "exit status %d", WEXITSTATUS(status)); + if (WEXITSTATUS(status) == EXIT_SUCCESS) + success = 1; + } else if (WIFSIGNALED(status)) { + fprintf(stderr, "signal %d", WTERMSIG(status)); + } +#endif + + if (t->must_fail) + success = !success; if (success) { pass++;