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

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

# patch from fedora
Patch1: libcanberra-quit-add.patch

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

Vendor: Project Vine
Distribution: Vine Linux

%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+ 2.x Bindings for libcanberra
Summary(ja): libcanberra の gtk+ 2.x バインディング
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description gtk2
Gtk+ 2.x bindings for libcanberra

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

%description gtk3
Gtk+ 3.x 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

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

%description gtk3-devel
Development Files for libcanberra GTK3 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}-gtk3
Summary: Gtk+ 3.x Bindings for libcanberra
Summary(ja): libcanberra の gtk+ 3.x バインディング
Group: System Environment/Libraries
Requires: compat32-%{name} = %{version}-%{release}

%description -n compat32-%{name}-gtk3
Gtk+ 3.x 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

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

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

%prep
%setup -q
# %patch1 -p1 -b .quit

%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 gtk3
/sbin/ldconfig

%postun gtk3 -p /sbin/ldconfig


%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)
%{_libdir}/libcanberra-gtk.so.*
%{_libdir}/gtk-2.0/modules/libcanberra-gtk-module.so

%files gtk3
%defattr(-,root,root)
%{_libdir}/libcanberra-gtk3.so.*
%{_libdir}/gtk-3.0/modules/libcanberra-gtk3-module.so
%{_libdir}/gtk-3.0/modules/libcanberra-gtk-module.so
%{_libdir}/gnome-settings-daemon-3.0/gtk-modules/canberra-gtk-module.desktop
%{_bindir}/canberra-gtk-play
%{_datadir}/gnome/autostart/libcanberra-login-sound.desktop
%{_datadir}/gnome/shutdown/libcanberra-logout-sound.sh
%{_datadir}/gdm/autostart/LoginWindow/libcanberra-ready-sound.desktop

%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
%{_datadir}/vala/vapi/libcanberra-gtk.vapi
%{_datadir}/vala/vapi/libcanberra.vapi

%files gtk3-devel
%defattr(-,root,root)
%{_libdir}/libcanberra-gtk3.so
%{_libdir}/pkgconfig/libcanberra-gtk3.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}-gtk3
%defattr(-,root,root)
%{_libdir}/libcanberra-gtk3.so.*
%{_libdir}/gtk-3.0/modules/libcanberra-gtk3-module.so
%{_libdir}/gtk-3.0/modules/libcanberra-gtk-module.so

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

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

%changelog
* Fri Sep 28 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.30-1
- new upstream release
- change BuildRequires; gstreamer1-devel instead of gstreamer-devel

* Sun Aug 14 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.28-1
- new upstream release
- drop Patch1

* Tue Apr 12 2011 IWAI, Masaharu <iwai@alib.jp> 0.26-2
- split -devel sub package
 - create -gtk3-devel sub package
 - drop Requires: gtk3-devel for -devel sub package

* Fri Feb 18 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.26-1
- new upstream release
- add BuildRequires: gtk3-devel
- add -gtk3 sub package
- add Patch1 (libcanberra-quit-add.patch)

* Sat Sep 25 2010 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.25-2
- rebuild with rpm-4.8.1 for pkg-config file

* Fri Jul 9 2010 Toshiharu Kudoh <toshi.kd2@gmail.com> 0.25-1
- new upstream release

* 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

