diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0b38c87 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/lua-compat53-0.7.tar.gz diff --git a/lua-compat53.spec b/lua-compat53.spec new file mode 100644 index 0000000..b184161 --- /dev/null +++ b/lua-compat53.spec @@ -0,0 +1,105 @@ +%{!?luaver: %global luaver %(lua -e "print(string.sub(_VERSION, 5))" || echo 0)} +%global luapkgdir %{_datadir}/lua/%{luaver} +%global lualibdir %{_libdir}/lua/%{luaver} + +%global luacompatver 5.1 +%global luacompatpkgdir %{_datadir}/lua/%{luacompatver} +%global luacompatlibdir %{_libdir}/lua/%{luacompatver} + +%if 0%{?fedora} || 0%{?rhel} > 7 +%global lualib lua-%{luacompatver} +%else +%global lualib lua +%endif + +%global luapkgname compat53 + +Name: lua-%{luapkgname} +Version: 0.7 +Release: 1%{?dist} +Summary: Compatibility module providing Lua-5.3-style APIs for Lua %{luacompatver} + +License: MIT +URL: https://github.com/keplerproject/lua-compat-5.3 +Source0: https://github.com/keplerproject/lua-compat-5.3/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildRequires: gcc +BuildRequires: pkgconfig +%if 0%{?fedora} || 0%{?rhel} > 7 +BuildRequires: compat-lua-devel >= %{luacompatver} +%else +BuildRequires: lua-devel >= %{luaver} +%endif + +%if 0%{?rhel} == 7 +Requires: lua >= %{luaver} +%endif + +%description +This is a small module that aims to make it easier to write code in a +Lua-5.3-style that is compatible with Lua 5.1, Lua 5.2, and Lua 5.3. This does +not make Lua 5.2 (or even Lua 5.1) entirely compatible with Lua 5.3, but it +brings the API closer to that of Lua 5.3. + +%if 0%{?fedora} || 0%{?rhel} > 7 +%package -n lua%{luacompatver}-%{luapkgname} +Summary: Compatibility module providing Lua-5.3-style APIs for Lua %{luacompatver} +Requires: lua(abi) = %{luacompatver} + +%description -n lua%{luacompatver}-%{luapkgname} +This is a small module that aims to make it easier to write code in a +Lua-5.3-style that is compatible with Lua 5.1, Lua 5.2, and Lua 5.3. This does +not make Lua 5.2 (or even Lua 5.1) entirely compatible with Lua 5.3, but it +brings the API closer to that of Lua 5.3. +%endif + +%prep +%setup -q -n lua-compat-5.3-%{version} + +%build +CFLAGS="%{optflags} -fPIC $(pkg-config --cflags %{lualib})" +LDFLAGS="%{build_ldflags} $(pkg-config --libs %{lualib})" + +gcc $CFLAGS -c lutf8lib.c -o lutf8lib.o +gcc $CFLAGS -c lstrlib.c -o lstrlib.o +gcc $CFLAGS -c ltablib.c -o ltablib.o +gcc -shared $LDFLAGS -o utf8.so lutf8lib.o +gcc -shared $LDFLAGS -o string.so lstrlib.o +gcc -shared $LDFLAGS -o table.so ltablib.o + +%install +%if 0%{?fedora} || 0%{?rhel} > 7 +PKGDIR=%{buildroot}/%{luacompatpkgdir} +LIBDIR=%{buildroot}/%{luacompatlibdir} +%else +PKGDIR=%{buildroot}/%{luapkgdir} +LIBDIR=%{buildroot}/%{lualibdir} +# NOTE: epel7 install command doesn't propely create dir when combining -D -t +mkdir -p "$PKGDIR/%{luapkgname}" +mkdir -p "$LIBDIR/%{luapkgname}" +%endif + +install -d -m 0755 "$PKGDIR/%{luapkgname}" +install -d -m 0755 "$LIBDIR/%{luapkgname}" +install -p -m 0644 %{luapkgname}/{init,module}.lua -t "$PKGDIR/%{luapkgname}/" +install -p -m 0755 {utf8,string,table}.so -t "$LIBDIR/%{luapkgname}/" + +%if 0%{?rhel} == 7 +%files +%license LICENSE +%doc README.md +%{luapkgdir}/%{luapkgname} +%{lualibdir}/%{luapkgname} +%endif + +%if 0%{?fedora} || 0%{?rhel} > 7 +%files -n lua%{luacompatver}-%{luapkgname} +%license LICENSE +%doc README.md +%{luacompatpkgdir}/%{luapkgname} +%{luacompatlibdir}/%{luapkgname} +%endif + +%changelog +* Wed Apr 03 2019 Tomas Krizek - 0.7-1 +- Initial package for Fedora 28+ and EPEL 7 diff --git a/sources b/sources new file mode 100644 index 0000000..bbcc388 --- /dev/null +++ b/sources @@ -0,0 +1 @@ +SHA512 (lua-compat53-0.7.tar.gz) = 665ece98422a105b818cffd96eea5788696fbb854d2ba41d2d387e8bd25c1fa9de601468e55e22e9e749979a66d4d2e0f7dfd656e5bf27b489d37bb07c96f48d