Add devel/lua-posix to work with Lua 5.0 and Lua 5.1 and turn devel/lua-posix

into a slave port of it.

PR:		ports/104990
Submitted by:	Andrew Turner <andrew+ports@fubar.geek.nz> (maintainer)
Repocopy by:	marcus
This commit is contained in:
Philip Paeps 2006-11-02 00:38:06 +00:00
parent 8824267a70
commit adb4c0b055
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=176142
11 changed files with 70 additions and 69 deletions

View file

@ -632,6 +632,7 @@
SUBDIR += lua50-posix
SUBDIR += lua50-pty
SUBDIR += lua-gettext
SUBDIR += lua-posix
SUBDIR += lwp
SUBDIR += m17n-db
SUBDIR += m17n-docs

View file

@ -15,12 +15,20 @@ DISTFILES= lposix.tar.gz
MAINTAINER= andrew+ports@fubar.geek.nz
COMMENT= A POSIX layer for Lua
USE_LUA= 5.0
USE_LUA?= 5.1
WRKSRC= ${WRKDIR}/posix
PLIST_FILES= %%LUA_MODSHAREDIR%%/posix.lua \
%%LUA_MODLIBDIR%%/lposix.so
.if ${USE_LUA} == 5.1
EXTRA_PATCHES= ${FILESDIR}/extrapatch-51-lposix.c \
${FILESDIR}/extrapatch-51-posix.lua \
${FILESDIR}/extrapatch-51-test.lua
.elif ${USE_LUA} == 5.0
EXTRA_PATCHES= ${FILESDIR}/extrapatch-50-Makefile
.endif
do-install:
@${INSTALL_DATA} ${WRKSRC}/posix.lua ${LUA_MODSHAREDIR}
@${INSTALL_PROGRAM} ${WRKSRC}/lposix.so ${LUA_MODLIBDIR}

View file

@ -0,0 +1,11 @@
--- Makefile.orig Wed Nov 5 21:26:49 2003
+++ Makefile Mon Aug 7 00:38:38 2006
@@ -21,7 +21,7 @@
all: test
test: $T
- $(LUABIN)/lua -l$(MYNAME) test.lua
+ LD_PRELOAD=${LUA_LIBDIR}/liblua.so:${LUA_LIBDIR}/liblualib.so $(LUABIN)/lua -l$(MYNAME) test.lua
$T: $(OBJS)
$(CC) -o $@ -shared $(OBJS)

View file

@ -0,0 +1,11 @@
--- lposix.c.orig Thu Nov 2 11:08:39 2006
+++ lposix.c Thu Nov 2 11:11:29 2006
@@ -64,7 +64,7 @@
}
else
{
- int j=luaL_findstring(luaL_checkstring(L, i), S);
+ int j=luaL_checkoption(L, i, NULL, S);
if (j==-1) luaL_argerror(L, i, "unknown selector");
return F(L, j, data);
}

View file

@ -0,0 +1,11 @@
--- posix.lua.orig Thu Nov 2 12:52:39 2006
+++ posix.lua Thu Nov 2 11:06:46 2006
@@ -4,7 +4,7 @@
local function so(x)
local SOPATH= os.getenv"LUA_SOPATH" or "./"
- assert(loadlib(SOPATH.."l"..x..".so","luaopen_"..x))()
+ assert(package.loadlib(SOPATH.."l"..x..".so","luaopen_"..x))()
end
so"posix"

View file

@ -0,0 +1,25 @@
--- test.lua.orig Thu Nov 2 11:13:00 2006
+++ test.lua Thu Nov 2 11:14:54 2006
@@ -41,7 +41,7 @@
f"HOME"
f"SHELL"
f"absent"
-for k in ox.getenv() do io.write(k,"\t") end io.write"\n"
+for k,_ in pairs(ox.getenv()) do io.write(k,"\t") end io.write"\n"
------------------------------------------------------------------------------
testing"putenv"
@@ -179,11 +179,11 @@
------------------------------------------------------------------------------
testing"times"
a=ox.times()
-for k,v in a do print(k,v) end
+for k,v in pairs(a) do print(k,v) end
print"sleeping 10 seconds..."
ox.sleep(10)
b=ox.times()
-for k,v in b do print(k,v) end
+for k,v in pairs(b) do print(k,v) end
print""
print("elapsed",b.elapsed-a.elapsed)
print("clock",os.clock())

