%bcond_with gcc
%bcond_with qt5
## START: Set by rpmautospec
## (rpmautospec version 0.5.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 4;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

Name:           kdsoap
Version:        2.2.0
Release:        %autorelease
Summary:        A Qt-based client-side and server-side SOAP component

# Note that this project requires the 3rd party 'libkode' submodule
# that is licensed separately with LGPL-2.0-or-later; however, libkode
# is used for code-generation only and the resulting code can be made
# available under any license.
# 
# Various other freely distributable files are contained in the unittests
# and are not used in the library code itself.
License:        MIT
URL:            https://github.com/KDAB/KDSoap
Source0:        https://github.com/KDAB/KDSoap/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz
Source1:        https://github.com/KDAB/KDSoap/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz.asc
Source2:        https://www.kdab.com/kdab-products.asc

%if %{with gcc}
BuildRequires:  gcc-toolset-14-gcc-c++
%else
BuildRequires:  clang
%endif
BuildRequires:  cmake
BuildRequires:  pkgconfig(Qt5Core)
BuildRequires:  pkgconfig(Qt6Core)
BuildRequires: gnupg2

%global _description %{expand:
KDSoap can be used to create client applications for web services
and also provides the means to create web services without the need
for any further component such as a dedicated web server.}

%description %{_description}

For more information, see
https://www.kdab.com/development-resources/qt-tools/kd-soap/
%if %{with qt5}
%package        devel
Summary:        Development files for %{name}
Requires:       %{name}%{?_isa} = %{version}-%{release}
Requires:       %{name}-devel-common%{?_isa} = %{version}-%{release}
%description    devel
This package contains header files and associated tools and libraries to
develop programs which need to access web services using the SOAP protocol.

%package        devel-common
Summary:        Header files and other common development files for kdsoap and kdsoap6
%description    devel-common
%{summary}.
%endif

%package     -n kdsoap6
Summary:        Qt 6 version of %{name}
%description -n kdsoap6
%{_description}

%package     -n kdsoap6-devel
Summary:        Development files for kdsoap6
Requires:       kdsoap6%{?_isa} = %{version}-%{release}
%if %{with qt5}
Requires:       %{name}-devel-common%{?_isa} = %{version}-%{release}
%endif
%description -n kdsoap6-devel
This package contains header files and associated tools and libraries to
develop programs which need to access web services using the SOAP protocol.

%package        doc
Summary:        Documentation for %{name}
BuildArch:      noarch

%description    doc
Documentation for %{name}

%prep
%{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}'
%autosetup

%build
%if %{with gcc}
%enable_devtoolset14
export CC=gcc
export CXX=c++
%else
export CC=clang
export CXX=clang++
%global optflags %(echo %{optflags}) -Qunused-arguments
%endif

%if %{with qt5}
%global _vpath_builddir %{_target_platform}-qt5
%cmake -DKDSoap_EXAMPLES=false -DKDSoap_QT6=OFF
%cmake_build
%endif

%global _vpath_builddir %{_target_platform}-qt6
%cmake -DKDSoap_EXAMPLES=false -DKDSoap_QT6=ON
%cmake_build

%install
%if %{with qt5}
%global _vpath_builddir %{_target_platform}-qt5
%cmake_install
%endif

%global _vpath_builddir %{_target_platform}-qt6
%cmake_install
rm -rf $RPM_BUILD_ROOT/%{_datarootdir}/doc/KDSoap{,-qt6}

%check
%global _vpath_builddir %{_target_platform}-qt5
%ctest
%global _vpath_builddir %{_target_platform}-qt6
%ctest


%files
%if %{with qt5}
%{_libdir}/libkdsoap-server.so.2*
%{_libdir}/libkdsoap.so.2*
%doc README.md
%license LICENSES/MIT.txt

%files devel
%doc kdsoap.pri kdwsdl2cpp.pri
%{_libdir}/libkdsoap-server.so
%{_libdir}/libkdsoap.so
%{_bindir}/kdwsdl2cpp
%{_libdir}/cmake/KDSoap/
%{_libdir}/qt5/mkspecs/modules/*
%{_includedir}/KDSoapClient/
%{_includedir}/KDSoapServer/

%files devel-common
%dir %{_datadir}/mkspecs
%dir %{_datadir}/mkspecs/features
%{_datadir}/mkspecs/features/kdsoap.prf
%endif

%files -n kdsoap6
%{_libdir}/libkdsoap-server-qt6.so.2*
%{_libdir}/libkdsoap-qt6.so.2*
%doc README.md
%license LICENSES/MIT.txt

%files -n kdsoap6-devel
%doc kdsoap.pri kdwsdl2cpp.pri
%{_libdir}/libkdsoap-server-qt6.so
%{_libdir}/libkdsoap-qt6.so
%{_bindir}/kdwsdl2cpp-qt6
%{_libdir}/cmake/KDSoap-qt6/
%{_libdir}/qt6/mkspecs/modules/*
%{_includedir}/KDSoapClient-Qt6/
%{_includedir}/KDSoapServer-Qt6/

%files doc
%doc docs


%changelog
## START: Generated by rpmautospec
* Wed Jan 24 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Sun Jan 21 2024 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild

* Mon Jan 15 2024 Alessandro Astone <ales.astone@gmail.com> - 2.2.0-2
- Move qt5 headers to the right package

* Mon Jan 15 2024 Steve Cossette <farchord@gmail.com> - 2.2.0-1
- Update to 2.2.0

* Mon Nov 27 2023 Alessandro Astone <ales.astone@gmail.com> - 2.1.1-10
- Split devel-common subpackage

* Fri Nov 24 2023 Alessandro Astone <ales.astone@gmail.com> - 2.1.1-9
- Add Qt6 build

* Thu Jul 20 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Fri Feb 17 2023 Casper Meijn <casper@meijn.net> - 2.1.1-7
- Check GPG signature on source file

* Thu Feb 16 2023 Casper Meijn <casper@meijn.net> - 2.1.1-4
- Update description to be in line with upstream

* Wed Feb 15 2023 Casper Meijn <casper@meijn.net> - 2.1.1-1
- Update to KDSoap 2.1.1 (rhbz#2126596)

* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

* Thu Jul 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild

* Thu Jan 20 2022 Fedora Release Engineering <releng@fedoraproject.org> - 2.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Thu Jan 06 2022 Casper Meijn <casper@meijn.net> - 2.0.0-1
- Update to KDSoap 2.0.0

* Thu Jul 22 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_35_Mass_Rebuild

* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 1.10.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild

* Tue Dec 29 2020 Casper Meijn <casper@meijn.net> - 1.10.0-1
- Update to KDSoap 1.10.0

* Sat Nov 14 2020 Marie Loise Nolden <loise@kde.org> - 1.9.1-1
- Update to 1.9.1

* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.9.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Thu Feb 20 2020 Casper Meijn <casper@meijn.net> - 1.9.0-6
- Update to KDSoap 1.9.0
- Disable building examples
- Remove RPath patch

* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.0-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.8.0-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sat May 18 2019 Casper Meijn <casper@meijn.net> - 1.8.0-3
- Update to KDSoap 1.8.0

* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 1.7.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Fri Oct 12 2018 Casper Meijn <casper@meijn.net> - 1.7.0-1
- First kdsoap package

## END: Generated by rpmautospec
