pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

sndio: more fixes * Standardise configure options across target platforms, to avoid PLIST inconsistencies. * Use /var/run/sndio as home directory for the _sndio users, as stated in the official docs. * Fix OSS patch for NetBSD. * USe libbsd on Linux. * Improve rc.d script: - create /var/run/sndio directory if non existent. - use daemonize to put sndio in background with debug option enabled. Redirect output to a log file inside sndio's directory.



Module Name:	pkgsrc-wip
Committed By:	Paolo Vincenzo Olivo <vms%retrobsd.ddns.net@localhost>
Pushed By:	vms
Date:		Sat Nov 15 22:37:08 2025 +0100
Changeset:	b14bc40f328140fb78e0e34a96abd0c9e45f369f

Modified Files:
	sndio/Makefile
	sndio/distinfo
	sndio/files/sndio.sh
	sndio/patches/patch-configure
	sndio/patches/patch-libsndio_sio__oss.c

Log Message:
sndio: more fixes
* Standardise configure options across target platforms, to avoid PLIST
  inconsistencies.
* Use /var/run/sndio as home directory for the _sndio users, as stated
  in the official docs.
* Fix OSS patch for NetBSD.
* USe libbsd on Linux.
* Improve rc.d script:
    - create /var/run/sndio directory if non existent.
    - use daemonize to put sndio in background with debug option
      enabled. Redirect output to a log file inside sndio's directory.

