%define __cmake_in_source_build 1
%bcond_with clang

Name:           xdg-desktop-portal-lxqt
Version:        0.5.0
Release:        1%{dist}
Summary:        A backend implementation for xdg-desktop-portal
License:        LGPL-2.1-or-later
Group:          Development/Libraries/C and C++
URL:            http://www.lxqt.org
Source:         https://github.com/lxqt/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz

BuildRequires:  cmake
%if %{with clang}
BuildRequires: clang >= 5.0
%else
BuildRequires: gcc-c++
%endif

BuildRequires:  pkgconfig
BuildRequires:  cmake(KF5WindowSystem) >= 5.78
BuildRequires:  pkgconfig(Qt5Core) >= 5.15
BuildRequires:  pkgconfig(Qt5DBus)
BuildRequires:  pkgconfig(libexif)
BuildRequires:  pkgconfig(libfm-qt) >= 1.4.0
BuildRequires:  pkgconfig(xdg-desktop-portal)

%description
A backend implementation for xdg-desktop-portal that is using Qt/KF5/libfm-qt.
functionality needed by nearly all of its components.

%prep
%setup -q

%build
%{__mkdir} -p %{_target_platform}

%if %{with clang}
export CC=clang
export CXX=clang++
%endif

pushd %{_target_platform}
%{cmake_lxqt} \
    ..

%cmake_build
popd

%install
pushd %{_target_platform}
  %cmake_install
popd

%files
%dir %{_datadir}/xdg-desktop-portal
%dir %{_datadir}/xdg-desktop-portal/portals
%{_libexecdir}/xdg-desktop-portal-lxqt
%{_datadir}/applications/org.freedesktop.impl.portal.desktop.lxqt.desktop
%{_datadir}/dbus-1/services/org.freedesktop.impl.portal.desktop.lxqt.service
%{_datadir}/xdg-desktop-portal/portals/lxqt.portal

%changelog
* Mon Nov  6 2023 Raven <raven@sysadmins.ws> - 1.4.0-1
- update to 1.4.0
- clang support

* Thu May 18 2023 Raven <raven@sysadmins.ws> - 0.4.0-1
- update to 0.4.0

* Fri Nov 11 2022 Raven <raven@sysadmins.ws> - 0.3.0-1
- initial build