On Tue, Oct 18, 2016 at 09:16:22AM +1100, Jonathan Gray wrote:
> On Tue, Apr 26, 2016 at 03:15:53PM +1000, Jonathan Gray wrote:
> > If the bit32 compat lua module is built against lua 5.2 and used with
> > luajit52 it fails with:
> > 
> > $ luajit52  
> > LuaJIT 2.0.4 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/
> > JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> > > bit32 = require "bit32"
> > luajit52:/usr/local/lib/lua/5.2/bit32.so: undefined symbol 
> > 'luaL_checkunsigned'
> > luajit52:/usr/local/lib/lua/5.2/bit32.so: undefined symbol 
> > 'lua_pushunsigned'
> > luajit52:/usr/local/lib/lua/5.2/bit32.so: undefined symbol 'luaL_setfuncs'
> > error loading module 'bit32' from file '/usr/local/lib/lua/5.2/bit32.so':
> >         Cannot load specified object
> > stack traceback:
> >         [C]: at 0x160e11850290
> >         [C]: in function 'require'
> >         stdin:1: in main chunk
> >         [C]: at 0x160e11807d90
> > 
> > Building against the luajit headers instead of the lua 5.2 headers seems
> > to fix this.
> > 
> > Building against lua 5.1 headers and using luajit51 seems to work.
> > 
> > But the real problem seems to be that luajit with the minimal 5.2 compat
> > flag enabled is abi compatible with lua 5.1 not lua 5.2.  The port
> > incorrectly changes this so it can use lua.port.mk with the FLAVOR.
> > 
> > http://luajit.org/extensions.html
> > 
> > "Note: this provides only partial compatibility with Lua 5.2 at the
> > language and Lua library level. LuaJIT is API+ABI-compatible with
> > Lua 5.1, which prevents implementing features that would otherwise break
> > the Lua/C API and ABI (e.g. _ENV)."
> > 
> 
> with lua52 flavour of luaposix
> 
> $ luajit52                                                                    
>  
> LuaJIT 2.0.4 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/
> JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> > errno = require "posix.errno"
> luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_pcallk'
> luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_tointegerx'
> luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_tonumberx'
> luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'lua_rawlen'
> luajit52:/usr/local/lib/lua/5.2/posix.so: undefined symbol 'luaL_setfuncs'
> error loading module 'posix.errno' from file 
> '/usr/local/lib/lua/5.2/posix.so':
>         Cannot load specified object
> stack traceback:
>         [C]: at 0x0795feb501c0
>         [C]: in function 'require'
>         stdin:1: in main chunk
>         [C]: at 0x0795feb07d90
> >
> 
> $ lua52                                                                       
>  
> Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio
> > errno = require "posix.errno"
> >
> 
> with luaposix without a flavour
> 
> $ luajit51                                                                    
>  
> LuaJIT 2.0.4 -- Copyright (C) 2005-2015 Mike Pall. http://luajit.org/
> JIT: ON CMOV SSE2 SSE3 SSE4.1 fold cse dce fwd dse narrow loop abc sink fuse
> > errno = require "posix.errno"
> >
> 

Here is an attempt to fix it, likely needs more work:

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/luajit/Makefile,v
retrieving revision 1.19
diff -u -p -r1.19 Makefile
--- Makefile    18 Mar 2016 23:12:18 -0000      1.19
+++ Makefile    17 Oct 2016 22:57:09 -0000
@@ -3,10 +3,11 @@
 ONLY_FOR_ARCHS = powerpc i386 amd64
 # arm needs EABI/aapcs
 
-SHARED_LIBS += luajit-${MODLUA_VERSION} 0.0 # 2.0.4
+SHARED_LIBS += luajit-5.1 0.0 # 2.0.4
 
 COMMENT =      just-in-time compiler for Lua
 V =            2.0.4
+REVISION =     0
 DISTNAME =     LuaJIT-${V}
 PKGNAME =      ${DISTNAME:L}
 
