File lua51-LPeg.spec of Package lua51-LPeg

#
# spec file for package lua-LPeg
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define mod_name    LPeg
%define lua_version %(lua -e 'print(_VERSION)' | cut -d ' ' -f 2)
%define lua_archdir %{_libdir}/lua/%{lua_version}
Name:           lua51-%{mod_name}
Version:        1.0.0
Release:        0
Summary:        A new pattern-matching library for Lua 5.1, based on PEGs
License:        MIT
Group:          Development/Libraries/Other
Url:            http://www.inf.puc-rio.br/~roberto/lpeg/
Source:         http://www.inf.puc-rio.br/~roberto/lpeg/lpeg-%{version}.tar.gz
BuildRequires:  lua51-devel
Requires:       lua51

%description
LPeg is a new pattern-matching library for Lua, based on Parsing Expression
Grammars (PEGs)

Following the Snobol tradition, LPeg defines patterns as first-class objects.
That is, patterns are regular Lua values (represented by userdata). The library
offers several functions to create and compose patterns. With the use of
metamethods, several of these functions are provided as infix or prefix
operators. On the one hand, the result is usually much more verbose than the
typical encoding of patterns using the so called regular expressions (which
typically are not regular expressions in the formal sense). On the other hand,
first-class patterns allow much better documentation (as it is easy to comment
the code, to break complex definitions in smaller parts, etc.) and are
extensible, as we can define new functions to create and compose patterns.

%package doc
Summary:        Lua Documentation for %{mod_name}
Group:          Development/Languages/Other
Requires:       %{name} = %{version}

%description doc
Documentation and examples included with the library, sometimes generated by
luadoc or ldoc.

%prep
%setup -q -n lpeg-%{version}

# Set our cflags
sed -i \
    -e 's: -O2: %{optflags}:g' \
    makefile

%build
make  -j1

%install

mkdir -p %{buildroot}%{_docdir}/%{name}
mkdir -p %{buildroot}%{lua_archdir}

install lpeg.so %{buildroot}%{lua_archdir}

%files
%defattr(-,root,root)
%dir %{lua_archdir}
%{lua_archdir}/*

%files doc
%defattr(-,root,root)
%doc re.html lpeg.html HISTORY

%changelog
openSUSE Build Service is sponsored by