pkgsrc-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
pkg/57414: LuaJIT2 not working correctly on macOS
>Number: 57414
>Category: pkg
>Synopsis: LuaJIT2 not working correctly on macOS
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: pkg-manager
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed May 17 14:55:00 +0000 2023
>Originator: jonathan buschmann
>Release: pkgsrc trunk / HEAD
>Organization:
>Environment:
sw_vers
ProductName: macOS
ProductVersion: 12.6.5
BuildVersion: 21G531
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
XCode 14.2
>Description:
LuaJIT2 is using an outdated and far from recommended to use anymore.
Unfortunately there is no clear indication when an update _official_ release will be made.
The fact that this library/code is outdate is mostly visible when using `neovim` on macOS (at least I get some strange behavior).
>How-To-Repeat:
>Fix:
The solution are to use :
1. LuaJIT2 code with a specific git tag and version this by a _date_
2. or use an alternative maintainer of LuaJIT2
(Both options are in the diff below and by default is to be as close as possible to the original code).
diff --git c/lang/LuaJIT2/Makefile i/lang/LuaJIT2/Makefile
index 5a493451d75..14c9de0389b 100644
--- c/lang/LuaJIT2/Makefile
+++ i/lang/LuaJIT2/Makefile
@@ -1,11 +1,21 @@
# $NetBSD: Makefile,v 1.16 2020/11/06 12:15:53 nia Exp $
#
-DISTNAME= LuaJIT-2.0.5
-PKGNAME= ${DISTNAME:S/LuaJIT/LuaJIT2/}
-PKGREVISION= 2
+DISTNAME= luajit-v2.1-20230430
+PKGNAME= ${DISTNAME:C/luajit-v([.0-9]+)-(.*)/LuaJIT2-\1.0.\2/}
CATEGORIES= lang lua
-MASTER_SITES= http://luajit.org/download/
+MASTER_SITES= ${MASTER_SITE_GITHUB:=LuaJIT/}
+
+GITHUB_PROJECT= LuaJIT
+GITHUB_TAG= 224129a8e64bfa219d35cd03055bf03952f167f6
+
+# DISTNAME= luajit-v2.1-20230410
+# PKGNAME= ${DISTNAME:C/luajit-v([.0-9]+)-(.*)/LuaJIT2-\1.0.\2/}
+# CATEGORIES= lang lua
+# MASTER_SITES= ${MASTER_SITE_GITHUB:=openresty/}
+
+# GITHUB_PROJECT= luajit2
+# GITHUB_TAG= ${DISTNAME:S/luajit-//}
MAINTAINER= pkgsrc-users%NetBSD.org@localhost
HOMEPAGE= https://luajit.org/
@@ -28,6 +38,17 @@ PTHREAD_AUTO_VARS= yes
.include "../../mk/bsd.prefs.mk"
+NOT_PAX_MPROTECT_SAFE+= bin/luajit-${PKGVERSION}
+
+MAKE_ENV+= PREREL=-${PKGVERSION}
+BUILD_TARGET= amalg
+CFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT
+
+.if ${OPSYS} == "Darwin" && ${OS_VERSION:R} >= 19
+CFLAGS.Darwin+= -fno-stack-check
+MAKE_ENV+= MACOSX_DEPLOYMENT_TARGET="${OSX_VERSION}"
+.endif
+
# Upstream doesn't support building shared libs on SunOS
# http://www.freelists.org/post/luajit/LuaJIT-on-solaris-64
PLIST_VARS+= shared
diff --git c/lang/LuaJIT2/PLIST i/lang/LuaJIT2/PLIST
index f02164a6134..d1f65185970 100644
--- c/lang/LuaJIT2/PLIST
+++ i/lang/LuaJIT2/PLIST
@@ -1,28 +1,33 @@
-@comment $NetBSD: PLIST,v 1.3 2016/06/21 16:40:10 fhajny Exp $
-bin/luajit
-bin/luajit-${PKGVERSION}
-include/luajit-2.0/lauxlib.h
-include/luajit-2.0/lua.h
-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 $NetBSD$
+bin/luajit-2.1.0-${PKGVERSION}
+include/luajit-2.1/lauxlib.h
+include/luajit-2.1/lua.h
+include/luajit-2.1/lua.hpp
+include/luajit-2.1/luaconf.h
+include/luajit-2.1/luajit.h
+include/luajit-2.1/lualib.h
+lib/libluajit-5.1.2.1.0.dylib
+lib/libluajit-5.1.2.dylib
lib/libluajit-5.1.a
-${PLIST.shared}lib/libluajit-5.1.so
-${PLIST.shared}lib/libluajit-5.1.so.2
-${PLIST.shared}lib/libluajit-5.1.so.${PKGVERSION}
+lib/libluajit-5.1.dylib
lib/pkgconfig/luajit.pc
-share/luajit-${PKGVERSION}/jit/bc.lua
-share/luajit-${PKGVERSION}/jit/bcsave.lua
-share/luajit-${PKGVERSION}/jit/dis_arm.lua
-share/luajit-${PKGVERSION}/jit/dis_mips.lua
-share/luajit-${PKGVERSION}/jit/dis_mipsel.lua
-share/luajit-${PKGVERSION}/jit/dis_ppc.lua
-share/luajit-${PKGVERSION}/jit/dis_x64.lua
-share/luajit-${PKGVERSION}/jit/dis_x86.lua
-share/luajit-${PKGVERSION}/jit/dump.lua
-share/luajit-${PKGVERSION}/jit/v.lua
-share/luajit-${PKGVERSION}/jit/vmdef.lua
man/man1/luajit.1
+share/luajit-2.1.0-${PKGVERSION}/jit/bc.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/bcsave.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_arm.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_arm64.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_arm64be.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_mips.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_mips64.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_mips64el.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_mipsel.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_ppc.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_x64.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dis_x86.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/dump.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/p.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/v.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/vmdef.lua
+share/luajit-2.1.0-${PKGVERSION}/jit/zone.lua
@pkgdir share/lua/5.1
@pkgdir lib/lua/5.1
diff --git c/lang/LuaJIT2/distinfo i/lang/LuaJIT2/distinfo
index 9c095926fb6..2be5cc45f6b 100644
--- c/lang/LuaJIT2/distinfo
+++ i/lang/LuaJIT2/distinfo
@@ -1,10 +1,6 @@
$NetBSD: distinfo,v 1.13 2021/10/26 10:51:29 nia Exp $
-BLAKE2s (LuaJIT-2.0.5.tar.gz) = 54f7b86f27f588160895a8e076bb11d63eb60bdad87c9e573d627ae03ea5319d
-SHA512 (LuaJIT-2.0.5.tar.gz) = 2636675602b4a060b0571c05220db2061dd2f38568e35b2be346a0f5e3128d87057d11d3d0d7567d8cc4e0817b5e4cf2c52a17a48065520962b157816465a9fe
-Size (LuaJIT-2.0.5.tar.gz) = 849845 bytes
-SHA1 (patch-Makefile) = edea30d017c9d2938d951bfdee88020906945aee
-SHA1 (patch-src_Makefile) = d7236260dc17f470d7d6e41a57a22dcd3a501c28
-SHA1 (patch-src_lj__arch.h) = 4c34706db4c678b368bb3e38b07505abde01e590
-SHA1 (patch-src_lj__ccallback.c) = 8032bc451a504ae9538fb0ae4cc1ee729ede3a70
-SHA1 (patch-src_lj__mcode.c) = c150e0b07ab441e983ace21e0e813fd4334290b5
+BLAKE2s (luajit-v2.1-20230430-224129a8e64bfa219d35cd03055bf03952f167f6.tar.gz) = 967d6064f27393b7401022b67011fb84e307a783db30e5c05f53cb860dd3ce1e
+SHA512 (luajit-v2.1-20230430-224129a8e64bfa219d35cd03055bf03952f167f6.tar.gz) = d035dd4f45fcbf364642c57bd7af7569261aa94cb2c177d420b71f78762887549560f126852b4ce7e8a479202c8f15a95aa6407019aacd3bd66fe37954d05380
+Size (luajit-v2.1-20230430-224129a8e64bfa219d35cd03055bf03952f167f6.tar.gz) = 1075631 bytes
+SHA1 (patch-Makefile) = a3804821d3ede1048ce87138342f0f2ee852f294
diff --git c/lang/LuaJIT2/patches/patch-Makefile i/lang/LuaJIT2/patches/patch-Makefile
index aac8fcb70dc..d9d4e49db3b 100644
--- c/lang/LuaJIT2/patches/patch-Makefile
+++ i/lang/LuaJIT2/patches/patch-Makefile
@@ -2,9 +2,18 @@ $NetBSD: patch-Makefile,v 1.6 2017/05/29 21:47:31 alnsn Exp $
Fix installation.
---- Makefile.orig 2017-05-01 18:11:00.000000000 +0000
-+++ Makefile
-@@ -24,7 +24,6 @@ ABIVER= 5.1
+--- Makefile 2023-04-30 19:38:29.000000000 +0800
++++ Makefile 2023-05-15 13:08:32.000000000 +0800
+@@ -16,7 +16,7 @@
+ MAJVER= 2
+ MINVER= 1
+ RELVER= 0
+-PREREL= -beta3
++PREREL?= -beta3
+ VERSION= $(MAJVER).$(MINVER).$(RELVER)$(PREREL)
+ ABIVER= 5.1
+
+@@ -25,7 +25,6 @@
# Change the installation path as needed. This automatically adjusts
# the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
#
@@ -12,7 +21,7 @@ Fix installation.
export MULTILIB= lib
##############################################################################
-@@ -40,7 +39,7 @@ INSTALL_LMODD= $(INSTALL_SHARE)/lua
+@@ -42,7 +41,7 @@
INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
INSTALL_CMODD= $(INSTALL_LIB)/lua
INSTALL_CMOD= $(INSTALL_CMODD)/$(ABIVER)
@@ -21,12 +30,12 @@ Fix installation.
INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
INSTALL_TNAME= luajit-$(VERSION)
-@@ -74,7 +73,7 @@ SYMLINK= ln -sf
+@@ -76,7 +75,7 @@
INSTALL_X= install -m 0755
INSTALL_F= install -m 0644
UNINSTALL= $(RM)
--LDCONFIG= ldconfig -n
+-LDCONFIG= ldconfig -n 2>/dev/null
+LDCONFIG= true
SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
-e "s|^multilib=.*|multilib=$(MULTILIB)|"
-
+ ifneq ($(INSTALL_DEFINC),$(INSTALL_INC))
diff --git c/lang/LuaJIT2/patches/patch-src_Makefile i/lang/LuaJIT2/patches/patch-src_Makefile
deleted file mode 100644
index 85dfba636cb..00000000000
--- c/lang/LuaJIT2/patches/patch-src_Makefile
+++ /dev/null
@@ -1,16 +0,0 @@
-$NetBSD: patch-src_Makefile,v 1.2 2017/05/29 21:47:31 alnsn Exp $
-
-Fix building on OS X.
-
---- src/Makefile.orig 2017-05-01 18:11:00.000000000 +0000
-+++ src/Makefile
-@@ -297,9 +297,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null
- TARGET_XCFLAGS+= -fno-stack-protector
- endif
- ifeq (Darwin,$(TARGET_SYS))
-- ifeq (,$(MACOSX_DEPLOYMENT_TARGET))
-- export MACOSX_DEPLOYMENT_TARGET=10.4
-- endif
- TARGET_STRIP+= -x
- TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC
- TARGET_DYNXLDOPTS=
diff --git c/lang/LuaJIT2/patches/patch-src_lj__arch.h i/lang/LuaJIT2/patches/patch-src_lj__arch.h
deleted file mode 100644
index 55835241d1e..00000000000
--- c/lang/LuaJIT2/patches/patch-src_lj__arch.h
+++ /dev/null
@@ -1,32 +0,0 @@
-$NetBSD: patch-src_lj__arch.h,v 1.1 2018/06/02 20:01:21 he Exp $
-
-Fix the test for endianness so that NetBSD/powerpc isn't
-mis-categorized as little-endian only because _LITTLE_ENDIAN
-is defined -- what matters on NetBSD is the value of _BYTE_ORDER.
-
---- src/lj_arch.h.orig 2017-05-01 18:11:00.000000000 +0000
-+++ src/lj_arch.h
-@@ -339,12 +339,21 @@
- #if defined(_SOFT_FLOAT) || defined(_SOFT_DOUBLE)
- #error "No support for PowerPC CPUs without double-precision FPU"
- #endif
--#if defined(_LITTLE_ENDIAN)
--#error "No support for little-endian PowerPC"
-+
-+#if defined(_BYTE_ORDER) && defined(_LITTLE_ENDIAN)
-+# if (_BYTE_ORDER == _LITTLE_ENDIAN)
-+# error "No support for little-endian PowerPC"
-+# endif
-+#else
-+# if defined(_LITTLE_ENDIAN)
-+# error "No support for little-endian PowerPC"
-+# endif
- #endif
-+
- #if defined(_LP64)
- #error "No support for PowerPC 64 bit mode"
- #endif
-+
- #elif LJ_TARGET_MIPS
- #if defined(__mips_soft_float)
- #error "No support for MIPS CPUs without FPU"
diff --git c/lang/LuaJIT2/patches/patch-src_lj__ccallback.c i/lang/LuaJIT2/patches/patch-src_lj__ccallback.c
deleted file mode 100644
index acfab0a0d84..00000000000
--- c/lang/LuaJIT2/patches/patch-src_lj__ccallback.c
+++ /dev/null
@@ -1,21 +0,0 @@
-$NetBSD: patch-src_lj__ccallback.c,v 1.1 2020/11/06 12:15:53 nia Exp $
-
-Make this PaX-MPROTECT safe on NetBSD.
-
---- src/lj_ccallback.c.orig 2017-05-01 18:11:00.000000000 +0000
-+++ src/lj_ccallback.c
-@@ -228,8 +228,12 @@ static void callback_mcode_new(CTState *
- if (!p)
- lj_err_caller(cts->L, LJ_ERR_FFI_CBACKOV);
- #elif LJ_TARGET_POSIX
-- p = mmap(NULL, sz, (PROT_READ|PROT_WRITE), MAP_PRIVATE|MAP_ANONYMOUS,
-- -1, 0);
-+#ifdef PROT_MPROTECT
-+ p = mmap(NULL, sz, (PROT_READ|PROT_WRITE) | PROT_MPROTECT(PROT_EXEC),
-+#else
-+ p = mmap(NULL, sz, (PROT_READ|PROT_WRITE),
-+#endif
-+ MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
- if (p == MAP_FAILED)
- lj_err_caller(cts->L, LJ_ERR_FFI_CBACKOV);
- #else
diff --git c/lang/LuaJIT2/patches/patch-src_lj__mcode.c i/lang/LuaJIT2/patches/patch-src_lj__mcode.c
deleted file mode 100644
index 647e6ac3bd4..00000000000
--- c/lang/LuaJIT2/patches/patch-src_lj__mcode.c
+++ /dev/null
@@ -1,27 +0,0 @@
-$NetBSD: patch-src_lj__mcode.c,v 1.1 2020/11/06 12:15:53 nia Exp $
-
-Make PaX-MPROTECT safe for NetBSD.
-
---- src/lj_mcode.c.orig 2017-05-01 18:11:00.000000000 +0000
-+++ src/lj_mcode.c
-@@ -99,7 +99,11 @@ static int mcode_setprot(void *p, size_t
-
- static void *mcode_alloc_at(jit_State *J, uintptr_t hint, size_t sz, int prot)
- {
-+#ifdef PROT_MPROTECT
-+ void *p = mmap((void *)hint, sz, prot | PROT_MPROTECT(MCPROT_RWX), MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-+#else
- void *p = mmap((void *)hint, sz, prot, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
-+#endif
- if (p == MAP_FAILED) {
- if (!hint) lj_trace_err(J, LJ_TRERR_MCODEAL);
- p = NULL;
-@@ -255,7 +259,7 @@ static void *mcode_alloc(jit_State *J, s
- /* All memory addresses are reachable by relative jumps. */
- static void *mcode_alloc(jit_State *J, size_t sz)
- {
--#ifdef __OpenBSD__
-+#if defined(__NetBSD__) || defined(__OpenBSD__)
- /* Allow better executable memory allocation for OpenBSD W^X mode. */
- void *p = mcode_alloc_at(J, 0, sz, MCPROT_RUN);
- if (p && mcode_setprot(p, sz, MCPROT_GEN)) {
Home |
Main Index |
Thread Index |
Old Index