diff --git a/packages/waypipe/build.sh b/packages/waypipe/build.sh new file mode 100644 index 000000000..ffef9d9f5 --- /dev/null +++ b/packages/waypipe/build.sh @@ -0,0 +1,21 @@ +TERMUX_PKG_HOMEPAGE=https://gitlab.freedesktop.org/mstoeckl/waypipe +TERMUX_PKG_DESCRIPTION="A proxy for Wayland clients" +TERMUX_PKG_LICENSE="MIT" +TERMUX_PKG_MAINTAINER="@termux" +TERMUX_PKG_VERSION=0.8.2 +TERMUX_PKG_SRCURL=https://gitlab.freedesktop.org/mstoeckl/waypipe/-/archive/v${TERMUX_PKG_VERSION}/waypipe-v${TERMUX_PKG_VERSION}.tar.bz2 +TERMUX_PKG_SHA256=599ebe409516ced32679d3325ee17a1bc4da614f2636472d9138e39def6ad6b4 +TERMUX_PKG_DEPENDS="libandroid-spawn, liblz4, zstd" +TERMUX_PKG_BUILD_DEPENDS="ffmpeg" +TERMUX_PKG_EXTRA_CONFIGURE_ARGS=" +-Dwith_video=enabled +-Dwith_dmabuf=disabled +-Dwith_lz4=enabled +-Dwith_zstd=enabled +-Dwith_vaapi=disabled +-Dwith_systemtap=false +" + +termux_step_pre_configure() { + LDFLAGS+=" -landroid-spawn" +} diff --git a/packages/waypipe/meson.build.patch b/packages/waypipe/meson.build.patch new file mode 100644 index 000000000..905795506 --- /dev/null +++ b/packages/waypipe/meson.build.patch @@ -0,0 +1,19 @@ +--- a/meson.build ++++ b/meson.build +@@ -58,8 +58,6 @@ + else + has_dmabuf = false + endif +-pthreads = dependency('threads') +-rt = cc.find_library('rt') + # XXX dtrace -G (Solaris, FreeBSD, NetBSD) isn't supported yet + is_linux = host_machine.system() == 'linux' + is_darwin = host_machine.system() == 'darwin' +@@ -92,7 +90,6 @@ + + subdir('protocols') + subdir('src') +-subdir('test') + + scdoc = dependency('scdoc', version: '>=1.9.4', native: true, required: get_option('man-pages')) + if scdoc.found() diff --git a/packages/waypipe/src-meson.build.patch b/packages/waypipe/src-meson.build.patch new file mode 100644 index 000000000..bf9f824ef --- /dev/null +++ b/packages/waypipe/src-meson.build.patch @@ -0,0 +1,11 @@ +--- a/src/meson.build ++++ b/src/meson.build +@@ -1,8 +1,6 @@ + + waypipe_source_files = ['dmabuf.c', 'handlers.c', 'kernel.c', 'mainloop.c', 'parsing.c', 'platform.c', 'shadow.c', 'interval.c', 'util.c', 'video.c'] + waypipe_deps = [ +- pthreads, # To run expensive computations in parallel +- rt, # For shared memory + ] + if config_data.has('HAS_DMABUF') + # General GPU buffer creation, aligned with dmabuf proto diff --git a/packages/waypipe/src-platform.c.patch b/packages/waypipe/src-platform.c.patch new file mode 100644 index 000000000..507f9e123 --- /dev/null +++ b/packages/waypipe/src-platform.c.patch @@ -0,0 +1,13 @@ +--- a/src/platform.c ++++ b/src/platform.c +@@ -50,6 +50,10 @@ + #if defined(__linux__) + /* memfd_create was introduced in glibc 2.27 */ + #if !defined(__GLIBC__) || (__GLIBC__ >= 2 && __GLIBC_MINOR__ >= 27) ++#if defined __ANDROID__ && __ANDROID_API__ < 30 ++#include ++#define memfd_create(name,flags) syscall(SYS_memfd_create,name,flags) ++#endif + #define HAS_MEMFD 1 + #endif + #endif diff --git a/packages/waypipe/src-util.c.patch b/packages/waypipe/src-util.c.patch new file mode 100644 index 000000000..602f102d4 --- /dev/null +++ b/packages/waypipe/src-util.c.patch @@ -0,0 +1,13 @@ +--- a/src/util.c ++++ b/src/util.c +@@ -255,8 +255,8 @@ + i, i); + } else { + link[len] = '\0'; +- if (!strcmp(link, "/var/lib/sss/mc/passwd")) { +- wp_debug("Known issue, leaked fd %d to /var/lib/sss/mc/passwd", ++ if (!strcmp(link, "@TERMUX_PREFIX@/var/lib/sss/mc/passwd")) { ++ wp_debug("Known issue, leaked fd %d to @TERMUX_PREFIX@/var/lib/sss/mc/passwd", + i); + } else { + wp_error("Unexpected open fd %d: %s", i, diff --git a/packages/waypipe/src-waypipe.c.patch b/packages/waypipe/src-waypipe.c.patch new file mode 100644 index 000000000..2ad9124a7 --- /dev/null +++ b/packages/waypipe/src-waypipe.c.patch @@ -0,0 +1,40 @@ +--- a/src/waypipe.c ++++ b/src/waypipe.c +@@ -79,8 +79,8 @@ + " -n, --no-gpu disable protocols which would use GPU resources\n" + " -o, --oneshot only permit one connected application\n" + " -s, --socket S set the socket path to either create or connect to:\n" +- " server default: /tmp/waypipe-server.sock\n" +- " client default: /tmp/waypipe-client.sock\n" ++ " server default: @TERMUX_PREFIX@/tmp/waypipe-server.sock\n" ++ " client default: @TERMUX_PREFIX@/tmp/waypipe-client.sock\n" + " ssh: sets the prefix for the socket path\n" + " --version print waypipe version and exit\n" + " --allow-tiled allow gpu buffers (DMABUFs) with format modifiers\n" +@@ -743,7 +743,7 @@ + } else { + strcpy(sockaddr.sun_path, + socketpath ? socketpath +- : "/tmp/waypipe-client.sock"); ++ : "@TERMUX_PREFIX@/tmp/waypipe-client.sock"); + int nmaxclients = oneshot ? 1 : 128; + int channelsock = + setup_nb_socket(&sockaddr, nmaxclients); +@@ -776,7 +776,7 @@ + } else { + strcpy(sockaddr.sun_path, + socketpath ? socketpath +- : "/tmp/waypipe-server.sock"); ++ : "@TERMUX_PREFIX@/tmp/waypipe-server.sock"); + + ret = run_server(&sockaddr, wayland_display, + control_path, &config, oneshot, +@@ -784,7 +784,7 @@ + } + } else { + if (!socketpath) { +- socketpath = "/tmp/waypipe"; ++ socketpath = "@TERMUX_PREFIX@/tmp/waypipe"; + } + const size_t spsz = + sizeof(((struct sockaddr_un *)NULL)->sun_path);