commit:     6b23d8c4a53e99b1605447eb7e9a561f860d1eed
Author:     Rafael Martins <rafaelmartins <AT> gentoo <DOT> org>
AuthorDate: Sun Dec  4 21:44:44 2016 +0000
Commit:     Rafael Martins <rafaelmartins <AT> gentoo <DOT> org>
CommitDate: Sun Dec  4 21:44:44 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6b23d8c4

dev-lang/lua: added 5.3.3, masked for testing (bug #541042)

Package-Manager: portage-2.2.28

 dev-lang/lua/Manifest                    |   1 +
 dev-lang/lua/files/lua-5.3-make-r1.patch |  91 ++++++++++++++++++++
 dev-lang/lua/lua-5.3.3.ebuild            | 137 +++++++++++++++++++++++++++++++
 3 files changed, 229 insertions(+)

diff --git a/dev-lang/lua/Manifest b/dev-lang/lua/Manifest
index 3404943..52b6621 100644
--- a/dev-lang/lua/Manifest
+++ b/dev-lang/lua/Manifest
@@ -1,3 +1,4 @@
 DIST lua-5.1.4.tar.gz 216679 SHA256 
b038e225eaf2a5b57c9bcc35cd13aa8c6c8288ef493d52970c9545074098af3a SHA512 
bc542fe8535826ac1e49b03a8f238cf049724b02c14718f8162cfeaf735a5e6c58412ff18dbe7a38e4cc4433f3d1e702554e9b24b5f021634b4280880980f40f
 WHIRLPOOL 
2d8fdf77e31314eed68d8ace368a62a608a58114bea5c8797a2e2d327ca870dd4450ede494733d49c97bb447c97adf08610027df3206999a35fb49cde77448fd
 DIST lua-5.1.5.tar.gz 221213 SHA256 
2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333 SHA512 
0142fefcbd13afcd9b201403592aa60620011cc8e8559d4d2db2f92739d18186860989f48caa45830ff4f99bfc7483287fd3ff3a16d4dec928e2767ce4d542a9
 WHIRLPOOL 
9dac93b73b9ad1ef6c69e0aa11fb53d5efe89274b65c55a1ac30bab23e8a255851b0e44306db54212b1d481e658cecd38e5ff22a25e1fa974858b7b03fb45b75
 DIST lua-5.2.3.tar.gz 251195 SHA256 
13c2fb97961381f7d06d5b5cea55b743c163800896fd5c5e2356201d3619002d SHA512 
264bb7c8db2f190ef0ca38584ec81999ab588f54e03119c5214c40bb8925b0eb407fac483a03e40cc8a220f6748ddff7d3a7392da3803418276b0d263b866449
 WHIRLPOOL 
d278a1e38416bcf7f82eb3e7fd5fb423e60ccb69e9d57a937070516ff8be2d19a98bbfdaf37ec6fd6fb3ef2d625900977ca0cb47e46cb0ede5ebd5d37a9454ef
+DIST lua-5.3.3.tar.gz 294290 SHA256 
5113c06884f7de453ce57702abaac1d618307f33f6789fa870e87a59d772aca2 SHA512 
7b8122ed48ea2a9faa47d1b69b4a5b1523bb7be67e78f252bb4339bf75e957a88c5405156e22b4b63ccf607a5407bf017a4cee1ce12b1aa5262047655960a3cc
 WHIRLPOOL 
e9d58093327e3c67e167dad9952796f1f2f0dbfa4f165c0ec5a8808a6a73d3b25e564797a2804d408bdaeb7229e7684f907491137d4521119ba918ce87c781bc

diff --git a/dev-lang/lua/files/lua-5.3-make-r1.patch 
b/dev-lang/lua/files/lua-5.3-make-r1.patch
new file mode 100644
index 00000000..b9e9051
--- /dev/null
+++ b/dev-lang/lua/files/lua-5.3-make-r1.patch
@@ -0,0 +1,91 @@
+diff -uNr lua-5.3.3.orig/Makefile lua-5.3.3/Makefile
+--- lua-5.3.3.orig/Makefile    2016-12-04 22:29:54.839135901 +0100
++++ lua-5.3.3/Makefile 2016-12-04 22:31:14.235851109 +0100
+@@ -12,7 +12,7 @@
+ # LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h.
+ INSTALL_TOP= /usr/local
+ INSTALL_BIN= $(INSTALL_TOP)/bin
+-INSTALL_INC= $(INSTALL_TOP)/include
++INSTALL_INC= $(INSTALL_TOP)/include/lua$V
+ INSTALL_LIB= $(INSTALL_TOP)/lib
+ INSTALL_MAN= $(INSTALL_TOP)/man/man1
+ INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V
+@@ -112,3 +112,18 @@
+ .PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho
+ 
+ # (end of Makefile)
++
++# Use libtool for binary installs, etc.
++
++export V
++export LIBTOOL = $(EROOT)usr/bin/libtool --quiet --tag=CC
++# See libtool manual about how to set this
++
++gentoo_clean:
++      cd src; $(MAKE) $@
++
++gentoo_install:
++      mkdir -p $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB)
++      cd src; $(LIBTOOL) --mode=install $(INSTALL_EXEC) lua$V luac$V 
$(INSTALL_BIN)
++      cd src; $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
++      cd src; $(LIBTOOL) --mode=install $(INSTALL_DATA) liblua$V.la 
$(INSTALL_LIB)
+diff -uNr lua-5.3.3.orig/src/Makefile lua-5.3.3/src/Makefile
+--- lua-5.3.3.orig/src/Makefile        2016-12-04 22:29:54.840135910 +0100
++++ lua-5.3.3/src/Makefile     2016-12-04 22:34:55.980848068 +0100
+@@ -36,10 +36,10 @@
+       lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o
+ BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS)
+ 
+-LUA_T=        lua
++LUA_T= lua$V
+ LUA_O=        lua.o
+ 
+-LUAC_T=       luac
++LUAC_T=       luac$V
+ LUAC_O=       luac.o
+ 
+ ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O)
+@@ -59,10 +59,10 @@
+       $(AR) $@ $(BASE_O)
+       $(RANLIB) $@
+ 
+-$(LUA_T): $(LUA_O) $(LUA_A)
++origin$(LUA_T): $(LUA_O) $(LUA_A)
+       $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+ 
+-$(LUAC_T): $(LUAC_O) $(LUA_A)
++origin$(LUAC_T): $(LUAC_O) $(LUA_A)
+       $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+ 
+ clean:
+@@ -195,3 +195,30 @@
+  lobject.h ltm.h lzio.h
+ 
+ # (end of Makefile)
++
++export LIBTOOL = $(EROOT)usr/bin/libtool --quiet --tag=CC
++export LIB_VERSION = 6:1:1
++
++# The following rules use libtool for compiling and linking in order to
++# provide shared library support.
++
++LIB_NAME = liblua$V.la
++LIB_OBJS = $(CORE_O:.o=.lo) $(LIB_O:.o=.lo)
++
++%.lo %.o: %.c
++      $(LIBTOOL) --mode=compile $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
++
++$(LIB_NAME): $(LIB_OBJS)
++      $(LIBTOOL) --mode=link $(CC) -version-info $(LIB_VERSION) \
++            -rpath $(RPATH) $(LDFLAGS) -o $(LIB_NAME) $(LIB_OBJS) $(LIB_LIBS)
++
++$(LUA_T): $(LUA_O:.o=.lo) $(LIB_NAME)
++      $(LIBTOOL) --mode=link $(CC) -export-dynamic $(LDFLAGS) -o $@ 
$(LUA_O:.o=.lo) $(LIB_NAME) $(LUA_LIBS)
++
++$(LUAC_T): $(LUAC_O:.o=.lo) $(LIB_NAME)
++      $(LIBTOOL) --mode=link $(CC) -static $(LDFLAGS) -o $@ $(LUAC_O:.o=.lo) 
$(LIB_NAME)
++
++gentoo_clean:
++      $(LIBTOOL) --mode=clean $(RM) $(ALL_O:.o=.lo) $(LIB_NAME) lua$V luac$V
++
++gentoo_all: $(LIB_NAME) $(LUA_T) $(LUAC_T)

