Name: amarok
Summary: Amarok Media Player
Summary(ja): Amarok メディアプレイヤー
Version: 2.6.0
Release: 1%{?_dist_release}

Group: Applications/Multimedia
License: GPLv2
URL: http://amarok.kde.org

Source0: http://download.kde.org/stable/amarok/%{version}/src/amarok-%{version}.tar.bz2
## upstream patches
Patch10: amarok-2.3.2_bpm_tags-in-flac_fix.patch
Patch20: amarok-2.3.2_0001-Re-add-some-tests-for-unprintable-but-also-invalid-c.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: curl-devel
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: kdelibs4-devel 
#BuildRequires: libifp-devel
#BuildRequires: liblastfm-devel
#BuildRequires: libmp4v2-devel
BuildRequires: libgcrypt-devel
BuildRequires: libgpod-devel >= 0.7.0
BuildRequires: libmtp-devel >= 1.0.0
BuildRequires: libnjb-devel
BuildRequires: libusb-devel
BuildRequires: libxml2-devel
BuildRequires: libvisual-devel
BuildRequires: loudmouth-devel
BuildRequires: MySQL-devel
BuildRequires: phonon-devel
BuildRequires: qca2-devel
BuildRequires: qjson-devel
BuildRequires: qtscriptbindings
BuildRequires: soprano-devel
BuildRequires: taglib-devel >= 1.7
BuildRequires: taglib-extras-devel >= 1.0.1
BuildRequires: zlib-devel

Requires: qtscriptbindings
Requires: %{name}-libs = %{version}-%{release}
Requires: %{name}-utils = %{version}-%{release}

# for trash protocol support, phonon kcm, etc...
# FIXME: should probably be handled lower in the stack
Requires: kdebase-runtime >= 4.5

# when we grew a -libs subpkg, multilib love
Obsoletes: amarok-konqueror < 1.5 
Obsoletes: amarok-helix-engine < 1.5
Obsoletes: amarok-void-engine < 1.5
Obsoletes: amarok-xine-engine < 1.5
Obsoletes: amarok-visualisation < 1.5

Vendor: Project Vine
Distribution: Vine Linux

%description
Amarok is a multimedia player with:
 - fresh playlist concept, very fast to use, with drag and drop
 - plays all formats supported by the various engines
 - audio effects, like reverb and compressor
 - compatible with the .m3u and .pls formats for playlists
 - nice GUI, integrates into the KDE look, but with a unique touch

%description -l ja
Amarokは、直感的インターフェースを備えた、Linux および Unix 用の音楽プレーヤーです。
Amarokはより好きな音楽を簡単に再生します。 

%package libs
Summary: Runtime libraries for %{name}
Summary(ja): %{name} のランタイムライブラリ
Group:   System Environment/Libraries
#Requires: %{name} = %{version}-%{release}
Requires: qt4 >= 4.6

%description libs
%{summary}.

%package utils
Summary: Amarok standalone utilities
Group: Applications/Multimedia
Obsoletes: amarok-collectionscanner < 2.0.90-2
Obsoletes: amarok-utilities < 2.0.96

%description utils 
%{summary}, including amarokcollectionscanner.

%prep
%setup -q
#patch10 -p0
#patch20 -p1

%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%cmake \
    -DCMAKE_BUILD_TYPE=release \
    -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
    -DDATA_INSTALL_DIR:PATH=%{_datadir}/kde4/apps \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/kde4 \
    -DLIB_INSTALL_DIR:PATH=%{_libdir} \
    -DLIBEXEC_INSTALL_DIR:PATH=%{_libexecdir}/kde4 \
    -DSYSCONF_INSTALL_DIR:PATH=%{_sysconfdir} \
    -DWITH_MYSQL_EMBEDDED=no \
    ..
popd

make %{?_smp_mflags} -C %{_target_platform}

%install
rm -rf $RPM_BUILD_ROOT 
make install/fast DESTDIR=$RPM_BUILD_ROOT -C %{_target_platform}

