%{!?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 Name: lua-compat53 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 compat-%{name} Summary: Compatibility module providing Lua-5.3-style APIs for Lua %{luacompatver} Requires: lua(abi) = %{luacompatver} %description -n compat-%{name} 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/compat53" mkdir -p "$LIBDIR/compat53" %endif install -d -m 0755 "$PKGDIR/compat53" install -d -m 0755 "$LIBDIR/compat53" install -p -m 0644 compat53/{init,module}.lua -t "$PKGDIR/compat53/" install -p -m 0755 {utf8,string,table}.so -t "$LIBDIR/compat53/" %if 0%{?rhel} == 7 %files %license LICENSE %doc README.md %{luapkgdir}/compat53 %{lualibdir}/compat53 %endif %if 0%{?fedora} || 0%{?rhel} > 7 %files -n compat-%{name} %license LICENSE %doc README.md %{luacompatpkgdir}/compat53 %{luacompatlibdir}/compat53 %endif %changelog * Wed Apr 03 2019 Tomas Krizek - 0.7-1 - Initial package for Fedora 28+ and EPEL 7