%define XNOISE_BIN %{_libexecdir}/%{name}

Name: xnoise
Version: 0.2.21
Release: 1%{?_dist_release}
Summary: Tracklist-centric Media Player
Summary(ja): トラックリストを中心とするメディアプレーヤー

Group: Applications/Multimedia
License: GPLv2+ with exceptions
URL: http://www.xnoise-media-player.com/

BuildRoot: %{_tmppath}/%{name}-%{version}-root

Source0: http://xnoise.googlecode.com/files/xnoise-%{version}.tar.gz
Source1: xnoise_ja.po
Source10: xnoise.sh

BuildRequires: pkgconfig
BuildRequires: gettext
BuildRequires: glib2-devel >= 2.30.0
BuildRequires: gtk3-devel
BuildRequires: gstreamer1-plugins-base-devel >= 1.0.1
BuildRequires: intltool
BuildRequires: libxml2-devel >= 2.6.32
BuildRequires: libsoup-devel >= 2.26.0
BuildRequires: libtaginfo-devel >= 0.1.6
BuildRequires: perl-XML-Parser
BuildRequires: sqlite3-devel >= 3.6
BuildRequires: taglib-devel >= 1.6.0
BuildRequires: unique-devel
BuildRequires: vala-devel >= 0.16.0
BuildRequires: desktop-file-utils gettext intltool
Requires: hicolor-icon-theme
Requires: libtaginfo >= 0.1.6
# xnoise >= 0.1.14 bundles the plug-ins
Provides: xnoise-plugins-core = %{version}-%{release}

%description
Xnoise is a Gtk+ media player with a tracklist-centric design. The
tracklist is a list of video or music tracks that are played one by
one without being removed (right side of window). This gives you the
possibility to enqueue any track in any order, regardless if they are
on the same album or not. The tracks can be reordered at any time by
using drag and drop.


%package devel
Summary: Development files for %{name}
Summary(ja): %{name} の開発ファイル
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%setup -q
%{__cp} -f %{SOURCE1} po/ja.po
#sed -i s/hu/hu\\nja/g po/LINGUAS
sed -i -e '16,$d' -e '13d' data/misc/xnoise.desktop*

%build
%configure --enable-soundmenu2=no
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'

# remove invalid locale file
rm -rf $RPM_BUILD_ROOT%{_share}/locale/default

## wrapper install
%__mkdir_p $RPM_BUILD_ROOT%{_libexecdir}
%__mv $RPM_BUILD_ROOT%{_bindir}/%{name} $RPM_BUILD_ROOT%{XNOISE_BIN}
%{__install} -m 755 %{SOURCE10} $RPM_BUILD_ROOT%{_bindir}/%{name}

%find_lang %{name}


%check
make check
desktop-file-validate $RPM_BUILD_ROOT/%{_datadir}/applications/xnoise.desktop


%post
/sbin/ldconfig
touch --no-create %{_datadir}/icons/hicolor &>/dev/null || :
update-desktop-database &> /dev/null || :

%postun
/sbin/ldconfig
if [ $1 -eq 0 ] ; then
    touch --no-create %{_datadir}/icons/hicolor &>/dev/null
    gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
fi
update-desktop-database &> /dev/null || :

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS COPYING README
%{XNOISE_BIN}
%{_bindir}/xnoise
%{_bindir}/xnoise_image_extractor_service
# libxnoise.so *needs* to be in main package
# otherwise plugins currently don't work
#%exclude %{_libdir}/xnoise/libxnoisetest.so
%{_libdir}/xnoise
%{_libdir}/libxnoise.so*
%{_mandir}/man1/xnoise.1*
%{_datadir}/xnoise
%{_datadir}/applications/xnoise.desktop
%{_datadir}//dbus-1/services/org.gtk.xnoise.ImageExtractor.service
%{_datadir}//dbus-1/services/org.gtk.xnoise.PlayerEngine.service
%{_datadir}/icons/hicolor/*
%{_datadir}/icons/ubuntu-mono-*/*