%find_lang amarok 
%find_lang amarokcollectionscanner_qt 
%find_lang amarokpkg 
%find_lang amarok_scriptengine_qscript 
cat amarokpkg.lang >> amarok.lang
cat amarok_scriptengine_qscript.lang >> amarok.lang

# unpackaged files
rm -f $RPM_BUILD_ROOT%{_libdir}/libamarok{-sqlcollection,-transcoding,_taglib,core,lib,plasma,pud,ocsclient}.so

%check
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/kde4/amarok.desktop
desktop-file-validate $RPM_BUILD_ROOT%{_datadir}/applications/kde4/amarok_containers.desktop

%clean
rm -rf $RPM_BUILD_ROOT

%post
touch --no-create %{_datadir}/icons/hicolor &> /dev/null || :

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

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

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog README
%doc %{_docdir}/HTML/*/amarok/*
%{_bindir}/amarok
%{_bindir}/amarokpkg
%{_bindir}/amarok_afttagger
%{_bindir}/amarokmp3tunesharmonydaemon
%{_datadir}/kde4/apps/amarok/
%{_datadir}/kde4/apps/desktoptheme/default/widgets/*
%{_datadir}/kde4/apps/kconf_update/amarok*
%{_datadir}/kde4/apps/solid/actions/amarok-play-audiocd.desktop
%{_datadir}/config/amarok.knsrc
%{_datadir}/config/amarok_homerc
%{_datadir}/config/amarokapplets.knsrc
%{_datadir}/applications/kde4/amarok.desktop
%{_datadir}/applications/kde4/amarok_containers.desktop
%{_datadir}/config.kcfg/amarokconfig.kcfg
%{_datadir}/dbus-1/interfaces/*.xml
%{_datadir}/kde4/services/*.desktop
%{_datadir}/kde4/services/*.protocol
%{_datadir}/kde4/services/ServiceMenus/amarok_append.desktop
%{_datadir}/kde4/servicetypes/*.desktop
%{_datadir}/icons/hicolor/*/*/*
%{_libdir}/kde4/*.so
#{_libdir}/strigi/*

%files libs
%defattr(-,root,root,-)
%{_libdir}/libamarokcore.so.1*
%{_libdir}/libamaroklib.so.1*
%{_libdir}/libamarokocsclient.so.4*
%{_libdir}/libamarokpud.so.1*
%{_libdir}/libamarok-sqlcollection.so.1*
%{_libdir}/libamarok-transcoding.so.*
%{_libdir}/libampache_account_login.so

%files utils -f amarokcollectionscanner_qt.lang
%defattr(-,root,root,-)
%{_bindir}/amarokcollectionscanner


%changelog
* Mon Sep 03 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.6.0-1
- new upstream release
- add BuildRequires: qjson-devel
- remove BuildRequires: MySQL-embedded-devel

* Sun Jun  5 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.4.1-1
- new upstream release

* Sun Oct 17 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.3.2-1
- new upstream release for KDE 4
- updated BR

* Mon Nov 09 2009 Kazutaka HARADA <kazutaka@dc4.so-net.ne.jp> 1.4.10-5
- drop helixplayer stuff to resolve unmet dependency
- drop --with-mp4v2 configure option

* Wed Jun 17 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.4.10-4vl5
- add BuildRequires: libvisual-devel

* Tue Jun 16 2009 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 1.4.10-3vl5
- add Patch4 (from Ubuntu/Debian) to fix build against libmtp >= 0.3.0

* Sat Mar 21 2009 TOSHI <milk-tea1977@dune.ocn.ne.jp> 1.4.10-2vl5
- Package Name Changes: self-build-libmad, self-build-faad2
- add patch100 for fix CVE2009-0135, CVE-2009-0136
- add PreReq & BuildPreReq: libart_lgpl, libart_lgpl-devel

* Wed Dec 31 2008 TOSHI <milk-tea1977@dune.ocn.ne.jp> 1.4.10-1vl5
- initial build for Vine Seed.
- add Patch3
- spec in utf-8, and applied vine versioning policy