git: 36accb2aa9ec - main - misc/xplr: allow using the bundled luajit on powerpc

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Wed, 18 Jan 2023 09:28:46 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=36accb2aa9ec00038261cb8f00e9cd0f39dfde93

commit 36accb2aa9ec00038261cb8f00e9cd0f39dfde93
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2023-01-18 09:26:59 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2023-01-18 09:28:45 +0000

    misc/xplr: allow using the bundled luajit on powerpc
    
    Requires merging the upstream patch that adds compatibility with clang.
---
 misc/xplr/Makefile                                      | 12 +++++++-----
 ...ajit-src-210.4.3+resty8384278_luajit2_src_lj__arch.h | 17 +++++++++++++++++
 2 files changed, 24 insertions(+), 5 deletions(-)

diff --git a/misc/xplr/Makefile b/misc/xplr/Makefile
index 1b02b7d41562..0b761f3caf88 100644
--- a/misc/xplr/Makefile
+++ b/misc/xplr/Makefile
@@ -11,7 +11,7 @@ WWW=		https://xplr.dev
 LICENSE=	MIT
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-USES=		cargo desktop-file-utils gmake
+USES=		cargo compiler desktop-file-utils gmake
 USE_GITHUB=	yes
 GH_ACCOUNT=	sayanarijit
 
@@ -186,9 +186,11 @@ EXTRA_PATCHES=	${FILESDIR}/extra-patch-Cargo.toml
 LIB_DEPENDS=	libluajit-5.1.so:lang/luajit-openresty
 .endif
 
-.if ${ARCH} == powerpc
-EXTRA_PATCHES=	${FILESDIR}/extra-patch-Cargo.toml
-LIB_DEPENDS=	libluajit-5.1.so:lang/luajit
+.include <bsd.port.pre.mk>
+
+.if ${ARCH} == powerpc && ${COMPILER_VERSION} < 140
+BUILD_DEPENDS+=	as:devel/binutils
+CFLAGS+=	-fno-integrated-as
 .endif
 
 post-install:
@@ -219,4 +221,4 @@ post-install-EXAMPLES-on:
 		${INSTALL_DATA} ${_EXAMPLES} \
 		${STAGEDIR}${EXAMPLESDIR}
 
-.include <bsd.port.mk>
+.include <bsd.port.post.mk>
diff --git a/misc/xplr/files/patch-cargo-crates_luajit-src-210.4.3+resty8384278_luajit2_src_lj__arch.h b/misc/xplr/files/patch-cargo-crates_luajit-src-210.4.3+resty8384278_luajit2_src_lj__arch.h
new file mode 100644
index 000000000000..15b5ed053bf4
--- /dev/null
+++ b/misc/xplr/files/patch-cargo-crates_luajit-src-210.4.3+resty8384278_luajit2_src_lj__arch.h
@@ -0,0 +1,17 @@
+--- cargo-crates/luajit-src-210.4.3+resty8384278/luajit2/src/lj_arch.h.orig	2023-01-17 22:53:47 UTC
++++ cargo-crates/luajit-src-210.4.3+resty8384278/luajit2/src/lj_arch.h
+@@ -499,8 +499,14 @@
+ #endif
+ #endif
+ #elif !LJ_TARGET_PS3
++#if __clang__
++#if ((__clang_major__ < 3) || ((__clang_major__ == 3) && __clang_minor__ < 5))
++#error "Need at least Clang 3.5 or newer"
++#endif
++#else
+ #if (__GNUC__ < 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ < 3)
+ #error "Need at least GCC 4.3 or newer"
++#endif
+ #endif
+ #endif
+ #endif