
Summary: Personal finance 
Name:    kmymoney
Version: 4.5
Release: 2%{?_dist_release}

Group:   Applications/Productivity
# kmm itself is GPLv2+ , but kdchart is GPLv2 or GPLv3
License: GPLv2 or GPLv3
URL:     http://kmymoney2.sourceforge.net/

Source0: http://downloads.sourceforge.net/sourceforge/kmymoney2/kmymoney-%{version}.tar.bz2

## upstreamable patches
# don't force/hardcode rpaths
Patch50: kmymoney-3.96.1-rpath.patch

## upstream patches

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: libboost-devel
BuildRequires: cppunit-devel
BuildRequires: desktop-file-utils
BuildRequires: gettext
BuildRequires: gpgme-devel
BuildRequires: glibmm-devel
BuildRequires: kdepimlibs-devel
#BuildRequires: koffice-kdchart-devel
BuildRequires: libical-devel
BuildRequires: libxml2-devel
BuildRequires: libofx-devel
BuildRequires: libxml++-devel
BuildRequires: q4banking-devel

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

Obsoletes: kmymoney2 < 2
Provides:  kmymoney2 = %{version}-%{release}

Obsoletes: kmymoney2-aqbanking < 2
Provides:  kmymoney2-aqbanking = %{version}-%{release} 

%description
KMyMoney strives to be the best personal finance manager.
The ultimate objectives of KMyMoney are...
* Accuracy.  Using time tested double entry accounting principles 
  helps ensure that your finances are kept in correct order.
* Ease of use.  Strives to be the easiest open source personal
  finance manager to use, especially for the non-technical user.
* Familiar Features.  Intends to provide all important features
  found in the commercially-available, personal finance managers.

%package libs
Summary: Run-time libraries for %{name}
Group:   System Environment/Libraries
Requires: %{name} = %{version}-%{release}
Obsoletes: kmymoney2-libs < 2
%description libs
%{summary}.

%package devel
Summary: Development files for %{name}
Group:   Development/Libraries
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: kdelibs4-devel
Obsoletes: kmymoney2-devel < 2
%description devel
%{summary}.


%prep
%setup -q -n kmymoney-%{version}

%patch50 -p1 -b .rpath

