pkgsrc-WIP-changes archive

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

LuaJIT2: Import v2.0.5 from -current



Module Name:	pkgsrc-wip
Committed By:	Malte Dehling <mdehling%gmail.com@localhost>
Pushed By:	mdehling
Date:		Tue Apr 2 20:14:02 2024 -0700
Changeset:	cffc26b7086a267b191e118e2b20a29f58d7da7f

Modified Files:
	Makefile
Added Files:
	LuaJIT2/DESCR
	LuaJIT2/Makefile
	LuaJIT2/PLIST
	LuaJIT2/buildlink3.mk
	LuaJIT2/distinfo
	LuaJIT2/patches/patch-Makefile
	LuaJIT2/patches/patch-src_Makefile
	LuaJIT2/patches/patch-src_lj__arch.h
	LuaJIT2/patches/patch-src_lj__ccallback.c
	LuaJIT2/patches/patch-src_lj__mcode.c
	LuaJIT2/platform.mk

Log Message:
LuaJIT2: Import v2.0.5 from -current

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=cffc26b7086a267b191e118e2b20a29f58d7da7f

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 LuaJIT2/DESCR                             |  5 ++++
 LuaJIT2/Makefile                          | 40 +++++++++++++++++++++++++++++++
 LuaJIT2/PLIST                             | 28 ++++++++++++++++++++++
 LuaJIT2/buildlink3.mk                     | 12 ++++++++++
 LuaJIT2/distinfo                          | 10 ++++++++
 LuaJIT2/patches/patch-Makefile            | 32 +++++++++++++++++++++++++
 LuaJIT2/patches/patch-src_Makefile        | 16 +++++++++++++
 LuaJIT2/patches/patch-src_lj__arch.h      | 32 +++++++++++++++++++++++++
 LuaJIT2/patches/patch-src_lj__ccallback.c | 21 ++++++++++++++++
 LuaJIT2/patches/patch-src_lj__mcode.c     | 27 +++++++++++++++++++++
 LuaJIT2/platform.mk                       | 18 ++++++++++++++
 Makefile                                  |  1 +
 12 files changed, 242 insertions(+)

