# Copyright (c) 2009-2010 oc2pus
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself.
#
# Please submit bugfixes or comments to toni@links2linux.de

# norootforbuild

%define _prefix		/usr
%define _cvs @RPM_VERSION_SUFFIX@

%define _SO_chart	4
%define _SO_money	4
%define _SO_plugin	4
%define _pname		kmymoney
 
Name:           @RPM_NAME@
Summary:		A Personal Finance Manager for KDE4
Group:			Productivity/Office/Finance
URL:			http://kmymoney.org
License:		GPL
Version:        @CPACK_PACKAGE_VERSION@
Release:        0.pm.%{_cvs}
Source:         @CPACK_SOURCE_PACKAGE_FILE_NAME@.tar.bz2
Source90:		%{name}-rpmlintrc
BuildRoot:		%{_tmppath}/%{name}-%{version}-build
BuildRequires:	boost-devel
BuildRequires:	cmake
BuildRequires:	aqbanking-qt4-devel
BuildRequires:	fdupes
BuildRequires:	gamin-devel
BuildRequires:	glib2-devel
BuildRequires:	glibmm2-devel
BuildRequires:	gwenhywfar3-devel
BuildRequires:	kdepim4-devel
BuildRequires:	libjpeg-devel
BuildRequires:	libgpgme-devel
BuildRequires:	libkde4-devel
BuildRequires:	libkdepimlibs4-devel
BuildRequires:	libktoblzcheck-devel
BuildRequires:	libofx-devel
BuildRequires:	libpng-devel
BuildRequires:	libxml2-devel
BuildRequires:	libxml++-devel
BuildRequires:	pkgconfig
BuildRequires:	qt-devel
BuildRequires:	update-desktop-files
BuildRequires:	zlib-devel
%kde4_runtime_requires
%kde4_pimlibs_requires
Requires:		aqbanking-qt4

Conflicts:		%{_pname}-unstable
Conflicts:		%{_pname}

# pmbs ...
BuildRequires:	libspeex1

%description
KMyMoney is a personal finance manager.

KMyMoney is the Personal Finance Manager for KDE4. It operates
similar to Quicken, supports various account types, categorization
of expenses, multiple currencies, online banking support via QIF,
OFX and HBCI, budgeting and a rich set of reports.

Authors:
Michael Edwardes <mte@users.sourceforge.net>
Javier Campos Morales <javi_c@users.sourceforge.net>
Felix Rodriguez <frodriguez@users.sourceforge.net>
John C <thetacoturtle@users.sourceforge.net>
Thomas Baumgart <ipwizard@users.sourceforge.net>

%package devel
Summary:	Include files and libraries mandatory for development
Group:		Development/Libraries/C and C++
Requires:	%{name} = %{version}
Requires:	libkmm_kdchart%{_SO_chart} = %{version}
Requires:	libkmm_mymoney%{_SO_money} = %{version}
Requires:	libkmm_plugin%{_SO_plugin} = %{version}
Requires:	aqbanking-qt4-devel
Requires:	boost-devel
Requires:	gamin-devel
Requires:	glib2-devel
Requires:	glibmm2-devel
Requires:	gwenhywfar3-devel
Requires:	kdepim4-devel
Requires:	libjpeg-devel
Requires:	libgpgme-devel
Requires:	libkde4-devel
Requires:	libkdepimlibs4-devel
Requires:	libktoblzcheck-devel
Requires:	libofx-devel
Requires:	libpng-devel
Requires:	libxml2-devel
Requires:	libxml++-devel
Requires:	qt-devel
Requires:	zlib-devel

Conflicts:	%{_pname}-devel
Conflicts:	%{_pname}-devel-unstable

%description devel
Include files and libraries mandatory for development with package
kmymoney (KDE4).

%package -n libkmm_kdchart%{_SO_chart}
Summary:	Shared library for kmymoney
Group:		System/Libraries

%description -n libkmm_kdchart%{_SO_chart}
Shared library for package kmymoney.

%package -n libkmm_mymoney%{_SO_money}
Summary:	Shared library for kmymoney
Group:		System/Libraries

%description -n libkmm_mymoney%{_SO_money}
Shared library for package kmymoney.

%package -n libkmm_plugin%{_SO_plugin}
Summary:	Shared library for kmymoney
Group:		System/Libraries

%description -n libkmm_plugin%{_SO_plugin}
Shared library for package kmymoney.

%package -n kmm_kbanking4
Summary:	Online Banking plugin
Group:		Productivity/Office/Finance
%kde4_runtime_requires
Conflicts:	kmm_kbanking

%description -n kmm_kbanking4
Online Banking plugin for package kmymoney.

%package -n kmm_ofximport
Summary:	OFX importing plugin
Group:		Productivity/Office/Finance
%kde4_runtime_requires

%description -n kmm_ofximport
OFX importing plugin for package kmymoney.

%package -n kmm_icalendarexport
Summary:	ICalendar plugin
Group:		Productivity/Office/Finance
%kde4_runtime_requires

%description -n kmm_icalendarexport
Exports schedules to iCalendar files for package kmymoney.

%package -n kmm_printcheck
Summary:	Print cheques plugin
Group:		Productivity/Office/Finance
%kde4_runtime_requires

%description -n kmm_printcheck
Provides the capability to print cheques with kmymoney.

%package -n kmm_reconciliationreport
Summary:	Reconciliation report plugin
Group:		Productivity/Office/Finance
%kde4_runtime_requires

%description -n kmm_reconciliationreport
Creates a report after each reconciliation containing data about the
reconciliation process for package kmymoney.

%debug_package
%lang_package

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

%build

%install
export SUSE_ASNEEDED=0

