#
# spec file for package pulseaudio
#
# Copyright (c) 2011 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

# norootforbuild

%define drvver 0.99

Name:           pulseaudio
Summary:        A Networked Sound Server
Version:        0.99.2
Release:        1
License:        GPLv2+ ; LGPLv2.1+
Group:          System/Sound Daemons
Source:         http://freedesktop.org/software/pulseaudio/releases/%{name}-%{version}.tar.gz
Source1:        default.pa-for-gdm
Source2:        setup-pulseaudio
Source3:        sysconfig.sound-pulseaudio
Source99:       baselibs.conf
Patch0:         disabled-start.diff
Patch1:         suppress-socket-error-msg.diff
Url:            http://pulseaudio.org
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  alsa-devel
BuildRequires:  bluez-devel
BuildRequires:  doxygen
BuildRequires:  gconf2-devel
BuildRequires:  glib2-devel
BuildRequires:  gtk2-devel
BuildRequires:  intltool
BuildRequires:  jack-devel
BuildRequires:  libatomic-ops-devel
BuildRequires:  libavahi-devel
BuildRequires:  libopenssl-devel
BuildRequires:  libsamplerate-devel
BuildRequires:  libsndfile-devel
BuildRequires:  libtool
#our libtdb-devel does not have a .pc file
BuildRequires:  libtdb-devel
BuildRequires:  gdbm-devel
BuildRequires:  lirc-devel
BuildRequires:  libudev-devel >= 143
BuildRequires:  speex-devel
BuildRequires:  tcpd-devel
BuildRequires:  translation-update-upstream
BuildRequires:  update-desktop-files
BuildRequires:  xorg-x11-devel
BuildRequires:  pkgconfig(json) >= 0.9
PreReq:         %fillup_prereq
PreReq:         pwdutils
Recommends:     alsa-plugins-pulse
Recommends:     %{name}-lang
Requires:       udev >= 146
Requires:       rtkit
Conflicts:      kernel < 2.6.31
Obsoletes:      libpulsecore9 <= 0.9.14
Obsoletes:      libpulsecore7 <= 0.9.12

%description
pulseaudio is a networked sound server for Linux, other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

%package esound-compat
License:        GPLv2+ ; LGPLv2.1+
Summary:        ESOUND compatibility for PulseAudio
Group:          System/Sound Daemons
Requires:       %{name} = %{version}
Provides:       esound-daemon = 0.2.41
Obsoletes:      esound-daemon <= 0.2.38

%description esound-compat
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

This package provides the compatibility layer for drop-in replacement
of ESOUND.

%package module-lirc
License:        GPLv2+ ; LGPLv2.1+
Summary:        LIRC module for PulseAudio
Group:          System/Sound Daemons
Requires:       %{name} = %{version}

%description module-lirc
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

%package module-x11
License:        GPLv2+ ; LGPLv2.1+
Summary:        X11 module for PulseAudio
Group:          System/Sound Daemons
Requires:       %{name} = %{version}
Requires:       %{name}-utils = %{version}

%description module-x11
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

%package module-zeroconf
License:        GPLv2+ ; LGPLv2.1+
Summary:        Zeroconf module for PulseAudio
Group:          System/Sound Daemons
Requires:       %{name} = %{version}

%description module-zeroconf
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

%package module-jack
License:        GPLv2+ ; LGPLv2.1+
Summary:        JACK support for the PulseAudio sound server
Group:          System/Sound Daemons
Requires:       %{name} = %{version}

%description module-jack
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

This package includes support for Jack-based applications.

%package module-bluetooth
License:        GPLv2+ ; LGPLv2.1+
Summary:        Bluetooth support for the PulseAudio sound server
Group:          System/Sound Daemons
Requires:       %{name} = %{version}
Requires:       bluez >= 4.34

%description module-bluetooth
Contains Bluetooth audio (A2DP/HSP/HFP) support for the PulseAudio sound server.

%package module-gconf
License:        GPLv2+ ; LGPLv2.1+
Summary:        GCONF module for PulseAudio
Group:          System/Sound Daemons
Requires:       %{name} = %{version}