%files devel
%defattr(-,root,root,-)
%{_includedir}/xnoise
#%{_libdir}/libxnoise*.so*
%{_libdir}/pkgconfig/xnoise-1.0.pc
# make package own the vala API dir:
# xnoise plugins don't have to be written in vala
%dir %{_datadir}/vala
%dir %{_datadir}/vala/vapi
%{_datadir}/vala/vapi/xnoise-1.0.*

%changelog
* Sat Jul 05 2014 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.21-1
- new upstream release

* Sat Oct 12 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.19-1
- new upstream release
- updated Source1

* Sun May 12 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.18-1
- new upstream release
- updated Source1
- changed BuildRequires: libtaginfo-devel >= 0.1.6
- changed Rquires: libtaginfo >= 0.1.6
- fixed desktop error
- deleted unrecognize option: --disable-ubuntuone

* Mon Apr 29 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.17-1
- new upstream release
- updated Source1
- changed BuildRequires: gstreamer-plugins-base-devel >= 0.10.23 to 
  gstreamer1-plugins-base-devel >= 1.0.1
- added BuildRequires: libtaginfo-devel
- added Requires: libtaginfo
- fixed Source10

* Fri Feb 08 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.15-1
- new upstream release
- updated Source1

* Fri Jan 11 2013 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.14-1
- new upstream release
- updated Source1

* Sat Nov 10 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.13-1
- new upstream release
- updated Source1

* Thu Oct 04 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.12-1
- new upstream release
- updated Source1
- deleted BuildRequires: libnotify-devel >= 0.7.0
- changed BuildRequires: vala-devel >= 0.15.0 to 0.16.0

* Sat Sep 22 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.11-1
- new upstream release
- updated Source1
- deleted %%configure option: --disable-magnatune

* Sat Sep 08 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.9-1
- new upstream release
- updated Source1

* Sat Aug 25 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.8-1
- new upstream release
- updated Source1
- added %%configure option: --disable-magnatune

* Fri Aug 10 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.5-1
- new upstream release
- updated Source1
- added %%configure option: --disable-ubuntuone

* Thu Aug 02 2012 Toshiharu Kudoh <toshi.kd2@gmail.com> - 0.2.4-1
- initial build for VineSeed

* Wed Oct  5 2011 Michel Salim <salimma@fedoraproject.org> - 0.1.29-1
- Update to 0.1.29

* Wed Sep 21 2011 Michel Salim <salimma@fedoraproject.org> - 0.1.28-1
- Update to 0.1.28

* Sat Sep 10 2011 Michel Salim <salimma@fedoraproject.org> - 0.1.27-1
- Update to 0.1.27

* Thu Jul 28 2011 Michel Salim <salimma@fedoraproject.org> - 0.1.26-1
- Update to 0.1.26
- Enable tests

* Mon Apr  4 2011 Michel Salim <salimma@fedoraproject.org> - 0.1.18-1
- Update to 0.1.18

* Sun Mar 13 2011 Michel Salim <salimma@fedoraproject.org> - 0.1.16-1
- Update to 0.1.16
- Now bundles the plugins, obsoleting xnoise-plugins-core

* Mon Feb 07 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.12-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Sat Nov  6 2010 Michel Salim <salimma@fedoraproject.org> - 0.1.12-3
- Own %%{_libdir}/xnoise for plugins

* Sat Nov  6 2010 Michel Salim <salimma@fedoraproject.org> - 0.1.12-2
- invoke ldconfig on (un)install
- remove %%clean section; only targeting F-14+
- re-enable deletion of invalid locale dir

* Sat Nov  6 2010 Michel Salim <salimma@fedoraproject.org> - 0.1.12-1
- Update to 0.1.12
- Specify the correct location for Vala API files in *.pc

* Fri Jun 25 2010 Michel Salim <salimma@fedoraproject.org> - 0.1.6-2
- Make xnoise-devel co-own Vala's VAPI dir
- Remove invalid locale file

* Wed Jun 23 2010 Michel Salim <salimma@fedoraproject.org> - 0.1.6-1
- Update to final 0.1.6 release

* Sat Apr  3 2010 Michel Salim <salimma@fedoraproject.org> - 0.1.2-0.1.331hg
- Initial package

