summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2020-01-23 15:35:30 -0800
committerRobin H. Johnson <robbat2@gentoo.org>2020-01-23 15:36:34 -0800
commit719f9a18c8709bf355d7ea80c09cd4e87f0a11fe (patch)
tree9f60203a68730cce95642b271a19dd4f5e8c0ae4 /dev-lang/lua
parentsci-mathematics/rkward: 0.7.1 version bump (diff)
downloadgentoo-719f9a18c8709bf355d7ea80c09cd4e87f0a11fe.tar.gz
gentoo-719f9a18c8709bf355d7ea80c09cd4e87f0a11fe.tar.bz2
gentoo-719f9a18c8709bf355d7ea80c09cd4e87f0a11fe.zip
dev-lang/lua: EAPI bump
Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
Diffstat (limited to 'dev-lang/lua')
-rw-r--r--dev-lang/lua/files/lua-5.1.5-disable-deprecated.patch59
-rw-r--r--dev-lang/lua/files/lua-5.1.5-gentoo-build.patch118
-rw-r--r--dev-lang/lua/files/lua-5.1.5-readline.patch17
-rw-r--r--dev-lang/lua/lua-5.1.5-r5.ebuild113
4 files changed, 307 insertions, 0 deletions
diff --git a/dev-lang/lua/files/lua-5.1.5-disable-deprecated.patch b/dev-lang/lua/files/lua-5.1.5-disable-deprecated.patch
new file mode 100644
index 000000000000..d1d7fb10115f
--- /dev/null
+++ b/dev-lang/lua/files/lua-5.1.5-disable-deprecated.patch
@@ -0,0 +1,59 @@
+diff -rdu old/src/luaconf.h new/src/luaconf.h
+--- old/src/luaconf.h 2008-02-12 17:00:03.000000000 +0000
++++ new/src/luaconf.h 2008-02-12 17:07:55.000000000 +0000
+@@ -340,14 +340,14 @@
+ ** CHANGE it to undefined as soon as your programs use only '...' to
+ ** access vararg parameters (instead of the old 'arg' table).
+ */
+-#define LUA_COMPAT_VARARG
++#undef LUA_COMPAT_VARARG
+
+ /*
+ @@ LUA_COMPAT_MOD controls compatibility with old math.mod function.
+ ** CHANGE it to undefined as soon as your programs use 'math.fmod' or
+ ** the new '%' operator instead of 'math.mod'.
+ */
+-#define LUA_COMPAT_MOD
++#undef LUA_COMPAT_MOD
+
+ /*
+ @@ LUA_COMPAT_LSTR controls compatibility with old long string nesting
+@@ -355,14 +355,14 @@
+ ** CHANGE it to 2 if you want the old behaviour, or undefine it to turn
+ ** off the advisory error when nesting [[...]].
+ */
+-#define LUA_COMPAT_LSTR 1
++#undef LUA_COMPAT_LSTR
+
+ /*
+ @@ LUA_COMPAT_GFIND controls compatibility with old 'string.gfind' name.
+ ** CHANGE it to undefined as soon as you rename 'string.gfind' to
+ ** 'string.gmatch'.
+ */
+-#define LUA_COMPAT_GFIND
++#undef LUA_COMPAT_GFIND
+
+ /*
+ @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
+@@ -370,7 +370,7 @@
+ ** CHANGE it to undefined as soon as you replace to 'luaL_register'
+ ** your uses of 'luaL_openlib'
+ */
+-#define LUA_COMPAT_OPENLIB
++#undef LUA_COMPAT_OPENLIB
+
+
+
+diff -rdu old/test/sieve.lua new/test/sieve.lua
+Rename deprecated functions in test scripts
+--- old/test/sieve.lua~ 2002-10-31 03:52:58.000000000 +0100
++++ new/test/sieve.lua 2008-02-20 17:44:22.468281121 +0100
+@@ -14,7 +14,7 @@
+ while 1 do
+ local n = g()
+ if n == nil then return end
+- if math.mod(n, p) ~= 0 then coroutine.yield(n) end
++ if math.fmod(n, p) ~= 0 then coroutine.yield(n) end
+ end
+ end)
+ end
diff --git a/dev-lang/lua/files/lua-5.1.5-gentoo-build.patch b/dev-lang/lua/files/lua-5.1.5-gentoo-build.patch
new file mode 100644
index 000000000000..62c4ed33648d
--- /dev/null
+++ b/dev-lang/lua/files/lua-5.1.5-gentoo-build.patch
@@ -0,0 +1,118 @@
+--- old/Makefile 2012-02-10 10:50:23.000000000 +0100
++++ new/Makefile 2019-07-12 12:00:30.807725876 +0200
+@@ -22,7 +22,8 @@
+
+ # How to install. If your install program does not support "-p", then you
+ # may have to run ranlib on the installed liblua.a (do "make ranlib").
+-INSTALL= install -p
++INSTALL?= install -p
++INSTALL_LINK= ln -s
+ INSTALL_EXEC= $(INSTALL) -m 0755
+ INSTALL_DATA= $(INSTALL) -m 0644
+ #
+@@ -33,7 +34,7 @@
+
+ # Utilities.
+ MKDIR= mkdir -p
+-RANLIB= ranlib
++RANLIB?= ranlib
+
+ # == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
+
+@@ -47,13 +48,17 @@
+ TO_MAN= lua.1 luac.1
+
+ # Lua version and release.
++M= 5
+ V= 5.1
+ R= 5.1.5
+
++# Export to sub-make
++export M R
++
+ all: $(PLAT)
+
+ $(PLATS) clean:
+- cd src && $(MAKE) $@
++ cd src && $(MKDIR) .libs && $(MAKE) $@
+
+ test: dummy
+ src/lua test/hello.lua
+@@ -61,6 +66,8 @@
+ install: dummy
+ cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD)
+ cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN)
++ cd src && $(INSTALL_EXEC) $(TO_LIB:.a=.so.$(R)) $(INSTALL_LIB)
++ cd src && $(INSTALL_LINK) $(TO_LIB:.a=.so.$(R)) $(INSTALL_LIB)/$(TO_LIB:.a=.so.$(M))
+ cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC)
+ cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB)
+ cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN)
+--- old/src/Makefile 2012-02-13 21:41:22.000000000 +0100
++++ new/src/Makefile 2019-07-12 11:31:02.945290602 +0200
+@@ -7,12 +7,14 @@
+ # Your platform. See PLATS for possible values.
+ PLAT= none
+
+-CC= gcc
+-CFLAGS= -O2 -Wall $(MYCFLAGS)
+-AR= ar rcu
+-RANLIB= ranlib
++CC?= gcc
++CFLAGS?= -O2 -Wall $(MYCFLAGS)
++SOFLAGS= -shared -fPIC -DPIC -Wl,-O1 -Wl,--as-needed -Wl,-soname -Wl,$(LUA_A:.a=.so.$(M)) $(MYLDFLAGS)
++AR?= ar
++ARFLAGS?= rcu
++RANLIB?= ranlib
+ RM= rm -f
+-LIBS= -lm $(MYLIBS)
++LIBS?= -lm $(MYLIBS)
+
+ MYCFLAGS=
+ MYLDFLAGS=
+@@ -35,8 +37,11 @@
+ LUAC_T= luac
+ LUAC_O= luac.o print.o
+
+-ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
+-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
++LUAS_T= $(LUA_A:.a=.so.$(R))
++LUAS_O= $(addprefix .libs/,$(CORE_O) $(LIB_O) $(LUA_O))
++
++ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O) $(LUAS_O)
++ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUAS_T)
+ ALL_A= $(LUA_A)
+
+ default: $(PLAT)
+@@ -48,9 +53,12 @@
+ a: $(ALL_A)
+
+ $(LUA_A): $(CORE_O) $(LIB_O)
+- $(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
++ $(AR) $(ARFLAGS) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
+ $(RANLIB) $@
+
++$(LUAS_T): $(LUAS_O)
++ $(CC) -o $@ $(SOFLAGS) $(LUAS_O) $(LIBS)
++
+ $(LUA_T): $(LUA_O) $(LUA_A)
+ $(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
+
+@@ -67,7 +75,7 @@
+ @echo "PLAT = $(PLAT)"
+ @echo "CC = $(CC)"
+ @echo "CFLAGS = $(CFLAGS)"
+- @echo "AR = $(AR)"
++ @echo "AR = $(AR) $(ARFLAGS)"
+ @echo "RANLIB = $(RANLIB)"
+ @echo "RM = $(RM)"
+ @echo "MYCFLAGS = $(MYCFLAGS)"
+@@ -120,6 +128,9 @@
+
+ # DO NOT DELETE
+
++.libs/%o: %c
++ $(CC) $(CFLAGS) -fPIC -DPIC -c -o $@ $<
++
+ lapi.o: lapi.c lua.h luaconf.h lapi.h lobject.h llimits.h ldebug.h \
+ lstate.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h \
+ lundump.h lvm.h
diff --git a/dev-lang/lua/files/lua-5.1.5-readline.patch b/dev-lang/lua/files/lua-5.1.5-readline.patch
new file mode 100644
index 000000000000..2b5221a8ab48
--- /dev/null
+++ b/dev-lang/lua/files/lua-5.1.5-readline.patch
@@ -0,0 +1,17 @@
+--- old/src/luaconf.h 2006-04-10 20:27:23.000000000 +0200
++++ new/src/luaconf.h 2006-11-15 14:53:07.000000000 +0100
+@@ -36,7 +36,6 @@
+ #if defined(LUA_USE_LINUX)
+ #define LUA_USE_POSIX
+ #define LUA_USE_DLOPEN /* needs an extra library: -ldl */
+-#define LUA_USE_READLINE /* needs some extra libraries */
+ #endif
+
+ #if defined(LUA_USE_MACOSX)
+--- old/src/Makefile 2012-02-13 21:41:22.000000000 +0100
++++ old/src/Makefile 2019-07-09 09:53:00.000000000 +0100
+@@ -98,3 +98,3 @@
+ linux:
+- $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
++ $(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl"
+
diff --git a/dev-lang/lua/lua-5.1.5-r5.ebuild b/dev-lang/lua/lua-5.1.5-r5.ebuild
new file mode 100644
index 000000000000..f6bb7d48bff9
--- /dev/null
+++ b/dev-lang/lua/lua-5.1.5-r5.ebuild
@@ -0,0 +1,113 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit eutils multilib multilib-minimal portability toolchain-funcs versionator flag-o-matic
+
+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="0"
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="+deprecated emacs readline doc"
+
+RDEPEND="readline? ( >=sys-libs/readline-6.2_p5-r1:0=[${MULTILIB_USEDEP}] )"
+DEPEND="${RDEPEND}"
+PDEPEND="emacs? ( app-emacs/lua-mode )"
+
+MULTILIB_WRAPPED_HEADERS=(
+ /usr/include/luaconf.h
+)
+
+src_prepare() {
+ # Correct documentation link
+ sed -i -e 's:\(/README\)\("\):\1.gz\2:g' doc/readme.html || die
+
+ # 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.
+
+ # Therefore both lua interpreter and compiler are statically linked to
+ # the core library modules.
+
+ # Note: This patch only adds the required targets to the makefiles
+ # instead of relying upon libtool, which fails cross-compiling. Both
+ # shared and static versions of lua libraries are installed.
+ epatch "${FILESDIR}"/${P}-gentoo-build.patch
+
+ # Rename deprecated functions in scripts
+ use deprecated || epatch "${FILESDIR}"/${P}-disable-deprecated.patch
+
+ # Remove readline dependency if not requested
+ use readline || epatch "${FILESDIR}"/${P}-disable-readline.patch
+
+ epatch "${FILESDIR}/${P}-fix_vararg_calls.patch"
+
+ # Required by EAPI >= 6
+ eapply_user
+
+ # Add documentation URIs if needed
+ use doc && \
+ HTML_DOCS=( doc/*.{html,css,png,gif} ) && \
+ DOCS="HISTORY README"
+
+ # custom Makefiles
+ multilib_copy_sources
+}
+
+multilib_src_configure() {
+ # Fix directories according to FHS/Gentoo policy paths and ABI
+ sed -i \
+ -e 's:/usr/local:'${EPREFIX}'/usr:' \
+ -e 's:/man/:/share/man/:' \
+ -e "s:\([/\"]\)\<lib\>:\1$(get_libdir):g" \
+ Makefile etc/lua.pc src/luaconf.h doc/manual.html || die
+}
+
+multilib_src_compile() {
+ append-cflags "-DLUA_USE_LINUX"
+ append-ldflags "-Wl,-E"
+ tc-export AR CC CPP LD RANLIB
+ emake \
+ MYLDFLAGS="${LDFLAGS}" \
+ MYCFLAGS="${CFLAGS}" \
+ linux
+}
+
+multilib_src_install() {
+ emake -j1 install INSTALL_TOP="${ED}/usr"
+
+ insinto usr/$(get_libdir)/pkgconfig
+ doins etc/lua.pc
+}
+
+multilib_src_install_all() {
+ einstalldocs -r
+
+ doicon etc/lua.ico
+
+ doman doc/lua.1 doc/luac.1
+}
+
+multilib_src_test() {
+ # These tests MUST succeed for the ebuild to succeed
+ local MUST_SUCCEED="bisect cf echo env factorial fib fibfor hello printf sieve
+ sort trace-calls trace-globals"
+
+ # These tests MUST fail for the ebuild to succeed
+ local MUST_FAIL="readonly"
+
+ cd "${BUILD_DIR}" || die
+
+ local test
+ for test in ${MUST_SUCCEED}; do
+ src/lua test/${test}.lua || die "test $test failed"
+ done
+
+ for test in ${MUST_FAIL}; do
+ src/lua test/${test}.lua && die "test $test failed"
+ done
+}