1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-15 13:26:42 +00:00

add(main): new package pipewire

closes #10786

Signed-off-by: Aditya Alok <dev.aditya.alok@gmail.com>
This commit is contained in:
Aditya Alok 2022-05-23 21:25:42 +05:30
parent 88290cfd81
commit 0f136e59e5
No known key found for this signature in database
GPG Key ID: 345AE134142077D8
5 changed files with 160 additions and 0 deletions

View File

@ -0,0 +1,35 @@
TERMUX_PKG_HOMEPAGE=https://pipewire.org/
TERMUX_PKG_DESCRIPTION="A server and user space API to deal with multimedia pipelines"
TERMUX_PKG_LICENSE="MIT, LGPL-2.1, LGPL-3.0, GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=0.3.51
TERMUX_PKG_SRCURL="https://gitlab.freedesktop.org/pipewire/pipewire/-/archive/${TERMUX_PKG_VERSION}/pipewire-${TERMUX_PKG_VERSION}.tar.bz2"
TERMUX_PKG_SHA256=1820bfd524805ef3e4e4dcb368f26efa5f43ca90f8c3c67731e502268c34245e
TERMUX_PKG_DEPENDS="avahi, ffmpeg, libfdk-aac, liblua54, lilv, libsndfile, libusb, libwebrtc-audio-processing, pulseaudio"
# 'media-session' session-managers is disabled as it requires alsa.
# Since we are building without x11, dbus is disabled.
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-Dtests=disabled
-Dexamples=disabled
-Dpipewire-alsa=disabled
-Dalsa=disabled
-Dpipewire-jack=disabled
-Djack=disabled
-Ddbus=disabled
-Dsession-managers=['wireplumber']
-Dffmpeg=enabled
-Dwireplumber:system-lua=true
-Dwireplumber:system-lua-version=54
"
termux_step_pre_configure() {
CFLAGS+=" -Dindex=strchr -Drindex=strrchr"
sed "s|@TERMUX_PKG_BUILDER_DIR@|${TERMUX_PKG_BUILDER_DIR}|g" \
"${TERMUX_PKG_BUILDER_DIR}"/reallocarray.diff | patch -p1
}
termux_step_install_license() {
install -Dm600 -t "${TERMUX_PREFIX}/share/doc/${TERMUX_PKG_NAME}" \
"${TERMUX_PKG_SRCDIR}"/LICENSE "${TERMUX_PKG_SRCDIR}"/COPYING
}

View File

@ -0,0 +1,13 @@
--- ./data-loop.c.orig 2022-05-23 23:10:06.894402311 +0530
+++ ./src/pipewire/data-loop.c 2022-05-23 23:13:31.814402233 +0530
@@ -230,8 +230,8 @@
if (loop->running) {
struct spa_thread_utils *utils;
if (loop->cancel) {
- pw_log_debug("%p cancel", loop);
- pthread_cancel(loop->thread);
+ pw_log_debug("%p cancel (used pthread_kill as cancel not available on android)", loop);
+ pthread_kill(loop->thread, 0);
} else {
pw_log_debug("%p signal", loop);
pw_loop_invoke(loop->loop, do_stop, 1, NULL, 0, false, loop);

View File

@ -0,0 +1,39 @@
/* $OpenBSD: reallocarray.c,v 1.2 2014/12/08 03:45:00 bcook Exp $ */
/*
* Copyright (c) 2008 Otto Moerbeek <otto@drijf.net>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <sys/cdefs.h>
#include <errno.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/types.h>
/*
* This is sqrt(SIZE_MAX+1), as s1*s2 <= SIZE_MAX
* if both s1 < MUL_NO_OVERFLOW and s2 < MUL_NO_OVERFLOW
*/
#define MUL_NO_OVERFLOW ((size_t)1 << (sizeof(size_t) * 4))
void *reallocarray(void *optr, size_t nmemb, size_t size) {
if ((nmemb >= MUL_NO_OVERFLOW || size >= MUL_NO_OVERFLOW) && nmemb > 0 &&
SIZE_MAX / nmemb < size) {
errno = ENOMEM;
return (NULL);
}
return (realloc(optr, size * nmemb));
}

View File

@ -0,0 +1,35 @@
# Use reallocarray from BSD, its available in bionic with __ANDROID_API__ >= 29.
--- meson.build.orig 2022-05-24 11:10:00.415154895 +0530
+++ ./src/pipewire/meson.build 2022-05-24 11:10:28.705154884 +0530
@@ -47,6 +47,7 @@
]
pipewire_sources = [
+ '@TERMUX_PKG_BUILDER_DIR@/reallocarray.c',
'buffers.c',
'impl-core.c',
'impl-client.c',
--- meson.build.orig 2022-05-24 12:11:59.965153476 +0530
+++ ./src/modules/meson.build 2022-05-24 12:13:02.385153453 +0530
@@ -326,7 +326,8 @@
)
pipewire_module_client_node = shared_library('pipewire-module-client-node',
- [ 'module-client-node.c',
+ [ '@TERMUX_PKG_BUILDER_DIR@/reallocarray.c',
+ 'module-client-node.c',
'module-client-node/remote-node.c',
'module-client-node/client-node.c',
'module-client-node/protocol-native.c',
@@ -395,7 +396,8 @@
)
pipewire_module_session_manager = shared_library('pipewire-module-session-manager',
- [ 'module-session-manager.c',
+ [ '@TERMUX_PKG_BUILDER_DIR@/reallocarray.c',
+ 'module-session-manager.c',
'module-session-manager/client-endpoint/client-endpoint.c',
'module-session-manager/client-endpoint/endpoint-stream.c',
'module-session-manager/client-endpoint/endpoint.c',

View File

@ -0,0 +1,38 @@
# Default to temporary folder for runtime_dir.
--- module-protocol-native.c.orig 2022-05-25 11:10:34.812429150 +0530
+++ ./src/modules/module-protocol-native.c 2022-05-25 11:22:50.862428869 +0530
@@ -660,5 +661,8 @@
runtime_dir = getenv("XDG_RUNTIME_DIR");
if (runtime_dir == NULL)
runtime_dir = getenv("USERPROFILE");
+ if (runtime_dir == NULL) {
+ runtime_dir = "@TERMUX_PREFIX@/tmp";
+ }
return runtime_dir;
}
--- utils.c.orig 2022-05-25 11:10:14.722429157 +0530
+++ ./src/modules/module-protocol-pulse/utils.c 2022-05-25 11:21:28.562428900 +0530
@@ -59,7 +59,10 @@
runtime_dir = getenv("PULSE_RUNTIME_PATH");
if (runtime_dir == NULL)
runtime_dir = getenv("XDG_RUNTIME_DIR");
+ if (runtime_dir == NULL) {
+ runtime_dir = "@TERMUX_PREFIX@/tmp";
+ }
if (runtime_dir == NULL) {
pw_log_error("could not find a suitable runtime directory in"
--- local-socket.c.orig 2022-05-25 11:10:47.232429145 +0530
+++ ./src/modules/module-protocol-native/local-socket.c 2022-05-25 11:19:02.752428956 +0530
@@ -70,5 +71,8 @@
runtime_dir = getenv("XDG_RUNTIME_DIR");
if (runtime_dir == NULL)
runtime_dir = getenv("USERPROFILE");
+ if (runtime_dir == NULL){
+ runtime_dir = "@TERMUX_PREFIX@/tmp";
+ }
return runtime_dir;
}