@@ -34,9 +35,9 @@ MAKE_FLAGS += \
        CC="${CC}" \
        CCOPT="${CFLAGS}" \
        CCOPT_x86="" \
-       INSTALL_LJLIBD="${DESTDIR}${MODLUA_DATADIR}" \
+       INSTALL_LJLIBD="${DESTDIR}${PREFIX}/share/lua/5.1/" \
        INSTALL_MAN="${DESTDIR}${PREFIX}/man/man1" \
-       
INSTALL_SONAME=libluajit-${MODLUA_VERSION}.so.${LIBluajit-${MODLUA_VERSION}_VERSION}
 \
+       INSTALL_SONAME=libluajit-5.1.so.${LIBluajit-5.1_VERSION} \
        PREFIX="${PREFIX}"
 
 USE_GMAKE =    Yes
Index: patches/patch-Makefile
===================================================================
RCS file: /cvs/ports/lang/luajit/patches/patch-Makefile,v
retrieving revision 1.5
diff -u -p -r1.5 patch-Makefile
--- patches/patch-Makefile      6 Jun 2015 09:03:16 -0000       1.5
+++ patches/patch-Makefile      17 Oct 2016 22:27:32 -0000
@@ -1,15 +1,6 @@
 $OpenBSD: patch-Makefile,v 1.5 2015/06/06 09:03:16 dcoppa Exp $
---- Makefile.orig      Thu May 14 20:30:00 2015
-+++ Makefile   Thu Jun  4 19:20:59 2015
-@@ -17,7 +17,7 @@ MAJVER=  2
- MINVER=  0
- RELVER=  4
- VERSION= $(MAJVER).$(MINVER).$(RELVER)
--ABIVER=  5.1
-+ABIVER=  ${MODLUA_VERSION}
- 
- ##############################################################################
- #
+--- Makefile.orig      Fri May 15 04:30:00 2015
++++ Makefile   Tue Oct 18 09:24:09 2016
 @@ -111,18 +111,13 @@ install: $(INSTALL_DEP)
        cd src && test -f $(FILE_A) && $(INSTALL_F) $(FILE_A) $(INSTALL_STATIC) 
|| :
        $(RM) $(INSTALL_TSYM) $(INSTALL_DYN) $(INSTALL_SHORT1) $(INSTALL_SHORT2)
Index: patches/patch-etc_luajit_pc
===================================================================
RCS file: /cvs/ports/lang/luajit/patches/patch-etc_luajit_pc,v
retrieving revision 1.1
diff -u -p -r1.1 patch-etc_luajit_pc
--- patches/patch-etc_luajit_pc 6 Jun 2015 09:03:16 -0000       1.1
+++ patches/patch-etc_luajit_pc 17 Oct 2016 22:27:21 -0000
@@ -1,12 +1,9 @@
 $OpenBSD: patch-etc_luajit_pc,v 1.1 2015/06/06 09:03:16 dcoppa Exp $
---- etc/luajit.pc.orig Thu Jun  4 20:05:32 2015
-+++ etc/luajit.pc      Thu Jun  4 20:06:57 2015
-@@ -3,9 +3,9 @@ majver=2
- minver=0
- relver=4
+--- etc/luajit.pc.orig Fri May 15 04:30:00 2015
++++ etc/luajit.pc      Tue Oct 18 09:24:31 2016
+@@ -5,7 +5,7 @@ relver=4
  version=${majver}.${minver}.${relver}
--abiver=5.1
-+abiver=${MODLUA_VERSION}
+ abiver=5.1
  
 -prefix=/usr/local
 +prefix=${TRUEPREFIX}
Index: patches/patch-src_luaconf_h
===================================================================
RCS file: /cvs/ports/lang/luajit/patches/patch-src_luaconf_h,v
retrieving revision 1.1
diff -u -p -r1.1 patch-src_luaconf_h
--- patches/patch-src_luaconf_h 6 Jun 2015 09:03:16 -0000       1.1
+++ patches/patch-src_luaconf_h 17 Oct 2016 22:27:26 -0000
@@ -1,15 +1,14 @@
 $OpenBSD: patch-src_luaconf_h,v 1.1 2015/06/06 09:03:16 dcoppa Exp $
