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

# KDE e.V. may determine that future GPL versions are accepted
License: GPLv2 or GPLv3
Group: Applications/Multimedia
URL: http://amarok.kde.org

Source0: http://download.kde.org/stable/amarok/%{version}/src/amarok-%{version}.tar.bz2
# http://quickgit.kde.org/?p=amarok.git&a=blob&&f=src%2Famarok.appdata.xml&o=plain
Source1: amarok.appdata.xml

# Invoke a browser on the online UserBase documentation instead of KHelpCenter
# for the help contents if the amarok-doc subpackage is not installed.
Patch0:  amarok-2.8.0-onlinedoc.patch

## upstreamable patches

## upstream patches


BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: curl-devel
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: kdelibs4-devel >= 4.9.0
BuildRequires: libappstream-glib-devel
BuildRequires: mariadb-devel mariadb-embedded
BuildRequires: gdk-pixbuf2-devel
BuildRequires: glib2-devel
BuildRequires: libxml2-devel
BuildRequires: phonon-devel
BuildRequires: qca2-devel
BuildRequires: qjson-devel
BuildRequires: qt4-devel
BuildRequires: taglib-devel >= 1.7
BuildRequires: taglib-extras-devel >= 1.0.1
#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: loudmouth-devel
BuildRequires: qtscriptbindings
BuildRequires: soprano-devel
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
Requires: kio_mtp
Requires: kio-upnp-ms
Requires: media-player-info
Requires: mariadb-server

Requires(post,postun): gtk2
Requires(post,postun): desktop-file-utils
Requires(post,postun): shared-mime-info

# 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
%{?_qt4_version:Requires: qt4 >= %{_qt4_version}}

%description libs
%{summary}.

%package utils
Summary: Amarok standalone utilities
Summary(ja): Amarok のスタンドアロンユーティリティ
Group: Applications/Multimedia
Obsoletes: amarok-collectionscanner < 2.0.90-2
Obsoletes: amarok-utilities < 2.0.96

%description utils 
%{summary}, including amarokcollectionscanner.

%package doc
Summary: Application handbook, documentation
Summary(ja): Amarok のドキュメント
Group: Applications/Documentation
# for upgrade path
Obsoletes: amarok < 2.6.0-1
Requires:  %{name} = %{version}-%{release}
BuildArch: noarch

%description doc
%{summary}.


%prep
%setup -q
%patch0 -p1


%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
%cmake \
    -DCMAKE_BUILD_TYPE=release \
    -DDATA_INSTALL_DIR:PATH=%{_datadir}/kde4/apps \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/kde4 \
    -DLIBEXEC_INSTALL_DIR:PATH=%{_libexecdir}/kde4 \
    -DKDE4_BUILD_TESTS=off \
    ..
popd
#    -DWITH_MYSQL_EMBEDDED=no \

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

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

# install appdata
install -m644 -p -D %{SOURCE1} $RPM_BUILD_ROOT%{_datadir}/appdata/%{name}.appdata.xml

%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,shared}.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 || :
touch --no-create %{_datadir}/mime/packages &> /dev/null || :

%posttrans
gtk-update-icon-cache %{_datadir}/icons/hicolor &> /dev/null || :
update-desktop-database -q &> /dev/null ||:
update-mime-database %{_datadir}/mime &> /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 ||:
    touch --no-create %{_datadir}/mime/packages &> /dev/null || :
    update-mime-database %{_datadir}/mime &> /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
%{_bindir}/amarok
%{_bindir}/amarokpkg
%{_bindir}/amarok_afttagger
%{_bindir}/amarokmp3tunesharmonydaemon
%{_bindir}/amzdownloader
%{_datadir}/appdata/%{name}.appdata.xml
%{_datadir}/applications/kde4/amarok.desktop
%{_datadir}/applications/kde4/amarok_containers.desktop
%{_datadir}/applications/kde4/amzdownloader.desktop
%{_datadir}/config/amarok.knsrc
%{_datadir}/config/amarok_homerc
%{_datadir}/config/amarokapplets.knsrc
%{_datadir}/config.kcfg/amarokconfig.kcfg
%{_datadir}/dbus-1/interfaces/*.xml
%{_datadir}/icons/hicolor/*/*/*
%{_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}/kde4/services/*.desktop
%{_datadir}/kde4/services/*.protocol
%{_datadir}/kde4/services/ServiceMenus/amarok_append.desktop
%{_datadir}/kde4/servicetypes/*.desktop
%{_datadir}/mime/packages/amzdownloader.xml
%{_libdir}/kde4/*.so

%files libs
%defattr(-,root,root,-)
%{_libdir}/libamarokcore.so.1*
%{_libdir}/libamaroklib.so.1*
%{_libdir}/libamarokocsclient.so.4*
%{_libdir}/libamarokpud.so.1*
%{_libdir}/libamarokshared.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

%files doc
%defattr(-,root,root,-)
%doc %{_docdir}/HTML/*/amarok/*


%changelog
* Wed Feb  4 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.8.0-1
- new upstream release
- split documents into doc subpackage
- built with libgrypt 1.6.0, libmtp 1.1.8 and mariadb-embedded 10.0.16

* 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

