%global framework kdelibs4support

Name:    	kf5-%{framework}
Version:        5.55.0
Release:        1
Summary:        KDE Frameworks 5 Tier 4 module with porting aid from KDELibs 4
License:        GPLv2+ and LGPLv2+ and BSD
URL:            https://cgit.kde.org/%{framework}.git

%global majmin %(echo %{version} | cut -d. -f1-2)
%global revision %(echo %{version} | cut -d. -f3)
%if %{revision} >= 50
%global stable unstable
%else
%global stable stable
%endif
Source0:        http://download.kde.org/%{stable}/frameworks/%{majmin}/portingAids/%{framework}-%{version}.tar.xz

BuildRequires:  ca-certificates  gettext-devel  extra-cmake-modules >= %{majmin}  kf5-kcompletion-devel >= %{majmin}  kf5-kconfig-devel >= %{majmin}  kf5-kconfigwidgets-devel >= %{majmin}  kf5-kcrash-devel >= %{majmin}  kf5-kdbusaddons-devel >= %{majmin}  kf5-kded-devel >= %{majmin}  kf5-kdesignerplugin-devel >= %{majmin}  kf5-kdoctools-devel >= %{majmin}  kf5-kemoticons-devel >= %{majmin}  kf5-kglobalaccel-devel >= %{majmin}  kf5-kguiaddons-devel >= %{majmin}  kf5-ki18n-devel >= %{majmin}  kf5-kiconthemes-devel >= %{majmin}  kf5-kio-devel >= %{majmin}  kf5-knotifications-devel >= %{majmin}  kf5-kparts-devel >= %{majmin}  kf5-kservice-devel >= %{majmin}  kf5-ktextwidgets-devel >= %{majmin}  kf5-kunitconversion-devel >= %{majmin}  kf5-kwidgetsaddons-devel >= %{majmin}  kf5-kwindowsystem-devel >= %{majmin}  kf5-kxmlgui-devel >= %{majmin}  kf5-rpm-macros  libSM-devel  libX11-devel openssl-devel  perl-generators  qt5-qtbase-devel  qt5-qtsvg-devel  qt5-qttools-devel  qt5-qtx11extras-devel
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}       ca-certificates       kde-settings       kf5-kded >= %{majmin}

%description
This framework provides code and utilities to ease the transition from kdelibs 4
to KDE Frameworks 5. This includes CMake macros and C++ classes whose
functionality has been replaced by code in CMake, Qt and other frameworks.

%package        libs
Summary:        Runtime libraries for %{name}
Requires:       %{name} = %{version}-%{release}
%description    libs
%{summary}.

%package        help
Summary:        Documentation and user manuals for %{name}
Requires:       %{name} = %{version}-%{release}
BuildArch:      noarch
%description    help
%{summary}.

%package        devel
Summary:        Development files for %{name}
Requires:       %{name}-libs%{?_isa} = %{version}-%{release}       kf5-kauth-devel >= %{majmin}       kf5-kconfigwidgets-devel >= %{majmin}       kf5-kcoreaddons-devel >= %{majmin}       kf5-kcrash-devel >= %{majmin}       kf5-kdesignerplugin-devel >= %{majmin}       kf5-kdoctools-devel >= %{majmin}       kf5-kemoticons-devel >= %{majmin}       kf5-kguiaddons-devel >= %{majmin}       kf5-kiconthemes-devel >= %{majmin}       kf5-kinit-devel >= %{majmin}       kf5-kitemmodels-devel >= %{majmin}       kf5-knotifications-devel >= %{majmin}       kf5-kparts-devel >= %{majmin}       kf5-ktextwidgets-devel >= %{majmin}       kf5-kunitconversion-devel >= %{majmin}       kf5-kwindowsystem-devel >= %{majmin}       kf5-kdbusaddons-devel >= %{majmin}       kf5-karchive-devel >= %{majmin}       qt5-qtbase-devel
%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.


%prep
%autosetup -n %{framework}-%{version} -p1


%build
mkdir %{_target_platform}
pushd %{_target_platform}
# Set absolute BIN_INSTALL_DIR, otherwise CMake will complain about mixed use of
# absolute and relative paths for some reason
# Remove once fixed upstream
%{cmake_kf5} .. \
        -DBIN_INSTALL_DIR=%{_kf5_bindir}
popd

%make_build -C %{_target_platform}


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

%find_lang all --all-name --with-man %{?_with_html}

%if 0%{?_with_html:1}
grep %{_kf5_docdir} all.lang > doc.lang
sort all.lang doc.lang | uniq -u > %{name}.lang
%else
echo '%{_kf5_docdir}/HTML/*/*' > doc.lang
cp all.lang %{name}.lang
%endif

## use ca-certificates' ca-bundle.crt, symlink as what most other
## distros do these days (http://bugzilla.redhat.com/521902)
if [  -f %{buildroot}%{_kf5_datadir}/kf5/kssl/ca-bundle.crt -a \
      -f /etc/pki/tls/certs/ca-bundle.crt ]; then
  ln -sf /etc/pki/tls/certs/ca-bundle.crt \
         %{buildroot}%{_kf5_datadir}/kf5/kssl/ca-bundle.crt
fi

## use kdebugrc from kde-settings instead
rm -fv %{buildroot}%{_kf5_sysconfdir}/xdg/kdebugrc


%files -f %{name}.lang
%doc README.md
%license COPYING.LIB
%{_kf5_bindir}/kf5-config
%{_kf5_mandir}/man1/kf5-config.1*
%{_kf5_bindir}/kdebugdialog5
# fileshareset pulls in perl
%{_kf5_libexecdir}/fileshareset
%{_kf5_datadir}/kservices5/*.protocol
%{_kf5_datadir}/kservices5/*.desktop
%{_kf5_datadir}/kservices5/qimageioplugins/*.desktop
%{_kf5_datadir}/kservicetypes5/*.desktop
%{_kf5_datadir}/kf5/kdoctools/customization/
%{_kf5_datadir}/kf5/locale/
%{_kf5_datadir}/locale/kf5_all_languages
%{_kf5_datadir}/kf5/widgets/
%config %{_kf5_sysconfdir}/xdg/ksslcalist
%{_kf5_datadir}/kf5/kssl/
%config %{_kf5_sysconfdir}/xdg/colors
%config %{_kf5_sysconfdir}/xdg/kdebug.areas

%ldconfig_scriptlets libs

%files libs
%{_kf5_libdir}/libKF5KDELibs4Support.so.*
%{_kf5_qtplugindir}/*.so
%{_kf5_qtplugindir}/designer/*.so
%{_kf5_plugindir}/kio/metainfo.so
%{_kf5_plugindir}/kded/networkstatus.so

%files help -f doc.lang

%files devel
%{_kf5_libdir}/libKF5KDELibs4Support.so
%{_kf5_libdir}/cmake/KF5KDELibs4Support/
%{_kf5_libdir}/cmake/KF5KDE4Support/
%{_kf5_libdir}/cmake/KDELibs4/
%{_kf5_includedir}/kdelibs4support_version.h
%{_kf5_includedir}/KDELibs4Support/
%{_kf5_datadir}/dbus-1/interfaces/*.xml


%changelog
* Mon Aug 17 2020 yeqinglong <yeqinglong@uniontech.com> - 5.55.0-1
- Initial release for OpenEuler

