git: 32d0b0d5e1b5 - 2023Q3 - multimedia/arcan: unbreak KMS support after cb7c09ae6a8e

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Sat, 30 Sep 2023 02:59:44 UTC
The branch 2023Q3 has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=32d0b0d5e1b5db3fb0a089a8eb30fb1891c27754

commit 32d0b0d5e1b5db3fb0a089a8eb30fb1891c27754
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-09-30 02:09:56 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-09-30 02:59:39 +0000

    multimedia/arcan: unbreak KMS support after cb7c09ae6a8e
    
    $ arcan console
    pid 12345 (arcan), jid 0, uid 1111: exited on signal 6 (no core dump - bad address)
    $ tail -1 /var/log/messages
    Sep 29 22:48:36 localhost arcan[12345]: stack overflow detected; terminated
    
    (lldb) bt
    * thread #2, name = 'arcan', stop reason = signal SIGABRT
      * frame #0: 0x00000008277faf5a libc.so.7`__sys_kill at kill.S:4
        frame #1: 0x00000008277fe361 libc.so.7`__fail(msg="stack overflow detected; terminated") at stack_protector.c:120:8
        frame #2: 0x00000008277fe2d0 libc.so.7`__stack_chk_fail at stack_protector.c:127:2
        frame #3: 0x00000000002eb876 arcan`button_count(fd=5, bitn=1, got_mouse=0x000000082040a5cf, got_joy=0x000000082040a5ce) at event.c:0
    (lldb) f 3
    frame #3: 0x00000000002eb876 arcan`button_count(fd=5, bitn=1, got_mouse=0x000000082040a5cf, got_joy=0x000000082040a5ce) at event.c:0
       844  #define bit_isset(ary, bit) (( ary[bit_longn(bit)] >> bit_ofs(bit)) & 1)
       845  #define bit_count(x) ( ((x) - 1 ) / (sizeof(long) * 8 ) + 1 )
       846
    -> 847  static size_t button_count(int fd, size_t bitn, bool* got_mouse, bool* got_joy)
       848  {
       849          size_t count = 0;
       850
    
    PR:             274163
    Reported by:    Albin "a12l" Otterhäll
    
    (cherry picked from commit 2258b3ebc4eea9aa93da7058a0df054475849f38)
---
 multimedia/arcan/Makefile                                 |  2 +-
 .../arcan/files/patch-platform_cmake_CMakeLists.BSD       | 15 +++++++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/multimedia/arcan/Makefile b/multimedia/arcan/Makefile
index 4d23ce46b92a..04c42c748903 100644
--- a/multimedia/arcan/Makefile
+++ b/multimedia/arcan/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	arcan
 DISTVERSION=	0.6.2.1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	multimedia
 
 PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
diff --git a/multimedia/arcan/files/patch-platform_cmake_CMakeLists.BSD b/multimedia/arcan/files/patch-platform_cmake_CMakeLists.BSD
new file mode 100644
index 000000000000..af4661e3174a
--- /dev/null
+++ b/multimedia/arcan/files/patch-platform_cmake_CMakeLists.BSD
@@ -0,0 +1,15 @@
+Partially revert https://github.com/letoram/arcan/commit/3c1674a8f5db
+
+--- platform/cmake/CMakeLists.BSD.orig	2022-10-12 20:23:54 UTC
++++ platform/cmake/CMakeLists.BSD
+@@ -74,6 +74,10 @@ else()
+ 	set(BSD_VARIANT_DEFINITIONS
+ 		-DCLOCK_MONOTONIC_RAW=CLOCK_REALTIME_FAST)
+ 
++# FreeBSD 12.1 enabled evdev but Arcan crashes
++	if(${INPUT_PLATFORM} STREQUAL "evdev")
++		SET(INPUT_PLATFORM "syscons")
++	endif()
+ 	if (VIDEO_PLATFORM STREQUAL "egl-dri")
+ 		list(APPEND ARCAN_PLATFORM ${PLATFORM_PATH}/psep_open.c)
+ 	else()