Package tested and working on NetBSD 10.1, with AUDIODEVICE set to
`rsnd/0' (accessing /dev/audio directly through libsndio).
I also built SoX with sunaudio disabled and sndio support turned on.
Playing a .wav file works fine when AUDIODEVICE points to rsnd/0.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=b14bc40f328140fb78e0e34a96abd0c9e45f369f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 sndio/Makefile                          | 30 +++++++++++++++++++++---------
 sndio/distinfo                          |  4 ++--
 sndio/files/sndio.sh                    | 27 +++++++++++++++++++++++++++
 sndio/patches/patch-configure           | 18 ++++++++++++------
 sndio/patches/patch-libsndio_sio__oss.c | 22 ++++++++++++++++------
 5 files changed, 78 insertions(+), 23 deletions(-)

diffs:
diff --git a/sndio/Makefile b/sndio/Makefile
index bba80e0ec1..974e8b5c80 100644
--- a/sndio/Makefile
+++ b/sndio/Makefile
@@ -11,28 +11,40 @@ LICENSE=	isc
 
 HAS_CONFIGURE=	yes
 
+BUILD_DEFS+=	VARBASE
+SNDIO_HOME=	${VARBASE}/run/sndio
+
+DEPENDS+=	daemonize-[0-9]*:../../sysutils/daemonize
+
 RCD_SCRIPTS=	sndio
 
 PKG_USERS=		_sndio:_sndio
 PKG_GROUPS=		_sndio
-PKG_GECOS._sndio=	Sndio user
+PKG_GECOS._sndio=	sndio user
 PKG_SHELL._sndio=	${NOLOGIN}
-PKG_HOME._sndio=	/nonexistent
+PKG_HOME._sndio=	${SNDIO_HOME}
 
 PKGCONFIG_OVERRIDE=		libsndio/sndio.pc
 PKGCONFIG_OVERRIDE_STAGE=	post-configure
 
-SUBST_CLASSES+=		oss
-SUBST_STAGE.oss=	pre-configure
-SUBST_MESSAGE.oss=	Point to the correct OSS device.
-SUBST_FILES.oss+=	libsndio/sio_oss.c
-SUBST_SED.oss+=		-e "s,/dev/dsp,${DEVOSSAUDIO},g"
-
 CONFIGURE_ARGS+=	--prefix=${PREFIX}
 CONFIGURE_ARGS+=	--mandir=${PREFIX}/${PKGMANDIR}
 CONFIGURE_ARGS+=	--pkgconfdir=${PREFIX}/lib/pkgconfig
 
+.include "../../mk/bsd.prefs.mk"
+
+.if ${OPSYS:M*BSD}
+.  include "../../mk/oss.buildlink3.mk"
+SUBST_CLASSES+=         oss
+SUBST_STAGE.oss=        pre-configure
+SUBST_MESSAGE.oss=      Point to the correct OSS device.
+SUBST_FILES.oss+=       libsndio/sio_oss.c
+SUBST_SED.oss+=         -e "s,/dev/dsp,${DEVOSSAUDIO},g"
+.elif ${OPSYS} == "Linux"
+.  include "../../devel/libbsd/buildlink3.mk"
+.  include "../../audio/alsa-lib/buildlink3.mk"
+.endif
+
 BUILD_DIRS+=		libsndio sndiod sndioctl aucat midicat
 
-.include "../../mk/oss.buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
diff --git a/sndio/distinfo b/sndio/distinfo
index 5d8fbdc7d0..e009c5bc51 100644
--- a/sndio/distinfo
+++ b/sndio/distinfo
@@ -3,5 +3,5 @@ $NetBSD$
 BLAKE2s (sndio-1.10.0.tar.gz) = 39f92241015c931433dad456ee5ca965806c5b86e97950265d8a609ac38525a3
 SHA512 (sndio-1.10.0.tar.gz) = c35462976a1bffd128eacb185165964dac6b03505255e9ab9a933e24be5ed146cd9ac6995fd7af23247cb9133c010cce0876572db53b783ebabeb563fec7a1cf
 Size (sndio-1.10.0.tar.gz) = 162725 bytes
-SHA1 (patch-configure) = f0d2dadffe8ce50a38a4fe8305c3b776fbbd7aa6
-SHA1 (patch-libsndio_sio__oss.c) = 67d867de6dabe4b4b1beed0ef87652ca854dbc42
+SHA1 (patch-configure) = 4dfe4c8dccf0ee395ed6847e9e96a6c4cee9647d
+SHA1 (patch-libsndio_sio__oss.c) = ca220153f77b65659b490ef26bfbb2efaab67d74
diff --git a/sndio/files/sndio.sh b/sndio/files/sndio.sh
index c8f57a34bc..39bcc57002 100644
--- a/sndio/files/sndio.sh
+++ b/sndio/files/sndio.sh
@@ -11,6 +11,33 @@
 name="sndio"
 rcvar=${name}
 command="@PREFIX@/bin/sndiod"
+command_args="-dd"
+pidfile="@VARBASE@/run/sndio/pid"
+logfile="@VARBASE@/run/sndio/log"
+start_precmd=sndio_prestart
+start_cmd=sndio_start
+stop_cmd=":"
+
+sndio_prestart() {
+	dir="@VARBASE@/run/sndio"
+	if [ ! -d "$dir" ]; then
+		@MKDIR@ -p $dir
+		@CHMOD@ 0755 $dir
+		@CHOWN@ _sndio:_sndio $dir
+	fi
+}
+
+sndio_start()
+{
+	echo "Starting sndio server"
+	daemonize="@PREFIX@/sbin/daemonize"
+	if [ -x "$daemonize" ]; then
+		$daemonize -p ${pidfile} -e ${logfile} \
+			${command} ${command_args} ${sndio_flags}
+	else
+		${command} ${command_args} ${sndio_flags}
+	fi
+}
 
 load_rc_config ${name}
 run_rc_command "$1"
diff --git a/sndio/patches/patch-configure b/sndio/patches/patch-configure
index 0cc668fb48..802d0ca93e 100644
--- a/sndio/patches/patch-configure
+++ b/sndio/patches/patch-configure
@@ -5,16 +5,19 @@ $NetBSD$
 
 --- configure.orig	2024-08-01 15:36:54.000000000 +0000
 +++ configure
-@@ -71,7 +71,7 @@ case `uname` in
+@@ -70,8 +70,9 @@ case `uname` in
+ 	Linux)
  		alsa=yes
  		ldadd="-lrt -lm"
- 		user=sndiod
+-		user=sndiod
 -		so_link="libsndio.so libsndio.so.\${MAJ} libsndio.so.\${MAJ}.0"
++		libbsd=yes
++		user=_sndio
 +		so_link="libsndio.so libsndio.so.\${MAJ}"
  		so_ldflags="-Wl,-soname=libsndio.so.\${MAJ}"
  		defs='-D_GNU_SOURCE -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME'
  		;;
-@@ -95,17 +95,21 @@ case `uname` in
+@@ -95,17 +96,21 @@ case `uname` in
  		;;
  	NetBSD)
  		sun=no
@@ -34,16 +37,19 @@ $NetBSD$
  	OpenBSD)
  		sun=yes
  		rmidi=yes
- 		user=_sndiop
+-		user=_sndiop
++		user=_sndio
 +		so_link="libsndio.so.\${MAJ}"
  		defs='-DHAVE_ARC4RANDOM -DHAVE_GETPEEREID -DHAVE_ISSETUGID \\\
  		-DHAVE_STRLCAT -DHAVE_STRLCPY -DHAVE_STRTONUM \\\
  		-DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME'
-@@ -115,7 +119,7 @@ case `uname` in
+@@ -114,8 +119,8 @@ case `uname` in
+ 		oss=yes
  		umidi=yes
  		user=_sndio
- 		so_ldflags="-Wl,-soname=libsndio.so.\${MAJ}.\${MIN}"
+-		so_ldflags="-Wl,-soname=libsndio.so.\${MAJ}.\${MIN}"
 -		so_link="libsndio.so"
++		so_ldflags="-Wl,-soname=libsndio.so.\${MAJ}"
 +		so_link="libsndio.so libsndio.so.\${MAJ}"
  		defs='-DHAVE_ARC4RANDOM -DHAVE_GETPEEREID -DHAVE_ISSETUGID \\\
  		-DHAVE_STRLCAT -DHAVE_STRLCPY -DHAVE_STRTONUM \\\
diff --git a/sndio/patches/patch-libsndio_sio__oss.c b/sndio/patches/patch-libsndio_sio__oss.c
index d22dbc67c3..2ac040cfab 100644
--- a/sndio/patches/patch-libsndio_sio__oss.c
+++ b/sndio/patches/patch-libsndio_sio__oss.c
@@ -2,16 +2,12 @@ $NetBSD$
 
 Add missing bits for ossaudio(3) on NetBSD.
 
---- libsndio/sio_oss.c.orig	2025-11-15 14:07:59.501355746 +0000
+--- libsndio/sio_oss.c.orig	2024-08-01 15:36:54.000000000 +0000
 +++ libsndio/sio_oss.c
-@@ -37,6 +37,26 @@
+@@ -37,6 +37,22 @@
  	sizeof(DEVPATH_PREFIX) - 1 +	\
  	sizeof(int) * 3)
  
-+#ifndef SNDCTL_DSP_LOW_WATER	/* Low water level control */
-+#define SNDCTL_DSP_LOW_WATER	_IOW ('P', 34, int)
-+#endif
-+
 +/*
 + * Additional OSS formats definitions.
 + */
@@ -31,3 +27,17 @@ Add missing bits for ossaudio(3) on NetBSD.
  struct sio_oss_fmt {
  	int fmt;
  	unsigned int bits;
+@@ -288,11 +304,13 @@ sio_oss_getfd(const char *str, unsigned 
+ 	}
+ 
+ 	val = 1;
++#if !defined(__NetBSD__)
+ 	if (ioctl(fd, SNDCTL_DSP_LOW_WATER, &val) == -1) {
+ 		DPERROR("sio_oss_start: LOW_WATER");
+ 		close(fd);
+ 		return -1;
+ 	}
++#endif
+ 	return fd;
+ }
+ 


Home | Main Index | Thread Index | Old Index