From 11ba4f4c0a6090ddbae5d1484ebc28b2c7cfd604 Mon Sep 17 00:00:00 2001 From: Vitaly Zaitsev Date: Sun, 9 Jan 2022 16:02:56 +0100 Subject: [PATCH] Build Qt 6 version on all architectures, except s390x. --- qcoro.spec | 61 +++++++++++++++++++++++++++++++++--------------------- 1 file changed, 37 insertions(+), 24 deletions(-) diff --git a/qcoro.spec b/qcoro.spec index f245df8..e59c019 100644 --- a/qcoro.spec +++ b/qcoro.spec @@ -1,5 +1,9 @@ %undefine __cmake_in_source_build %global tests 1 +%global use_qt5 1 +%ifnarch s390x +%global use_qt6 1 +%endif %global appname QCoro %global qt5_build_dir release-qt5 @@ -43,42 +47,41 @@ BuildRequires: dbus-x11 %description %_description +%if 0%{?use_qt5} %package qt5 Summary: %{summary} 5 Provides: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: %{name} < %{?epoch:%{epoch}:}%{version}-%{release} -%package qt6 -Summary: %{summary} 6 - %package qt5-devel Summary: Development files for %{appname} (Qt 5 version) Requires: %{name}-qt5%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Provides: %{name}-devel = %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: %{name}-devel < %{?epoch:%{epoch}:}%{version}-%{release} +%description qt5 %_description +%description qt5-devel %_description +%endif + +%if 0%{?use_qt6} +%package qt6 +Summary: %{summary} 6 + %package qt6-devel Summary: Development files for %{appname} (Qt 6 version) Requires: %{name}-qt6%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} -%description qt5 %_description - %description qt6 %_description - -%description qt5-devel %_description - %description qt6-devel %_description +%endif %prep %autosetup -p1 sed -e '/-Werror/d' -i CMakeLists.txt %build -# Creating directories for separate builds... -mkdir {%{qt5_build_dir},%{qt6_build_dir}} - -# Building Qt 5 version... -pushd %{qt5_build_dir} +%if 0%{?use_qt5} +mkdir %{qt5_build_dir} && pushd %{qt5_build_dir} %cmake -G Ninja \ -S'..' \ -DCMAKE_BUILD_TYPE=Release \ @@ -95,9 +98,10 @@ pushd %{qt5_build_dir} -DQCORO_WITH_QTNETWORK:BOOL=ON %cmake_build popd +%endif -# Building Qt 6 version... -pushd %{qt6_build_dir} +%if 0%{?use_qt6} +mkdir %{qt6_build_dir} && pushd %{qt6_build_dir} %cmake -G Ninja \ -S'..' \ -DCMAKE_BUILD_TYPE=Release \ @@ -114,50 +118,59 @@ pushd %{qt6_build_dir} -DQCORO_WITH_QTNETWORK:BOOL=ON %cmake_build popd +%endif %install -# Installing Qt 5 version... +%if 0%{?use_qt5} pushd %{qt5_build_dir} %cmake_install popd +%endif -# Installing Qt 6 version... +%if 0%{?use_qt6} pushd %{qt6_build_dir} %cmake_install popd +%endif %if 0%{?tests} %check -# Performing tests against Qt 5 version... +%if 0%{?use_qt5} pushd %{qt5_build_dir} %ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)' popd +%endif -# Performing tests against Qt 6 version... +%if 0%{?use_qt6} pushd %{qt6_build_dir} %ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)' popd %endif +%endif +%if 0%{?use_qt5} %files qt5 %doc README.md %license LICENSES/* %{_libdir}/lib%{appname}5*.so.0* -%files qt6 -%doc README.md -%license LICENSES/* -%{_libdir}/lib%{appname}6*.so.0* - %files qt5-devel %{_includedir}/%{name}5/ %{_libdir}/cmake/%{appname}5*/ %{_libdir}/lib%{appname}5*.so +%endif + +%if 0%{?use_qt6} +%files qt6 +%doc README.md +%license LICENSES/* +%{_libdir}/lib%{appname}6*.so.0* %files qt6-devel %{_includedir}/%{name}6/ %{_libdir}/cmake/%{appname}6*/ %{_libdir}/lib%{appname}6*.so +%endif %changelog * Sun Jan 09 2022 Vitaly Zaitsev - 0.4.0-1