%description module-gconf
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

%package -n libpulse0
Summary:        Client interface to PulseAudio
License:        GPLv2+ ; LGPLv2.1+
Group:          System/Libraries
Provides:       pulseaudio-libs = %{version}-%{release}
Obsoletes:      pulseaudio-libs < %{version}

%description -n libpulse0
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

This package contains the system libraries for clients of pulseaudio
sound server.

%package -n libpulse-mainloop-glib0
Summary:        GLIB 2.0 Main Loop wrapper for PulseAudio
License:        GPLv2+ ; LGPLv2.1+
Group:          System/Sound Daemons
Provides:       pulseaudio-libs-glib2 = %{version}-%{release}
Obsoletes:      pulseaudio-libs-glib2 < %{version}

%description -n libpulse-mainloop-glib0
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

%package -n libpulse-devel
Summary:        Development package for the pulseaudio library
License:        GPLv2+ ; LGPLv2.1+
Group:          Development/Libraries/C and C++
Requires:       libpulse0 = %{version}
Requires:       libpulse-mainloop-glib0 = %{version}
Requires:       pkgconfig glib2-devel
Provides:       pulseaudio-devel = %{version}-%{release}
Obsoletes:      pulseaudio-devel < %{version}

%description -n libpulse-devel
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

This package contains the files needed to compile programs that use the
pulseaudio library.

%package utils
Summary:        PulseAudio utilities
License:        GPLv2+ ; LGPLv2.1+
Group:          System/Sound Daemons
Requires:       %{name} = %{version}
Requires:       libpulse0 = %{version}
Requires:       libpulse-mainloop-glib0 = %{version}

%description utils
pulseaudio is a networked sound server for Linux and other Unix like
operating systems and Microsoft Windows. It is intended to be an
improved drop-in replacement for the Enlightened Sound Daemon (ESOUND).

%package gdm-hooks
Summary:        PulseAudio GDM integration
License:        GPLv2+ ; LGPLv2.1+
Group:          Productivity/Multimedia/Other
Requires:       %{name} = %{version}
Requires:       gdm >= 2.22
#for the gdm user
Requires(pre):  gdm
#avoid cycle
#!BuildIgnore: gdm

%description gdm-hooks
This package contains GDM integration hooks for the PulseAudio sound server.

%lang_package
%prep
%setup -q -T -b0
translation-update-upstream
%patch0
%patch1 -p1

%build
autoreconf
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
# libpulse and libpulsecommon need each other - no way with as-needed
export SUSE_ASNEEDED=0
%configure \
        --disable-static \
        --disable-rpath \
        --with-system-user=pulse \
        --with-system-group=pulse \
        --with-access-group=pulse-access \
        --disable-hal
make %{?jobs:-j%jobs}
make doxygen

