Name:           lua-expat
Version:        1.5.2
Release:        2
Summary:        A SAX XML parser based on the Expat library
License:        MIT
URL:            https://lunarmodules.github.io/luaexpat/
Source0:        https://github.com/lunarmodules/luaexpat/archive/%{version}/luaexpat-%{version}.tar.gz

BuildRequires:  gcc
BuildRequires:  lua-devel >= 5.1
BuildRequires:  expat-devel
Requires:       lua(abi) = %{lua_version}

%description
LuaExpat is a SAX XML parser based on the Expat library.SAX is the Simple API for XML,
process a XML document incrementally, thus being able to handle huge documents without
memory penalties, register handler functions which are called by the parser during the
processing of the document, handling the document elements or text.

%package_help

%prep
%autosetup -n luaexpat-%{version} -p1

%build
%make_build LUA_V=%{lua_version} LUA_CDIR=%{lua_libdir} LUA_LDIR=%{lua_pkgdir} LUA_INC=-I%{_includedir} EXPAT_INC=-I%{_includedir} \
  CFLAGS="%{optflags} -fPIC -std=c99 %{build_ldflags}" LDFLAGS="-llua"

%install
%make_install LUA_CDIR=%{lua_libdir} LUA_LDIR=%{lua_pkgdir}

%check
lua -e \
  'package.cpath="%{buildroot}%{lua_libdir}/?.so;"..package.cpath;
   package.path="%{buildroot}%{lua_pkgdir}/?.lua;"..package.path;
   local lxp = require("lxp"); print("Hello from "..lxp._VERSION.."!");'

%files
%license LICENSE
%doc README.md
%{lua_libdir}/*
%{lua_pkgdir}/*

%files help
%doc docs/*

%changelog
* Sat Sep 28 2024 Funda Wang <fundawang@yeah.net> - 1.5.2-2
- cleanup spec

* Tue Aug  6 2024 dillon chen<dillon.chen@gmail.com> - 1.5.2-1
- Type:
- ID:NA
- SUG:NA
- DESC:update to 1.5.2

* Fri Jul 23 2021 yuanxin<yuanxin24@huawei.com> - 1.3.0-20
- remove BuildRequires gdb

* Fri Aug 14 2020 shenyangyang<shenyangyang4@huawei.com> - 1.3.0-19
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Modify macro of luaver for bumping version of lua

* Wed Aug 12 2020 wenzhanli<wenzhanli2@huawei.com> - 1.3.0-18
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix unresolvable because lua roll back version 5.3.5

* Fri Aug 7 2020 wenzhanli<wenzhanli2@huawei.com> - 1.3.0-17
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix make test because lua update version 5.4.0

* Thu Mar 19 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.3.0-16
- add necessary BuildRequires

* Fri Aug 30 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.3.0-15
- Build for Help Package

* Fri Aug 30 2019 openEuler Buildteam <buildteam@openeuler.org> - 1.3.0-14
- Package init