#   ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
#   File: purple-lurch.spec
#   Copyright 🄯 2022, 2023 Van de Bugger.
#   SPDX-License-Identifier: FSFAP
#   ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――

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

%global         nam     lurch
%global         ver     0.7.0
%global         rel     0.vdb.1

%bcond_without tests

Name:             purple-%{nam}
Version:          %{ver}
Release:          %{rel}%{?dist}
Summary:          OMEMO encryption for libpurple

License:          GPLv3
URL:              https://github.com/gkdr/lurch
Source0:          https://github.com/gkdr/lurch/archive/refs/tags/v%{ver}.tar.gz#/lurch-%{ver}.tar.gz

BuildRequires:    gcc
BuildRequires:    make
BuildRequires:    pkgconfig(glib-2.0)
BuildRequires:    pkgconfig(libaxc)
BuildRequires:    pkgconfig(libomemo)
BuildRequires:    pkgconfig(libsignal-protocol-c)
BuildRequires:    pkgconfig(libxml-2.0)
BuildRequires:    pkgconfig(purple)
BuildRequires:    pkgconfig(cmocka)

%global __requires_exclude ^libxmpp\\.so\\(\\)

%description
%{text -- \
    Packager description:

    This package enables OMEMO encryption in libpurple clients, e. g. Pidgin.

    Author description:

    In German, an Axolotl is a type of Lurch, which simply means 'amphibian'. This plugin
    brings Axolotl, by now renamed to double ratchet, to libpurple applications such as Pidgin
    by implementing the XEP-0384: OMEMO Encryption. For a higher-level overview, see the
    official OMEMO homepage.

    (Plus I thought the word sounds funny.)
}

%prep
%autosetup -n %{nam}-%{ver}

%build
%make_build

%install
%make_install

%check
# Some cmocka tests fail when build with -flto=auto option. Let's disable LTO (set by Fedora rpm
# macros) to let tests run.
CFLAGS="$CFLAGS -fno-lto"
%make_build test

%files
            %{_libdir}/purple-2/%{nam}.so

%changelog

* Fri Mar 11 2022 Van de Bugger - 0.7.0-0.vdb.1
- Initial package