[arch-commits] Commit in ossp/trunk (3 files)

Jan Steffens heftig at archlinux.org
Fri Dec 18 23:39:52 UTC 2020


    Date: Friday, December 18, 2020 @ 23:39:51
  Author: heftig
Revision: 404506

1.3.2+11+g9e94d67-3

Added:
  ossp/trunk/0001-Log-the-right-slave-program-name.patch
  ossp/trunk/0002-Hack-to-work-with-modern-PulseAudio.patch
Modified:
  ossp/trunk/PKGBUILD

------------------------------------------------+
 0001-Log-the-right-slave-program-name.patch    |  127 +++++++++++++++++++++++
 0002-Hack-to-work-with-modern-PulseAudio.patch |   38 ++++++
 PKGBUILD                                       |   28 +++--
 3 files changed, 183 insertions(+), 10 deletions(-)

Added: 0001-Log-the-right-slave-program-name.patch
===================================================================
--- 0001-Log-the-right-slave-program-name.patch	                        (rev 0)
+++ 0001-Log-the-right-slave-program-name.patch	2020-12-18 23:39:51 UTC (rev 404506)
@@ -0,0 +1,127 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens at gmail.com>
+Date: Fri, 18 Dec 2020 23:08:02 +0000
+Subject: [PATCH] Log the right slave program name
+
+---
+ ossp-alsap.c |  2 +-
+ ossp-padsp.c |  2 +-
+ ossp-slave.c | 40 ++++++++++++++++++++--------------------
+ ossp-slave.h |  2 +-
+ 4 files changed, 23 insertions(+), 23 deletions(-)
+
+diff --git a/ossp-alsap.c b/ossp-alsap.c
+index 72f3bd5..6b8228b 100644
+--- a/ossp-alsap.c
++++ b/ossp-alsap.c
+@@ -577,7 +577,7 @@ int main(int argc, char **argv)
+ {
+ 	int rc;
+ 
+-	ossp_slave_init(argc, argv);
++	ossp_slave_init("ossp-alsap", argc, argv);
+ 
+ 	page_size = sysconf(_SC_PAGE_SIZE);
+ 
+diff --git a/ossp-padsp.c b/ossp-padsp.c
+index 3143960..c505b57 100644
+--- a/ossp-padsp.c
++++ b/ossp-padsp.c
+@@ -1479,7 +1479,7 @@ int main(int argc, char **argv)
+ {
+ 	int rc;
+ 
+-	ossp_slave_init(argc, argv);
++	ossp_slave_init("ossp-padsp", argc, argv);
+ 
+ 	page_size = sysconf(_SC_PAGE_SIZE);
+ 
+diff --git a/ossp-slave.c b/ossp-slave.c
+index a290636..a0a9590 100644
+--- a/ossp-slave.c
++++ b/ossp-slave.c
+@@ -21,27 +21,27 @@
+ 
+ #include "ossp-slave.h"
+ 
+-static const char *usage =
+-"usage: ossp-SLAVE [options]\n"
+-"\n"
+-"proxies commands from osspd to pulseaudio\n"
+-"\n"
+-"options:\n"
+-"    -u UID            uid to use\n"
+-"    -g GID            gid to use\n"
+-"    -c CMD_FD         fd to receive commands from osspd\n"
+-"    -n NOTIFY_FD      fd to send async notifications to osspd\n"
+-"    -m MMAP_FD        fd to use for mmap\n"
+-"    -o MMAP_OFFSET    mmap offset\n"
+-"    -s MMAP_SIZE      mmap size\n"
+-"    -l LOG_LEVEL      set log level\n"
+-"    -t                enable log timestamps\n";
++#define USAGE \
++	"usage: %s [options]\n" \
++	"\n" \
++	"proxies commands from osspd to audio output\n" \
++	"\n" \
++	"options:\n" \
++	"    -u UID            uid to use\n" \
++	"    -g GID            gid to use\n" \
++	"    -c CMD_FD         fd to receive commands from osspd\n" \
++	"    -n NOTIFY_FD      fd to send async notifications to osspd\n" \
++	"    -m MMAP_FD        fd to use for mmap\n" \
++	"    -o MMAP_OFFSET    mmap offset\n" \
++	"    -s MMAP_SIZE      mmap size\n" \
++	"    -l LOG_LEVEL      set log level\n" \
++	"    -t                enable log timestamps\n"
+ 
+ char ossp_user_name[OSSP_USER_NAME_LEN];
+ int ossp_cmd_fd = -1, ossp_notify_fd = -1;
+ void *ossp_mmap_addr[2];
+ 
+-void ossp_slave_init(int argc, char **argv)
++void ossp_slave_init(const char *slave_name, int argc, char **argv)
+ {
+ 	int have_uid = 0, have_gid = 0;
+ 	uid_t uid;
+@@ -89,23 +89,23 @@ void ossp_slave_init(int argc, char **argv)
+ 	}
+ 
+ 	if (!have_uid || !have_gid || ossp_cmd_fd < 0 || ossp_notify_fd < 0) {
+-		fputs(usage, stderr);
++		fprintf(stderr, USAGE, slave_name);
+ 		_exit(1);
+ 	}
+ 
+ 	snprintf(ossp_user_name, sizeof(ossp_user_name), "uid%d", uid);
+ 	if (getpwuid_r(uid, &pw_buf, pw_sbuf, sizeof(pw_sbuf), &pw) == 0)
+ 		snprintf(ossp_user_name, sizeof(ossp_user_name), "%s",
+ 			 pw->pw_name);
+ 
+-	snprintf(ossp_log_name, sizeof(ossp_log_name), "ossp-padsp[%s:%d]",
+-		 ossp_user_name, getpid());
++	snprintf(ossp_log_name, sizeof(ossp_log_name), "%s[%s:%d]",
++		 slave_name, ossp_user_name, getpid());
+ 
+ 	if (mmap_fd >= 0) {
+ 		void *p;
+ 
+ 		if (!mmap_off || !mmap_size) {
+-			fputs(usage, stderr);
++			fprintf(stderr, USAGE, slave_name);
+ 			_exit(1);
+ 		}
+ 
+diff --git a/ossp-slave.h b/ossp-slave.h
+index 10c22cd..02522d9 100644
+--- a/ossp-slave.h
++++ b/ossp-slave.h
+@@ -19,7 +19,7 @@ extern char ossp_user_name[OSSP_USER_NAME_LEN];
+ extern int ossp_cmd_fd, ossp_notify_fd;
+ extern void *ossp_mmap_addr[2];
+ 
+-void ossp_slave_init(int argc, char **argv);
++void ossp_slave_init(const char *slave_name, int argc, char **argv);
+ int ossp_slave_process_command(int cmd_fd,
+ 			       ossp_action_fn_t const *action_fn_tbl,
+ 			       int (*action_pre_fn)(void),

Added: 0002-Hack-to-work-with-modern-PulseAudio.patch
===================================================================
--- 0002-Hack-to-work-with-modern-PulseAudio.patch	                        (rev 0)
+++ 0002-Hack-to-work-with-modern-PulseAudio.patch	2020-12-18 23:39:51 UTC (rev 404506)
@@ -0,0 +1,38 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: "Jan Alexander Steffens (heftig)" <jan.steffens at gmail.com>
+Date: Fri, 18 Dec 2020 23:17:36 +0000
+Subject: [PATCH] Hack to work with modern PulseAudio
+
+---
+ ossp-padsp.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/ossp-padsp.c b/ossp-padsp.c
+index c505b57..b4ac097 100644
+--- a/ossp-padsp.c
++++ b/ossp-padsp.c
+@@ -22,6 +22,8 @@
+ #include <sys/stat.h>
+ #include <sys/types.h>
+ #include <unistd.h>
++#include <linux/limits.h>
++#include <stdlib.h>
+ 
+ #include <pulse/pulseaudio.h>
+ #include <sys/soundcard.h>
+@@ -1478,9 +1480,15 @@ static void action_post(void)
+ int main(int argc, char **argv)
+ {
+ 	int rc;
++	static char runtime_dir[PATH_MAX];
+ 
+ 	ossp_slave_init("ossp-padsp", argc, argv);
+ 
++	snprintf(runtime_dir, sizeof runtime_dir, "/run/user/%llu",
++		(long long unsigned) getuid());
++	if (access(runtime_dir, R_OK | X_OK) == 0)
++		setenv("XDG_RUNTIME_DIR", runtime_dir, 0);
++
+ 	page_size = sysconf(_SC_PAGE_SIZE);
+ 
+ 	mainloop = pa_threaded_mainloop_new();

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-12-18 23:37:19 UTC (rev 404505)
+++ PKGBUILD	2020-12-18 23:39:51 UTC (rev 404506)
@@ -1,9 +1,9 @@
-# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens at gmail.com>
+# Maintainer: Jan Alexander Steffens (heftig) <heftig at archlinux.org>
 # Contributor: Jonathan Liu <net147 at gmail.com>
 
 pkgname=ossp
 pkgver=1.3.2+11+g9e94d67
-pkgrel=2
+pkgrel=3
 pkgdesc="Emulate OSS device using CUSE"
 arch=(x86_64)
 url="https://sourceforge.net/projects/osspd/"
@@ -13,8 +13,12 @@
 optdepends=("libpulse: PulseAudio backend"
             "alsa-lib: ALSA backend")
 _commit=9e94d673070623c955646e802d42950906b6e184  # master
-source=("git+https://github.com/heftig/osspd#commit=$_commit")
-sha256sums=('SKIP')
+source=("git+https://github.com/heftig/osspd#commit=$_commit"
+        0001-Log-the-right-slave-program-name.patch
+        0002-Hack-to-work-with-modern-PulseAudio.patch)
+sha256sums=('SKIP'
+            '102d34362ed782c74792d08741ccc4780137c3e95b0b2e4eb15073ba7f162590'
+            '900cc0d8ac2d37a42a87afec4760a2cd99e95ae022262c4a4d144ee5c1312c10')
 
 pkgver() {
   cd osspd
@@ -23,22 +27,23 @@
 
 prepare() {
   cd osspd
+  git apply -3 ../*.patch
   sed -i 's|/sbin|/bin|g' Makefile
   sed -i 's|GROUP="audio"|SUBSYSTEM=="cuse", MODE="0666"|' 98-osscuse.rules
 }
 
+_make() {
+  make prefix=/usr UDEVDIR=/usr/lib/udev/rules.d "$@"
+}
+
 build() {
   cd osspd
-  make
+  _make
 }
 
 package() {
   cd osspd
-  make install \
-    DESTDIR="$pkgdir" \
-    prefix=/usr \
-    UDEVDIR=/usr/lib/udev/rules.d
-  install -Dt "$pkgdir/usr/share/doc/$pkgname" -m644 README
+  _make DESTDIR="$pkgdir" install
 
   install -Dm644 /dev/stdin "$pkgdir/usr/lib/systemd/system/osspd.service" <<END
 [Unit]
@@ -56,4 +61,7 @@
 snd-seq-oss
 END
 
+  install -Dt "$pkgdir/usr/share/doc/$pkgname" -m644 README
 }
+
+# vim:set sw=2 et:



More information about the arch-commits mailing list