Hello,
Attached is an update patch for LuaJIT2
Best regards,
On 5 Sep 2023, at 18:14, jonathan buschmann wrote:
On 6 Sep 2023, at 0:00, nia wrote:
The following reply was made to PR pkg/57604; it has been noted by GNATS.
From: nia <nia%NetBSD.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: pkg/57604: LuaJIT2 use rolling release, patch to update pkgsrc
package
Date: Tue, 5 Sep 2023 15:58:06 +0000A few comments:
- For rolling release packages, the version number should be
x.y.z.YYYYMMDD.OK
- Your PLIST will result in the package being broken on
everything except macOS. Ideally, it should be fixed to
build with libtool, like the other Lua interpreters.I’m sorry I only have a macOS system available.
- Deleting the MPROTECT-safety patches is quite rude.
pkgsrc packages should not suddenly become less secure
by surprise.
You are right.
diff --git i/lang/LuaJIT2/Makefile w/lang/LuaJIT2/Makefile index 5a493451d75..8b7bd8df640 100644 --- i/lang/LuaJIT2/Makefile +++ w/lang/LuaJIT2/Makefile @@ -1,11 +1,14 @@ # $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 +LUAJIT_TIMESTAMP= 1703358377 +DISTNAME= luajit-v2.1.${LUAJIT_TIMESTAMP} +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= c525bcb9024510cad9e170e12b6209aedb330f83 MAINTAINER= pkgsrc-users%NetBSD.org@localhost HOMEPAGE= https://luajit.org/ @@ -28,6 +31,20 @@ PTHREAD_AUTO_VARS= yes .include "../../mk/bsd.prefs.mk" +post-extract: + ${ECHO} ${LUAJIT_TIMESTAMP} > ${WRKSRC}/.relver + +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 + +PLIST_SUBST= LUAJIT_TIMESTAMP=${LUAJIT_TIMESTAMP} + # Upstream doesn't support building shared libs on SunOS # http://www.freelists.org/post/luajit/LuaJIT-on-solaris-64 PLIST_VARS+= shared @@ -38,3 +55,10 @@ PRINT_PLIST_AWK+= {if ($$0 ~ /\.so/) {$$0 = "$${PLIST.shared}" $$0;}} .include "../../mk/pthread.buildlink3.mk" .include "../../mk/bsd.pkg.mk" + +timestamp: + ${RUN} git --version > /dev/null 2>&1 + ${RUN} git clone https://github.com/LuaJIT/LuaJIT ${.TARGET}.tmp > /dev/null 2>&1 + @${ECHO_MSG} "Please update timestamp in Makefile with : " \ + $$(cd ${.TARGET}.tmp && git show -s --format=%ct) + ${ECHO} ${RM} -rf ${.TARGET}.tmp diff --git i/lang/LuaJIT2/PLIST w/lang/LuaJIT2/PLIST index f02164a6134..817ff2d4fdc 100644 --- i/lang/LuaJIT2/PLIST +++ w/lang/LuaJIT2/PLIST @@ -1,28 +1,36 @@ -@comment $NetBSD: PLIST,v 1.3 2016/06/21 16:40:10 fhajny Exp $ +@comment $NetBSD$ 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 +bin/luajit-2.1 +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.${LUAJIT_TIMESTAMP}.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/jit/bc.lua +share/luajit-2.1/jit/bcsave.lua +share/luajit-2.1/jit/dis_arm.lua +share/luajit-2.1/jit/dis_arm64.lua +share/luajit-2.1/jit/dis_arm64be.lua +share/luajit-2.1/jit/dis_mips.lua +share/luajit-2.1/jit/dis_mips64.lua +share/luajit-2.1/jit/dis_mips64el.lua +share/luajit-2.1/jit/dis_mips64r6.lua +share/luajit-2.1/jit/dis_mips64r6el.lua +share/luajit-2.1/jit/dis_mipsel.lua +share/luajit-2.1/jit/dis_ppc.lua +share/luajit-2.1/jit/dis_x64.lua +share/luajit-2.1/jit/dis_x86.lua +share/luajit-2.1/jit/dump.lua +share/luajit-2.1/jit/p.lua +share/luajit-2.1/jit/v.lua +share/luajit-2.1/jit/vmdef.lua +share/luajit-2.1/jit/zone.lua @pkgdir share/lua/5.1 @pkgdir lib/lua/5.1 diff --git i/lang/LuaJIT2/distinfo w/lang/LuaJIT2/distinfo index 9c095926fb6..dde4b33af23 100644 --- i/lang/LuaJIT2/distinfo +++ w/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.1703358377-c525bcb9024510cad9e170e12b6209aedb330f83.tar.gz) = 36922f5cba073a211f069b6e5cd87e03101b81bc061b9fa82c462e1086a7c32d +SHA512 (luajit-v2.1.1703358377-c525bcb9024510cad9e170e12b6209aedb330f83.tar.gz) = 86ed4b8fb5fabe8b7ce7c059d18acf16d527501edb1f5d1a0453e17b75a4722f1f048d0309515f25cd6c3850f22934ef793e709362ad88053dd2b0e4ab735666 +Size (luajit-v2.1.1703358377-c525bcb9024510cad9e170e12b6209aedb330f83.tar.gz) = 1079440 bytes +SHA1 (patch-Makefile) = 89904974c7e2737d5600c78669d0bdbf0de4cf0a diff --git i/lang/LuaJIT2/patches/patch-Makefile w/lang/LuaJIT2/patches/patch-Makefile index aac8fcb70dc..885bcd81165 100644 --- i/lang/LuaJIT2/patches/patch-Makefile +++ w/lang/LuaJIT2/patches/patch-Makefile @@ -2,9 +2,9 @@ $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-08-29 08:21:51.000000000 +0800 ++++ Makefile 2023-08-29 10:20:21.000000000 +0800 +@@ -30,7 +30,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 +12,7 @@ Fix installation. export MULTILIB= lib ############################################################################## -@@ -40,7 +39,7 @@ INSTALL_LMODD= $(INSTALL_SHARE)/lua +@@ -47,10 +46,10 @@ INSTALL_LMOD= $(INSTALL_LMODD)/$(ABIVER) INSTALL_CMODD= $(INSTALL_LIB)/lua INSTALL_CMOD= $(INSTALL_CMODD)/$(ABIVER) @@ -20,13 +20,17 @@ Fix installation. +INSTALL_MAN= $(DPREFIX)/${PKGMANDIR}/man1 INSTALL_PKGCONFIG= $(INSTALL_LIB)/pkgconfig - INSTALL_TNAME= luajit-$(VERSION) -@@ -74,7 +73,7 @@ SYMLINK= ln -sf +-INSTALL_TNAME= luajit-$(VERSION) ++INSTALL_TNAME= luajit-$(MMVERSION) + INSTALL_TSYMNAME= luajit + INSTALL_ANAME= libluajit-$(ABIVER).a + INSTALL_SOSHORT1= libluajit-$(ABIVER).so +@@ -81,7 +80,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)|" - + -e "s|^multilib=.*|multilib=$(MULTILIB)|" \ + -e "s|^relver=.*|relver=$(RELVER)|" diff --git i/lang/LuaJIT2/patches/patch-src_Makefile w/lang/LuaJIT2/patches/patch-src_Makefile deleted file mode 100644 index 85dfba636cb..00000000000 --- i/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 i/lang/LuaJIT2/patches/patch-src_lj__arch.h w/lang/LuaJIT2/patches/patch-src_lj__arch.h deleted file mode 100644 index 55835241d1e..00000000000 --- i/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 i/lang/LuaJIT2/patches/patch-src_lj__ccallback.c w/lang/LuaJIT2/patches/patch-src_lj__ccallback.c deleted file mode 100644 index acfab0a0d84..00000000000 --- i/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 i/lang/LuaJIT2/patches/patch-src_lj__mcode.c w/lang/LuaJIT2/patches/patch-src_lj__mcode.c deleted file mode 100644 index 647e6ac3bd4..00000000000 --- i/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)) {