## START: Set by rpmautospec
## (rpmautospec version 0.3.0)
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
    release_number = 1;
    base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
    print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec

%global forgeurl    https://github.com/lite-xl/lite-xl

Name:    lite-xl
Version: 2.1.0

Release: %autorelease

%forgemeta

Summary: A lightweight text editor written in Lua, adapted from lite
License: MIT and OFL
URL:     https://lite-xl.com/
Source:  %{forgesource}

BuildRequires: gcc
BuildRequires: meson
BuildRequires: (pkgconfig(lua) >= 5.4 with pkgconfig(lua) < 5.5)
BuildRequires: pkgconfig(libpcre2-8)
BuildRequires: pkgconfig(freetype2)
BuildRequires: pkgconfig(sdl2)
BuildRequires: desktop-file-utils

# https://fedoraproject.org/wiki/Changes/EncourageI686LeafRemoval
ExcludeArch: %{ix86}

%description
A lightweight, simple, fast, feature-filled, and extremely
extensible text editor written in C, and Lua, adapted from lite.
Lite XL is derived from lite. It is a lightweight text editor
written mostly in Lua — it aims to provide something practical,
pretty, small and fast easy to modify and extend, or to use
without doing either.
The aim of Lite XL compared to lite is to be more user friendly, 
improve the quality of font rendering, and reduce CPU usage.

%prep
%forgesetup

%build
%meson -Darch_tuple=%{_arch}-linux
%meson_build

%install
%meson_install

%check
%meson_test
desktop-file-validate %{buildroot}%{_datadir}/applications/org.lite_xl.lite_xl.desktop

%files
%license LICENSE
%license %{_docdir}/%{name}/licenses.md
%doc README.md changelog.md
%{_bindir}/%{name}
%{_datadir}/%{name}
%{_datadir}/icons/hicolor
%{_datadir}/applications/org.lite_xl.lite_xl.desktop
%{_datadir}/metainfo/org.lite_xl.lite_xl.appdata.xml

%changelog
* Wed Nov 16 2022 Alessio <alciregi@fedoraproject.org> 2.1.0-1
- Initial import (fedora#2051643).