---- src/luaconf.h.orig Thu Jun  4 21:49:15 2015
-+++ src/luaconf.h      Thu Jun  4 21:52:03 2015
+--- src/luaconf.h.orig Fri May 15 04:30:00 2015
++++ src/luaconf.h      Tue Oct 18 09:25:09 2016
 @@ -35,9 +35,9 @@
  #ifndef LUA_LMULTILIB
  #define LUA_LMULTILIB "lib"
  #endif
 -#define LUA_LROOT     "/usr/local"
--#define LUA_LUADIR    "/lua/5.1/"
--#define LUA_LJDIR     "/luajit-2.0.4/"
 +#define LUA_LROOT     "${TRUEPREFIX}"
-+#define LUA_LUADIR    "/lua/${MODLUA_VERSION}/"
+ #define LUA_LUADIR    "/lua/5.1/"
+-#define LUA_LJDIR     "/luajit-2.0.4/"
 +#define LUA_LJDIR     "/luajit-2.0/"
  
  #ifdef LUA_ROOT
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/lang/luajit/pkg/PLIST,v
retrieving revision 1.2
diff -u -p -r1.2 PLIST
--- pkg/PLIST   3 May 2014 14:24:03 -0000       1.2
+++ pkg/PLIST   17 Oct 2016 22:53:37 -0000
@@ -7,22 +7,22 @@ include/luajit-2.0/lua.hpp
 include/luajit-2.0/luaconf.h
 include/luajit-2.0/luajit.h
 include/luajit-2.0/lualib.h
-@comment lib/libluajit-${MODLUA_VERSION}.so
-lib/libluajit-${MODLUA_VERSION}.a
-@lib lib/libluajit-${MODLUA_VERSION}.so.${LIBluajit-${MODLUA_VERSION}_VERSION}
-lib/lua/${MODLUA_VERSION}/
+@comment lib/libluajit-5.1.so
+lib/libluajit-5.1.a
+@lib lib/libluajit-5.1.so.${LIBluajit-5.1_VERSION}
+lib/lua/5.1/
 lib/pkgconfig/luajit.pc
 @man man/man1/luajit.1
-share/lua/${MODLUA_VERSION}/
-share/lua/${MODLUA_VERSION}/jit/
-share/lua/${MODLUA_VERSION}/jit/bc.lua
-share/lua/${MODLUA_VERSION}/jit/bcsave.lua
-share/lua/${MODLUA_VERSION}/jit/dis_arm.lua
-share/lua/${MODLUA_VERSION}/jit/dis_mips.lua
-share/lua/${MODLUA_VERSION}/jit/dis_mipsel.lua
-share/lua/${MODLUA_VERSION}/jit/dis_ppc.lua
-share/lua/${MODLUA_VERSION}/jit/dis_x64.lua
-share/lua/${MODLUA_VERSION}/jit/dis_x86.lua
-share/lua/${MODLUA_VERSION}/jit/dump.lua
-share/lua/${MODLUA_VERSION}/jit/v.lua
-share/lua/${MODLUA_VERSION}/jit/vmdef.lua
+share/lua/5.1/
+share/lua/5.1/jit/
+share/lua/5.1/jit/bc.lua
+share/lua/5.1/jit/bcsave.lua
+share/lua/5.1/jit/dis_arm.lua
+share/lua/5.1/jit/dis_mips.lua
+share/lua/5.1/jit/dis_mipsel.lua
+share/lua/5.1/jit/dis_ppc.lua
+share/lua/5.1/jit/dis_x64.lua
+share/lua/5.1/jit/dis_x86.lua
+share/lua/5.1/jit/dump.lua
+share/lua/5.1/jit/v.lua
+share/lua/5.1/jit/vmdef.lua

Reply via email to