glfs/general/prog/lua52.xml

265 lines
7.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!ENTITY % general-entities SYSTEM "../../general.ent">
%general-entities;
<!ENTITY lua-download-http "https://www.lua.org/ftp/lua-&lua52-version;.tar.gz">
<!ENTITY lua-download-ftp " ">
<!ENTITY lua-md5sum "913fdb32207046b273fdb17aad70be13">
<!ENTITY lua-size "248 KB">
<!ENTITY lua-buildsize "3.6 MB">
<!ENTITY lua-time "less than 0.1 SBU">
]>
<sect1 id="lua52" xreflabel="Lua-&lua52-version;">
<?dbhtml filename="lua52.html"?>
<title>Lua-&lua52-version;</title>
<indexterm zone="lua52">
<primary sortas="a-Lua">Lua</primary>
</indexterm>
<sect2 role="package">
<title>Introduction to Lua 5.2</title>
<para>
<application>Lua</application> is a powerful light-weight programming
language designed for extending applications. It is also frequently used
as a general-purpose, stand-alone language. <application>Lua</application>
is implemented as a small library of C functions, written in ANSI C, and
compiles unmodified in all known platforms. The implementation goals are
simplicity, efficiency, portability, and low embedding cost. The result is
a fast language engine with small footprint, making it ideal in embedded
systems too.
</para>
<para>
This is an older version of <application>Lua</application> needed only
for compatibility with other programs such as <xref linkend='wireshark'/>
and <xref linkend="vlc"/>.
</para>
&lfs121_checked;
<bridgehead renderas="sect3">Package Information</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Download (HTTP): <ulink url="&lua-download-http;"/>
</para>
</listitem>
<listitem>
<para>
Download (FTP): <ulink url="&lua-download-ftp;"/>
</para>
</listitem>
<listitem>
<para>
Download MD5 sum: &lua-md5sum;
</para>
</listitem>
<listitem>
<para>
Download size: &lua-size;
</para>
</listitem>
<listitem>
<para>
Estimated disk space required: &lua-buildsize;
</para>
</listitem>
<listitem>
<para>
Estimated build time: &lua-time;
</para>
</listitem>
</itemizedlist>
<bridgehead renderas="sect3">Additional Downloads</bridgehead>
<itemizedlist spacing="compact">
<listitem>
<para>
Required patch:
<ulink url="&patch-root;/lua-&lua52-version;-shared_library-1.patch"/>
</para>
</listitem>
</itemizedlist>
</sect2>
<sect2 role="installation">
<title>Installation of Lua 5.2</title>
<para>
Some packages check for the <application>pkg-config</application> file
for <application>Lua</application>, which is created with:
</para>
<screen><userinput>cat &gt; lua.pc &lt;&lt; "EOF"
<literal>V=5.2
R=&lua52-version;
prefix=/usr
INSTALL_BIN=${prefix}/bin
INSTALL_INC=${prefix}/include/lua5.2
INSTALL_LIB=${prefix}/lib
INSTALL_MAN=${prefix}/share/man/man1
INSTALL_LMOD=${prefix}/share/lua/${V}
INSTALL_CMOD=${prefix}/lib/lua/${V}
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include/lua5.2
Name: Lua
Description: An Extensible Extension Language
Version: ${R}
Requires:
Libs: -L${libdir} -llua5.2 -lm -ldl
Cflags: -I${includedir}</literal>
EOF</userinput></screen>
<para>
Install <application>Lua</application> by running the following
commands:
</para>
<screen><userinput>patch -Np1 -i ../lua-&lua52-version;-shared_library-1.patch &amp;&amp;
sed -i '/#define LUA_ROOT/s:/usr/local/:/usr/:' src/luaconf.h &amp;&amp;
sed -r -e '/^LUA_(SO|A|T)=/ s/lua/lua5.2/' \
-e '/^LUAC_T=/ s/luac/luac5.2/' \
-i src/Makefile &amp;&amp;
make MYCFLAGS="-fPIC" linux</userinput></screen>
<!--
<para>
To test the results, issue: <command>make test</command>.
<quote>This will run the interpreter and print its version.</quote>.
More comprehensive tests can be performed if you downloaded the "Test
suite" tarball. Those tests need to be executed after the package is
installed, thus we defer to the description below.
</para>
-->
<para>
The installation of this package is complex, so we will use
the DESTDIR method of installation:
</para>
<screen><userinput>make TO_BIN='lua5.2 luac5.2' \
TO_LIB="liblua5.2.so liblua5.2.so.5.2 liblua5.2.so.&lua52-version;" \
INSTALL_DATA="cp -d" \
INSTALL_TOP=$PWD/install/usr \
INSTALL_INC=$PWD/install/usr/include/lua5.2 \
INSTALL_MAN=$PWD/install/usr/share/man/man1 \
install &amp;&amp;
install -Dm644 lua.pc install/usr/lib/pkgconfig/lua52.pc &amp;&amp;
mkdir -pv install/usr/share/doc/lua-&lua52-version; &amp;&amp;
cp -v doc/*.{html,css,gif,png} install/usr/share/doc/lua-&lua52-version; &amp;&amp;
ln -s liblua5.2.so install/usr/lib/liblua.so.5.2 &amp;&amp;
ln -s liblua5.2.so install/usr/lib/liblua.so.&lua52-version; &amp;&amp;
mv install/usr/share/man/man1/{lua.1,lua5.2.1} &amp;&amp;
mv install/usr/share/man/man1/{luac.1,luac5.2.1}</userinput></screen>
<para>
Now, as the <systemitem class="username">root</systemitem> user:
</para>
<screen role="root"><userinput>chown -R root:root install &amp;&amp;
cp -a install/* /</userinput></screen>
</sect2>
<sect2 role="commands">
<title>Command Explanations</title>
<para>
<command>sed -i ... src/luaconf.h</command>: This command changes the
<application>Lua</application> search path to match the install path.
</para>
<para>
<command>sed -i ... src/Makefile</command>: This command deconflicts
this installation with the latest version of lua.
</para>
</sect2>
<sect2 role="content">
<title>Contents</title>
<segmentedlist>
<segtitle>Installed Programs</segtitle>
<segtitle>Installed Library</segtitle>
<segtitle>Installed Directories</segtitle>
<seglistitem>
<seg>
lua5.2 and luac5.2
</seg>
<seg>
liblua5.2.so
</seg>
<seg>
/usr/include/lua5.2,
/usr/lib/lua/5.2,
/usr/share/doc/lua-&lua52-version;, and
/usr/share/lua/5.2
</seg>
</seglistitem>
</segmentedlist>
<variablelist>
<bridgehead renderas="sect3">Short Descriptions</bridgehead>
<?dbfo list-presentation="list"?>
<?dbhtml list-presentation="table"?>
<varlistentry id="lua52-prog">
<term><command>lua5.2</command></term>
<listitem>
<para>
is the standalone Lua version 5.2 interpreter
</para>
<indexterm zone="lua52 lua-prog">
<primary sortas="b-lua52">lua5.2</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="luac52">
<term><command>luac5.2</command></term>
<listitem>
<para>
is the Lua version 5.2 compiler
</para>
<indexterm zone="lua52 luac52">
<primary sortas="b-luac52">luac5.2</primary>
</indexterm>
</listitem>
</varlistentry>
<varlistentry id="liblua52">
<term><filename class="libraryfile">liblua5.2.so</filename></term>
<listitem>
<para>
contains the <application>Lua</application> version 5.2 API functions
</para>
<indexterm zone="lua52 liblua52">
<primary sortas="c-liblua52">liblua5.2.so</primary>
</indexterm>
</listitem>
</varlistentry>
</variablelist>
</sect2>
</sect1>