#!/bin/bash
#
# Copyright 2009 dropline GNOME
# Available under the terms of the GNU GPL.
#

NAME="pulseaudio"
VERSION="2.1"
REVISION="1"

PKG_SOURCEURL='http://freedesktop.org/software/$NAME/releases/$NAME-$VERSION.tar.xz'
PKG_LOCALSTATEDIR="/var"
PKG_SANIFYNOTOUCH="yes"

. $DLG_ROOT/etc/config
. $DLG_ROOT/lib/dl-base

cflags
prepare
analyzesource
# tcpwrap's check is broken because of a deprecated yp_get_default_domain
# reference on Slackware's libwrap.a
configure --with-system-user=pulse \
	--with-system-group=pulse \
	--with-access-group=pulse-access
make
makeinstall install-strip
tidydocumentation
analyzebinaries

# Alsa and Pulseaudio config
cat << EOF >> $PKG_STAGEROOT/etc/asound.conf
pcm.headset {
        type bluetooth
}

ctl.headset {
        type bluetooth
}

pcm.pulse {
    type pulse
}

ctl.pulse {
    type pulse
}

pcm.!default {
    type pulse
}

ctl.!default {
    type pulse
}

EOF

# Rename config files
configfile /etc/pulse/client.conf
configfile /etc/pulse/default.pa
configfile /etc/pulse/daemon.conf
configfile /etc/pulse/system.pa
configfile /etc/asound.conf

createroleaccount pulse 230 230
createroleaccount realtime 231 231
createroleaccount pulse-access 232 232

finalizepackage
packagize
cleanup
