Build Qt 6 version on all architectures, except s390x.

epel9
Vitaly Zaitsev 3 years ago
parent b36f9b223f
commit 11ba4f4c0a
No known key found for this signature in database
GPG Key ID: BF99FC6DD45AB90A

@ -1,5 +1,9 @@
%undefine __cmake_in_source_build %undefine __cmake_in_source_build
%global tests 1 %global tests 1
%global use_qt5 1
%ifnarch s390x
%global use_qt6 1
%endif
%global appname QCoro %global appname QCoro
%global qt5_build_dir release-qt5 %global qt5_build_dir release-qt5
@ -43,42 +47,41 @@ BuildRequires: dbus-x11
%description %_description %description %_description
%if 0%{?use_qt5}
%package qt5 %package qt5
Summary: %{summary} 5 Summary: %{summary} 5
Provides: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} Provides: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: %{name} < %{?epoch:%{epoch}:}%{version}-%{release} Obsoletes: %{name} < %{?epoch:%{epoch}:}%{version}-%{release}
%package qt6
Summary: %{summary} 6
%package qt5-devel %package qt5-devel
Summary: Development files for %{appname} (Qt 5 version) Summary: Development files for %{appname} (Qt 5 version)
Requires: %{name}-qt5%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: %{name}-qt5%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-devel = %{?epoch:%{epoch}:}%{version}-%{release} Provides: %{name}-devel = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: %{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 %package qt6-devel
Summary: Development files for %{appname} (Qt 6 version) Summary: Development files for %{appname} (Qt 6 version)
Requires: %{name}-qt6%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release} Requires: %{name}-qt6%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
%description qt5 %_description
%description qt6 %_description %description qt6 %_description
%description qt5-devel %_description
%description qt6-devel %_description %description qt6-devel %_description
%endif
%prep %prep
%autosetup -p1 %autosetup -p1
sed -e '/-Werror/d' -i CMakeLists.txt sed -e '/-Werror/d' -i CMakeLists.txt
%build %build
# Creating directories for separate builds... %if 0%{?use_qt5}
mkdir {%{qt5_build_dir},%{qt6_build_dir}} mkdir %{qt5_build_dir} && pushd %{qt5_build_dir}
# Building Qt 5 version...
pushd %{qt5_build_dir}
%cmake -G Ninja \ %cmake -G Ninja \
-S'..' \ -S'..' \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
@ -95,9 +98,10 @@ pushd %{qt5_build_dir}
-DQCORO_WITH_QTNETWORK:BOOL=ON -DQCORO_WITH_QTNETWORK:BOOL=ON
%cmake_build %cmake_build
popd popd
%endif
# Building Qt 6 version... %if 0%{?use_qt6}
pushd %{qt6_build_dir} mkdir %{qt6_build_dir} && pushd %{qt6_build_dir}
%cmake -G Ninja \ %cmake -G Ninja \
-S'..' \ -S'..' \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
@ -114,50 +118,59 @@ pushd %{qt6_build_dir}
-DQCORO_WITH_QTNETWORK:BOOL=ON -DQCORO_WITH_QTNETWORK:BOOL=ON
%cmake_build %cmake_build
popd popd
%endif
%install %install
# Installing Qt 5 version... %if 0%{?use_qt5}
pushd %{qt5_build_dir} pushd %{qt5_build_dir}
%cmake_install %cmake_install
popd popd
%endif
# Installing Qt 6 version... %if 0%{?use_qt6}
pushd %{qt6_build_dir} pushd %{qt6_build_dir}
%cmake_install %cmake_install
popd popd
%endif
%if 0%{?tests} %if 0%{?tests}
%check %check
# Performing tests against Qt 5 version... %if 0%{?use_qt5}
pushd %{qt5_build_dir} pushd %{qt5_build_dir}
%ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)' %ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)'
popd popd
%endif
# Performing tests against Qt 6 version... %if 0%{?use_qt6}
pushd %{qt6_build_dir} pushd %{qt6_build_dir}
%ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)' %ctest --timeout 3600 --exclude-regex '(qcoroprocess|qcoroabstractsocket|qcorolocalsocket)'
popd popd
%endif %endif
%endif
%if 0%{?use_qt5}
%files qt5 %files qt5
%doc README.md %doc README.md
%license LICENSES/* %license LICENSES/*
%{_libdir}/lib%{appname}5*.so.0* %{_libdir}/lib%{appname}5*.so.0*
%files qt6
%doc README.md
%license LICENSES/*
%{_libdir}/lib%{appname}6*.so.0*
%files qt5-devel %files qt5-devel
%{_includedir}/%{name}5/ %{_includedir}/%{name}5/
%{_libdir}/cmake/%{appname}5*/ %{_libdir}/cmake/%{appname}5*/
%{_libdir}/lib%{appname}5*.so %{_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 %files qt6-devel
%{_includedir}/%{name}6/ %{_includedir}/%{name}6/
%{_libdir}/cmake/%{appname}6*/ %{_libdir}/cmake/%{appname}6*/
%{_libdir}/lib%{appname}6*.so %{_libdir}/lib%{appname}6*.so
%endif
%changelog %changelog
* Sun Jan 09 2022 Vitaly Zaitsev <vitaly@easycoding.org> - 0.4.0-1 * Sun Jan 09 2022 Vitaly Zaitsev <vitaly@easycoding.org> - 0.4.0-1

Loading…
Cancel
Save