Files
haikuports/dev-lang/lua/patches/lua-5.1.5.patchset
2017-10-13 19:39:19 +02:00

124 lines
3.2 KiB
Plaintext

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