%bcond_with clang

Name:          lxqt-archiver
Summary:       LXQt File Archiver
Version:       1.0.0
Release:       1%{?dist}
License:       GPLv2+
URL:           https://lxqt.github.io/
Source0:       https://github.com/lxqt/%{name}/releases/download/%{version}/%{name}-%{version}.tar.xz
Source1:       %{name}.appdata.xml
BuildRequires: cmake
%if %{with clang}
BuildRequires:  clang >= 5.0
%else
BuildRequires:  gcc-c++
%endif
BuildRequires: cmake(Qt6Widgets)
BuildRequires: cmake(Qt6LinguistTools)
BuildRequires: cmake(fm-qt6)
BuildRequires: cmake(lxqt2-build-tools)
BuildRequires: pkgconfig(lxqt)
BuildRequires: pkgconfig(glib-2.0)
BuildRequires: desktop-file-utils
BuildRequires: json-glib-devel
BuildRequires: libexif-devel
BuildRequires: libappstream-glib
BuildRequires: perl

%description
%{summary}.

%package l10n
BuildArch:      noarch
Summary:        Translations for lxqt-archiver
Requires:       lxqt-archiver
%description l10n
This package provides translations for the lxqt-archiver package.

%prep
%autosetup

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

%cmake_lxqt
%cmake_build

%install
%cmake_install
desktop-file-edit \
    --remove-category=LXQt --add-category=X-LXQt \
    %{buildroot}%{_datadir}/applications/%{name}.desktop
mkdir -p %{buildroot}%{_datadir}/lxqt/translations/%{name}
mkdir -p %{buildroot}%{_metainfodir}/
cp %{SOURCE1} %{buildroot}%{_metainfodir}/
appstream-util validate-relax --nonet %{buildroot}%{_metainfodir}/*.appdata.xml
%find_lang %{name} --with-qt

%files
%doc CHANGELOG AUTHORS README.md
%license LICENSE
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_metainfodir}/%{name}.appdata.xml
%dir %{_datadir}/%{name}

%files l10n -f %{name}.lang
%doc CHANGELOG AUTHORS README.md
%license LICENSE
%dir %{_datadir}/%{name}/translations
%{_datadir}/%{name}/translations/%{name}_arn.qm
%{_datadir}/%{name}/translations/%{name}_ast.qm

%changelog
* Fri Sep 27 2024 Raven <raven@sysadmins.ws> - 1.0.0-1
- 1.0.0

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

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

* Fri Nov 11 2022 Raven <raven@sysadmins.ws> - 0.7.0-1
- update to 0.7.0

* Mon Nov 08 2021 Raven <raven@sysadmins.ws> - 0.5.0-1
- update to 0.5.0
- drop RHEL7 support

* Tue Jan 26 2021 Raven <raven@sysadmins.ws> - 0.3.0-1
- version update

* Tue Jun 16 2020 Raven <raven@sysadmins.ws> - 0.2.0-1
- version update

* Mon May 18 2020 Callum Farmer <callumjfarmer13@gmail.com>
- Removed Recommends lxqt-archiver-lang due to auto supplements
* Sun May 17 2020 Michael Vetter <mvetter@suse.com>
- Update to 0.2.0:
  * Added an icon for the app.
  * Prevent the contents of an extracted archive from being mixed
    with other files if overwriting isn't chosen.
  * Added expand and collapse actions.
  * Fixed build with GCC 10.
  * Required json-glib as a dependency.
- Remove lxqt-archiver.desktop:
  use upstream desktop file. It has its own icon now.
  See https://github.com/lxqt/lxqt-archiver/issues/157
* Fri May 15 2020 Callum Farmer <callumjfarmer13@gmail.com>
- Fixed sources and added keyring
* Sat Apr 25 2020 Callum Farmer <callumjfarmer13@gmail.com>
- Removed lxqt-archiver-execdir.patch: contained in upstream
- Update to version 0.1.1
  * Removed the unused qtdbus dependency.
  * Used 'LIBEXECDIR' instead of 'LIBDIR' for internal executables.
  * Fixed handling of RPM archives.
* Wed Apr 22 2020 Michael Vetter <mvetter@suse.com>
- Add lxqt-archiver-execdir.patch: install in helper programs
  in libexecdir not libdir
* Wed Apr 22 2020 Michael Vetter <mvetter@suse.com>
- Create package 0.1.0 for openSUSE
