%global github_name FeatherNotes

%bcond_without qt6
%bcond_with clang

Name:           feathernotes

Version:        1.1.1
Release:        2%{?dist}
Summary:        Lightweight Qt hierarchical notes-manager for Linux

License:        GPLv3+
URL:            https://github.com/tsujan/%{github_name}
Source0:        %{url}/releases/download/V%{version}/%{github_name}-%{version}.tar.xz

BuildRequires:  desktop-file-utils
%if %{with clang}
BuildRequires:  clang >= 5.0
%else
BuildRequires:  gcc-c++
%endif
BuildRequires:  cmake >= 3.0
%if %{with qt6}
BuildRequires: qt6-qtbase-devel >= 6.3.0
BuildRequires: qt6-qtsvg-devel
%else
BuildRequires:  qt5-qtbase-devel >= 5.15.0
BuildRequires:  qt5-qtsvg-devel
BuildRequires:  qt5-qtx11extras-devel
%endif
BuildRequires:  hunspell-devel
BuildRequires:  shared-mime-info

Requires:       hicolor-icon-theme

%description
Lightweight Qt hierarchical notes-manager for Linux

%prep
%autosetup -n %{github_name}-%{version} -p 1

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

%cmake \
%if %{without qt6}
    -DENABLE_QT5:BOOL=ON \
%endif
    -DWITH_HUNSPELL:BOOL=ON

%cmake_build

%install
%cmake_install
%find_lang %{name} --with-qt

%check
desktop-file-validate %{buildroot}%{_datadir}/applications/%{name}.desktop



%files -f %{name}.lang
%license COPYING
%doc ChangeLog INSTALL NEWS README.md
%{_bindir}/*
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg
%{_datadir}/icons/hicolor/scalable/mimetypes/text-%{name}-fnx.svg
%{_datadir}/mime/packages/%{name}.xml
%{_metainfodir}/%{name}.metainfo.xml
%dir %{_datadir}/%{name}/translations


%changelog
* Wed Dec 20 2023 Raven <raven@sysadmins.ws> - 1.1.1-2
- Qt6 build is default now

* Tue Nov  8 2023 Raven <raven@sysadmins.ws> - 1.1.1-1
- version update
- clang build support

* Thu Jan  5 2023 Raven <raven@sysadmins.ws> - 1.1.0-1
- version update
- drop qmake build
- Hunspell support
- qt6 build support

* Wed Nov 16 2022 Raven <raven@sysadmins.ws> - 1.0.0-1
- version update

* Tue Apr 20 2021 Raven <raven@sysadmins.ws> - 0.10.0-1.RC1
- version update

* Wed Jan 27 2021 Raven <raven@sysadmins.ws> - 0.8.0-1
- initial build
