Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
luajit, arm64, games/love/0.10
To:
ports <ports@openbsd.org>
Date:
Thu, 9 May 2024 22:09:39 +0100

Download raw body.

Thread
Currently our luajit port is for an old tagged release of luajit-2.0;
the 2.0 branch only supports arm amd64 i386 powerpc (in particular,
no arm64).

Upstream now only do rolling updates and there's a 2.1 branch with
better arch support (at least arm64, maybe riscv, not sure if any more).
Adding a second port for 2.1 to move across bit by bit would be possible
but would be a bit of a pain. So ideally I'd quite like to switch the
existing port across.

(There are many newer commits on the 2.0 tree too but no wider arch
support that I noticed).

I've successfully built all ports using luajit with 2.1 other than
games/love/0.10 (some small diffs were needed, all easy). I did runtime
tests on a few of them so far, those were successful.

How useful is love/0.10, does it still make sense to keep it?

Here's the diff I've tested so far (only tested on amd64 so far, I will
try arm64 too).

(I removed some of the MODLUA_VERSION in the Makefile, afaict luajit
only targets 5.1).

Index: Makefile
===================================================================
RCS file: /cvs/ports/lang/luajit/Makefile,v
diff -u -p -r1.34 Makefile
--- Makefile	23 Jun 2023 17:34:51 -0000	1.34
+++ Makefile	9 May 2024 16:38:11 -0000
@@ -6,19 +6,23 @@ ONLY_FOR_ARCHS = arm amd64 i386 powerpc
 # no aarch64 support in luajit 2.0 branch
 # games/tome4 is using embedded copy of luajit
 
-SHARED_LIBS +=	luajit-${MODLUA_VERSION} 1.0 # 2.0.5
+SHARED_LIBS +=	luajit-5.1 1.0 # 2.0.5
 
-# "Releases are only made occasionally. You're strongly encouraged to follow
-# the git branches"
+# "LuaJIT uses rolling releases. There are no release tarballs available
+# for download."
+# "Distro maintainers for distros that require the fiction of a release
+# should do frequent snapshots of a branch. Do not attempt to cherry-pick
+# or backport individual changes, no matter how self-standing individual
+# changes look (because they often are not)."
 GH_ACCOUNT =	LuaJIT
 GH_PROJECT =	LuaJIT
-GH_COMMIT =	98f95f69180d48ce49289d6428b46a9ccdd67a46
+GH_COMMIT =	5790d253972c9d78a0c2aece527eda5b134bbbf7
 
 COMMENT =	just-in-time compiler for Lua
-V =		2.0.5
-DISTNAME =	LuaJIT-${V}pl20210608
+# see ${WRKSRC}/.relver
+V =		2.1.1713773202
+DISTNAME =	LuaJIT-${V}
 PKGNAME =	${DISTNAME:L}
-REVISION =	0
 
 CATEGORIES =	lang
 
@@ -33,6 +37,7 @@ WANTLIB =	c m
 
 MODULES =	lang/lua
 MODLUA_SA=	Yes
+# luajit specifically targets the 5.1 ABI
 MODLUA_VERSION=	5.1
 
 MAKE_FLAGS += \
@@ -41,12 +46,13 @@ MAKE_FLAGS += \
 	CCOPT_x86="" \
 	INSTALL_LJLIBD="${DESTDIR}${MODLUA_DATADIR}" \
 	INSTALL_MAN="${DESTDIR}${PREFIX}/man/man1" \
-	INSTALL_SONAME=libluajit-${MODLUA_VERSION}.so.${LIBluajit-${MODLUA_VERSION}_VERSION} \
-	PREFIX="${PREFIX}"
+	INSTALL_SONAME=libluajit-5.1.so.${LIBluajit-5.1_VERSION} \
+	PREFIX="${PREFIX}" \
+	Q= E=@:
 
 USE_GMAKE =	Yes
 
-SUBST_VARS+=	MODLUA_VERSION
+SUBST_VARS =	V
 
 pre-configure:
 	${SUBST_CMD} ${WRKDIST}/Makefile \
@@ -54,7 +60,8 @@ pre-configure:
 		${WRKDIST}/src/luaconf.h
 
 post-install:
-	mv ${PREFIX}/bin/luajit-$V ${PREFIX}/bin/luajit${MODLUA_DEP_VERSION}
+	rm ${PREFIX}/lib/libluajit-${MODLUA_VERSION}.so{,.?}
+	ln -s luajit-${V} ${PREFIX}/bin/luajit${MODLUA_DEP_VERSION}
 
 do-test:
 	${WRKSRC}/src/luajit -e "print('hello world')" | grep "^hello world$$"
