%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary: Portable Sound Event Library
Summary(ja): ポータブルサウンドイベントライブラリ
Name: libcanberra
Version: 0.22
Release: 1%{?_dist_release}
Group: System Environment/Libraries
Source0: http://0pointer.de/lennart/projects/libcanberra/libcanberra-%{version}.tar.gz
Source1: libcanberra-gtk-module.sh
License: LGPLv2+
Url: http://git.0pointer.de/?p=libcanberra.git;a=summary

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gtk2-devel
BuildRequires: alsa-lib-devel
BuildRequires: libvorbis-devel
BuildRequires: libtool-ltdl-devel
BuildRequires: gtk-doc
BuildRequires: pulseaudio-libs-devel >= 0.9.12
BuildRequires: gstreamer-devel
Requires: sound-theme-freedesktop
Requires: pulseaudio-libs

%description
A small and lightweight implementation of the XDG Sound Theme Specification
(http://0pointer.de/public/sound-theme-spec.html).

%description -l ja
libcanberra は XDG サウンドテーマ仕様にしたがった小型かつ軽量な実装です。

%package gtk2
Summary: Gtk+ Bindings for libcanberra
Summary(ja): libcanberra の gtk+ バインディング
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description gtk2
Gtk+ bindings for libcanberra

%package devel
Summary: Development Files for libcanberra Client Development
Summary(ja): libcanberra クライアントのための開発ファイル
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: %{name}-gtk2 = %{version}-%{release}
Requires: pkgconfig
Requires: gtk-doc
Requires: gtk2-devel

%description devel
Development Files for libcanberra Client Development

# compat32
%package -n compat32-%{name}
Summary: Portable Sound Event Library
Summary(ja): ポータブルサウンドイベントライブラリ
Group: System Environment/Libraries
Requires: compat32-pulseaudio-libs

%description -n compat32-%{name}
A small and lightweight implementation of the XDG Sound Theme Specification
(http://0pointer.de/public/sound-theme-spec.html).

%description -n compat32-%{name} -l ja
libcanberra は XDG サウンドテーマ仕様にしたがった小型かつ軽量な実装です。

%package -n compat32-%{name}-gtk2
Summary: Gtk+ Bindings for libcanberra
Summary(ja): libcanberra の gtk+ バインディング
Group: System Environment/Libraries
Requires: compat32-%{name} = %{version}-%{release}

%description -n compat32-%{name}-gtk2
Gtk+ bindings for libcanberra

%package -n compat32-%{name}-devel
Summary: Development Files for libcanberra Client Development
Summary(ja): libcanberra クライアントのための開発ファイル
Group: Development/Libraries
Requires: compat32-%{name} = %{version}-%{release}
Requires: compat32-%{name}-gtk2 = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Requires: gtk-doc
Requires: compat32-gtk2-devel

%description -n compat32-%{name}-devel
Development Files for libcanberra Client Development

%prep
%setup -q

%build
%configure --disable-static --disable-rpath --enable-pulse \
           --enable-alsa --enable-null --disable-oss --with-builtin=dso
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
find $RPM_BUILD_ROOT \( -name *.a -o -name *.la \) -exec rm {} \;
install -D -m755  %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/X11/xinit/xinitrc.d/libcanberra-gtk-module.sh
rm $RPM_BUILD_ROOT%{_docdir}/libcanberra/README

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%post gtk2
/sbin/ldconfig
export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
gconftool-2 --makefile-install-rule %{_sysconfdir}/gconf/schemas/libcanberra.schemas > /dev/null || :

%postun gtk2 -p /sbin/ldconfig

%pre gtk2
if [ "$1" -gt 1 ]; then
    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
    gconftool-2 --makefile-install-rule \
                %{_sysconfdir}/gconf/schemas/libcanberra.schemas >& /dev/null || :
fi

%preun gtk2
if [ "$1" -eq 0 ]; then
    export GCONF_CONFIG_SOURCE=`gconftool-2 --get-default-source`
    gconftool-2 --makefile-uninstall-rule \
                %{_sysconfdir}/gconf/schemas/libcanberra.schemas >& /dev/null || :
fi

%clean
rm -rf $RPM_BUILD_ROOT

%post -n compat32-%{name} -p /sbin/ldconfig
%postun -n compat32-%{name} -p /sbin/ldconfig

%post -n compat32-%{name}-gtk2 -p /sbin/ldconfig
%postun -n compat32-%{name}-gtk2 -p /sbin/ldconfig

%files
%defattr(-,root,root)
%doc README LGPL
%{_libdir}/libcanberra.so.*
%dir %{_libdir}/libcanberra-%{version}
%{_libdir}/libcanberra-%{version}/libcanberra-alsa.so
%{_libdir}/libcanberra-%{version}/libcanberra-pulse.so
%{_libdir}/libcanberra-%{version}/libcanberra-null.so
%{_libdir}/libcanberra-%{version}/libcanberra-multi.so
%{_libdir}/libcanberra-%{version}/libcanberra-gstreamer.so

%files gtk2
%defattr(-,root,root)
%{_sysconfdir}/gconf/schemas/libcanberra.schemas
%{_libdir}/libcanberra-gtk.so.*
%{_libdir}/gtk-2.0/modules/libcanberra-gtk-module.so
%{_sysconfdir}/X11/xinit/xinitrc.d/libcanberra-gtk-module.sh
%{_bindir}/canberra-gtk-play
%{_datadir}/gnome/autostart/libcanberra-login-sound.desktop
%{_datadir}/gnome/shutdown/libcanberra-logout-sound.sh

%files devel
%defattr(-,root,root)
%doc %{_datadir}/gtk-doc/html/libcanberra
%{_includedir}/canberra-gtk.h
%{_includedir}/canberra.h
%{_libdir}/libcanberra-gtk.so
%{_libdir}/libcanberra.so
%{_libdir}/pkgconfig/libcanberra-gtk.pc
%{_libdir}/pkgconfig/libcanberra.pc

# compat32
%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
%{_libdir}/libcanberra.so.*
%dir %{_libdir}/libcanberra-%{version}
%{_libdir}/libcanberra-%{version}/libcanberra-alsa.so
%{_libdir}/libcanberra-%{version}/libcanberra-pulse.so
%{_libdir}/libcanberra-%{version}/libcanberra-null.so
%{_libdir}/libcanberra-%{version}/libcanberra-multi.so
%{_libdir}/libcanberra-%{version}/libcanberra-gstreamer.so

%files -n compat32-%{name}-gtk2
%defattr(-,root,root)
%{_libdir}/libcanberra-gtk.so.*
%{_libdir}/gtk-2.0/modules/libcanberra-gtk-module.so

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/libcanberra-gtk.so
%{_libdir}/libcanberra.so
%{_libdir}/pkgconfig/libcanberra-gtk.pc
%{_libdir}/pkgconfig/libcanberra.pc
%endif

%changelog
* Sat Jan 23 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> 0.22-1
- new upstream release
- fixed BuildRoot

* Sun Sep 13 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.17-1
- new upstream release

* Sat May 09 2009 NAKAMURA Kenta <kenta@vinelinux.org> 0.12-2
- added compat32 package for x86_64 arch support

* Wed Apr 15 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.12-1
- new upstream release
- disable oss plugin

* Tue Sep 23 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 0.9-1
- initial build for Vine Linux

* Thu Sep 9 2008 Lennart Poettering <lpoetter@redhat.com> 0.9-1
- New version

* Thu Aug 28 2008 Lennart Poettering <lpoetter@redhat.com> 0.8-2
- Fix build-time dep on Gstreamer

* Thu Aug 28 2008 Lennart Poettering <lpoetter@redhat.com> 0.8-1
- New version

* Thu Aug 14 2008 Lennart Poettering <lpoetter@redhat.com> 0.7-1
- New version

* Mon Aug 4 2008 Lennart Poettering <lpoetter@redhat.com> 0.6-1
- New version

* Wed Jul 30 2008 Lennart Poettering <lpoetter@redhat.com> 0.5-4
- Really add versioned dependency on libpulse

* Wed Jul 30 2008 Lennart Poettering <lpoetter@redhat.com> 0.5-3
- Ship libcanberra-gtk-module.sh directly in CVS

* Wed Jul 30 2008 Lennart Poettering <lpoetter@redhat.com> 0.5-2
- Fix build

* Wed Jul 30 2008 Lennart Poettering <lpoetter@redhat.com> 0.5-1
- New version

* Mon Jul 28 2008 Lennart Poettering <lpoetter@redhat.com> 0.4-3
- Add versioned dependency on libpulse

* Sun Jul 27 2008 Lennart Poettering <lpoetter@redhat.com> 0.4-2
- Fix module name in libcanberra-gtk-module.sh

* Fri Jul 25 2008 Lennart Poettering <lpoetter@redhat.com> 0.4-1
- New version
- Install libcanberra-gtk-module.sh

* Mon Jun 16 2008 Lennart Poettering <lpoetter@redhat.com> 0.3-2
- Add dependency on sound-theme-freedesktop

* Fri Jun 13 2008 Lennart Poettering <lpoetter@redhat.com> 0.3-1
- Initial package, based on Colin Guthrie's Mandriva package