View file

@ -19,12 +19,3 @@
WARN= -pedantic -Wall
INCS= -I$(LUAINC)
@@ -21,7 +21,7 @@
all: test
test: $T
- $(LUABIN)/lua -l$(MYNAME) test.lua
+ LD_PRELOAD=${LUA_LIBDIR}/liblua.so:${LUA_LIBDIR}/liblualib.so $(LUABIN)/lua -l$(MYNAME) test.lua
$T: $(OBJS)
$(CC) -o $@ -shared $(OBJS)

View file

@ -5,24 +5,8 @@
# $FreeBSD$
#
PORTNAME= posix
PORTVERSION= 5.0
CATEGORIES= devel
MASTER_SITES= http://www.tecgraf.puc-rio.br/~lhf/ftp/lua/5.0/
PKGNAMEPREFIX= ${LUA_PKGNAMEPREFIX}
DISTFILES= lposix.tar.gz
MAINTAINER= andrew+ports@fubar.geek.nz
COMMENT= A POSIX layer for Lua
USE_LUA= 5.0
WRKSRC= ${WRKDIR}/posix
PLIST_FILES= %%LUA_MODSHAREDIR%%/posix.lua \
%%LUA_MODLIBDIR%%/lposix.so
MASTERDIR= ${.CURDIR}/../lua-posix
do-install:
@${INSTALL_DATA} ${WRKSRC}/posix.lua ${LUA_MODSHAREDIR}
@${INSTALL_PROGRAM} ${WRKSRC}/lposix.so ${LUA_MODLIBDIR}
.include <bsd.port.mk>
.include "${MASTERDIR}/Makefile"

View file

@ -1,3 +0,0 @@
MD5 (lposix.tar.gz) = f22871247e444412a901d179028a0d82
SHA256 (lposix.tar.gz) = e5140e19df90069b579be7983506e2461b6678e9e80b82545b6ca8070fd318a3
SIZE (lposix.tar.gz) = 9651

View file

@ -1,30 +0,0 @@
--- Makefile.orig Wed Nov 5 21:26:49 2003
+++ Makefile Mon Aug 7 00:38:38 2006
@@ -1,13 +1,13 @@
# makefile for POSIX library for Lua
# change these to reflect your Lua installation
-LUA= /tmp/lhf/lua-5.0
-LUAINC= $(LUA)/include
-LUALIB= $(LUA)/lib
-LUABIN= $(LUA)/bin
+LUA= ${PREFIX}
+LUAINC= $(LUA_INCDIR)
+LUALIB= $(LUA_LIBDIR)
+LUABIN= $(LUA_BINDIR)
# no need to change anything below here
-CFLAGS= -fPIC $(INCS) $(WARN) -O2 $G
+CFLAGS+= -fPIC $(INCS) $(WARN) -O2 $G
WARN= -pedantic -Wall
INCS= -I$(LUAINC)
@@ -21,7 +21,7 @@
all: test
test: $T
- $(LUABIN)/lua -l$(MYNAME) test.lua
+ LD_PRELOAD=${LUA_LIBDIR}/liblua.so:${LUA_LIBDIR}/liblualib.so $(LUABIN)/lua -l$(MYNAME) test.lua
$T: $(OBJS)
$(CC) -o $@ -shared $(OBJS)

View file

@ -1,8 +0,0 @@
--- posix.lua.orig Tue Apr 11 23:59:52 2006
+++ posix.lua Wed Apr 12 00:00:49 2006
@@ -8,3 +8,5 @@
end
so"posix"
+
+return posix