Index: distinfo
===================================================================
RCS file: /cvs/ports/lang/luajit/distinfo,v
diff -u -p -r1.9 distinfo
--- distinfo	3 Jul 2021 20:21:07 -0000	1.9
+++ distinfo	9 May 2024 16:38:11 -0000
@@ -1,2 +1,2 @@
-SHA256 (LuaJIT-2.0.5pl20210608-98f95f69.tar.gz) = wmjMMUjuUzRqfRu4plfFqD7otJefP7Wwj67uj4mDfdQ=
-SIZE (LuaJIT-2.0.5pl20210608-98f95f69.tar.gz) = 844346
+SHA256 (LuaJIT-2.1.1713773202-5790d253.tar.gz) = opnNOJxFaM/0yQDp6G+1ax9CK/OEl6aV9qluN2B6ZkU=
+SIZE (LuaJIT-2.1.1713773202-5790d253.tar.gz) = 1081581
Index: patches/patch-Makefile
===================================================================
RCS file: patches/patch-Makefile
diff -N patches/patch-Makefile
--- patches/patch-Makefile	11 Mar 2022 19:29:06 -0000	1.8
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,32 +0,0 @@
-Index: Makefile
---- Makefile.orig
-+++ Makefile
-@@ -17,7 +17,7 @@ MAJVER=  2
- MINVER=  0
- RELVER=  5
- VERSION= $(MAJVER).$(MINVER).$(RELVER)
--ABIVER=  5.1
-+ABIVER=  ${MODLUA_VERSION}
- 
- ##############################################################################
- #
-@@ -117,18 +117,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)
- 	cd src && test -f $(FILE_SO) && \
--	  $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) && \
--	  ( $(LDCONFIG) $(INSTALL_LIB) || : ) && \
--	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT1) && \
--	  $(SYMLINK) $(INSTALL_SONAME) $(INSTALL_SHORT2) || :
-+	  $(INSTALL_X) $(FILE_SO) $(INSTALL_DYN) || :
- 	cd etc && $(INSTALL_F) $(FILE_MAN) $(INSTALL_MAN)
- 	cd etc && $(SED_PC) $(FILE_PC) > $(FILE_PC).tmp && \
- 	  $(INSTALL_F) $(FILE_PC).tmp $(INSTALL_PC) && \
- 	  $(RM) $(FILE_PC).tmp
- 	cd src && $(INSTALL_F) $(FILES_INC) $(INSTALL_INC)
- 	cd src/jit && $(INSTALL_F) $(FILES_JITLIB) $(INSTALL_JITLIB)
--	$(SYMLINK) $(INSTALL_TNAME) $(INSTALL_TSYM)
--	@echo "==== Successfully installed LuaJIT $(VERSION) to $(PREFIX) ===="
- 
- uninstall:
- 	@echo "==== Uninstalling LuaJIT $(VERSION) from $(PREFIX) ===="
Index: patches/patch-etc_luajit_pc
===================================================================
RCS file: patches/patch-etc_luajit_pc
diff -N patches/patch-etc_luajit_pc
--- patches/patch-etc_luajit_pc	11 Mar 2022 19:29:06 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,14 +0,0 @@
---- etc/luajit.pc.orig	Tue May  2 04:11:00 2017
-+++ etc/luajit.pc	Tue May  2 11:40:27 2017
-@@ -3,9 +3,9 @@ majver=2
- minver=0
- relver=5
- version=${majver}.${minver}.${relver}
--abiver=5.1
-+abiver=${MODLUA_VERSION}
- 
--prefix=/usr/local
-+prefix=${TRUEPREFIX}
- multilib=lib
- exec_prefix=${prefix}
- libdir=${exec_prefix}/${multilib}
Index: patches/patch-src_Makefile
===================================================================
RCS file: /cvs/ports/lang/luajit/patches/patch-src_Makefile,v
diff -u -p -r1.8 patch-src_Makefile
--- patches/patch-src_Makefile	11 Mar 2022 19:29:06 -0000	1.8
+++ patches/patch-src_Makefile	9 May 2024 16:38:11 -0000
@@ -1,7 +1,7 @@
 Index: src/Makefile
 --- src/Makefile.orig
 +++ src/Makefile
-@@ -331,6 +331,10 @@ else
+@@ -351,6 +351,10 @@ else
    ifeq (GNU/kFreeBSD,$(TARGET_SYS))
      TARGET_XLIBS+= -ldl
    endif
@@ -12,7 +12,7 @@ Index: src/Makefile
  endif
  endif
  endif
-@@ -568,10 +572,10 @@ endif
+@@ -608,10 +612,10 @@ endif
  endif
  endif
  
