%global _hardened_build 1

Name:           qtkeychain
Version:        0.7.0
Release:        8%{?dist}
Summary:        A password store library

License:        BSD
Url:            https://github.com/frankosterfeld/qtkeychain
Source0:        %{url}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires:  gcc-c++
BuildRequires:  cmake

BuildRequires:  pkgconfig(QtCore)
BuildRequires:  pkgconfig(QtDBus)

%description
The qtkeychain library allows you to store passwords easy and secure.

%package devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}

%description devel
This package contains development files for qtkeychain.

%package qt5
Summary:        %{summary}

%description qt5
The qt5keychain library allows you to store passwords easy and secure.

%package qt5-devel
Summary:        Development files for %{name}-qt5
BuildRequires:  cmake(Qt5Core)
BuildRequires:  cmake(Qt5LinguistTools)
Requires:       %{name}-qt5%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Requires:       qt5-qtbase-devel%{?_isa}

%description qt5-devel
This package contains development files for qt5keychain.

%prep
%autosetup
mkdir %{_target_platform}-qt4
mkdir %{_target_platform}-qt5

%build
pushd %{_target_platform}-qt4
  %cmake3 .. \
    -DBUILD_WITH_QT4:BOOL=ON \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo
popd
pushd %{_target_platform}-qt5
   %cmake3 .. \
    -DBUILD_WITH_QT4:BOOL=OFF \
    -DCMAKE_BUILD_TYPE=RelWithDebInfo
popd

%make_build -C %{_target_platform}-qt4
%make_build -C %{_target_platform}-qt5

%install
%make_install -C %{_target_platform}-qt4
%make_install -C %{_target_platform}-qt5

%find_lang %{name} --with-qt

grep %{_qt4_translationdir} %{name}.lang > %{name}-qt4.lang
grep %{_qt5_translationdir} %{name}.lang > %{name}-qt5.lang


%pre -p /sbin/ldconfig
%preun -p /sbin/ldconfig


%files -f %{name}-qt4.lang
%doc ReadMe.txt
%license COPYING
%{_libdir}/libqtkeychain.so.*

%files devel
%{_includedir}/qtkeychain/
%{_libdir}/cmake/QtKeychain/
%{_libdir}/libqtkeychain.so

%pre qt5 -p /sbin/ldconfig
%preun qt5 -p /sbin/ldconfig

%files qt5 -f %{name}-qt5.lang
%doc ReadMe.txt
%license COPYING
%{_libdir}/libqt5keychain.so.*

%files qt5-devel
%{_includedir}/qt5keychain/
%{_libdir}/cmake/Qt5Keychain/
%{_libdir}/libqt5keychain.so

%changelog
* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.7.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Sat Jul 23 2016 Igor Gnatenko <ignatenko@redhat.com> - 0.7.0-2
- Fix packaging problems

* Mon May 23 2016 nikos roussos <comzeradd@fedoraproject.org> 0.7.0-1
- update to 0.7.0

* Sun May 22 2016 Nikos Roussos <comzeradd@fedoraproject.org> 0.6.2-2
- Bump release

* Thu Apr 28 2016 Nikos Roussos <comzeradd@fedoraproject.org> 0.6.2-1
- update to 0.6.2

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.5.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Sep 29 2015 Rex Dieter <rdieter@fedoraproject.org> 0.5.0-1
- qtkeychain-0.5.0 (#1136285), enable Qt5 support

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.90-6.20140405git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 0.3.90-5.20140405git
- Rebuilt for GCC 5 C++11 ABI change

* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.90-4.20140405git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Sun Jun 08 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.3.90-3.20140405git
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Tue May 06 2014 Rex Dieter <rdieter@fedoraproject.org> 0.3.90-2.20140405git
- track libqtkeychain soname
- use %%find_lang
- omit dup'd cmake defines

* Sun May 04 2014 <jmarrero@fedoraproject.org> 0.3.90-1
- Update to latest github commit.

* Sun Mar 16 2014 <jmarrero@fedoraproject.org> 0.3.0-1
- Update to latest upstream version

* Tue Jan 07 2014 <jmarrero@fedoraproject.org> 0.1.0-4.20130805git
- Remove gcc-c++ dep
- Fix Requires
- Remove unneeded line in devel description
- Leave black line between changelogs

* Sat Jan 04 2014 <jmarrero@fedoraproject.org> 0.1.0-3.20130805git
- Fix Version and Release
- Fix %%files devel's cmake ownership by pointing the subfiles 
- Fix Changelog to reflect version and release changes 

* Tue Dec 24 2013 <jmarrero@fedoraproject.org> 0.1.0-2.20130805git
- Fix descriptions

* Mon Dec 23 2013 <jmarrero@fedoraproject.org> 0.1.0-1.20130805git
- Initial Packaging
