git: 8e2c64a7e526 - main - devel/lua-language-server: fix build on powerpc*

From: Piotr Kubaj <pkubaj_at_FreeBSD.org>
Date: Tue, 13 Sep 2022 17:14:28 UTC
The branch main has been updated by pkubaj:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8e2c64a7e526b5a475e624d4dfeafa42ddb5aca9

commit 8e2c64a7e526b5a475e624d4dfeafa42ddb5aca9
Author:     Piotr Kubaj <pkubaj@FreeBSD.org>
AuthorDate: 2022-09-13 17:04:46 +0000
Commit:     Piotr Kubaj <pkubaj@FreeBSD.org>
CommitDate: 2022-09-13 17:04:46 +0000

    devel/lua-language-server: fix build on powerpc*
    
    In file included from 3rd/bee.lua/binding/lua_thread.cpp:2:
    In file included from 3rd/bee.lua/bee/thread/lockqueue.h:5:
    3rd/bee.lua/bee/thread/spinlock.h:22:6: error: unsupport platform
        #error unsupport platform
         ^
    3rd/bee.lua/bee/thread/spinlock.h:34:21: error: use of undeclared identifier 'cpu_relax'
                        cpu_relax();
---
 devel/lua-language-server/Makefile                            |  4 +++-
 .../files/patch-3rd_bee.lua_bee_thread_spinlock.h             | 11 +++++++++++
 .../files/patch-3rd_luamake_3rd_bee.lua_bee_thread_spinlock.h | 11 +++++++++++
 3 files changed, 25 insertions(+), 1 deletion(-)

diff --git a/devel/lua-language-server/Makefile b/devel/lua-language-server/Makefile
index 510e093dd175..79609c7dda8d 100644
--- a/devel/lua-language-server/Makefile
+++ b/devel/lua-language-server/Makefile
@@ -11,7 +11,7 @@ LICENSE_FILE=	${WRKSRC}/LICENSE
 
 LIB_DEPENDS=	libinotify.so:devel/libinotify
 
-USES=		lua:build ninja:make
+USES=		dos2unix lua:build ninja:make
 USE_GITHUB=	yes
 GH_ACCOUNT=	sumneko
 GH_TUPLE=	actboy168:bee.lua:301ad60:bee/3rd/bee.lua \
@@ -22,6 +22,8 @@ GH_TUPLE=	actboy168:bee.lua:301ad60:bee/3rd/bee.lua \
 		sqmedeiros:lpeglabel:b5d7638:lpeglabel/3rd/lpeglabel
 
 BINARY_ALIAS=	gcc=${CC}
+DOS2UNIX_FILES=	3rd/bee.lua/bee/thread/spinlock.h \
+		3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h
 SUB_FILES=	lua-language-server
 PLIST_FILES=	bin/lua-language-server \
 		${DATADIR_REL}/bin/lua-language-server \
diff --git a/devel/lua-language-server/files/patch-3rd_bee.lua_bee_thread_spinlock.h b/devel/lua-language-server/files/patch-3rd_bee.lua_bee_thread_spinlock.h
new file mode 100644
index 000000000000..8c63fb448f7d
--- /dev/null
+++ b/devel/lua-language-server/files/patch-3rd_bee.lua_bee_thread_spinlock.h
@@ -0,0 +1,11 @@
+--- 3rd/bee.lua/bee/thread/spinlock.h.orig	2022-09-13 00:54:42 UTC
++++ 3rd/bee.lua/bee/thread/spinlock.h
+@@ -18,6 +18,8 @@
+         asm volatile ("div %0, %0, zero" : "=r" (dummy));
+         asm volatile ("" ::: "memory");
+     }}
++#elif defined(__powerpc__)
++    namespace bee { inline void cpu_relax() { asm volatile("ori 0,0,0" ::: "memory"); }}
+ #else
+     #error unsupport platform
+ #endif
diff --git a/devel/lua-language-server/files/patch-3rd_luamake_3rd_bee.lua_bee_thread_spinlock.h b/devel/lua-language-server/files/patch-3rd_luamake_3rd_bee.lua_bee_thread_spinlock.h
new file mode 100644
index 000000000000..6ef12c62ee02
--- /dev/null
+++ b/devel/lua-language-server/files/patch-3rd_luamake_3rd_bee.lua_bee_thread_spinlock.h
@@ -0,0 +1,11 @@
+--- 3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h.orig	2022-09-13 00:54:31 UTC
++++ 3rd/luamake/3rd/bee.lua/bee/thread/spinlock.h
+@@ -18,6 +18,8 @@
+         asm volatile ("div %0, %0, zero" : "=r" (dummy));
+         asm volatile ("" ::: "memory");
+     }}
++#elif defined(__powerpc__)
++    namespace bee { inline void cpu_relax() { asm volatile("ori 0,0,0" ::: "memory"); }}
+ #else
+     #error unsupport platform
+ #endif