Name:           skrooge
Summary:        Personal finances manager
Summary(ja):    個人向け財務管理ツール
Version:        0.8.0
Release:        2%{?_dist_release}

Group:          Applications/Productivity
License:        GPLv3+
URL:            http://skrooge.org

Source0:        http://skrooge.org/files/%{name}-%{version}.tar.bz2

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  qca2-devel
BuildRequires:  libofx-devel
BuildRequires:  sqlite3-devel
BuildRequires:  kdelibs4-devel
BuildRequires:  soprano-devel
BuildRequires:  gettext

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

%description   
%{name} is a personal finances manager, 
aiming at being simple and intuitive. 
It allows you to keep track of your expenses and incomes, 
categorize them, and build reports of them.

%package libs
Summary:        Skrooge libraries
Summary(ja):    Skrooge ライブラリ
Group:          System Environment/Libraries
#Requires:       %{name} = %{version}-%{release}
Requires:       kdelibs4 >= 4.4.0

%description libs
%{name} libraries.

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

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

%prep
%setup -q

## to prevent spurious-executable-perm in -debuginfo
chmod -x skgbasegui/skglineedit.h
chmod -x skgbasegui/skglineedit.cpp
chmod -x skgbasegui/skglineeditdesignerplugin.h
chmod -x skgbasegui/skgtablewidgetdesignerplugin.h
chmod -x skgbasegui/skglineeditdesignerplugin.cpp
chmod -x skgbasegui/skgtablewidgetdesignerplugin.cpp

%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
unset QTDIR || : ; . /etc/profile.d/qt4.sh
## the -DCMAKE is needed to prevent unused-direct-shlib-dependency in -libs
## cant be fixed upstream, see: https://bugs.kde.org/show_bug.cgi?id=209912
%{cmake} \
    -Wno-dev \
    -DCMAKE_BUILD_TYPE=release \
    -DDATA_INSTALL_DIR:PATH=%{_datadir}/kde4/apps \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/kde4 \
    -DLIBEXEC_INSTALL_DIR:PATH=%{_libexecdir}/kde4 \
    -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--as-needed" \
    ..
popd

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


%install
rm -rf %{buildroot}
make install/fast -C %{_target_platform} DESTDIR=%{buildroot}
%find_lang %{name} --with-kde

# hack to support non-oxygen icon users (gnome), drop when/if skrooge
# ever provides hicolor icons (too).
mv %{buildroot}%{_datadir}/icons/oxygen %{buildroot}%{_datadir}/icons/hicolor 


%clean
rm -rf %{buildroot}

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/kde4/skrooge.desktop

%post 
touch --no-create %{_datadir}/icons/hicolor &>/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
   update-mime-database %{_datadir}/mime &> /dev/null
fi

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

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%files -f %{name}.lang
%defattr(-,root,root,-)
%doc AUTHORS CHANGELOG COPYING README TODO 
%{_bindir}/skrooge
%{_datadir}/applications/kde4/skrooge.desktop
%{_datadir}/config.kcfg/*.kcfg
%{_datadir}/icons/hicolor/*/*/*
%{_datadir}/kde4/apps/skrooge*/
%{_datadir}/kde4/apps/skg*
%{_datadir}/kde4/services/*.desktop
%{_datadir}/kde4/servicetypes/skg-plugin.desktop
%{_datadir}/mime/packages/x-skg.xml
%{_datadir}/doc/HTML/*/skrooge/

%files libs
%defattr(-,root,root,-)
%{_libdir}/kde4/plugins/designer/*.so.*
%{_libdir}/kde4/*.so
%{_libdir}/lib*.so.*

%files devel
%defattr(-,root,root,-)
%{_libdir}/libskg*.so
%{_libdir}/kde4/plugins/designer/libskg*.so

%changelog
* Sun May 15 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 0.8.0-2
- add BuildRequires:  soprano-devel

* Sun Jan 16 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 0.8.0-1
- Initial build for Vine Linux

* Mon May 17 2010 Thomas Janssen <thomasj@fedoraproject.org> 0.7.1-1
- skrooge 0.7.1 bugfix release

* Mon Apr 26 2010 Thomas Janssen <thomasj@fedoraproject.org> 0.7.0-1
- Skrooge 0.7.0

* Wed Feb 10 2010 Thomas Janssen <thomasj@fedoraproject.org> 0.6.0-1
- New upstream source 0.6.0

* Thu Jan 28 2010 Rex Dieter <rdieter@fedoraproject.org> 0.5.5-2
- use %%{_kde4_version}, don't rely on kde4-config --version parsing

* Sun Dec 27 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.5.5-1
- Update to new upstream release
- Corrects a lot of bugs and problems. See the CHANGELOG for details.

* Sun Nov 30 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.5.4-1
- Update to new upstream version
- Corrects a lot of bugs and problems. See the changelog for details.

* Sun Nov 01 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.5.3-1
- Updated to new upstream version
- Readded a -DCMAKE workaround (please keep it for now)
- Useing chmod -x to prevent spurious-executable-perm. Bug filed.

* Wed Oct 14 2009 Rex Dieter <rdieter@fedoraproject.org> 0.5.2-2
- (HTML) docs patch, use %%find_lang --with-kde
- own %%{_kde4_appsdir}/skrooge*/ dirs
- %%check: omit extraneous desktop-file-validate's

* Thu Oct 08 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.5.2-1
- Changed to final 0.5.2 version
- Bugfixes, including a nasty bug where one thinks the data is gone
- added HTML documentation
- added localizations

* Tue Sep 22 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.5.2-0.1.beta
- Changed to new upstream Version 0.5.2_beta (lots of bugfixes)

* Mon Sep 21 2009 Thomas Janssen <thomasj@fedoraproject.org> 0.5.1-0.5.beta
- Added -libs Requires libofx

* Mon Sep 21 2009 Rex Dieter <rdieter@fedoraproject.org> 0.5.1-0.4.beta
- misc cosmetics
- mime scriptlets
- move icons to hicolor
- -libs: drop dup'd docs, add min kdelibs4 dep

* Thu Sep 17 2009 Thomas Janssen <thomasj@fedoraproject.org>  0.5.1-0.3.beta
- Spec file corrections and Version correction

* Wed Sep 16 2009 Thomas Janssen <thomasj@fedoraproject.org>  0.5.1-beta2
- cleaned up desktop files

* Tue Sep 15 2009 Thomas Janssen <thomasj@fedoraproject.org>  0.5.1-beta1
- changed version to 0.5.1 beta with fixed rpmlint output

* Sun Sep 13 2009 Thomas Janssen <thomasj@fedoraproject.org>  0.5.0-2
- Fixed the spec and rpmlintoutput debuginfo-without-source

* Fri Sep 11 2009 Thomas Janssen <thomasj@fedoraproject.org>  0.5.0-1
- Initial Release 0.5.0