%install
%makeinstall
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.la $RPM_BUILD_ROOT%{_libdir}/pulse-%{drvver}/modules/*.la
# configure --disable-static had no effect; delete manually.
rm -rf $RPM_BUILD_ROOT%{_libdir}/*.a
%suse_update_desktop_file pulseaudio
%find_lang %{name}
install %SOURCE2 $RPM_BUILD_ROOT%{_bindir}
chmod 755 $RPM_BUILD_ROOT%{_bindir}/setup-pulseaudio
install -d $RPM_BUILD_ROOT%{_localstatedir}/adm/fillup-templates
install -m 0644 %SOURCE3 %{buildroot}%{_localstatedir}/adm/fillup-templates
mkdir -p $RPM_BUILD_ROOT/etc/profile.d
touch $RPM_BUILD_ROOT/etc/profile.d/pulseaudio.sh
touch $RPM_BUILD_ROOT/etc/profile.d/pulseaudio.csh
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/lib/gdm/.pulse
cp $RPM_SOURCE_DIR/default.pa-for-gdm $RPM_BUILD_ROOT%{_localstatedir}/lib/gdm/.pulse/default.pa
ln -s esdcompat $RPM_BUILD_ROOT%{_bindir}/esd

%clean
rm -rf $RPM_BUILD_ROOT

%pre
groupadd -r pulse &>/dev/null || :
useradd -r -c 'PulseAudio daemon' \
    -s /sbin/nologin -d /var/lib/pulseaudio -g pulse -G audio pulse &>/dev/null || :
groupadd -r pulse-access &>/dev/null || :

%post -n libpulse0 -p /sbin/ldconfig

%postun -n libpulse0 -p /sbin/ldconfig

%post -n libpulse-mainloop-glib0 -p /sbin/ldconfig

%postun -n libpulse-mainloop-glib0 -p /sbin/ldconfig

%post
/sbin/ldconfig
%{fillup_only -an sound}
# Update the /etc/profile.d/pulseaudio.* files
setup-pulseaudio --auto > /dev/null

%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README LICENSE GPL LGPL
%dir %{_sysconfdir}/pulse/
%config(noreplace) %{_sysconfdir}/pulse/daemon.conf
%config(noreplace) %{_sysconfdir}/pulse/default.pa
%config(noreplace) %{_sysconfdir}/pulse/system.pa
%config(noreplace) %{_sysconfdir}/dbus-1/system.d/pulseaudio-system.conf
%{_bindir}/pulseaudio
%{_bindir}/setup-pulseaudio
# created by setup-pulseaudio script
%ghost /etc/profile.d/pulseaudio.sh
%ghost /etc/profile.d/pulseaudio.csh
%{_localstatedir}/adm/fillup-templates/sysconfig.sound-pulseaudio
%dir %{_libdir}/pulse-%{drvver}/
%dir %{_libdir}/pulse-%{drvver}/modules/
%{_libdir}/libpulsecore-%{drvver}.so
%{_libdir}/libpulsedsp.so
%{_libdir}/pulse-%{drvver}/modules/libalsa-util.so
%{_libdir}/pulse-%{drvver}/modules/libcli.so
%{_libdir}/pulse-%{drvver}/modules/liboss-util.so
%{_libdir}/pulse-%{drvver}/modules/libprotocol-cli.so
%{_libdir}/pulse-%{drvver}/modules/libprotocol-esound.so
%{_libdir}/pulse-%{drvver}/modules/libprotocol-http.so
%{_libdir}/pulse-%{drvver}/modules/libprotocol-native.so
%{_libdir}/pulse-%{drvver}/modules/libprotocol-simple.so
%{_libdir}/pulse-%{drvver}/modules/librtp.so
%{_libdir}/pulse-%{drvver}/modules/module-alsa-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-alsa-source.so
%{_libdir}/pulse-%{drvver}/modules/module-alsa-card.so
%{_libdir}/pulse-%{drvver}/modules/module-always-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-cli-protocol-tcp.so
%{_libdir}/pulse-%{drvver}/modules/module-cli-protocol-unix.so
%{_libdir}/pulse-%{drvver}/modules/module-cli.so
%{_libdir}/pulse-%{drvver}/modules/module-combine.so
%{_libdir}/pulse-%{drvver}/modules/module-combine-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-dbus-protocol.so
%{_libdir}/pulse-%{drvver}/modules/module-device-manager.so
%{_libdir}/pulse-%{drvver}/modules/module-loopback.so
%{_libdir}/pulse-%{drvver}/modules/module-console-kit.so
%{_libdir}/pulse-%{drvver}/modules/module-detect.so
%{_libdir}/pulse-%{drvver}/modules/module-device-restore.so
%{_libdir}/pulse-%{drvver}/modules/module-esound-compat-spawnfd.so
%{_libdir}/pulse-%{drvver}/modules/module-esound-compat-spawnpid.so
%{_libdir}/pulse-%{drvver}/modules/module-esound-protocol-tcp.so
%{_libdir}/pulse-%{drvver}/modules/module-esound-protocol-unix.so
%{_libdir}/pulse-%{drvver}/modules/module-esound-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-filter-apply.so
%{_libdir}/pulse-%{drvver}/modules/module-filter-heuristics.so
%{_libdir}/pulse-%{drvver}/modules/module-hal-detect.so
%{_libdir}/pulse-%{drvver}/modules/module-http-protocol-tcp.so
%{_libdir}/pulse-%{drvver}/modules/module-http-protocol-unix.so
%{_libdir}/pulse-%{drvver}/modules/module-match.so
%{_libdir}/pulse-%{drvver}/modules/module-mmkbd-evdev.so
%{_libdir}/pulse-%{drvver}/modules/module-native-protocol-fd.so
%{_libdir}/pulse-%{drvver}/modules/module-native-protocol-tcp.so
%{_libdir}/pulse-%{drvver}/modules/module-native-protocol-unix.so
%{_libdir}/pulse-%{drvver}/modules/module-null-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-null-source.so
%{_libdir}/pulse-%{drvver}/modules/module-oss.so
%{_libdir}/pulse-%{drvver}/modules/module-pipe-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-pipe-source.so
%{_libdir}/pulse-%{drvver}/modules/module-position-event-sounds.so
%{_libdir}/pulse-%{drvver}/modules/module-rescue-streams.so
%{_libdir}/pulse-%{drvver}/modules/module-rtp-recv.so
%{_libdir}/pulse-%{drvver}/modules/module-rtp-send.so
%{_libdir}/pulse-%{drvver}/modules/module-simple-protocol-tcp.so
%{_libdir}/pulse-%{drvver}/modules/module-simple-protocol-unix.so
%{_libdir}/pulse-%{drvver}/modules/module-stream-restore.so
%{_libdir}/pulse-%{drvver}/modules/module-switch-on-connect.so
%{_libdir}/pulse-%{drvver}/modules/module-card-restore.so
%{_libdir}/pulse-%{drvver}/modules/module-sine.so
%{_libdir}/pulse-%{drvver}/modules/module-tunnel-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-tunnel-source.so
%{_libdir}/pulse-%{drvver}/modules/module-volume-restore.so
%{_libdir}/pulse-%{drvver}/modules/module-suspend-on-idle.so
%{_libdir}/pulse-%{drvver}/modules/module-default-device-restore.so
%{_libdir}/pulse-%{drvver}/modules/module-ladspa-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-remap-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-augment-properties.so
%{_libdir}/pulse-%{drvver}/modules/module-cork-music-on-phone.so
%{_libdir}/pulse-%{drvver}/modules/module-sine-source.so
%{_libdir}/pulse-%{drvver}/modules/module-intended-roles.so
%{_libdir}/pulse-%{drvver}/modules/module-rygel-media-server.so
%{_libdir}/pulse-%{drvver}/modules/module-udev-detect.so
%{_libdir}/pulse-%{drvver}/modules/module-echo-cancel.so
%{_libdir}/pulse-%{drvver}/modules/module-virtual-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-virtual-source.so
%dir %{_datadir}/pulseaudio
%dir %{_datadir}/pulseaudio/alsa-mixer
%dir %{_datadir}/pulseaudio/alsa-mixer/paths
%dir %{_datadir}/pulseaudio/alsa-mixer/profile-sets
%{_datadir}/pulseaudio/alsa-mixer/paths/*
%{_datadir}/pulseaudio/alsa-mixer/profile-sets/*
%{_mandir}/man1/pulseaudio.1.gz
%{_mandir}/man5/default.pa.5.gz
%{_mandir}/man5/pulse-client.conf.5.gz
%{_mandir}/man5/pulse-daemon.conf.5.gz
/lib/udev/rules.d/90-pulseaudio.rules

%files esound-compat
%defattr(-,root,root)
%{_bindir}/esdcompat
%{_bindir}/esd
%{_mandir}/man1/esdcompat.1.gz

%files module-lirc
%defattr(-,root,root)
%{_libdir}/pulse-%{drvver}/modules/module-lirc.so

%files module-x11
%defattr(-,root,root)
%{_sysconfdir}/xdg/autostart/pulseaudio.desktop
%{_sysconfdir}/xdg/autostart/pulseaudio-kde.desktop
%{_bindir}/start-pulseaudio-x11
%{_bindir}/start-pulseaudio-kde
%{_libdir}/pulse-%{drvver}/modules/module-x11-bell.so
%{_libdir}/pulse-%{drvver}/modules/module-x11-publish.so
%{_libdir}/pulse-%{drvver}/modules/module-x11-xsmp.so
%{_libdir}/pulse-%{drvver}/modules/module-x11-cork-request.so
%{_mandir}/man1/start-pulseaudio-kde.1.gz
%{_mandir}/man1/start-pulseaudio-x11.1.gz

%files module-zeroconf
%defattr(-,root,root)
%{_libdir}/pulse-%{drvver}/modules/libavahi-wrap.so
%{_libdir}/pulse-%{drvver}/modules/module-zeroconf-publish.so
%{_libdir}/pulse-%{drvver}/modules/module-zeroconf-discover.so
%{_libdir}/pulse-%{drvver}/modules/libraop.so
%{_libdir}/pulse-%{drvver}/modules/module-raop-discover.so
%{_libdir}/pulse-%{drvver}/modules/module-raop-sink.so

%files module-jack
%defattr(-,root,root)
%{_libdir}/pulse-%{drvver}/modules/module-jack-sink.so
%{_libdir}/pulse-%{drvver}/modules/module-jack-source.so
%{_libdir}/pulse-%{drvver}/modules/module-jackdbus-detect.so

%files module-bluetooth
%defattr(-,root,root)
%{_libdir}/pulse-%{drvver}/modules/libbluetooth-ipc.so
%{_libdir}/pulse-%{drvver}/modules/libbluetooth-sbc.so
%{_libdir}/pulse-%{drvver}/modules/libbluetooth-util.so
%{_libdir}/pulse-%{drvver}/modules/module-bluetooth-device.so
%{_libdir}/pulse-%{drvver}/modules/module-bluetooth-discover.so
%{_libdir}/pulse-%{drvver}/modules/module-bluetooth-proximity.so
%attr(0755,root,root) %{_libexecdir}/pulse/proximity-helper

%files module-gconf
%defattr(-,root,root)
%dir %{_libexecdir}/pulse
%{_libdir}/pulse-%{drvver}/modules/module-gconf.so
%{_libexecdir}/pulse/gconf-helper

%files -n libpulse0
%defattr(-,root,root)
%doc README LICENSE GPL LGPL
%dir %{_sysconfdir}/pulse/
%config(noreplace) %{_sysconfdir}/pulse/client.conf
%{_libdir}/libpulse.so.*
%{_libdir}/libpulsecommon-%{drvver}.so
%{_libdir}/libpulse-simple.so.*

%files -n libpulse-mainloop-glib0
%defattr(-,root,root)
%{_libdir}/libpulse-mainloop-glib.so.*

%files -n libpulse-devel
%defattr(-,root,root)
%doc doxygen/html
%{_includedir}/pulse/
%{_libdir}/libpulse.so
%{_libdir}/libpulse-mainloop-glib.so
%{_libdir}/libpulse-simple.so
%{_libdir}/pkgconfig/libpulse*.pc
%{_datadir}/vala

%files utils
%defattr(-,root,root)
%{_bindir}/pacat
%{_bindir}/pacmd
%{_bindir}/pactl
%{_bindir}/paplay
%{_bindir}/parec
%{_bindir}/pamon
%{_bindir}/parecord
%{_bindir}/pax11publish
%{_bindir}/padsp
%{_bindir}/pasuspender
%{_mandir}/man1/pacat.1.gz
%{_mandir}/man1/pacmd.1.gz
%{_mandir}/man1/pactl.1.gz
%{_mandir}/man1/paplay.1.gz
%{_mandir}/man1/pasuspender.1.gz
%{_mandir}/man1/padsp.1.gz
%{_mandir}/man1/pax11publish.1.gz

%files gdm-hooks
%defattr(-,root,root)
%attr(0750, gdm, gdm) %dir %{_localstatedir}/lib/gdm
%attr(0700, gdm, gdm) %dir %{_localstatedir}/lib/gdm/.pulse
%attr(0600, gdm, gdm) %{_localstatedir}/lib/gdm/.pulse/default.pa

%files lang -f %{name}.lang

%changelog