Files
lua-jsregexp/lua-jsregexp.spec

74 lines
2.1 KiB
RPMSpec

#
# spec file
#
# Copyright (c) 2022 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#
%define flavor @BUILD_FLAVOR@
%define mod_name jsregexp
Version: 0.0.6
Release: 0
Summary: Regualr expression support for Lua
License: MIT
Group: Development/Libraries/Other
URL: https://github.com/kmarius/jsregexp
Source0: https://github.com/kmarius/jsregexp/archive/v%{version}.tar.gz#/%{mod_name}-%{version}.tar.gz
BuildRequires: %{flavor}-devel
BuildRequires: lua-macros
BuildRequires: quickjs-devel
%if 0%{?suse_version} && 0%{?suse_version} < 1500
BuildRequires: gcc7
%define compiler CC=gcc-7
%endif
%lua_provides
%if "%{flavor}" == ""
Name: lua-%{mod_name}
ExclusiveArch: do_not_build
%else
Name: %{flavor}-%{mod_name}
%endif
%description
LPeg is a new pattern-matching library for Lua, based on Parsing Expression Grammars (PEGs).
%prep
%setup -q -n %{mod_name}-%{version}
%build
make -O %{?_smp_mflags} %{?compiler} CFLAGS="$(pkg-config --cflags lua%{lua_version}) %{optflags} -fPIC"
%install
mkdir -p %{buildroot}%{lua_archdir}
mkdir -p %{buildroot}%{lua_noarchdir}
install %{mod_name}.so %{buildroot}%{lua_archdir}
install -Dm 644 %{mod_name}.lua %{buildroot}%{lua_noarchdir}
%check
LUA_PATH='%{_datadir}/lua/%{lua_version}/?.lua'
LUA_PATH="%{buildroot}%{lua_noarchdir}/?/init.lua;${LUA_PATH}"
export LUA_PATH="%{buildroot}%{lua_noarchdir}/?.lua;${LUA_PATH}"
%{_bindir}/lua%{lua_version} test.lua
%files
%license LICENSE
%doc README.md
%{lua_archdir}
%{lua_noarchdir}
%changelog