%__install -dm 755 build
pushd build
	cmake \
		-DCMAKE_INSTALL_PREFIX=%{_prefix} \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_CXX_FLAGS="%{optflags}" \
		-DCMAKE_C_FLAGS="%{optflags}" \
		-DCMAKE_SKIP_RPATH=1 \
		-DCMAKE_STRIP="echo" \
		-DMAN_INSTALL_DIR=%{_mandir} \
		..

	# make is rebuilding some files again ==> only a make install call
	%makeinstall
popd

# icon
%__install -dm 755 %{buildroot}%{_datadir}/pixmaps
%__install -m 644 kmymoney/hi48-app-%{_pname}.png \
	%{buildroot}%{_datadir}/pixmaps/%{_pname}.png

# menu
%suse_update_desktop_file -n %{_pname} Finance

%find_lang %{_pname}
%fdupes -s %{buildroot}

# make rpmlint happy
%__chmod 644 %{buildroot}%{_datadir}/kde4/apps/kmymoney/misc/financequote.pl

%kde_post_install

%clean
[ "%{buildroot}" != "/" ] && [ -d "%{buildroot}" ] && %__rm -rf "%{buildroot}"

%post   -n libkmm_kdchart%{_SO_chart} -p /sbin/ldconfig
%postun -n libkmm_kdchart%{_SO_chart} -p /sbin/ldconfig

%post   -n libkmm_mymoney%{_SO_money} -p /sbin/ldconfig
%postun -n libkmm_mymoney%{_SO_money} -p /sbin/ldconfig

%post   -n libkmm_plugin%{_SO_plugin} -p /sbin/ldconfig
%postun -n libkmm_plugin%{_SO_plugin} -p /sbin/ldconfig

%files lang -f %{_pname}.lang
%defattr(-,root,root)
%exclude %{_datadir}/doc/kde/HTML/*

%files
%defattr(-,root,root)
%doc AUTHORS COPYING ChangeLog* README* TODO
%doc %{_mandir}/man1/%{_pname}.*
%{_bindir}/%{_pname}
%{_datadir}/applications/kde4/%{_pname}.desktop
%{_datadir}/doc/kde/HTML/*
%{_datadir}/icons/*
%dir %{_datadir}/kde4/apps/%{_pname}
%{_datadir}/kde4/apps/%{_pname}/*
%{_datadir}/kde4/config.kcfg/*.kcfg
%{_datadir}/kde4/servicetypes/*.desktop
%{_datadir}/mime/packages/*
%{_datadir}/pixmaps/%{_pname}.png

%files devel
%defattr(-,root,root)
%dir %{_includedir}/%{_pname}
%{_includedir}/%{_pname}/*
%{_libdir}/*.so

%files -n libkmm_kdchart%{_SO_chart}
%defattr(-,root,root)
%{_libdir}/libkmm_kdchart.so.*

%files -n libkmm_mymoney%{_SO_money}
%defattr(-,root,root)
%{_libdir}/libkmm_mymoney.so.*

%files -n libkmm_plugin%{_SO_plugin}
%defattr(-,root,root)
%{_libdir}/libkmm_plugin.so.*

%files -n kmm_kbanking4
%defattr(-,root,root)
%{_libdir}/kde4/kmm_kbanking.so
%dir %{_datadir}/kde4/apps/kmm_kbanking
%{_datadir}/kde4/apps/kmm_kbanking/kmm_kbanking.rc
%{_datadir}/kde4/services/kmm_kbanking.desktop

%files -n kmm_ofximport
%defattr(-,root,root)
%{_libdir}/kde4/kmm_ofximport.so
%dir %{_datadir}/kde4/apps/kmm_ofximport
%{_datadir}/kde4/apps/kmm_ofximport/kmm_ofximport.rc
%{_datadir}/kde4/services/kmm_ofximport.desktop

%files -n kmm_icalendarexport
%defattr(-,root,root)
%{_libdir}/kde4/kcm_kmm_icalendarexport.so
%{_libdir}/kde4/kmm_icalendarexport.so
%dir %{_datadir}/kde4/apps/kmm_icalendarexport
%{_datadir}/kde4/apps/kmm_icalendarexport/kmm_icalendarexport.rc
%{_datadir}/kde4/services/kcm_kmm_icalendarexport.desktop
%{_datadir}/kde4/services/kmm_icalendarexport.desktop

%files -n kmm_printcheck
%defattr(-,root,root)
%{_libdir}/kde4/kcm_kmm_printcheck.so
%{_libdir}/kde4/kmm_printcheck.so
%dir %{_datadir}/kde4/apps/kmm_printcheck
%{_datadir}/kde4/apps/kmm_printcheck/check_template.html
%{_datadir}/kde4/apps/kmm_printcheck/kmm_printcheck.rc
%{_datadir}/kde4/services/kcm_kmm_printcheck.desktop
%{_datadir}/kde4/services/kmm_printcheck.desktop

%files -n kmm_reconciliationreport
%defattr(-,root,root)
%{_libdir}/kde4/kmm_reconciliationreport.so
%{_datadir}/kde4/services/kmm_reconciliationreport.desktop

%changelog
* Tue Feb 16 2010 Toni Graffy <toni@links2linux.de> - 3.96.0-142.pm.1
- update to 3.96.0
* Wed Dec 30 2009 Toni Graffy <toni@links2linux.de> - 3.95.0-142.pm.1
- added sub-packages kmm_* for the plugins
- build with aqbnaking-qt4 (kmm_kbanking4-plugin)
* Tue Dec 29 2009 Toni Graffy <toni@links2linux.de> - 3.95.0-42.pm.1
- initial build 3.95.0
