File lua51-lpeg.spec of Package lua51-lpeg
#
# spec file for package lua51-lpeg
#
# Copyright (c) 2025 SUSE LLC
#
%define mod_name lpeg
%define lua_version 5.1
%define lua_archdir %{_libdir}/lua/%{lua_version}
%define lua_noarchdir %{_datadir}/lua/%{lua_version}
Name: lua51-%{mod_name}
Version: 1.1.0
Release: 0
Summary: Pattern-matching library for Lua based on PEGs
License: MIT
URL: http://www.inf.puc-rio.br/~roberto/lpeg/
Source0: %{mod_name}-%{version}.tar.bz2
BuildRequires: gcc
BuildRequires: lua51-devel
Requires: lua51
%description
LPeg is a pattern-matching library for Lua, based on Parsing Expression
Grammars (PEGs). It allows creating complex grammars in pure Lua.
%package doc
Summary: Documentation for %{mod_name}
Group: Development/Languages/Other
BuildArch: noarch
%description doc
Documentation and examples for LPeg, including HTML and history notes.
%prep
%autosetup -n %{mod_name}-%{version}
# Makefile: allow CFLAGS injection
sed -i -e 's|^CFLAGS =|CFLAGS +=|g' -e 's|^COPT = -O2 -DNDEBUG|COPT = -DNDEBUG|g' makefile
%build
make %{?_smp_mflags} \
LUA_INCLUDE=/usr/include/lua5.1 \
CFLAGS="%{optflags} -I/usr/include/lua5.1 -fPIC"
%install
# Shared object
install -Dm0755 lpeg.so %{buildroot}%{lua_archdir}/lpeg.so
# Lua module
install -Dm0644 re.lua %{buildroot}%{lua_noarchdir}/re.lua
# Docs
mkdir -p %{buildroot}%{_docdir}/%{name}
install -m0644 HISTORY lpeg.html re.html %{buildroot}%{_docdir}/%{name}/
%files
%dir %{lua_archdir}
%{lua_archdir}/lpeg.so
%dir %{lua_noarchdir}
%{lua_noarchdir}/re.lua
%files doc
%{_docdir}/%{name}
%changelog
* Sat Nov 09 2025 itachi_re <xanbenson99@gmail.com>
- Fixed missing docdir mkdir during install
- Verified successful build on openSUSE Tumbleweed