#   ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
#   File: pidgin-xmpp-receipts.spec
#   Copyright 🄯 2025 Van de Bugger.
#   SPDX-License-Identifier: FSFAP
#   ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

Source1000:     vdb.lua
%include        %{S:1000}

%global Name    xmpp-receipts
%global Major   0
%global Minor   6

Name:           pidgin-%{Name}
Version:        %{Major}.%{Minor}
Release:        0.vdb.1%{?dist}
Summary:        XMPP message delivery receipts for Pidgin
License:        GPL-2.0-or-later
    # COPYING file from the source tarball is GPLv3.
    # But the header comment in the source says the licence is GPLv2 or later.
URL:            https://app.assembla.com/spaces/%{name}
Source0:        %{name}-%{version}.tar.gz

BuildRequires:  make
BuildRequires:  gcc
BuildRequires:  pkgconfig(pidgin)

Requires:       pidgin

%description
%{text -- \
    This pidgin-plugin implements xmpp message delivery receipts (XEP-0184). When no delivering
    confirmation is displayed, it is also possible that the receiver doesn't support the extension.
}

%prep
%autosetup -p1

%build
pidgin_cflags=$( pkg-config --cflags pidgin )
pidgin_libs=$( pkg-config --libs pidgin )
%make_build \
    CFLAGS="-fPIC $CFLAGS $pidgin_cflags" \
    INCLUDES="" \
    LDFLAGS="-shared $LDFLAGS $pidgin_libs" \
    xmpp-receipts.so

%install
# Makefile installs the plugin into the user's home directory.
plugindir=$( pkg-config --variable=plugindir pidgin )
%{__install} -D -t "%{buildroot}/$plugindir" %{Name}.so
%{__install} -D -t "%{buildroot}/%{_pkgdocdir}" README

%check

%files
            %{_libdir}/pidgin/%{Name}.so
%doc %dir   %{_pkgdocdir}
%doc        %{_pkgdocdir}/README
%license    COPYING

%changelog

* Wed Mar  5 2025 Van de Bugger - 0.6-0.vdb.1
- Initial release