PackagingDrafts/Lua

From FedoraProject

< PackagingDrafts(Difference between revisions)
Jump to: navigation, search
(Macros)
(Macros: make usage of lua(abi) clearer)
 
Line 18: Line 18:
 
</pre>
 
</pre>
  
From Fedora 16 and onwards (not RHEL 6!), the main <code>lua</code> package virtually provides <code>lua(abi) = %{luaver}</code>, so packages targeting this release and above can declare this runtime dependency:
+
From Fedora 16 and onwards ('''not''' RHEL 6!), the main <code>lua</code> package virtually provides <code>lua(abi) = %{luaver}</code>, so packages targeting this release and above should declare this runtime dependency:
  
 
<pre>
 
<pre>
Line 24: Line 24:
 
</pre>
 
</pre>
  
to target older releases (or RHEL 6), use the following instead.
+
to target older releases (or RHEL 6), you must use the following instead.
  
 
<pre>
 
<pre>
Line 30: Line 30:
 
Requires: lua >= %{luaver}
 
Requires: lua >= %{luaver}
 
Requires: lua <  %{luanext}
 
Requires: lua <  %{luanext}
 +
</pre>
 +
 +
To target both releases, use %if guards as follows:
 +
 +
<pre>
 +
%if 0%{?fedora} || 0%{?rhel} >= 7
 +
...
 +
%else
 +
...
 +
%endif
 
</pre>
 
</pre>
  

Latest revision as of 03:40, 25 October 2012

[edit] Naming

(This section should eventually be linked from Packaging:NamingGuidelines)

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.


[edit] Macros

Define the following on top of your spec file:

%{!?luaver: %global luaver %(lua -e "print(string.sub(_VERSION, 5))")}
# for compiled modules
%global lualibdir %{_libdir}/lua/%{luaver}
# for arch-independent modules
%global luapkgdir %{_datadir}/lua/%{luaver}

From Fedora 16 and onwards (not RHEL 6!), the main lua package virtually provides lua(abi) = %{luaver}, so packages targeting this release and above should declare this runtime dependency:

Requires: lua(abi) = %{luaver}

to target older releases (or RHEL 6), you must use the following instead.

%global luanext 5.2
Requires: lua >= %{luaver}
Requires: lua <  %{luanext}

To target both releases, use %if guards as follows:

%if 0%{?fedora} || 0%{?rhel} >= 7
...
%else
...
%endif

[edit] Rocks

Upstream Lua developers increasingly use LuaRocks to distribute their modules. We are exploring providing better integration with LuaRocks in the future -- both in generating spec files from .rockspec specifications, and in shipping a luarocks package that can pick up existing RPM-installed Lua packages, but for the time being, you can use upstream rockspec specifications to guide your packaging work.