Name:		kde-partitionmanager
Summary:	KDE Partition Manager
Summary(ja):	KDE パーティションマネージャ
Version:	1.0.3
Release:	4%{?_dist_release}

Group:		Applications/Administration
License:	GPLv2+
URL:		http://partitionman.sourceforge.net/

Source0:	http://downloads.sourceforge.net/project/partitionman/partitionmanager/1.0.3/partitionmanager-%{version}.tar.bz2

Patch0:		partitionmanager-1.0.3-r1263692.patch

## upstreamable patches

BuildRoot:	%{_tmppath}/%{name}-%{version}-root
BuildRequires:  kdelibs4-devel
BuildRequires:  parted-devel
BuildRequires:  e2fsprogs-devel
%if %{?_dist_release} !="vl5"
BuildRequires:	libuuid-devel
BuildRequires:  libblkid-devel
BuildRequires:  libatasmart-devel
%endif
BuildRequires:  pkgconfig
BuildRequires:  gettext
BuildRequires:  cmake
Requires:	parted
Requires:       e2fsprogs

%global kde4_version %((kde4-config --version 2>/dev/null || echo "KDE 4.4.5") | grep ^KDE | cut -d' ' -f2)

#{?_kde4_macros_api:Requires: kde4-macros(api) = %{_kde4_macros_api} }

%description
KDE Partition Manager is a utility program to help you manage the disk devices,
partitions and file systems on your computer. It allows you to easily create, 
copy, move, delete, resize without losing data, backup and restore partitions.
 
KDE Partition Manager supports a large number of file systems, 
including ext2/3/4, reiserfs, NTFS, FAT16/32, jfs, xfs and more.
 
It makes use of external programs to get its job done, so you might have to 
install additional software (preferably packages from your distribution) 
to make use of all features and get full support for all file systems.

%prep
%setup -q -n partitionmanager-%{version}
%patch0 -p1
## Due to the name change
mv src/partitionmanager.desktop src/kde-partitionmanager.desktop
#mv src/kcm/kcm_partitionmanager.desktop src/kcm/kcm_kde-partitionmanager.desktop
sed -i 's,partitionmanager.desktop,kde-partitionmanager.desktop,' src/CMakeLists.txt

%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 \
    ..
popd

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

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

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

%clean
rm -rf %{buildroot}

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

%posttrans
gtk-update-icon-cache %{_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 || :
fi

%files -f partitionmanager.lang
%defattr(-,root,root,-)
%doc README COPYING CHANGES
%{_bindir}/partitionmanager*
%{_libdir}/*.so
%{_libdir}/kde4/pmlibpartedbackendplugin.so
%{_datadir}/applications/kde4/%{name}.desktop
%{_datadir}/icons/hicolor/*/*/*.png
%{_datadir}/kde4/apps/partitionmanager
%{_datadir}/kde4/services/pmlibpartedbackendplugin.desktop
%{_datadir}/kde4/servicetypes/pmcorebackendplugin.desktop
## %{_kde4_datadir}/kde4/services/kcm_kde-partitionmanager.desktop


%changelog
* Sat Jul 09 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.3-4
- rebuild with gcc-5.4.0

* Sun Jul 15 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.3-3
- rebuild with parted-3.1

* Fri Jan 06 2012 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.0.3-2
- add Patch0 (partitionmanager-1.0.3-r1263692.patch)
- add BuildRequires: libatasmart-devel

* Thu Jan 13 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.3-1
- new upstream release

* Fri Jul 23 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.2-3
- disabled BR: libuuid-devel, libblkid-devel on Vine Linux 5

* Mon Jul 19 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 1.0.2-2
- Initial build for Vine Linux

* Tue May 18 2010 Thomas Janssen <thomasj@fedoraproject.org> 1.0.2-1
- bugfix release

* Wed Mar 31 2010 Thomas Janssen <thomasj@fedoraproject.org> 1.0.1-1%{?dist}.2
- rebuild for new parted

* Sun Feb 14 2010 Thomas Janssen <thomasj@fedoraproject.org> 1.0.1-1%{?dist}.1
- DSO fix for rawhide

* Mon Jan 25 2010 Thomas Janssen <thomasj@fedoraproject.org> 1.0.1-1
- New upstream source

* Wed Nov 18 2009 Thomas Janssen <thomasj@fedoraproject.org> 1.0.0-2
- Moved desktop-file-validate to %%install
- Removed superfluous BR qt4-devel

* Wed Nov 18 2009 Thomas Janssen <thomasj@fedoraproject.org> 1.0.0-1
- Initial Fedora release