diff options
author | 2008-08-22 18:00:26 +0300 | |
---|---|---|
committer | 2008-08-22 18:00:26 +0300 | |
commit | b533cd4a3c6f8df48a64f9fdcf6e543648a92bf8 (patch) | |
tree | cba98df6b18bdad7de0a835638a9b1064d6c4a90 | |
parent | Install lua modules to /usr/share (diff) | |
download | hawking-b533cd4a3c6f8df48a64f9fdcf6e543648a92bf8.tar.gz hawking-b533cd4a3c6f8df48a64f9fdcf6e543648a92bf8.tar.bz2 hawking-b533cd4a3c6f8df48a64f9fdcf6e543648a92bf8.zip |
Added lua.eclass
-rw-r--r-- | eclass/lua.eclass | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/eclass/lua.eclass b/eclass/lua.eclass new file mode 100644 index 0000000..a11c8b0 --- /dev/null +++ b/eclass/lua.eclass @@ -0,0 +1,59 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: $ + +# @ECLASS: lua.eclass +# @MAINTAINER: +# hawking@gentoo.org +# +# @BLURB: +# A Utility Eclass that should be inherited by anything that deals with Lua or Lua modules. +# @DESCRIPTION: +# Some useful functions for dealing with Lua. + +inherit multilib + +# @FUNCTION: lua_version +# @DESCRIPTION: +# Run without arguments, it sets LUAVER +lua_version() { + local luaver= + luaver="$(lua -v 2>&1| cut -d' ' -f2)" + export LUAVER="${luaver%.*}" +} + +# @FUNCTION: lua_get_sharedir +# Run without arguments, returns the share dir where lua modules are installed. +lua_get_sharedir() { + lua_version + echo -n /usr/share/lua/${LUAVER}/ +} + +# @FUNCTION: lua_get_libdir +# Run without arguments, returns the library dir where lua C modules are +# installed. +lua_get_libdir() { + lua_version + echo -n /usr/$(get_libdir)/lua/${LUAVER} +} + +# @FUNCTION: lua_install_module +# @DESCRIPTION: +# Install a lua module +lua_install_module() { + lua_version + + insinto /usr/share/lua/${LUAVER} + doins $@ || die "doins failed" +} + +# @FUNCTION: lua_install_cmodule +# @DESCRIPTION: +# Install a Lua module which is a .so file. +lua_install_cmodule() { + lua_version + + insinto /usr/$(get_libdir)/lua/${LUAVER} + doins $@ || die "doins failed" +} + |