Reintrouce a recipe for lua 5.1.

This partially reverts commit 9b3fcef5c0.

Minor versions of Lua are not completely compatible, and a lot of
software was not updated yet to the 5.2 or 5.3 APIs. We should thus have
a lua51 package for these, so they can still be run.
This commit is contained in:
Adrien Destugues
2015-11-12 13:30:48 +01:00
parent fae6076edd
commit 5bdc49df6b
2 changed files with 201 additions and 0 deletions

View File

@@ -0,0 +1,78 @@
SUMMARY="A powerful, fast, light-weight, embeddable scripting language"
DESCRIPTION="Lua combines simple procedural syntax with powerful data \
description constructs based on associative arrays and extensible semantics. \
Lua is dynamically typed, runs by interpreting bytecode for a register-based \
virtual machine, and has automatic memory management with incremental garbage \
collection, making it ideal for configuration, scripting, and rapid \
prototyping."
HOMEPAGE="http://www.lua.org"
LICENSE="MIT"
REVISION="7"
ARCHITECTURES="x86 x86_gcc2"
SECONDARY_ARCHITECTURES="x86 x86_gcc2"
SOURCE_URI="http://www.lua.org/ftp/lua-5.1.4.tar.gz"
CHECKSUM_SHA256="b038e225eaf2a5b57c9bcc35cd13aa8c6c8288ef493d52970c9545074098af3a"
SOURCE_DIR="lua-$portVersion"
COPYRIGHT="1994-2009, Lua.org, PUC-Rio"
PATCHES="lua-5.1.4.patchset"
PROVIDES="
lua51${secondaryArchSuffix} = $portVersion compat >= 5.1
cmd:lua5.1${secondaryArchSuffix} = $portVersion compat >= 5.1
cmd:luac5.1${secondaryArchSuffix} = $portVersion compat >= 5.1
lib:liblua${secondaryArchSuffix} = $portVersion compat >= 5.1
"
REQUIRES="
haiku${secondaryArchSuffix}
"
PROVIDES_devel="
lua51${secondaryArchSuffix}_devel = $portVersion compat >= 5.1
devel:liblua$secondaryArchSuffix = $portVersion compat >= 5.1
devel:liblua5.1$secondaryArchSuffix = $portVersion compat >= 5.1
"
REQUIRES_devel="
lua51$secondaryArchSuffix == $portVersion
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:make
cmd:gcc${secondaryArchSuffix}
"
BUILD()
{
make haiku
}
INSTALL()
{
make install INSTALL_TOP="$prefix" INSTALL_MAN="$manDir/man1" \
INSTALL_INC="$includeDir/lua5.1" INSTALL_LMOD="$dataDir/lua/5.1" \
INSTALL_LIB="$libDir" INSTALL_BIN="$binDir"
mkdir -p $libDir/pkgconfig
cp etc/lua.pc $libDir/pkgconfig/lua.pc
ln -s liblua.so $libDir/liblua.so.5.1
ln -s liblua.a $libDir/liblua5.1.a
mv $binDir/lua $binDir/lua5.1
mv $binDir/luac $binDir/luac5.1
prepareInstalledDevelLib liblua
prepareInstalledDevelLib liblua5.1
fixPkgconfig
# The includes are in a subdirectory of includeDir, and fixPkgconfig breaks
# that.
sed -i -e "s,^includedir=.*,includedir=$prefix/$relativeIncludeDir/lua5.1," \
$developLibDir/pkgconfig/lua.pc
packageEntries devel $developDir
}

View File

