daemon/sndio/ndmake.sh
$ cat ndmake.sh
#!/bin/sh -ue
NAME=sndio
VERSION=1.10.0
RELEASE=1
SOURCE="https://sndio.org/sndio-1.10.0.tar.gz"

build(){
	msg "configuring sndio..."

	./configure \
		--prefix="$PREFIX" \
		--privsep-user=sndiod \
		--enable-alsa \
		--enable-static || die "configure failed"

	msg "building sndio..."
	make LDFLAGS="$LDFLAGS -lasound" || die "make failed"

	msg "installing sndio..."
	make DESTDIR="$PKG" install || die "make install failed"
}

post_install() {
	# Create sndiod group
	echo 'grep -q "^sndiod:" /etc/group 2>/dev/null || addgroup -S sndiod'
	# Create the sndiod service user
	echo 'id sndiod >/dev/null 2>&1 || adduser -S -H -D -h /var/empty -s /bin/nologin -G sndiod sndiod'
	# Add sndiod to the audio group
	echo 'addgroup sndiod audio 2>/dev/null || :'
}
post_remove() {
	echo 'id sndiod >/dev/null 2>&1 && deluser sndiod 2>/dev/null || :'
	echo 'grep -q "^sndiod:" /etc/group 2>/dev/null && delgroup sndiod 2>/dev/null || :'
}

. ${0%/*}/../../libsh/libdmake.sh