pkgsrc-Bugs archive

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

pkg/57604: LuaJIT2 use rolling release, patch to update pkgsrc package



>Number:         57604
>Category:       pkg
>Synopsis:       LuaJIT2 use rolling release, patch to update pkgsrc package
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Tue Sep 05 15:40:00 +0000 2023
>Originator:     jonathan buschmann
>Release:        current
>Organization:
>Environment:
>Description:
Luajit2 as being packaged right now, is not working correctly see for example :

NetBSD Problem Report #57414

But recently (2023-08-23) LuaJIT announced to use `rolling release`, see https://www.freelists.org/post/luajit/LuaJIT-uses-rolling-releases

So the attached patch does just that with one minor modification; instead of using the _timestamp_ for the version identifier it uses the commit hash.
It has also been sent upstream (https://github.com/LuaJIT/LuaJIT/pull/1073)
As based on this comment (https://github.com/LuaJIT/LuaJIT/issues/1053#issuecomment-1689000029) it could be possible to report a bug against a commit hash.

Feel free to use a more commit and update the DISTNAME accordingly.
>How-To-Repeat:

>Fix:
diff --git c/lang/LuaJIT2/Makefile i/lang/LuaJIT2/Makefile
index 5a493451d75..07fbc431193 100644
--- c/lang/LuaJIT2/Makefile
+++ i/lang/LuaJIT2/Makefile
@@ -1,11 +1,13 @@
 # $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-20230829
+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=	83954100dba9fc0cf5eeaf122f007df35ec9a604
 
 MAINTAINER=	pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=	https://luajit.org/
@@ -28,6 +30,22 @@ PTHREAD_AUTO_VARS=	yes
 
 .include "../../mk/bsd.prefs.mk"
 
+post-extract:
+	${ECHO} ${GITHUB_TAG} > ${WRKSRC}/.relver
+
+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
+
+PLIST_SUBST=		COMMITHASH=${GITHUB_TAG}
+
 # 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..31c1e44e976 100644
--- c/lang/LuaJIT2/PLIST
+++ i/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.${COMMITHASH}.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 c/lang/LuaJIT2/distinfo i/lang/LuaJIT2/distinfo
index 9c095926fb6..754eb7abf1e 100644
--- c/lang/LuaJIT2/distinfo
+++ i/lang/LuaJIT2/distinfo
@@ -1,10 +1,7 @@
 $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-20230829-83954100dba9fc0cf5eeaf122f007df35ec9a604.tar.gz) = c123a03241b5dc51f8667b780da6ca94b35cd2f75ce6054cfb698bd73630cf2a
+SHA512 (luajit-v2.1-20230829-83954100dba9fc0cf5eeaf122f007df35ec9a604.tar.gz) = e3436fbc47a5467b6ad54389051849b3a9d0709fa98de9c797aea52dc41975b42a44b68fc5498efb8434ea42b3ef3f78792b10fb09ff13903cb307f35df5ed14
+Size (luajit-v2.1-20230829-83954100dba9fc0cf5eeaf122f007df35ec9a604.tar.gz) = 1074786 bytes
+SHA1 (patch-Makefile) = 89904974c7e2737d5600c78669d0bdbf0de4cf0a
+SHA1 (patch-src_host_genversion.lua) = bdc80f052b89d2e89a47e62bc74bd4cd279ae946
diff --git c/lang/LuaJIT2/patches/patch-Makefile i/lang/LuaJIT2/patches/patch-Makefile
index aac8fcb70dc..885bcd81165 100644
--- c/lang/LuaJIT2/patches/patch-Makefile
+++ i/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 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_host_genversion.lua i/lang/LuaJIT2/patches/patch-src_host_genversion.lua
new file mode 100644
index 00000000000..c3e89f9fd2e
--- /dev/null
+++ i/lang/LuaJIT2/patches/patch-src_host_genversion.lua
@@ -0,0 +1,15 @@
+$NetBSD$
+
+As commit hash is being used to report the version needs to allow a-z
+
+--- src/host/genversion.lua	2023-08-29 10:28:45.000000000 +0800
++++ src/host/genversion.lua	2023-08-29 10:28:50.000000000 +0800
+@@ -29,7 +29,7 @@
+ end
+ 
+ local text = file_read(FILE_ROLLING_H)
+-local relver = file_read(FILE_RELVER_TXT):match("(%d+)")
++local relver = file_read(FILE_RELVER_TXT):match("(%w+)")
+ 
+ if relver then
+   text = text:gsub("ROLLING", relver)
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