diff --git a/dev-lang/lua/lua-5.3.3.ebuild b/dev-lang/lua/lua-5.3.3.ebuild
new file mode 100644
index 00000000..7fea00e
--- /dev/null
+++ b/dev-lang/lua/lua-5.3.3.ebuild
@@ -0,0 +1,137 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit eutils autotools multilib multilib-minimal portability toolchain-funcs 
versionator
+
+DESCRIPTION="A powerful light-weight programming language designed for 
extending applications"
+HOMEPAGE="http://www.lua.org/";
+SRC_URI="http://www.lua.org/ftp/${P}.tar.gz";
+
+LICENSE="MIT"
+SLOT="5.3"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc 
~x86 ~amd64-fbsd ~x86-fbsd ~arm-linux ~x86-linux ~ppc-aix ~x64-freebsd 
~ia64-hpux ~x86-interix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos 
~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+deprecated emacs readline static"
+
+RDEPEND="readline? ( sys-libs/readline:0= )
+       app-eselect/eselect-lua
+       !dev-lang/lua:0"
+DEPEND="${RDEPEND}
+       sys-devel/libtool"
+PDEPEND="emacs? ( app-emacs/lua-mode )"
+
+MULTILIB_WRAPPED_HEADERS=(
+       /usr/include/lua${SLOT}/luaconf.h
+)
+
+src_prepare() {
+       local PATCH_PV=$(get_version_component_range 1-2)
+
+       epatch "${FILESDIR}"/${PN}-${PATCH_PV}-make-r1.patch
+
+       # use glibtool on Darwin (versus Apple libtool)
+       if [[ ${CHOST} == *-darwin* ]] ; then
+               sed -i -e '/LIBTOOL = /s:/libtool:/glibtool:' \
+                       Makefile src/Makefile || die
+       fi
+
+       [ -d "${FILESDIR}/${PV}" ] && \
+               EPATCH_SOURCE="${FILESDIR}/${PV}" 
EPATCH_SUFFIX="upstream.patch" epatch
+
+       # correct lua versioning
+       sed -i -e 's/\(LIB_VERSION = \)6:1:1/\10:0:0/' src/Makefile || die
+
+       sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html || die
+
+       if ! use readline ; then
+               sed -i -e '/#define LUA_USE_READLINE/d' src/luaconf.h || die
+       fi
+
+       # Using dynamic linked lua is not recommended for performance
+       # reasons. http://article.gmane.org/gmane.comp.lang.lua.general/18519
+       # Mainly, this is of concern if your arch is poor with GPRs, like x86
+       # Note that this only affects the interpreter binary (named lua), not 
the lua
+       # compiler (built statically) nor the lua libraries (both shared and 
static
+       # are installed)
+       if use static ; then
+               sed -i -e 's:\(-export-dynamic\):-static \1:' src/Makefile || 
die
+       fi
+
+       # upstream does not use libtool, but we do (see bug #336167)
+       cp "${FILESDIR}/configure.in" "${S}/configure.ac" || die
+       eautoreconf
+
+       # custom Makefiles
+       multilib_copy_sources
+}
+
+multilib_src_configure() {
+       sed -i \
+               -e 's:\(define LUA_ROOT\s*\).*:\1"'${EPREFIX}'/usr/":' \
+               -e "s:\(define LUA_CDIR\s*LUA_ROOT \"\)lib:\1$(get_libdir):" \
+               src/luaconf.h \
+       || die "failed patching luaconf.h"
+
+       econf
+}
+
+multilib_src_compile() {
+       tc-export CC
+
+       # what to link to liblua
+       liblibs="-lm"
+       liblibs="${liblibs} $(dlopen_lib)"
+
+       # what to link to the executables
+       mylibs=
+       use readline && mylibs="-lreadline"
+
+       cd src
+
+       local myCFLAGS=""
+       use deprecated && myCFLAGS="-DLUA_COMPAT_ALL"
+
+       case "${CHOST}" in
+               *-mingw*) : ;;
+               *) myCFLAGS+=" -DLUA_USE_LINUX" ;;
+       esac
+
+       emake CC="${CC}" CFLAGS="${myCFLAGS} ${CFLAGS}" \
+                       SYSLDFLAGS="${LDFLAGS}" \
+                       RPATH="${EPREFIX}/usr/$(get_libdir)/" \
+                       LUA_LIBS="${mylibs}" \
+                       LIB_LIBS="${liblibs}" \
+                       V=$(get_version_component_range 1-2) \
+                       gentoo_all
+}
+
+multilib_src_install() {
+       emake INSTALL_TOP="${ED}/usr" INSTALL_LIB="${ED}/usr/$(get_libdir)" \
+                       V=${SLOT} gentoo_install
+
+       # We want packages to find our things...
+       cp "${FILESDIR}/lua.pc" "${WORKDIR}"
+       sed -i \
+               -e "s:^prefix= :prefix= ${EPREFIX}:" \
+               -e "s:^V=.*:V= ${PATCH_PV}:" \
+               -e "s:^R=.*:R= ${PV}:" \
+               -e "s:/,lib,:/$(get_libdir):g" \
+               "${WORKDIR}/lua.pc"
+
+       insinto "/usr/$(get_libdir)/pkgconfig"
+       newins "${WORKDIR}/lua.pc" "lua${SLOT}.pc"
+}
+
+multilib_src_install_all() {
+       dodoc README
+       dohtml doc/*.html doc/*.png doc/*.css doc/*.gif
+
+       newman doc/lua.1 lua${SLOT}.1
+       newman doc/luac.1 luac${SLOT}.1
+}
+
+# Makefile contains a dummy target that doesn't do tests
+# but causes issues with slotted lua (bug #510360)
+src_test() { :; }

Reply via email to