Index: x11/libxshmfence/files/patch-config.h.in =================================================================== --- x11/libxshmfence/files/patch-config.h.in +++ /dev/null @@ -1,12 +0,0 @@ ---- config.h.in.orig 2015-03-04 15:18:49 UTC -+++ config.h.in -@@ -22,6 +22,9 @@ - /* Define to 1 if you have the header file. */ - #undef HAVE_MEMORY_H - -+/* Use mkostemp(3) */ -+#undef HAVE_MKOSTEMP -+ - /* Use pthread primitives */ - #undef HAVE_PTHREAD - Index: x11/libxshmfence/files/patch-configure =================================================================== --- x11/libxshmfence/files/patch-configure +++ /dev/null @@ -1,17 +0,0 @@ ---- configure.orig 2015-03-04 15:22:23 UTC -+++ configure -@@ -18104,6 +18104,14 @@ else - fi - - -+ac_fn_c_check_func "$LINENO" "mkostemp" "ac_cv_func_mkostemp" -+if test "x$ac_cv_func_mkostemp" = xyes; then : -+ -+$as_echo "#define HAVE_MKOSTEMP 1" >>confdefs.h -+ -+fi -+ -+ - - pkg_failed=no - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XPROTO" >&5 Index: x11/libxshmfence/files/patch-mkostemp =================================================================== --- /dev/null +++ x11/libxshmfence/files/patch-mkostemp @@ -0,0 +1,69 @@ +alloc: prefer atomic close-on-exec without O_TMPFILE as well + +https://lists.x.org/archives/xorg-devel/2017-July/054053.html + +--- config.h.in.orig 2015-01-02 18:44:59 UTC ++++ config.h.in +@@ -22,6 +22,9 @@ + /* Define to 1 if you have the header file. */ + #undef HAVE_MEMORY_H + ++/* Define to 1 if you have the `mkostemp' function. */ ++#undef HAVE_MKOSTEMP ++ + /* Use pthread primitives */ + #undef HAVE_PTHREAD + +--- configure.orig 2015-01-02 18:44:56 UTC ++++ configure +@@ -18200,12 +18200,13 @@ fi + + CFLAGS="$CFLAGS $XPROTO_CFLAGS" + +-for ac_func in memfd_create ++for ac_func in memfd_create mkostemp + do : +- ac_fn_c_check_func "$LINENO" "memfd_create" "ac_cv_func_memfd_create" +-if test "x$ac_cv_func_memfd_create" = xyes; then : ++ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ++ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" ++if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +-#define HAVE_MEMFD_CREATE 1 ++#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 + _ACEOF + + fi +--- src/xshmfence_alloc.c.orig 2014-10-09 12:09:03 UTC ++++ src/xshmfence_alloc.c +@@ -26,6 +26,8 @@ + + #include "xshmfenceint.h" + ++#include ++ + #if !HAVE_MEMFD_CREATE + #if HAVE_DECL___NR_MEMFD_CREATE + #include +@@ -79,10 +81,21 @@ xshmfence_alloc_shm(void) + if (fd < 0) + #endif + { ++#ifdef HAVE_MKOSTEMP ++ fd = mkostemp(template, O_CLOEXEC); ++#else + fd = mkstemp(template); ++#endif + if (fd < 0) + return fd; + unlink(template); ++#ifndef HAVE_MKOSTEMP ++ int flags = fcntl(fd, F_GETFD); ++ if (flags != -1) { ++ flags |= FD_CLOEXEC; ++ (void) fcntl(fd, F_SETFD, &flags); ++ } ++#endif + } + } + if (ftruncate(fd, sizeof (struct xshmfence)) < 0) { Index: x11/libxshmfence/files/patch-src__xshmfence_alloc.c =================================================================== --- x11/libxshmfence/files/patch-src__xshmfence_alloc.c +++ /dev/null @@ -1,14 +0,0 @@ ---- src/xshmfence_alloc.c.orig 2015-03-04 15:28:23 UTC -+++ src/xshmfence_alloc.c -@@ -79,7 +79,11 @@ xshmfence_alloc_shm(void) - if (fd < 0) - #endif - { -+#ifdef HAVE_MKOSTEMP -+ fd = mkostemp(template, O_CLOEXEC); -+#else - fd = mkstemp(template); -+#endif - if (fd < 0) - return fd; - unlink(template); Index: x11/libxshmfence/files/patch-src__xshmfence_futex.h =================================================================== --- x11/libxshmfence/files/patch-src__xshmfence_futex.h +++ /dev/null @@ -1,10 +0,0 @@ ---- src/xshmfence_futex.h.orig 2014-06-17 16:46:42.000000000 -0400 -+++ src/xshmfence_futex.h 2015-04-18 12:16:21.953572000 -0400 -@@ -28,6 +28,7 @@ - - #ifdef HAVE_UMTX - -+#include - #include - #include - Index: x11/libxshmfence/files/patch-src__xshmfenceint.h =================================================================== --- x11/libxshmfence/files/patch-src__xshmfenceint.h +++ /dev/null @@ -1,10 +0,0 @@ ---- src/xshmfenceint.h.orig 2015-03-04 15:38:56 UTC -+++ src/xshmfenceint.h -@@ -23,6 +23,7 @@ - #ifndef _XSHMFENCEINT_H_ - #define _XSHMFENCEINT_H_ - -+#include - #include - #include - #include Index: x11/libxshmfence/files/patch-src_xshmfence__futex.h =================================================================== --- /dev/null +++ x11/libxshmfence/files/patch-src_xshmfence__futex.h @@ -0,0 +1,21 @@ +futex: unbreak build on FreeBSD on 11.0+ + +In file included from src/xshmfence_alloc.c:27: +In file included from src/xshmfenceint.h:32: +src/xshmfence_futex.h:40:39: error: use of undeclared identifier 'INT_MAX' + return sys_futex(addr, UMTX_OP_WAKE, INT_MAX); + ^ +1 error generated. + +https://lists.x.org/archives/xorg-devel/2017-July/054065.html + +--- src/xshmfence_futex.h.orig 2014-06-17 20:46:42 UTC ++++ src/xshmfence_futex.h +@@ -28,6 +28,7 @@ + + #ifdef HAVE_UMTX + ++#include + #include + #include +