Major axing of the lua part, it is much, much simpler now.

Sponsored by:	Absolight
This commit is contained in:
Mathieu Arnold 2014-05-26 16:34:04 +00:00
parent dfc805e467
commit 568006cfe1
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=44959

View file

@ -3676,355 +3676,21 @@ PLIST_SUB+= VERSION="${VER_STR}"
<sect2 xml:id="lua-version">
<title>Version Selection</title>
<para>To make your port use a specific version of
<application>Lua</application> there are two variables
available for defining (if only one is defined the other
will be set to a default value):</para>
<para>A port using <application>Lua</application> only needs to
have the following line:</para>
<table xml:id="lua-ver-sel-table" frame="none">
<title>Variables to Select <application>Lua</application>
Versions</title>
<programlisting>USES= lua</programlisting>
<tgroup cols="3">
<thead>
<row>
<entry>Variable</entry>
<entry>Description</entry>
<entry>Default value</entry>
</row>
</thead>
<tbody>
<row>
<entry><varname>USE_LUA</varname></entry>
<entry>List of versions the port can use</entry>
<entry>All available versions</entry>
</row>
<row>
<entry><varname>USE_LUA_NOT</varname></entry>
<entry>List of versions the port can not use</entry>
<entry>None</entry>
</row>
</tbody>
</tgroup>
</table>
<para>The following is a list of available
<application>Lua</application> versions and the
corresponding ports in the tree:</para>
<table frame="none" xml:id="using-lua-available-versions">
<title>Available <application>Lua</application>
Versions</title>
<tgroup cols="2">
<thead>
<row>
<entry>Version</entry>
<entry>Port</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>4.0</literal></entry>
<entry><package
role="port">lang/lua4</package></entry>
</row>
<row>
<entry><literal>5.0</literal></entry>
<entry><package
role="port">lang/lua50</package></entry>
</row>
<row>
<entry><literal>5.1</literal></entry>
<entry><package role="port">lang/lua</package></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The variables in <xref linkend="lua-ver-sel-table"/> can
be set to one or more of the following combinations
separated by spaces:</para>
<table frame="none" xml:id="using-lua-version-specifications">
<title><application>Lua</application> Version
Specifications</title>
<tgroup cols="2">
<thead>
<row>
<entry>Description</entry>
<entry>Example</entry>
</row>
</thead>
<tbody>
<row>
<entry>Single version</entry>
<entry><literal>4.0</literal></entry>
</row>
<row>
<entry>Ascending range</entry>
<entry><literal>5.0+</literal></entry>
</row>
<row>
<entry>Descending range</entry>
<entry><literal>5.0-</literal></entry>
</row>
<row>
<entry>Full range (must be ascending)</entry>
<entry><literal>5.0-5.1</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<para>There are also some variables to select the preferred
versions from the available ones. They can be set to a list
of versions, the first ones will have higher
priority.</para>
<table frame="none" xml:id="using-lua-variables">
<title>Variables to Select Preferred
<application>Lua</application> Versions</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Designed for</entry>
</row>
</thead>
<tbody>
<row>
<entry><varname>WANT_LUA_VER</varname></entry>
<entry>the port</entry>
</row>
<row>
<entry><varname>WITH_LUA_VER</varname></entry>
<entry>the user</entry>
</row>
</tbody>
</tgroup>
</table>
<example xml:id="lua-version-example">
<title>Selecting the <application>Lua</application>
Version</title>
<para>The following fragment is from a port which can use
<application>Lua</application> version
<literal>5.0</literal> or <literal>5.1</literal>, and uses
<literal>5.0</literal> by default. It can be overridden
by the user with <varname>WITH_LUA_VER</varname>.</para>
<programlisting>USE_LUA= 5.0-5.1
WANT_LUA_VER= 5.0</programlisting>
</example>
</sect2>
<sect2 xml:id="lua-components">
<title>Component Selection</title>
<para>There are other applications that, while not being
<application>Lua</application> libraries, are related to
them. These applications can be specified in the
<varname>LUA_COMPS</varname> variable. The following
components are available:</para>
<table frame="none" xml:id="using-lua-components-list">
<title>Available <application>Lua</application>
Components</title>
<tgroup cols="3">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
<entry>Version restriction</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>lua</literal></entry>
<entry>main library</entry>
<entry>none</entry>
</row>
<row>
<entry><literal>tolua</literal></entry>
<entry>Library for accessing C/C++ code</entry>
<entry><literal>4.0-5.0</literal></entry>
</row>
<row>
<entry><literal>ruby</literal></entry>
<entry>Ruby bindings</entry>
<entry><literal>4.0-5.0</literal></entry>
</row>
</tbody>
</tgroup>
</table>
<note>
<para>There are more components but they are modules for the
interpreter, not used by applications (only by other
modules).</para>
</note>
<para>The dependency type can be selected for each component
by adding a suffix separated by a semicolon. If not present
then a default type will be used (see
<xref linkend="lua-def-dep-types"/>). The following types
are available:</para>
<table frame="none" xml:id="using-lua-dependency-types">
<title>Available <application>Lua</application> Dependency
Types</title>
<tgroup cols="2">
<thead>
<row>
<entry>Name</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>build</literal></entry>
<entry>Component is required for building, equivalent
to <varname>BUILD_DEPENDS</varname></entry>
</row>
<row>
<entry><literal>run</literal></entry>
<entry>Component is required for running, equivalent
to <varname>RUN_DEPENDS</varname></entry>
</row>
<row>
<entry><literal>lib</literal></entry>
<entry>Component is required for building and running,
equivalent to <varname>LIB_DEPENDS</varname></entry>
</row>
</tbody>
</tgroup>
</table>
<para>The default values for the components are detailed in
the following table:</para>
<table xml:id="lua-def-dep-types" frame="none">
<title>Default <application>Lua</application> Dependency
Types</title>
<tgroup cols="2">
<thead>
<row>
<entry>Component</entry>
<entry>Dependency type</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>lua</literal></entry>
<entry><literal>lib</literal> for
<literal>4.0-5.0</literal> (shared) and
<literal>build</literal> for <literal>5.1</literal>
(static)</entry>
</row>
<row>
<entry><literal>tolua</literal></entry>
<entry><literal>build</literal> (static)</entry>
</row>
<row>
<entry><literal>ruby</literal></entry>
<entry><literal>lib</literal> (shared)</entry>
</row>
</tbody>
</tgroup>
</table>
<example xml:id="lua-components-example">
<title>Selecting <application>Lua</application>
Components</title>
<para>The following fragment corresponds to a port which
uses <application>Lua</application> version
<literal>4.0</literal> and its
<application>Ruby</application> bindings.</para>
<programlisting>USE_LUA= 4.0
LUA_COMPS= lua ruby</programlisting>
</example>
</sect2>
<sect2 xml:id="lua-version-detection">
<title>Detecting Installed Versions</title>
<para>To detect an installed version you have to define
<varname>WANT_LUA</varname>. If you do not set it to a
specific version then the components will have a version
suffix. The <varname>HAVE_LUA</varname> variable will be
filled after detection.</para>
<example xml:id="lua-ver-det-example">
<title>Detecting Installed <application>Lua</application>
Versions and Components</title>
<para>The following fragment can be used in a port that uses
<application>Lua</application> if it is installed, or an
option is selected.</para>
<programlisting>WANT_LUA= yes
.include &lt;bsd.port.pre.mk&gt;
.if defined(WITH_LUA5) || !empty(PORT_OPTIONS:MLUA5) || !empty(HAVE_LUA:Mlua-5.[01])
USE_LUA= 5.0-5.1
CONFIGURE_ARGS+= --enable-lua5
.endif</programlisting>
<para>The following fragment can be used in a port that
enables <application>tolua</application> support if it is
installed or if an option is selected, in addition to
<application>Lua</application>, both version
<literal>4.0</literal>.</para>
<programlisting>USE_LUA= 4.0
LUA_COMPS= lua
WANT_LUA= 4.0
.include &lt;bsd.port.pre.mk&gt;
.if defined(WITH_TOLUA) || !empty(PORT_OPTIONS:MTOLUA) || !empty(HAVE_LUA:Mtolua)
LUA_COMPS+= tolua
CONFIGURE_ARGS+= --enable-tolua
.endif</programlisting>
</example>
<para>If a specific version of Lua is needed, instructions on
how to select it are given in the <link
linkend="uses-lua"><literal>USES=lua</literal></link> part
of <xref linkend="uses-values"/>.</para>
</sect2>
<sect2 xml:id="lua-defined-variables">
<title>Defined Variables</title>
<para>The following variables are available in the port (after
defining one from
<xref linkend="lua-ver-sel-table"/>).</para>
<para>The following variables are available in the port.</para>
<table frame="none" xml:id="using-lua-variables-ports">
<title>Variables Defined for Ports That Use
@ -4046,13 +3712,6 @@ CONFIGURE_ARGS+= --enable-tolua
<literal>5.1</literal>)</entry>
</row>
<row>
<entry><varname>LUA_VER_SH</varname></entry>
<entry>The <application>Lua</application> shared
library major version (e.g.,
<literal>1</literal>)</entry>
</row>
<row>
<entry><varname>LUA_VER_STR</varname></entry>
<entry>The <application>Lua</application> version
@ -4122,75 +3781,9 @@ CONFIGURE_ARGS+= --enable-tolua
<entry>The path to the <application>Lua</application>
compiler</entry>
</row>
<row>
<entry><varname>TOLUA_CMD</varname></entry>
<entry>The path to the
<application>tolua</application> program</entry>
</row>
</tbody>
</tgroup>
</table>
<example xml:id="lua-variables-example">
<title>Telling the Port Where to Find
<application>Lua</application></title>
<para>The following fragment shows how to tell a port that
uses a configure script where the
<application>Lua</application> header files and libraries
are.</para>
<programlisting>USE_LUA= 4.0
GNU_CONFIGURE= yes
CONFIGURE_ENV= CPPFLAGS="-I${LUA_INCDIR}" LDFLAGS="-L${LUA_LIBDIR}"</programlisting>
</example>
</sect2>
<sect2 xml:id="lua-premk">
<title>Processing in
<filename>bsd.port.pre.mk</filename></title>
<para>If you need to use the variables for running commands
right after including <filename>bsd.port.pre.mk</filename>
you need to define <varname>LUA_PREMK</varname>.</para>
<important>
<para>If you define <varname>LUA_PREMK</varname>, then the
version, dependencies, components and defined variables
will not change if you modify the
<application>Lua</application> port variables
<emphasis>after</emphasis> including
<filename>bsd.port.pre.mk</filename>.</para>
</important>
<example xml:id="lua-premk-example">
<title>Using <application>Lua</application> Variables in
Commands</title>
<para>The following fragment illustrates the use of
<varname>LUA_PREMK</varname> by running the
<application>Lua</application> interpreter to obtain the
full version string, assign it to a variable and pass it
to the program.</para>
<programlisting>USE_LUA= 5.0
LUA_PREMK= yes
.include &lt;bsd.port.pre.mk&gt;
.if exists(${LUA_CMD})
VER_STR!= ${LUA_CMD} -v
CFLAGS+= -DLUA_VERSION_STRING="${VER_STR}"
.endif</programlisting>
</example>
<note>
<para>The <application>Lua</application> variables can be
safely used in commands when they are inside targets
without the need of <varname>LUA_PREMK</varname>.</para>
</note>
</sect2>
</sect1>