ports: sndio

This commit is contained in:
Matheus
2026-05-28 23:55:24 -03:00
parent 1c7b74ccbf
commit 3994eccbaa
5 changed files with 128 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/usr/bin/bash
set -e
case "$1" in
pre)
;;
post)
if ! grep -q '^sndiod:' /etc/group; then
groupadd -r sndiod
fi
if ! grep -q '^sndiod:' /etc/passwd; then
useradd -r -g sndiod -d /var/empty -s /bin/false -c "sndio daemon" sndiod
fi
;;
esac
exit 0
+71
View File
@@ -0,0 +1,71 @@
diff --git sndio-clean/configure sndio-workdir/configure
index d36e767..547c8fb 100755
--- sndio-clean/configure
+++ sndio-workdir/configure
@@ -63,10 +63,20 @@ unset defs # no extra #defines
unset ldadd # no extra libraries (-l options)
unset dev
+: "${UNAME:=`uname`}"
+
#
# guess OS-specific parameters
#
-case `uname` in
+case ${UNAME} in
+ Astral)
+ oss=yes
+ ldadd="-lrt -lm"
+ user=sndiod
+ so_link="libsndio.so libsndio.so.\${MAJ} libsndio.so.\${MAJ}.0"
+ so_ldflags="-Wl,-soname=libsndio.so.\${MAJ}"
+ defs='-D_GNU_SOURCE -DHAVE_SOCK_CLOEXEC -DHAVE_CLOCK_GETTIME'
+ ;;
Linux)
alsa=yes
ldadd="-lrt -lm"
diff --git sndio-clean/libsndio/sio_oss.c sndio-workdir/libsndio/sio_oss.c
index 7614497..1fc8ad6 100644
--- sndio-clean/libsndio/sio_oss.c
+++ sndio-workdir/libsndio/sio_oss.c
@@ -66,15 +66,6 @@ static struct sio_oss_fmt formats[] = {
{ AFMT_S24_BE, 24, 3, 1, 0, 1 },
{ AFMT_S24_LE, 24, 3, 1, 1, 0 },
{ AFMT_S24_LE, 24, 3, 1, 1, 1 },
- { AFMT_U24_BE, 24, 3, 0, 0, 0 },
- { AFMT_U24_BE, 24, 3, 0, 0, 1 },
- { AFMT_U24_LE, 24, 3, 0, 1, 0 },
- { AFMT_U24_LE, 24, 3, 0, 1, 1 },
-
- { AFMT_S32_BE, 32, 4, 1, 0, 1 },
- { AFMT_S32_LE, 32, 4, 1, 1, 1 },
- { AFMT_U32_BE, 32, 4, 0, 0, 1 },
- { AFMT_U32_LE, 32, 4, 0, 1, 1 },
};
struct sio_oss_hdl {
@@ -147,8 +138,7 @@ sio_oss_getcap(struct sio_hdl *sh, struct sio_cap *cap)
48000, 64000, 88200, 96000, 192000
};
static int afmts[] = {
- AFMT_U8, AFMT_S16_LE, AFMT_S16_BE, AFMT_S24_LE, AFMT_U24_LE,
- AFMT_S32_LE, AFMT_U32_LE
+ AFMT_U8, AFMT_S16_LE, AFMT_S16_BE, AFMT_S24_LE,
};
struct sio_oss_hdl *hdl = (struct sio_oss_hdl *)sh;
unsigned int nconf = 0;
@@ -287,12 +277,14 @@ sio_oss_getfd(const char *str, unsigned int mode, int nbio)
return -1;
}
+#ifndef __astral__
val = 1;
if (ioctl(fd, SNDCTL_DSP_LOW_WATER, &val) == -1) {
DPERROR("sio_oss_start: LOW_WATER");
close(fd);
return -1;
}
+#endif
return fd;
}
+22
View File
@@ -0,0 +1,22 @@
name=sndio
revision=2
from_source=sndio
imagedeps="build-essential"
hostdeps="xgcc xbinutils"
deps="base oss shadow" # shadow is here for the post-install hook
configure() {
cp -rp ${source_dir}/* .
UNAME=Astral ./configure --prefix=${prefix} CFLAGS="-I'${sysroot_dir}/usr/lib/oss/include' ${CFLAGS}" CC=x86_64-astral-gcc
}
build() {
make -j ${parallelism}
}
package() {
make install DESTDIR=${dest_dir}
mkdir -p ${dest_dir}/etc/init.d
cp ${base_dir}/service-scripts/sndiod ${dest_dir}/etc/init.d
copy_install_hook
}
+11
View File
@@ -0,0 +1,11 @@
#!/sbin/openrc-run
description="start the sndio audio server"
command=/usr/bin/sndiod
command_args="${sndiod_options}"
retry="${retry:-TERM/5/KILL/5}"
depend() {
need localmount
after bootmisc
}
+5
View File
@@ -0,0 +1,5 @@
name=sndio
version=1.10.0
source_method=tarball
tarball_url="https://sndio.org/sndio-${version}.tar.gz"
tarball_sha512="c35462976a1bffd128eacb185165964dac6b03505255e9ab9a933e24be5ed146cd9ac6995fd7af23247cb9133c010cce0876572db53b783ebabeb563fec7a1cf"