diffs:
diff --git a/LuaJIT2/DESCR b/LuaJIT2/DESCR
new file mode 100644
index 0000000000..67c43e77d5
--- /dev/null
+++ b/LuaJIT2/DESCR
@@ -0,0 +1,5 @@
+LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language.
+Lua is a powerful, dynamic and light-weight programming language. It may
+be embedded or used as a general-purpose, stand-alone language.
+
+LuaJIT 2.0 is compatible with Lua 5.1.
diff --git a/LuaJIT2/Makefile b/LuaJIT2/Makefile
new file mode 100644
index 0000000000..5a493451d7
--- /dev/null
+++ b/LuaJIT2/Makefile
@@ -0,0 +1,40 @@
+# $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
+CATEGORIES=	lang lua
+MASTER_SITES=	http://luajit.org/download/
+
+MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=	https://luajit.org/
+COMMENT=	Just-In-Time Compiler for the Lua programming language
+LICENSE=	mit
+
+USE_TOOLS+=	gmake
+
+# LuaJIT 2.1.0 will support mips64 and aarch64.
+ONLY_FOR_PLATFORM+=	*-*-*arm*
+ONLY_FOR_PLATFORM+=	*-*-i386
+ONLY_FOR_PLATFORM+=	*-*-mipseb
+ONLY_FOR_PLATFORM+=	*-*-mipsel
+ONLY_FOR_PLATFORM+=	*-*-powerpc
+ONLY_FOR_PLATFORM+=	*-*-x86_64
+
+# Address pkg/47587 lua not linked to pthread causes issues with modules
+PTHREAD_OPTS+=		native
+PTHREAD_AUTO_VARS=	yes
+
+.include "../../mk/bsd.prefs.mk"
+
+# Upstream doesn't support building shared libs on SunOS
+# http://www.freelists.org/post/luajit/LuaJIT-on-solaris-64
+PLIST_VARS+=		shared
+.if ${OPSYS} != "SunOS"
+PLIST.shared=		yes
+.endif
+PRINT_PLIST_AWK+=	{if ($$0 ~ /\.so/) {$$0 = "$${PLIST.shared}" $$0;}}
+
+.include "../../mk/pthread.buildlink3.mk"
+.include "../../mk/bsd.pkg.mk"
diff --git a/LuaJIT2/PLIST b/LuaJIT2/PLIST
new file mode 100644
index 0000000000..f02164a613
--- /dev/null
+++ b/LuaJIT2/PLIST
@@ -0,0 +1,28 @@
+@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
+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/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
+@pkgdir share/lua/5.1
+@pkgdir lib/lua/5.1
diff --git a/LuaJIT2/buildlink3.mk b/LuaJIT2/buildlink3.mk
new file mode 100644
index 0000000000..79a799b70a
--- /dev/null
+++ b/LuaJIT2/buildlink3.mk
@@ -0,0 +1,12 @@
+# $NetBSD: buildlink3.mk,v 1.1 2014/03/26 13:29:53 imil Exp $
+
+BUILDLINK_TREE+=	LuaJIT2
+
+.if !defined(LUAJIT2_BUILDLINK3_MK)
+LUAJIT2_BUILDLINK3_MK:=
+
+BUILDLINK_API_DEPENDS.LuaJIT2+=	LuaJIT2>=2.0.3
+BUILDLINK_PKGSRCDIR.LuaJIT2?=	../../lang/LuaJIT2
+.endif	# LUAJIT2_BUILDLINK3_MK
+
+BUILDLINK_TREE+=	-LuaJIT2
diff --git a/LuaJIT2/distinfo b/LuaJIT2/distinfo
new file mode 100644
index 0000000000..9c095926fb
--- /dev/null
+++ b/LuaJIT2/distinfo
@@ -0,0 +1,10 @@
+$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
diff --git a/LuaJIT2/patches/patch-Makefile b/LuaJIT2/patches/patch-Makefile
new file mode 100644
index 0000000000..aac8fcb70d
--- /dev/null
+++ b/LuaJIT2/patches/patch-Makefile
@@ -0,0 +1,32 @@
+$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
+ # Change the installation path as needed. This automatically adjusts
+ # the paths in src/luaconf.h, too. Note: PREFIX must be an absolute path!
+ #
+-export PREFIX= /usr/local
+ export MULTILIB= lib
+ ##############################################################################
+ 
+@@ -40,7 +39,7 @@ INSTALL_LMODD= $(INSTALL_SHARE)/lua
+ INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER)
+ INSTALL_CMODD= $(INSTALL_LIB)/lua
+ INSTALL_CMOD= $(INSTALL_CMODD)/$(ABIVER)
+-INSTALL_MAN= $(INSTALL_SHARE)/man/man1
++INSTALL_MAN= $(DPREFIX)/${PKGMANDIR}/man1
+ INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig
+ 
+ INSTALL_TNAME= luajit-$(VERSION)
+@@ -74,7 +73,7 @@ SYMLINK= ln -sf
+ INSTALL_X= install -m 0755
+ INSTALL_F= install -m 0644
+ UNINSTALL= $(RM)
+-LDCONFIG= ldconfig -n
++LDCONFIG= true
+ SED_PC= sed -e "s|^prefix=.*|prefix=$(PREFIX)|" \
+             -e "s|^multilib=.*|multilib=$(MULTILIB)|"
+ 
diff --git a/LuaJIT2/patches/patch-src_Makefile b/LuaJIT2/patches/patch-src_Makefile
new file mode 100644
index 0000000000..85dfba636c
--- /dev/null
+++ b/LuaJIT2/patches/patch-src_Makefile
@@ -0,0 +1,16 @@
+$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 a/LuaJIT2/patches/patch-src_lj__arch.h b/LuaJIT2/patches/patch-src_lj__arch.h
new file mode 100644
index 0000000000..55835241d1
--- /dev/null
+++ b/LuaJIT2/patches/patch-src_lj__arch.h
@@ -0,0 +1,32 @@
+$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 a/LuaJIT2/patches/patch-src_lj__ccallback.c b/LuaJIT2/patches/patch-src_lj__ccallback.c
new file mode 100644
index 0000000000..acfab0a0d8
--- /dev/null
+++ b/LuaJIT2/patches/patch-src_lj__ccallback.c
@@ -0,0 +1,21 @@
+$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 a/LuaJIT2/patches/patch-src_lj__mcode.c b/LuaJIT2/patches/patch-src_lj__mcode.c
new file mode 100644
index 0000000000..647e6ac3bd
--- /dev/null
+++ b/LuaJIT2/patches/patch-src_lj__mcode.c
@@ -0,0 +1,27 @@
+$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)) {
diff --git a/LuaJIT2/platform.mk b/LuaJIT2/platform.mk
new file mode 100644
index 0000000000..679c094a64
--- /dev/null
+++ b/LuaJIT2/platform.mk
@@ -0,0 +1,18 @@
+# $NetBSD: platform.mk,v 1.1 2020/06/24 11:16:00 nia Exp $
+
+.include "../../mk/bsd.fast.prefs.mk"
+
+.if !defined(PLATFORM_SUPPORTS_LUAJIT)
+
+.  for _luajit_arch in *arm* i386 mipseb mipsel powerpc x86_64
+LUAJIT_PLATFORMS+=		*-*-${_luajit_arch}
+.  endfor
+
+.  for _luajit_platform in ${LUAJIT_PLATFORMS}
+.    if !empty(MACHINE_PLATFORM:M${_luajit_platform})
+PLATFORM_SUPPORTS_LUAJIT=	yes
+.    endif
+.  endfor
+PLATFORM_SUPPORTS_LUAJIT?=	no
+
+.endif # !defined(PLATFORM_SUPPORTS_LUAJIT)
diff --git a/Makefile b/Makefile
index bebff28a8c..2b6d1847e8 100644
--- a/Makefile
+++ b/Makefile
@@ -24,6 +24,7 @@ SUBDIR+=	Geomyidae-git
 SUBDIR+=	HP-1973
 SUBDIR+=	I2util
 SUBDIR+=	LuaJIT-git
+SUBDIR+=	LuaJIT2
 SUBDIR+=	LuaJIT21
 SUBDIR+=	MoleInvasion
 SUBDIR+=	OpenGLUT


Home | Main Index | Thread Index | Old Index