@@ -0,0 +1,123 @@
From 0ba6279d1bee18e580206f0f86e3410f65db73c5 Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Wed, 15 Jan 2014 15:33:52 -0600
Subject: [PATCH] lua: fix 5.1 runtime issues
* Thanks to the work of Chris Roberts and
Adrien Destugues
---
Makefile | 6 +++---
src/Makefile | 13 ++++++++++---
src/luaconf.h | 11 +++++++++++
3 files changed, 24 insertions(+), 6 deletions(-)
diff --git a/Makefile b/Makefile
index 6e78f66..b2e3868 100644
--- a/Makefile
+++ b/Makefile
@@ -38,12 +38,12 @@ RANLIB= ranlib
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
# Convenience platforms targets.
-PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+PLATS= aix ansi bsd freebsd generic haiku linux macosx mingw posix solaris
# What to install.
TO_BIN= lua luac
TO_INC= lua.h luaconf.h lualib.h lauxlib.h ../etc/lua.hpp
-TO_LIB= liblua.a
+TO_LIB= liblua.a liblua.so
TO_MAN= lua.1 luac.1
# Lua version and release.
@@ -53,7 +53,7 @@ R= 5.1.4
all: $(PLAT)
$(PLATS) clean:
- cd src && $(MAKE) $@
+ cd src && $(MAKE) V=$(V) $@
test: dummy
src/lua test/hello.lua
diff --git a/src/Makefile b/src/Makefile
index e4a3cd6..9df0326 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -20,9 +20,10 @@ MYLIBS=
# == END OF USER SETTINGS. NO NEED TO CHANGE ANYTHING BELOW THIS LINE =========
-PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
+PLATS= aix ansi bsd freebsd generic haiku linux macosx mingw posix solaris
LUA_A= liblua.a
+LUA_SO= liblua.so
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
lundump.o lvm.o lzio.o
@@ -36,7 +37,7 @@ 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)
+ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) $(LUA_SO)
ALL_A= $(LUA_A)
default: $(PLAT)
@@ -57,8 +58,11 @@ $(LUA_T): $(LUA_O) $(LUA_A)
$(LUAC_T): $(LUAC_O) $(LUA_A)
$(CC) -o $@ $(MYLDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS)
+$(LUA_SO): $(CORE_O) $(LIB_O)
+ $(CC) -o $@ -shared -fPIC -Wl,-soname=liblua.so.$(V) $(LDFLAGS) $? $(LIBS)
+
clean:
- $(RM) $(ALL_T) $(ALL_O)
+ $(RM) $(ALL_T) $(ALL_O) $(ALL_SO)
depend:
@$(CC) $(CFLAGS) -MM l*.c print.c
@@ -95,6 +99,9 @@ freebsd:
generic:
$(MAKE) all MYCFLAGS=
+haiku:
+ $(MAKE) all SYSCFLAGS="-DLUA_USE_HAIKU" LIBS=
+
linux:
$(MAKE) all MYCFLAGS=-DLUA_USE_LINUX MYLIBS="-Wl,-E -ldl -lreadline -lhistory -lncurses"
diff --git a/src/luaconf.h b/src/luaconf.h
index e2cb261..96c4d45 100644
--- a/src/luaconf.h
+++ b/src/luaconf.h
@@ -33,6 +33,13 @@
#define LUA_WIN
#endif
+#if defined(LUA_USE_HAIKU)
+#define LUA_USE_MKSTEMP
+#define LUA_USE_ISATTY
+#define LUA_USE_POPEN
+#define LUA_USE_DLOPEN
+#endif
+
#if defined(LUA_USE_LINUX)
#define LUA_USE_POSIX
#define LUA_USE_DLOPEN /* needs an extra library: -ldl */
@@ -94,8 +101,12 @@
".\\?.dll;" LUA_CDIR"?.dll;" LUA_CDIR"loadall.dll"
#else
+#ifndef LUA_ROOT
#define LUA_ROOT "/usr/local/"
+#endif
+#ifndef LUA_LDIR
#define LUA_LDIR LUA_ROOT "share/lua/5.1/"
+#endif
#define LUA_CDIR LUA_ROOT "lib/lua/5.1/"
#define LUA_PATH_DEFAULT \
"./?.lua;" LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \
--
1.8.3.4