# All upstream version numbers are unique, but they may
# have a "release tag" (_dev, _beta, _qa) after the version
# number, indicating various degree of non-stable releases.
# Stable releases does not have such a tag - thus not enabled
# on stable release builds.
# For non-stable builds, the version comparison can get
# confused by these additional tags.  The RPM packaging
# moves these release tags tags after the RPM Release
# number instead.
#
#%%global releasetag .qa1
#%%global versiontag _qa1


%global _hardened_build 1
%global _vpath_srcdir %{name}-%{version}%{?versiontag}

Name:     gdbuspp
Version:  3
Release:  4%{?releasetag}%{?dist}
Summary:  GDBus++ - glib2 D-Bus wrapper for C++
License:  AGPL-3.0-only
URL:      https://codeberg.org/OpenVPN/gdbuspp/
Source0:  https://swupdate.openvpn.net/community/releases/%{name}-%{version}%{?versiontag}.tar.xz
Source1:  https://swupdate.openvpn.net/community/releases/%{name}-%{version}%{?versiontag}.tar.xz.asc
Source2:  https://swupdate.openvpn.net/community/keys/gpgkey-F554A3687412CFFEBDEFE0A312F5F7B42F2B01E7.gpg

# The upstream GDBus++ project does not support 32-bit platforms.
# Attempting to build on 32-bit platforms will result in C++ int types
# being mixed up with the long type in the C++ templates.
ExcludeArch: arm7hl i686

BuildRequires: gcc-c++
BuildRequires: gnupg2
BuildRequires: python3-dbus
BuildRequires: python3-gobject-base
BuildRequires: meson
BuildRequires: glib2-devel
BuildRequires: dbus-devel
BuildRequires: python3-xmltodict

%description
GDBus++ is an API wrapper around glib2's D-Bus interface to write D-Bus
services and proxies (clients) using C++17.  It tries to avoid exposing
the low-level glib2 APIs as much as possible to the developer.

%package devel
Summary:   Development headers for GDBus++
Requires:  %{name}%{?_isa} = %{version}-%{release}

%description devel
Contains all the development headers needed to compile an application
implementing the GDBus++ API

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


%build
%meson
%meson_build


%check
# Only stand-alone tests are enabled, as other tests depends
# on a dbus daemon/broker being available and functional.  This
# is not the case in Koji/Copr builders
%meson_test --suite standalone


%install
%meson_install

# Since glib2 is not packaged with static libraries,
# it makes little sense package a static library for GDBus++
# which has glib2 as a hard dependency.
rm -f %{buildroot}/%{_libdir}/lib%{name}.a


%files
%license %{name}-%{version}/LICENSES/AGPL-3.0-only.txt
%{_pkgdocdir}/README.md
%{_libdir}/lib%{name}.so.3*


%files devel
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/%{name}
%dir %{_pkgdocdir}
%{_pkgdocdir}/dbus-primer.md
%{_pkgdocdir}/example-*.cpp


%changelog
* Tue Jan  7 2025  David Sommerseth <davids@openvpn.net> - 3-4
- Final changes before import into Fedora

* Wed Dec 18 2024 David Sommerseth <davids@openvpn.net> - 3-3
- Removed duplicated docs in _pkgdocdir and explicitly target .so.3 (RHBZ#2330591)

* Fri Dec  6 2024 David Sommerseth <davids@openvpn.net> - 3-2
- Removed static library from gdbuspp-devel (RHBZ#2330591)

* Tue Dec  3 2024 David Sommerseth <davids@openvpn.net> - 3-1
- Updated to GDBus++ v3 release

* Wed Aug 28 2024 David Sommerseth <davids@openvpn.net> - 2-1
- Updated to latest upstream release
- Relocated development related docs to gdbuspp-devel

* Mon Jun 17 2024 David Sommerseth <davids@openvpn.net> - 1-1
- First official release of GDBus++