From f3bd364055c08d9704b72c46c336b43c9744e519 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Andriot?= <albator78@libertysurf.fr>
Date: Thu, 12 May 2022 16:03:06 +0200
Subject: RPM: kmymoney: switch to cmake build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: François Andriot <albator78@libertysurf.fr>
---
 redhat/applications/kmymoney/kmymoney.spec | 88 ++++++++++++++----------------
 1 file changed, 42 insertions(+), 46 deletions(-)

(limited to 'redhat/applications')

diff --git a/redhat/applications/kmymoney/kmymoney.spec b/redhat/applications/kmymoney/kmymoney.spec
index 6bcc58c11..0154e5e34 100644
--- a/redhat/applications/kmymoney/kmymoney.spec
+++ b/redhat/applications/kmymoney/kmymoney.spec
@@ -68,7 +68,7 @@ BuildRequires:	trinity-tdelibs-devel >= %{tde_version}
 BuildRequires:	trinity-tdebase-devel >= %{tde_version}
 BuildRequires:	desktop-file-utils
 
-BuildRequires:	autoconf automake libtool m4
+BuildRequires:	cmake
 BuildRequires:	gcc-c++
 BuildRequires:	pkgconfig
 BuildRequires:	libtool
@@ -84,6 +84,7 @@ BuildRequires:	update-desktop-files
 BuildRequires:	brp-check-trinity
 %endif
 
+BuildRequires:	html2ps
 BuildRequires:	recode
 BuildRequires:	libofx-devel
 
@@ -148,17 +149,17 @@ have '%{name}' package installed, you will hardly find this package useful.
 %{tde_datadir}/apps/kmymoney2/
 %{tde_datadir}/config.kcfg/kmymoney2.kcfg
 %{tde_datadir}/icons/hicolor/*/*/*.png
-%dir %{tde_datadir}/icons/Tango/
-%dir %{tde_datadir}/icons/Tango/*/
-%dir %{tde_datadir}/icons/Tango/*/*/
-%{tde_datadir}/icons/Tango/*/*/*.png
-%{tde_datadir}/icons/Tango/scalable/*.svgz
+#%dir %{tde_datadir}/icons/Tango/
+#%dir %{tde_datadir}/icons/Tango/*/
+#%dir %{tde_datadir}/icons/Tango/*/*/
+#%{tde_datadir}/icons/Tango/*/*/*.png
+#%{tde_datadir}/icons/Tango/scalable/*.svgz
 %{tde_datadir}/icons/locolor/*/*/*.png
-%dir %{tde_datadir}/icons/oxygen/
-%dir %{tde_datadir}/icons/oxygen/*/
-%dir %{tde_datadir}/icons/oxygen/*/*/
-%{tde_datadir}/icons/oxygen/*/*/*.png
-%{tde_datadir}/icons/oxygen/scalable/*.svgz
+#%dir %{tde_datadir}/icons/oxygen/
+#%dir %{tde_datadir}/icons/oxygen/*/
+#%dir %{tde_datadir}/icons/oxygen/*/*/
+#%{tde_datadir}/icons/oxygen/*/*/*.png
+#%{tde_datadir}/icons/oxygen/scalable/*.svgz
 %{tde_tdedocdir}/HTML/en/kmymoney2/
 %{tde_mandir}/man1/kmymoney2.*
 %{tde_datadir}/apps/kmm_ofximport/
@@ -181,6 +182,7 @@ This package contains development files needed for KMyMoney plugins.
 %{tde_libdir}/libkmm_mymoney.la
 %{tde_libdir}/libkmm_plugin.la
 %{tde_libdir}/*.so
+%{_libdir}/tqt3/plugins/designer/libkmymoney.la
 %{_libdir}/tqt3/plugins/designer/libkmymoney.so
 
 ##########
@@ -197,54 +199,48 @@ This package contains development files needed for KMyMoney plugins.
 
 %__install -m644 %{SOURCE1} kmymoney2/widgets/
 
-%__cp "/usr/share/aclocal/libtool.m4" "admin/libtool.m4.in"
-%__cp "/usr/share/libtool/"*"/ltmain.sh" "admin/ltmain.sh" || %__cp "/usr/share/libtool/ltmain.sh" "admin/ltmain.sh"
-%__make -f "admin/Makefile.common"
-
 
 %build
-unset QTDIR QTINC QTLIB
+unset QTDIR QTLIB QTINC
 export PATH="%{tde_bindir}:${PATH}"
-export PKG_CONFIG_PATH="%{tde_libdir}/pkgconfig:${PKG_CONFIG_PATH}"
-
-%if 0%{?fedora} >= 29 || 0%{?rhel} >= 8
-LDFLAGS="-Wl,--allow-shlib-undefined"
-%endif
 
-# Warning: --enable-final causes FTBFS
-%configure \
-  --prefix=%{tde_prefix} \
-  --exec-prefix=%{tde_prefix} \
-  --bindir=%{tde_bindir} \
-  --datadir=%{tde_datadir} \
-  --libdir=%{tde_libdir} \
-  --mandir=%{tde_mandir} \
-  --includedir=%{tde_tdeincludedir} \
+if ! rpm -E %%cmake|grep -q "cd build"; then
+  %__mkdir_p build
+  cd build
+fi
+
+%cmake \
+  -DCMAKE_BUILD_TYPE="RelWithDebInfo" \
+  -DCMAKE_C_FLAGS="${RPM_OPT_FLAGS}" \
+  -DCMAKE_CXX_FLAGS="${RPM_OPT_FLAGS}" \
+  -DCMAKE_SKIP_RPATH=OFF \
+  -DCMAKE_SKIP_INSTALL_RPATH=OFF \
+  -DCMAKE_INSTALL_RPATH="%{tde_libdir}" \
+  -DCMAKE_VERBOSE_MAKEFILE=ON \
+  -DWITH_GCC_VISIBILITY=OFF \
+  \
+  -DCMAKE_INSTALL_PREFIX="%{tde_prefix}" \
+  -DBIN_INSTALL_DIR="%{tde_bindir}" \
+  -DDOC_INSTALL_DIR="%{tde_docdir}" \
+  -DINCLUDE_INSTALL_DIR="%{tde_tdeincludedir}" \
+  -DLIB_INSTALL_DIR="%{tde_libdir}" \
+  -DPKGCONFIG_INSTALL_DIR="%{tde_libdir}/pkgconfig" \
+  -DSYSCONF_INSTALL_DIR="%{_sysconfdir}/trinity" \
+  -DSHARE_INSTALL_PREFIX="%{tde_datadir}" \
   \
-  --disable-dependency-tracking \
-  --disable-debug \
-  --enable-new-ldflags \
-  --disable-final \
-  --enable-closure \
-  --enable-rpath \
-  --disable-gcc-hidden-visibility \
+  -DWITH_ALL_OPTIONS=ON \
   \
-  --with-qmake=%{_bindir}/tqmake \
-  --with-qt-dir=%{_libdir}/tqt3 \
+  -DBUILD_ALL=ON \
   \
-  --disable-pdf-docs \
-  --enable-ofxplugin \
-  --enable-ofxbanking \
-  --enable-qtdesigner \
-  --disable-sqlite3
+  ..
 
-%__make %{?_smp_mflags}
+%__make %{?_smp_mflags} || %__make
 
 
 %install
 export PATH="%{tde_bindir}:${PATH}"
 %__rm -rf %{buildroot}
-%__make install DESTDIR=%{buildroot}
+%__make install DESTDIR=%{buildroot} -C build
 
 %find_lang kmymoney2
 
-- 
cgit v1.2.1