-# TODO where to put files and docs of KF5
-%define _state stable
-%define orgname extra-cmake-modules
+#
+# Conditional build:
+%bcond_without doc # build without doc
+%bcond_without tests # build without tests
+%define orgname extra-cmake-modules
+%define kdeframever 5.104
Summary: Extra Cmake Modules for KF5
-Name: kf5-extra-cmake-modules
-Version: 1.0.0
-Release: 0.2
-License: See COPYING-CMAKE-SCRIPTS
-Group: X11/Libraries
-Source0: ftp://ftp.kde.org/pub/kde/%{_state}/frameworks/5.0.0/%{orgname}-%{version}.tar.xz
-# Source0-md5: a7b9e8756fdc2b3a8518ad9f9d21dfd5
-URL: http://www.kde.org/
-BuildRequires: cmake >= 2.8.12
-BuildRequires: rpmbuild(macros) >= 1.164
-BuildRequires: sphinx-pdg
+Summary(pl.UTF-8): Dodatkowe moduły Cmake'a dla KF5
+Name: kf5-%{orgname}
+Version: 5.104.0
+Release: 1
+License: BSD
+Group: Development/Building
+Source0: https://download.kde.org/stable/frameworks/%{kdeframever}/%{orgname}-%{version}.tar.xz
+# Source0-md5: 868f2ede18cd48146830476d3af9f8ca
+Patch0: %{orgname}-tests.patch
+Patch1: kdefetchtranslations-test.patch
+Patch2: no-fatal-warnings.patch
+URL: https://kde.org/
+BuildRequires: cmake >= 3.16
+BuildRequires: qt5-assistant >= 5.9.0
+BuildRequires: qt5-linguist
+BuildRequires: rpmbuild(macros) >= 1.698
+BuildRequires: sed >= 4.0
+%{?with_doc:BuildRequires: sphinx-pdg >= 1.2}
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
+%if %{with tests}
+BuildRequires: Qt5Core-devel >= 5.9.0
+BuildRequires: Qt5Quick-devel >= 5.9.0
+BuildRequires: libstdc++-devel >= 6:5
+%endif
+BuildConflicts: qmake
+BuildArch: noarch
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
-%define qt5dir %{_libdir}/qt5
-
%description
The Extra CMake Modules package, or ECM, adds to the modules provided
-by CMake, including both ones used by ``find_package()`` to find
-common software and ones that can be used directly in
-``CMakeLists.txt`` files to perform common tasks.
+by CMake, including both ones used by find_package() to find common
+software and ones that can be used directly in CMakeLists.txt files to
+perform common tasks.
In addition, it provides common build settings used in software
produced by the KDE community.
CMake scripts across KDE software, it is intended to be useful for any
software that uses the CMake build system.
-%package doc
-Summary: Documentation for ECM
+%description -l pl.UTF-8
+Pakiet Extra CMake Modules (ECM) dostarcza dodatkowe moduły do tych
+dostarczanych przez CMake'a, zawierające te używane przez
+find_package() do szukania popularnego oprogramowania, a także takie,
+których można używać bezpośrednio w CMakeLists.txt do wykonywania
+wspólnych zadań.
+
+Ponadto pakiet dostarcza wspólne ustawienia budowana używane w
+oprogramowaniu tworzonym przez społeczność KDE.
+
+O ile główną motywacją tego modułu jest zmniejszenie duplikacji w
+skryptach CMake'a w oprogramowaniu KDE, ma także być przydatny dla
+dowolnych programów wykorzystujących system budowania CMake.
+
+%package apidocs
+Summary: API documentation for %{orgname}
+Summary(pl.UTF-8): Dokumentacja API %{orgname}
Group: Documentation
-BuildArch: noarch
+Obsoletes: kf5-extra-cmake-modules-doc < 1.4.0
+
+%description apidocs
+API documentation for %{orgname}.
-%description doc
-Documentation for ECM.
+%description apidocs -l pl.UTF-8
+Dokumentacja API dla %{orgname}.
%prep
%setup -q -n %{orgname}-%{version}
+%patch0 -p1
+%patch1 -p0
+%patch2 -p1
+
+# causes make install failure after running tests
+%{__sed} -i -e '/ECMToolchainAndroidTest/d' tests/CMakeLists.txt
%build
install -d build
cd build
%cmake \
- -DBIN_INSTALL_DIR=%{_bindir} \
- -DKCFG_INSTALL_DIR=%{_datadir}/config.kcfg \
- -DPLUGIN_INSTALL_DIR=%{qt5dir}/plugins \
- -DQT_PLUGIN_INSTALL_DIR=%{qt5dir}/plugins \
- -DQML_INSTALL_DIR=%{qt5dir}/qml \
- -DIMPORTS_INSTALL_DIR=%{qt5dirs}/imports \
- -DSYSCONF_INSTALL_DIR=%{_sysconfdir} \
- -DLIBEXEC_INSTALL_DIR=%{_libexecdir} \
- -DKF5_LIBEXEC_INSTALL_DIR=%{_libexecdir} \
- -DKF5_INCLUDE_INSTALL_DIR=%{_includedir} \
- -DECM_MKSPECS_INSTALL_DIR=%{qt5dir}/mkspecs/modules \
- -D_IMPORT_PREFIX=%{_prefix} \
- ../
+ %{!?with_tests:-DBUILD_TESTING=OFF} \
+ %{!?with_doc:-DBUILD_HTML_DOCS=OFF} \
+ ..
+
%{__make}
+%if %{with tests}
+# GenerateSipBindings wants clang and has libclang checks incompatible with libclang >= 4
+# ECMPoQmToolsTest fails to build it's own moc file
+ctest -E '(GenerateSipBindings|ECMPoQmToolsTest)' --output-on-failure
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
-%{__make} -C build/ install \
+%{__make} -C build -j1 install \
DESTDIR=$RPM_BUILD_ROOT
+sed -i -e 's#/usr/bin/env bash#/bin/bash#' $RPM_BUILD_ROOT%{_datadir}/ECM/kde-modules/kde-git-commit-hooks/pre-commit.in
+sed -i -e 's#/usr/bin/env bash#/bin/bash#' $RPM_BUILD_ROOT%{_datadir}/ECM/kde-modules/kde-git-commit-hooks/clang-format.sh
+
+%if %{with doc}
+%{__mv} $RPM_BUILD_ROOT%{_docdir}/ECM ECM-doc
+%endif
+install -d $RPM_BUILD_ROOT%{_datadir}/qlogging-categories5
+
%clean
rm -rf $RPM_BUILD_ROOT
%defattr(644,root,root,755)
%doc COPYING-CMAKE-SCRIPTS README.rst
%{_datadir}/ECM
-%{_mandir}/man7/ecm*
+%{_datadir}/qlogging-categories5
+%{_mandir}/man7/ecm*.7*
-%files doc
+%if %{with doc}
+%files apidocs
%defattr(644,root,root,755)
-%{_docdir}/ECM
+%doc ECM-doc/html/*
+%endif