Index: patches/patch-src_host_buildvm_asm_c
===================================================================
RCS file: patches/patch-src_host_buildvm_asm_c
diff -N patches/patch-src_host_buildvm_asm_c
--- patches/patch-src_host_buildvm_asm_c	11 Mar 2022 19:29:06 -0000	1.5
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,19 +0,0 @@
-.gnu_attribute requires binutils 2.18
-
---- src/host/buildvm_asm.c.orig	Tue May  2 04:11:00 2017
-+++ src/host/buildvm_asm.c	Tue May  2 11:40:27 2017
-@@ -290,12 +290,14 @@ void emit_asm(BuildCtx *ctx)
- #if !(LJ_TARGET_PS3 || LJ_TARGET_PSVITA)
-     fprintf(ctx->fp, "\t.section .note.GNU-stack,\"\"," ELFASM_PX "progbits\n");
- #endif
-+#if 0
- #if LJ_TARGET_PPCSPE
-     /* Soft-float ABI + SPE. */
-     fprintf(ctx->fp, "\t.gnu_attribute 4, 2\n\t.gnu_attribute 8, 3\n");
- #elif LJ_TARGET_PPC && !LJ_TARGET_PS3
-     /* Hard-float ABI. */
-     fprintf(ctx->fp, "\t.gnu_attribute 4, 1\n");
-+#endif
- #endif
-     /* fallthrough */
-   case BUILD_coffasm:
Index: patches/patch-src_lj_arch_h
===================================================================
RCS file: /cvs/ports/lang/luajit/patches/patch-src_lj_arch_h,v
diff -u -p -r1.7 patch-src_lj_arch_h
--- patches/patch-src_lj_arch_h	11 Mar 2022 19:29:06 -0000	1.7
+++ patches/patch-src_lj_arch_h	9 May 2024 16:38:11 -0000
@@ -5,8 +5,8 @@ ignore the gcc version check ifdef hell 
 Index: src/lj_arch.h
 --- src/lj_arch.h.orig
 +++ src/lj_arch.h
-@@ -299,7 +299,7 @@
- #endif
+@@ -446,7 +446,7 @@
+ /* -- Checks for requirements --------------------------------------------- */
  
  /* Check for minimum required compiler versions. */
 -#if defined(__GNUC__)
Index: patches/patch-src_luaconf_h
===================================================================
RCS file: patches/patch-src_luaconf_h
diff -N patches/patch-src_luaconf_h
--- patches/patch-src_luaconf_h	11 Mar 2022 19:29:06 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,15 +0,0 @@
---- src/luaconf.h.orig	Tue May  2 04:11:00 2017
-+++ src/luaconf.h	Tue May  2 11:42:59 2017
-@@ -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.5/"
-+#define LUA_LROOT	"${TRUEPREFIX}"
-+#define LUA_LUADIR	"/lua/${MODLUA_VERSION}/"
-+#define LUA_LJDIR	"/luajit-2.0/"
- 
- #ifdef LUA_ROOT
- #define LUA_JROOT	LUA_ROOT
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/lang/luajit/pkg/PLIST,v
diff -u -p -r1.4 PLIST
--- pkg/PLIST	11 Mar 2022 19:29:06 -0000	1.4
+++ pkg/PLIST	9 May 2024 16:38:11 -0000
@@ -1,13 +1,15 @@
-@bin bin/luajit${MODLUA_DEP_VERSION}
-include/luajit-2.0/
-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 lib/libluajit-${MODLUA_VERSION}.so
+bin/luajit
+@bin bin/luajit-${V}
+bin/luajit${MODLUA_DEP_VERSION}
+include/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
 @static-lib lib/libluajit-${MODLUA_VERSION}.a
+@comment lib/libluajit-${MODLUA_VERSION}.so
 @lib lib/libluajit-${MODLUA_VERSION}.so.${LIBluajit-${MODLUA_VERSION}_VERSION}
 lib/pkgconfig/luajit.pc
 @man man/man1/luajit.1
@@ -15,11 +17,19 @@ 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_arm64.lua
+share/lua/${MODLUA_VERSION}/jit/dis_arm64be.lua
 share/lua/${MODLUA_VERSION}/jit/dis_mips.lua
+share/lua/${MODLUA_VERSION}/jit/dis_mips64.lua
+share/lua/${MODLUA_VERSION}/jit/dis_mips64el.lua
+share/lua/${MODLUA_VERSION}/jit/dis_mips64r6.lua
+share/lua/${MODLUA_VERSION}/jit/dis_mips64r6el.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/p.lua
 share/lua/${MODLUA_VERSION}/jit/v.lua
 share/lua/${MODLUA_VERSION}/jit/vmdef.lua
+share/lua/${MODLUA_VERSION}/jit/zone.lua