477f74
%define luaver 5.1
477f74
%define lualibdir %{_libdir}/lua/%{luaver}
477f74
%define luapkgdir %{_datadir}/lua/%{luaver}
477f74
477f74
Name:           lua-lpeg
d96e9c
Version:        0.10.2
e6dc37
Release:        3%{?dist}
477f74
Summary:        Parsing Expression Grammars for Lua
477f74
477f74
Group:          Development/Libraries
477f74
License:        MIT
d96e9c
URL:            http://www.inf.puc-rio.br/~roberto/lpeg/
d96e9c
Source0:        http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-%{version}.tar.gz
d96e9c
%if 0%{?el5}
477f74
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
d96e9c
%endif
477f74
d96e9c
BuildRequires:  lua-devel >= %{luaver}
477f74
Requires:       lua >= %{luaver}
477f74
477f74
%description
477f74
LPeg is a new pattern-matching library for Lua, based on Parsing Expression
477f74
Grammars (PEGs).
477f74
477f74
%prep
477f74
%setup -q -n lpeg-%{version}
d96e9c
%{__sed} -i -e "s|/usr/bin/env lua5.1|%{_bindir}/lua|" test.lua
d96e9c
# strict module not part of our Lua 5.1.4
d96e9c
%{__sed} -i -e 's|require"strict"|-- require"strict"|' test.lua
477f74
%{__chmod} -x test.lua
477f74
477f74
%build
477f74
%{__cc} %{optflags} -fPIC -c -o lpeg.o lpeg.c
477f74
%{__cc} %{optflags} -fPIC -shared -o lpeg.so.%{version} lpeg.o
477f74
%{__ln_s} lpeg.so.%{version} lpeg.so
477f74
477f74
%install
477f74
%{__rm} -rf %{buildroot}
477f74
%{__mkdir_p} %{buildroot}%{lualibdir}
477f74
%{__mkdir_p} %{buildroot}%{luapkgdir}
477f74
%{__install} -p lpeg.so.%{version} %{buildroot}%{lualibdir}
477f74
%{__ln_s} lpeg.so.%{version} %{buildroot}%{lualibdir}/lpeg.so
477f74
%{__install} -p -m 0644 re.lua %{buildroot}%{luapkgdir}
477f74
477f74
477f74
%check
477f74
lua test.lua
477f74
d96e9c
%if 0%{?rhel}
477f74
%clean
477f74
%{__rm} -rf %{buildroot}
d96e9c
%endif
477f74
477f74
477f74
%files
477f74
%defattr(-,root,root,-)
d96e9c
%doc HISTORY lpeg.html re.html lpeg-128.gif test.lua
477f74
%{lualibdir}/*
477f74
%{luapkgdir}/*
477f74
477f74
477f74
%changelog
e6dc37
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.2-3
e6dc37
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
e6dc37
62ae22
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.10.2-2
62ae22
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
62ae22
d96e9c
* Tue Aug 16 2011 Michel Salim <salimma@fedoraproject.org> - 0.10.2-1
d96e9c
- Update to 0.10.2
d96e9c
49c8c8
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-4
49c8c8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
49c8c8
ae035f
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-3
ae035f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
ae035f
97152b
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.9-2
97152b
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
97152b
83f386
* Mon Dec 22 2008 Tim Niemueller <tim@niemueller.de> - 0.9-1
83f386
- Update to 0.9
83f386
477f74
* Fri Jun 13 2008 Tim Niemueller <tim@niemueller.de> - 0.8.1-2
477f74
- Consistent macro usage, moved sed/chmod to prep
477f74
477f74
* Thu Jun 12 2008 Tim Niemueller <tim@niemueller.de> - 0.8.1-1
477f74
- Initial package
477f74