From 4e02b92e3d3d11afea3e13317260b894caf56cbc Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Sep 07 2023 16:15:05 +0000 Subject: [PATCH 1/4] Add Lua Add Lua to navigation list --- diff --git a/guidelines/modules/ROOT/nav.adoc b/guidelines/modules/ROOT/nav.adoc index 49bfab1..a773e7d 100644 --- a/guidelines/modules/ROOT/nav.adoc +++ b/guidelines/modules/ROOT/nav.adoc @@ -51,6 +51,7 @@ *** xref:java-packaging-howto::index.adoc[Java Packaging HOWTO] ** xref:JavaScript.adoc[JavaScript] ** xref:Lisp.adoc[Lisp] +** xref:Lua.adoc[Lua] ** xref:Mono.adoc[Mono] ** xref:Node.js.adoc[Node.js] ** xref:OCaml.adoc[OCaml] From 807c2ea1c7a5a68d213bc1253a7a8753c0225999 Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Sep 07 2023 16:15:13 +0000 Subject: [PATCH 2/4] Initial version Lua packaging guidelines Adapted from https://fedoraproject.org/wiki/PackagingDrafts/Lua Please enter the commit message for your changes. Lines starting --- diff --git a/guidelines/modules/ROOT/pages/Lua.adoc b/guidelines/modules/ROOT/pages/Lua.adoc new file mode 100644 index 0000000..a1c71dc --- /dev/null +++ b/guidelines/modules/ROOT/pages/Lua.adoc @@ -0,0 +1,118 @@ += Lua Packaging Guidelines +:toc: + +== What is Lua? + +As described on the https://www.lua.org/[Lua website], Lua is + +"Lua is a powerful, efficient, lightweight, embeddable scripting language. +It supports procedural programming, object-oriented programming, functional +programming, data-driven programming, and data description." + +To learn Lua, read https://www.lua.org/pil/contents.html[Programming in Lua]. + +== Spec Template for a Lua Package + +Many Lua packages use http://luarocks.org/[Lua-rocks] for packaging. It is helpful +to examine the `+.rockspec+` specification as a guide in writing your spec file. +Some packages require compilation of C programs, but others may be pure Lua. Both +will have very similar install locations. + +... +Summary: Lua integration with libev +Name: lua-ev +License: MIT + +Version: 1.5 +Release: 2%{?dist} + +URL: https://github.com/brimworks/lua-ev +Source0: %{url}/archive/v%{version}/%{name}-%{version}.tar.gz + +BuildRequires: cmake +BuildRequires: gcc +BuildRequires: libev-devel +BuildRequires: lua-devel + +%description +Event loop programming with Lua. + +%prep +%autosetup -n %{name}-%{version} + +%build +%cmake -DINSTALL_CMOD=%{lua_libdir} +%cmake_build + +%install +%cmake_install + +%check +#packaged tests do not work directly +#Use example program as a smoke test +LUA_CPATH=%{buildroot}%{lua_libdir}/?.so \ +lua example.lua +LUA_CPATH=%{buildroot}%{lua_libdir}/?.so \ +lua -e 'ev = require "ev"; print(ev.version())' + +%files +%license README +%doc example.lua +%{lua_libdir}/ev.so + +%changelog +* Thu Dec 08 2022 Benson Muite - 1.5-1 +- Use README as license + +* Sat Nov 19 2022 Benson Muite - 1.5-2 +- Fix install location based on review +- Add further smoke test + +* Wed Nov 16 2022 Benson Muite - 1.5-1 +- Initial release +... + +== Naming + +Lua add-on packages generally follow the naming scheme of `+lua-modulename` +-- e.g. `+lua-filesystem+`, `+lua-lpeg+`, `+lua-moonscript+`. If the module name +makes it clear that it is an add-on for Lua, though, the module name +itself is sufficient. e.g. `+lutok+`. + +Use your judgement -- e.g. the second `+l+` in `+lua-lpeg+` already stands for Lua, +but it might not be seen as unambiguous enough. + +== Macros + +Starting with Fedora 24, the following macros for packaging lua extensions are provided +by the `+lua-devel+` package: + +[%header,cols=2*] +|=== +| Macro | Description +| `+%lua_version+` | version of system installed lua +| `+%lua_libdir+` | installation directory for compiled modules +| `+%lua_pkgdir+` | installation directory for arch-independent modules +| `+%lua_requires+` | declares the needed runtime dependencies for the binary package +|=== + +For EPEL, define the following macros at the top of your spec file: + +... +%{!?lua_version: %global lua_version %{lua: print(string.sub(_VERSION, 5))}} +# for compiled modules +%{!?lua_libdir: %global lua_libdir %{_libdir}/lua/%{lua_version}} +# for arch-independent modules +%{!?lua_pkgdir: %global lua_pkgdir %{_datadir}/lua/%{lua_version}} +... + +To make the package pull the correct runtime dependencies, declare them like this: + +... +%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7 +Requires: lua(abi) = %{lua_version} +%else +Requires: lua >= %{lua_version} +Requires: lua < %{lua: os.setlocale('C'); print(string.sub(_VERSION, 5) + 0.1)} +%endif +... From 6b0aa6aea0182ccbf31f77bb5dac5757d194c8f8 Mon Sep 17 00:00:00 2001 From: Benson Muite Date: Sep 07 2023 16:15:19 +0000 Subject: [PATCH 3/4] Requires lua(abi) no longer needed Pointed out in review --- diff --git a/guidelines/modules/ROOT/pages/Lua.adoc b/guidelines/modules/ROOT/pages/Lua.adoc index a1c71dc..dbbb61e 100644 --- a/guidelines/modules/ROOT/pages/Lua.adoc +++ b/guidelines/modules/ROOT/pages/Lua.adoc @@ -109,10 +109,6 @@ For EPEL, define the following macros at the top of your spec file: To make the package pull the correct runtime dependencies, declare them like this: ... -%if 0%{?fedora} >= 16 || 0%{?rhel} >= 7 -Requires: lua(abi) = %{lua_version} -%else Requires: lua >= %{lua_version} Requires: lua < %{lua: os.setlocale('C'); print(string.sub(_VERSION, 5) + 0.1)} -%endif ... From ac2d5d3775a8b38e7297bb8619bd13481e9881e7 Mon Sep 17 00:00:00 2001 From: Fabio Valentini Date: Sep 07 2023 16:17:05 +0000 Subject: [PATCH 4/4] Lua: AsciiDoc syntax fixups --- diff --git a/guidelines/modules/ROOT/pages/Lua.adoc b/guidelines/modules/ROOT/pages/Lua.adoc index dbbb61e..941362a 100644 --- a/guidelines/modules/ROOT/pages/Lua.adoc +++ b/guidelines/modules/ROOT/pages/Lua.adoc @@ -18,7 +18,7 @@ to examine the `+.rockspec+` specification as a guide in writing your spec file. Some packages require compilation of C programs, but others may be pure Lua. Both will have very similar install locations. -... +.... Summary: Lua integration with libev Name: lua-ev License: MIT @@ -70,11 +70,11 @@ lua -e 'ev = require "ev"; print(ev.version())' * Wed Nov 16 2022 Benson Muite - 1.5-1 - Initial release -... +.... == Naming -Lua add-on packages generally follow the naming scheme of `+lua-modulename` +Lua add-on packages generally follow the naming scheme of `+lua-modulename+` -- e.g. `+lua-filesystem+`, `+lua-lpeg+`, `+lua-moonscript+`. If the module name makes it clear that it is an add-on for Lua, though, the module name itself is sufficient. e.g. `+lutok+`. @@ -84,8 +84,8 @@ but it might not be seen as unambiguous enough. == Macros -Starting with Fedora 24, the following macros for packaging lua extensions are provided -by the `+lua-devel+` package: +The following macros for packaging lua extensions are provided by the +`+lua-devel+` package: [%header,cols=2*] |=== @@ -98,17 +98,17 @@ by the `+lua-devel+` package: For EPEL, define the following macros at the top of your spec file: -... +.... %{!?lua_version: %global lua_version %{lua: print(string.sub(_VERSION, 5))}} # for compiled modules %{!?lua_libdir: %global lua_libdir %{_libdir}/lua/%{lua_version}} # for arch-independent modules %{!?lua_pkgdir: %global lua_pkgdir %{_datadir}/lua/%{lua_version}} -... +.... To make the package pull the correct runtime dependencies, declare them like this: -... +.... Requires: lua >= %{lua_version} Requires: lua < %{lua: os.setlocale('C'); print(string.sub(_VERSION, 5) + 0.1)} -... +....