1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit eutils autotools multilib multilib-minimal portability toolchain-funcs
8 DESCRIPTION
="A powerful light-weight programming language designed for extending applications"
9 HOMEPAGE
="http://www.lua.org/"
10 SRC_URI
="http://www.lua.org/ftp/${P}.tar.gz"
14 KEYWORDS
="~amd64 ~arm ~arm64 ~hppa ~mips ~ppc ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
15 IUSE
="+deprecated emacs +static"
18 >=sys-libs/readline-6.3:0[${MULTILIB_USEDEP}]
19 app-eselect/eselect-lua
24 PDEPEND
="emacs? ( app-emacs/lua-mode )"
26 MULTILIB_WRAPPED_HEADERS
=(
27 "/usr/include/lua${SLOT}/luaconf.h"
31 eapply
"${FILESDIR}/lua-5.3.4_make.patch"
33 # use glibtool on Darwin (versus Apple libtool)
34 if [[ ${CHOST} == *-darwin* ]] ; then
35 sed -i -e '/LIBTOOL = /s:/libtool:/glibtool:' \
36 Makefile src
/Makefile || die
39 sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc
/readme.html || die
41 sed -i -e 's/\(LIB_VERSION = \)6:1:1/\10:0:0/' src
/Makefile || die
43 # Using dynamic linked lua is not recommended for performance
44 # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519
45 # Mainly, this is of concern if your arch is poor with GPRs, like x86
46 # Note that this only affects the interpreter binary (named lua), not the lua
47 # compiler (built statically) nor the lua libraries (both shared and static
50 sed -i -e 's:\(-export-dynamic\):-static \1:' src
/Makefile || die
55 # upstream does not use libtool, but we do (see bug #336167)
56 cp "${FILESDIR}/configure.ac" "${S}"/ || die
62 cp "${FILESDIR}/lua.pc" "${S}"
63 # A slotted Lua uses different directories for headers & names for
64 # libraries, and pkgconfig should reflect that.
66 -e "s:^V=.*:V= ${SLOT}:" \
67 -e "s:^R=.*:R= ${PV}:" \
68 -e "s:/,lib,:/$(get_libdir):g" \
69 -e "/^Libs:/s,((-llua)($| )),\2${SLOT}\3," \
73 multilib_src_configure
() {
75 -e 's:\(define LUA_ROOT\s*\).*:\1"'${EPREFIX}'/usr/":' \
76 -e "s:\(define LUA_CDIR\s*LUA_ROOT \"\)lib:\1$(get_libdir):" \
78 || die
"failed patching luaconf.h"
83 multilib_src_compile
() {
86 # what to link to liblua
88 liblibs
="${liblibs} $(dlopen_lib)"
90 # what to link to the executables
96 use deprecated
&& myCFLAGS
="-DLUA_COMPAT_5_2 -DLUA_COMPAT_5_1 -DLUA_COMPAT_ALL"
97 # -DLUA_COMPAT_FLOATSTRING"
101 *) myCFLAGS
+=" -DLUA_USE_LINUX" ;;
104 emake CC
="${CC}" CFLAGS="${myCFLAGS} ${CFLAGS}" \
105 SYSLDFLAGS
="${LDFLAGS}" \
106 RPATH
="${EPREFIX}/usr/$(get_libdir)/" \
107 LUA_LIBS
="${mylibs}" \
108 LIB_LIBS
="${liblibs}" \
113 multilib_src_install
() {
114 emake INSTALL_TOP
="${ED}/usr" INSTALL_LIB
="${ED}/usr/$(get_libdir)" \
115 V
=${SLOT} gentoo_install
117 insinto
"/usr/$(get_libdir)/pkgconfig"
118 newins
"${S}/lua.pc" "lua${SLOT}.pc"
121 multilib_src_install_all
() {
123 HTML_DOCS
=(doc
/*.html
doc
/*.png
doc
/*.css
doc
/*.gif
)
126 newman
doc
/lua
.1 lua
${SLOT}.1
127 newman
doc
/luac
.1 luac
${SLOT}.1
130 # Makefile contains a dummy target that doesn't do tests
131 # but causes issues with slotted lua (bug #510360)