diff options
author | Matthieu Herrb <matthieu@herrb.eu> | 2019-08-05 23:19:19 +0200 |
---|---|---|
committer | Matthieu Herrb <matthieu@herrb.eu> | 2019-08-05 23:19:19 +0200 |
commit | a9de1ba422cbcb9bd5a5cbf8685c756ca06ce5ca (patch) | |
tree | 64810809cdea3329d9c24db4347d04f371168ef7 /x11 | |
parent | 01bbd8853ec8adfd32176afb44bd4480e6c911ac (diff) |
Initial libxshmfence
Diffstat (limited to 'x11')
-rw-r--r-- | x11/libxshmfence/Makefile | 37 | ||||
-rw-r--r-- | x11/libxshmfence/distinfo | 2 | ||||
-rw-r--r-- | x11/libxshmfence/patches/patch-configure_ac | 27 | ||||
-rw-r--r-- | x11/libxshmfence/patches/patch-src_xshmfence_alloc_c | 25 | ||||
-rw-r--r-- | x11/libxshmfence/patches/patch-src_xshmfence_futex_h | 28 | ||||
-rw-r--r-- | x11/libxshmfence/pkg/DESCR | 11 | ||||
-rw-r--r-- | x11/libxshmfence/pkg/PLIST | 6 |
7 files changed, 136 insertions, 0 deletions
diff --git a/x11/libxshmfence/Makefile b/x11/libxshmfence/Makefile new file mode 100644 index 0000000..8034f2a --- /dev/null +++ b/x11/libxshmfence/Makefile @@ -0,0 +1,37 @@ +# $OpenBSD: Makefile.template,v 1.83 2019/07/02 12:03:14 sthen Exp $ +COMMENT = shared memory SyncFence synchronization primitive + +DISTNAME = libxshmfence-1.3 +CATEGORIES = x11 + +HOMEPAGE = https://gitlab.freedesktop.org/xorg/lib/libxshmfence + +MAINTAINER = xenocara@openbsd.org + +SHARED_LIBS= xshmfence 0.0 + +# MIT +PERMIT_PACKAGE = Yes + +#WANTLIB = ??? + +MASTER_SITES = ${MASTER_SITE_XORG:=lib/} + +# Dependencies +BUILD_DEPENDS = devel/xorg-util-macros \ + devel/xorgproto + +SEPARATE_BUILD = Yes +CONFIGURE_STYLE = autoreconf + +CONFIGURE_ARGS = --with-shared-memory-dir=/tmp + +# for gnu stuff +AUTOCONF_VERSION = 2.69 +AUTOMAKE_VERSION = 1.12 + +#NO_BUILD = Yes +NO_TEST = Yes + + +.include <bsd.port.mk> diff --git a/x11/libxshmfence/distinfo b/x11/libxshmfence/distinfo new file mode 100644 index 0000000..379d59c --- /dev/null +++ b/x11/libxshmfence/distinfo @@ -0,0 +1,2 @@ +SHA256 (libxshmfence-1.3.tar.gz) = frPUatkbq0RPEh1HWxGzknMULQkPfprEPmqH9P9fkCw= +SIZE (libxshmfence-1.3.tar.gz) = 378960 diff --git a/x11/libxshmfence/patches/patch-configure_ac b/x11/libxshmfence/patches/patch-configure_ac new file mode 100644 index 0000000..0b7faed --- /dev/null +++ b/x11/libxshmfence/patches/patch-configure_ac @@ -0,0 +1,27 @@ +$OpenBSD$ + +Index: configure.ac +--- configure.ac.orig ++++ configure.ac +@@ -32,6 +32,7 @@ AC_USE_SYSTEM_EXTENSIONS + + # Initialize Automake + AM_INIT_AUTOMAKE([foreign dist-bzip2]) ++AM_MAINTAINER_MODE + + # Initialize libtool + AC_PROG_LIBTOOL +@@ -56,6 +57,13 @@ AC_ARG_ENABLE(futex, AS_HELP_STRING([--enable-futex], + + if test "x$FUTEX" = "xauto"; then + AC_CHECK_HEADER([linux/futex.h], [FUTEX=yes]) ++fi ++ ++if test "x$FUTEX" = "xauto"; then ++ AC_CHECK_HEADER([sys/futex.h], [FUTEX=yes]) ++ if test "x$FUTEX" = "xyes"; then ++ AC_DEFINE(HAVE_FUTEX, 1, [Use futex]) ++ fi + fi + + if test "x$FUTEX" = "xauto"; then diff --git a/x11/libxshmfence/patches/patch-src_xshmfence_alloc_c b/x11/libxshmfence/patches/patch-src_xshmfence_alloc_c new file mode 100644 index 0000000..7e25867 --- /dev/null +++ b/x11/libxshmfence/patches/patch-src_xshmfence_alloc_c @@ -0,0 +1,25 @@ +$OpenBSD$ + +Index: src/xshmfence_alloc.c +--- src/xshmfence_alloc.c.orig ++++ src/xshmfence_alloc.c +@@ -26,6 +26,10 @@ + + #include "xshmfenceint.h" + ++#ifndef __MAP_NOFAULT ++#define __MAP_NOFAULT 0 ++#endif ++ + #if !HAVE_MEMFD_CREATE + #if HAVE_DECL___NR_MEMFD_CREATE + #include <asm/unistd.h> +@@ -105,7 +109,7 @@ struct xshmfence * + xshmfence_map_shm(int fd) + { + struct xshmfence *addr; +- addr = mmap (NULL, sizeof (struct xshmfence) , PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0); ++ addr = mmap (NULL, sizeof (struct xshmfence) , PROT_READ|PROT_WRITE, MAP_SHARED | __MAP_NOFAULT, fd, 0); + if (addr == MAP_FAILED) { + close (fd); + return 0; diff --git a/x11/libxshmfence/patches/patch-src_xshmfence_futex_h b/x11/libxshmfence/patches/patch-src_xshmfence_futex_h new file mode 100644 index 0000000..99e2a7a --- /dev/null +++ b/x11/libxshmfence/patches/patch-src_xshmfence_futex_h @@ -0,0 +1,28 @@ +$OpenBSD$ + +Index: src/xshmfence_futex.h +--- src/xshmfence_futex.h.orig ++++ src/xshmfence_futex.h +@@ -26,7 +26,21 @@ + + #include <errno.h> + +-#ifdef HAVE_UMTX ++#ifdef HAVE_FUTEX ++ ++#include <sys/time.h> ++#include <sys/futex.h> ++#include <limits.h> ++ ++static inline int futex_wake(int32_t *addr) { ++ return futex(addr, FUTEX_WAKE, INT_MAX, NULL, NULL); ++} ++ ++static inline int futex_wait(int32_t *addr, int32_t value) { ++ return futex(addr, FUTEX_WAIT, value, NULL, NULL); ++} ++ ++#elif HAVE_UMTX + + #include <sys/types.h> + #include <sys/umtx.h> diff --git a/x11/libxshmfence/pkg/DESCR b/x11/libxshmfence/pkg/DESCR new file mode 100644 index 0000000..96da5f0 --- /dev/null +++ b/x11/libxshmfence/pkg/DESCR @@ -0,0 +1,11 @@ +libxshmfence - Shared memory 'SyncFence' synchronization primitive + +This library offers a CPU-based synchronization primitive compatible +with the X SyncFence objects that can be shared between processes +using file descriptor passing. + +There are two underlying implementations: + +On Linux, the library uses futexes + +On other systems, the library uses posix mutexes and condition variables. diff --git a/x11/libxshmfence/pkg/PLIST b/x11/libxshmfence/pkg/PLIST new file mode 100644 index 0000000..f21e00a --- /dev/null +++ b/x11/libxshmfence/pkg/PLIST @@ -0,0 +1,6 @@ +@comment $OpenBSD: PLIST,v$ +include/X11/xshmfence.h +lib/libxshmfence.a +lib/libxshmfence.la +@lib lib/libxshmfence.so.${LIBxshmfence_VERSION} +lib/pkgconfig/xshmfence.pc |