lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Hi

I did this port some years ago. I was thinking that it might be
interesting to at least let you know about it.
diff --git a/lua.h b/lua.h
index 219784cc..32ccdedc 100644
--- a/lua.h
+++ b/lua.h
@@ -12,6 +12,9 @@
 #include <stdarg.h>
 #include <stddef.h>
 
+#ifdef Plan9
+#pragma lib "/$M/lib/ape/liblua.a"
+#endif
 
 #include "luaconf.h"
 
diff --git a/mkfile b/mkfile
new file mode 100644
index 00000000..af0bbd98
--- /dev/null
+++ b/mkfile
@@ -0,0 +1,81 @@
+</$objtype/mkfile
+
+LIB=liblua.a
+
+OFILES=\
+     lzio.$O\
+     lctype.$O\
+     lopcodes.$O\
+     lmem.$O\
+     lundump.$O\
+     ldump.$O\
+     lstate.$O\
+     lgc.$O\
+     llex.$O\
+     lcode.$O\
+     lparser.$O\
+     ldebug.$O\
+     lfunc.$O\
+     lobject.$O\
+     ltm.$O\
+     lstring.$O\
+     ltable.$O\
+     ldo.$O\
+     lvm.$O\
+     lapi.$O\
+     lauxlib.$O\
+     lbaselib.$O\
+     lcorolib.$O\
+     ldblib.$O\
+     liolib.$O\
+     lmathlib.$O\
+     loadlib.$O\
+     loslib.$O\
+     lstrlib.$O\
+     ltablib.$O\
+     lutf8lib.$O\
+     linit.$O\
+    
+HFILES=\
+    /sys/include/ape/lauxlib.h\
+    /sys/include/ape/lua.h\
+    /sys/include/ape/luaconf.h\
+    /sys/include/ape/lualib.h\ 
+
+UPDATE=\
+    mkfile\
+    $HFILES\
+    ${OFILES:%.$O=%.c}\
+    ${LIB:/$objtype/%=/386/%}\
+
+</sys/src/cmd/mksyslib
+
+CC=pcc
+LD=pcc
+CFLAGS= -c -I. -D_C99_SNPRINTF_EXTENSION -D_POSIX_SOURCE \
+        -D_SUSV2_SOURCE -DLUA_POSIX -DENABLE_CJSON_GLOBAL \
+        -DMAKE_LIB -DPlan9 -DRand64='unsigned long long'
+
+%.$O: %.c
+    $CC $CFLAGS $stem.c
+
+install:V:
+    cp liblua.a /$objtype/lib/ape/liblua.a
+    cp lauxlib.h /sys/include/ape/lauxlib.h
+    cp lua.h /sys/include/ape/lua.h
+    cp luaconf.h /sys/include/ape/luaconf.h
+    cp lualib.h /sys/include/ape/lualib.h 
+    @{
+        mk -f mkfile_bin install
+    }
+
+clean:V:
+    rm -f *.[$OS]
+
+nuke:V:
+    rm -f $LIB
+    rm -f /$objtype/lib/ape/liblua.a
+    rm -f $HFILES
+    @{
+        mk -f mkfile_bin nuke
+    }
diff --git a/mkfile_bin b/mkfile_bin
new file mode 100644
index 00000000..211d576c
--- /dev/null
+++ b/mkfile_bin
@@ -0,0 +1,37 @@
+APE=/sys/src/ape
+<$APE/config
+
+TARG=lua 
+
+BIN=/$objtype/bin/ape
+
+OFILES=\
+    lua.$O \
+    
+HFILES=\
+    /sys/include/ape/lauxlib.h \
+    /sys/include/ape/lua.h \
+    /sys/include/ape/luaconf.h \
+    /sys/include/ape/lualib.h 
+
+UPDATE=\
+	mkfile\
+	$HFILES\
+	${OFILES:%.$O=%.c}\
+	/$objtype/lib/ape/liblua.a
+
+</sys/src/cmd/mkone
+
+CC=pcc
+LD=pcc
+CFLAGS= -c -I. -D_C99_SNPRINTF_EXTENSION -D_POSIX_SOURCE \
+        -D_SUSV2_SOURCE -DLUA_POSIX -DENABLE_CJSON_GLOBAL \
+        -DPlan9 -DMAKE_LUA
+
+install:V:
+        cp $O.out /$objtype/bin/ape/lua
+        
+nuke:V:
+        rm -f /$objtype/bin/ape/lua
+        
+