# nuke .directory files
rm -fv kmymoney/pics/l10n/*/.directory

## kdchart munging begin
#sed -i.kdchart -e 's|ADD_SUBDIRECTORY( libkdchart )|#ADD_SUBDIRECTORY( libkdchart )|' CMakeLists.txt
#sed -i.kdchart -e 's|kmm_kdchart|kdchart|' kmymoney/CMakeLists.txt
#mv libkdchart libkdchart.kdchart
#mkdir libkdchart
#ln -s /usr/include/KDChart libkdchart/include
#ln -s /usr/include/kdchart libkdchart/kdchart
## kdchart munging end


%build
mkdir -p %{_target_platform}
pushd %{_target_platform}
unset QTDIR || : ; . /etc/profile.d/qt4.sh
%{cmake} \
    -DCMAKE_BUILD_TYPE=release \
    -DDATA_INSTALL_DIR:PATH=%{_datadir}/kde4/apps \
    -DINCLUDE_INSTALL_DIR:PATH=%{_includedir}/kde4 \
    -DLIBEXEC_INSTALL_DIR:PATH=%{_libexecdir}/kde4 \
    ..
popd

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

# fix world writable perms
find . -type f -name 'ui_*.h' -exec chmod 0644 {} ';'


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

%find_lang kmymoney --with-kde 


%check 
desktop-file-validate %{buildroot}%{_datadir}/applications/kde4/kmymoney.desktop
# make test

%clean
rm -rf %{buildroot}

%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig

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

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

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


%files -f kmymoney.lang
%defattr(-,root,root,-)
%doc AUTHORS ChangeLog COPYING TODO
%doc README.Fileformats README.ofx
%{_bindir}/kmymoney
%{_datadir}/kde4/apps/kmymoney/
%{_datadir}/kde4/apps/kmm_*/
%{_datadir}/applications/kde4/kmymoney.desktop
%{_datadir}/config.kcfg/kmymoney.kcfg
%{_datadir}/kde4/services/*.desktop
%{_datadir}/kde4/servicetypes/*.desktop
%{_mandir}/man1/kmymoney.1.gz
%{_datadir}/mime/packages/x-kmymoney.xml
%{_datadir}/icons/locolor/*/*/*
%{_datadir}/icons/oxygen/*/*/*
%{_libdir}/kde4/*.so

%files libs
%defattr(-,root,root,-)
%{_libdir}/libkmm_kdchart.so.4*
%{_libdir}/libkmm_mymoney.so.4*
%{_libdir}/libkmm_plugin.so.4*
%{_libdir}/libkmm_widgets.so.4*

%files devel
%defattr(-,root,root,-)
%{_includedir}/kde4/kmymoney/
%{_libdir}/libkmm_*.so


%changelog
* Wed Sep 15 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.5-2
- Initial build for VineLinux

* Mon Aug 16 2010 Rex Dieter <rdieter@fedoraproject.org> - 4.5-1
- kmymoney-4.5

* Sun May 16 2010 Rex Dieter <rdieter@fedoraproject.org> - 3.98.0-1
- kmymoney-3.98.0

* Wed Apr 07 2010 Rex Dieter <rdieter@fedoraproject.org> - 3.97.2-1
- kmymoney-3.97.2
- License: GPLv2 or GPLv3
- omit .directory files from packaging
- -debuginfo: fix world-writable perms in generated headers 

* Fri Apr 02 2010 Rex Dieter <rdieter@fedoraproject.org> - 3.97.0-1
- kmymoney-3.97.0
- use external/shared kdchart

* Fri Mar 19 2010 Rex Dieter <rdieter@fedoraproject.org> - 3.96.1-1
- kmymoney-3.96.1 (for kde4, beta)
- Obsoletes: kmymoney2 (and friends)

* Mon Feb 15 2010 Rex Dieter <rdieter@fedoraproject.org> - 1.0.3-1
- kmymoney2-1.0.3

* Thu Jan 21 2010 Bill Nottingham <notting@redhat.com> - 1.0.2-2
- rebuild against latest aqbanking/qbanking

* Sun Oct 04 2009 Rex Dieter <rdieter@fedoraproject.org> - 1.0.2-1
- kmymoney2-1.0.2

* Sun Sep 06 2009 Rex Dieter <rdieter@fedoraproject.org> - 1.0.1-1
- kmymoney2-1.0.1

* Wed Aug 19 2009 Rex Dieter <rdieter@fedoraproject.org> - 1.0.0-1
- kmymoney2-1.0.0

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.3-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Fri Jul 17 2009 Rex Dieter <rdieter@fedoraproject.org> - 0.9.3-3
- validate .desktop file
- -libs unconditional
- use %%_isa where appropriate
- optimize scriptlets

* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9.3-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Tue Feb 24 2009 Rex Dieter <rdieter@fedoraproject.org> 0.9.3-1
- kmymoney2-0.9.3

* Mon Sep 15 2008 Rex Dieter <rdieter@fedoraproject.org> 0.9.2-3
- respun tarball 

* Sun Sep 14 2008 Rex Dieter <rdieter@fedoraproject.org> 0.9.2-1
- kmymoney2-0.9.2

* Tue Sep  9 2008 Bill Nottingham <notting@redhat.com> 0.9-2
- rebuild for new libofx ABI

* Wed May 14 2008 Rex Dieter <rdieter@fedoraproject.org> 0.9-1
- kmymoney2-0.9

* Wed Mar 26 2008 Rex Dieter <rdieter@fedoraproject.org> 0.8.9-1
- kmymoney2-0.8.9
- --disable-kbanking (requires aqbanking,kbanking fix/update)
- drop multilib upgrade hack

* Fri Feb 22 2008 Rex Dieter <rdieter@fedoraproject.org> 0.8.8-3
- gcc43 patch (#434398)
- multiarch conflicts, -libs subpkg (#341821)

* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 0.8.8-2
- Autorebuild for GCC 4.3

* Wed Dec 19 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.8.8-1
- kmymoney2-0.8.8
- --enable-kbanking

* Sat Dec 08 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.8.7-5
- BR: kdelibs3-devel

* Sat Aug 25 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.8.7-4
- respin (BuildID)

* Thu Aug 09 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.8.7-3
- License: GPLv2+

* Wed Jul 25 2007 Jesse Keating <jkeating@redhat.com> 0.8.7-2
- Rebuild for RH #249435

* Mon Jul 23 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.8.7-1
- kmymoney2-0.8.7

* Sat Mar 10 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.8.6-1
- kmymoney2-0.8.6
- fix Obsoletes: kmymoney

* Thu Jan 11 2007 Rex Dieter <rdieter[AT]fedoraproject.org> 0.8.5-3
- fix _enable_ofxbanking macro usage to re-enable ofx support

* Tue Nov 28 2006 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.5-2
- drop desktop-file-utils bits
- Ob/Pr: kmymoney(-devel), upstream/rpmforge calls it kmymoney

* Thu Aug 31 2006 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.5-1
- 0.8.5

* Tue Aug 29 2006 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.4-2
- --disable-final (for now)
- BR: gettext

* Sun May 21 2006 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.4-1
- 0.8.4

* Thu Apr 13 2006 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.3-3
- desktop-file-install --vendor=""

* Wed Feb 22 2006 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.3-1
- 0.8.3

* Fri Feb 10 2006 Rex Dieter <rexdieter[AT]users.sf.net>
- fc5: gcc/glibc respin

* Sat Dec 31 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.2-1
- 0.8.2

* Fri Dec 23 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.1-7
- gcc41 patch

* Fri Dec 23 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.1-6
- cleanup ofx deps

* Fri Dec 23 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.1-5
- cleanup %%post
- fc5 respin for new(er) libofx

* Mon Nov 14 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.1-4
- relax BR: kdelibs-devel to 3.3 (for aurora/sparc, #173133)

* Thu Nov 10 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.1-3
- fix relative symlinks

* Wed Nov 09 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.1-2
- qt-3.3.5 patch
- 'make check' workaround (kde bug #115863)
- trim %%description

* Sat Nov 05 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8.1-1
- 0.8.1

* Fri Nov 04 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8-5
- drop useless macros
- use %%fedora,%%rhel to conditionalize ofxbanking support

* Fri Oct 21 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8-4
- %%post,%%postun: gtk-update-icon-cache, update-desktop-database
- omit lib*.la
- x86_64: set QTDIR/QTLIB

* Thu Sep 01 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8-3
- BR: libofx-devel

* Tue Aug 30 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8-2
- simplify specfile
- fix build

* Fri Aug 12 2005 Rex Dieter <rexdieter[AT]users.sf.net> 0.8-1
- 0.8

