git: 8d634a6eeacb - main - games/dethrace: New port: Reverse engineering the 1997 game "Carmageddon"

From: Nuno Teixeira <eduardo_at_FreeBSD.org>
Date: Sun, 28 Jun 2026 23:53:02 UTC
The branch main has been updated by eduardo:

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

commit 8d634a6eeacbbf51549921163c1ac111147cd073
Author:     Nuno Teixeira <eduardo@FreeBSD.org>
AuthorDate: 2026-06-28 23:10:56 +0000
Commit:     Nuno Teixeira <eduardo@FreeBSD.org>
CommitDate: 2026-06-28 23:52:37 +0000

    games/dethrace: New port: Reverse engineering the 1997 game "Carmageddon"
    
    Dethrace is an attempt to learn how the 1997 driving/mayhem game Carmageddon
    works behind the scenes and rebuild it to run natively on modern systems.
    
    WWW: https://github.com/dethrace-labs/dethrace
---
 games/Makefile                                     |  1 +
 games/dethrace/Makefile                            | 31 +++++++++++++++
 games/dethrace/distinfo                            |  5 +++
 games/dethrace/files/patch-Use-GNUInstallDirs      | 45 ++++++++++++++++++++++
 .../files/patch-src_DETHRACE_pc-all_allnet.c       | 10 +++++
 .../files/patch-src_harness_CMakeLists.txt         | 11 ++++++
 games/dethrace/files/patch-src_harness_os_linux.c  | 10 +++++
 games/dethrace/pkg-descr                           |  2 +
 8 files changed, 115 insertions(+)

diff --git a/games/Makefile b/games/Makefile
index e34466a8a58e..4e6bf3dd3931 100644
--- a/games/Makefile
+++ b/games/Makefile
@@ -186,6 +186,7 @@
     SUBDIR += dangen
     SUBDIR += darkplaces
     SUBDIR += defendguin
+    SUBDIR += dethrace
     SUBDIR += devd-controller-rules
     SUBDIR += devilutionX
     SUBDIR += dhewm3
diff --git a/games/dethrace/Makefile b/games/dethrace/Makefile
new file mode 100644
index 000000000000..d9cc0c0c068d
--- /dev/null
+++ b/games/dethrace/Makefile
@@ -0,0 +1,31 @@
+PORTNAME=	dethrace
+DISTVERSIONPREFIX=	v
+DISTVERSION=	0.10.1
+CATEGORIES=	games
+
+MAINTAINER=	eduardo@FreeBSD.org
+COMMENT=	Reverse engineering the 1997 game "Carmageddon"
+WWW=		https://github.com/dethrace-labs/dethrace
+
+LICENSE=	GPLv3
+LICENSE_FILE=	${WRKSRC}/LICENSE
+
+USES=		cmake:testing sdl
+USE_GITHUB=	yes
+GH_ACCOUNT=	dethrace-labs
+GH_TUPLE=	dethrace-labs:BRender-v1.3.2:44d27ffa026a0a3ea4dc0642315913bf5bc27e25:brender/lib/BRender-v1.3.2
+USE_SDL=	sdl3
+
+CMAKE_ON=	DETHRACE_INSTALL DETHRACE_PLATFORM_SDL3
+CMAKE_OFF=	BUILD_TESTS DETHRACE_PLATFORM_SDL1 DETHRACE_PLATFORM_SDL2 \
+		DETHRACE_PLATFORM_SDL_DYNAMIC
+CMAKE_TESTING_ON=	BUILD_TESTS
+
+LDFLAGS+=	-lexecinfo
+
+PLIST_FILES=	bin/${PORTNAME}
+
+post-extract:
+	@${ECHO_CMD} "${DISTVERSION}" > ${WRKSRC}/VERSION
+
+.include <bsd.port.mk>
diff --git a/games/dethrace/distinfo b/games/dethrace/distinfo
new file mode 100644
index 000000000000..e7688d49a0f2
--- /dev/null
+++ b/games/dethrace/distinfo
@@ -0,0 +1,5 @@
+TIMESTAMP = 1782682202
+SHA256 (dethrace-labs-dethrace-v0.10.1_GH0.tar.gz) = 05040a0e3b40b82ca0e2856648969816bca846880d4ea0cb02446d91a5a12985
+SIZE (dethrace-labs-dethrace-v0.10.1_GH0.tar.gz) = 2227244
+SHA256 (dethrace-labs-BRender-v1.3.2-44d27ffa026a0a3ea4dc0642315913bf5bc27e25_GH0.tar.gz) = 40f2291104a4503c4a6dea8db1c75c0101bdcc2545775f483a6ab38d64e592a4
+SIZE (dethrace-labs-BRender-v1.3.2-44d27ffa026a0a3ea4dc0642315913bf5bc27e25_GH0.tar.gz) = 2386439
diff --git a/games/dethrace/files/patch-Use-GNUInstallDirs b/games/dethrace/files/patch-Use-GNUInstallDirs
new file mode 100644
index 000000000000..1b3caec46600
--- /dev/null
+++ b/games/dethrace/files/patch-Use-GNUInstallDirs
@@ -0,0 +1,45 @@
+From d39be33ef45c365a2a1a68af5de5b5c06705818d Mon Sep 17 00:00:00 2001
+From: buzz <buzz@users.noreply.github.com>
+Date: Fri, 27 Feb 2026 18:42:04 +0100
+Subject: [PATCH] Use `GNUInstallDirs` in `CMakeLists.txt` (#485)
+
+Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
+---
+ CMakeLists.txt              | 3 ++-
+ src/DETHRACE/CMakeLists.txt | 2 +-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git CMakeLists.txt CMakeLists.txt
+index 488b78270..9f9a62cab 100644
+--- CMakeLists.txt
++++ CMakeLists.txt
+@@ -13,6 +13,7 @@ if(MSVC)
+     set(CMAKE_INSTALL_DOCDIR "." CACHE PATH "Documentation root")
+ endif()
+ 
++include(GNUInstallDirs)
+ include(CheckCCompilerFlag)
+ include(CMakeDependentOption)
+ 
+@@ -171,7 +172,7 @@ endif()
+ 
+ if(DETHRACE_INSTALL)
+     install(FILES LICENSE
+-        DESTINATION "."
++        DESTINATION "${CMAKE_INSTALL_DOCDIR}"
+     )
+ 
+     set(DETHRACE_PACKAGE_PLATFORM "" CACHE STRING "Dethrace binary package platform")
+diff --git src/DETHRACE/CMakeLists.txt src/DETHRACE/CMakeLists.txt
+index cabb873e6..7401e53c8 100644
+--- src/DETHRACE/CMakeLists.txt
++++ src/DETHRACE/CMakeLists.txt
+@@ -235,7 +235,7 @@ endif()
+ if(DETHRACE_INSTALL)
+     install(TARGETS dethrace
+         BUNDLE DESTINATION . COMPONENT Runtime
+-        RUNTIME DESTINATION . COMPONENT Runtime
++        RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT Runtime
+     )
+ 
+     if(APPLE)
diff --git a/games/dethrace/files/patch-src_DETHRACE_pc-all_allnet.c b/games/dethrace/files/patch-src_DETHRACE_pc-all_allnet.c
new file mode 100644
index 000000000000..2adf5fbe7f0d
--- /dev/null
+++ b/games/dethrace/files/patch-src_DETHRACE_pc-all_allnet.c
@@ -0,0 +1,10 @@
+--- src/DETHRACE/pc-all/allnet.c.orig	2026-06-28 21:41:50 UTC
++++ src/DETHRACE/pc-all/allnet.c
+@@ -15,6 +15,7 @@
+ #include <ctype.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <netinet/in.h>
+ 
+ #ifdef _WIN32
+ #define _WINSOCK_DEPRECATED_NO_WARNINGS
diff --git a/games/dethrace/files/patch-src_harness_CMakeLists.txt b/games/dethrace/files/patch-src_harness_CMakeLists.txt
new file mode 100644
index 000000000000..9c13aa8b1532
--- /dev/null
+++ b/games/dethrace/files/patch-src_harness_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- src/harness/CMakeLists.txt.orig	2026-06-28 21:33:35 UTC
++++ src/harness/CMakeLists.txt
+@@ -72,7 +72,7 @@ elseif(APPLE)
+     target_link_libraries(harness PRIVATE dbghelp ws2_32 iphlpapi)
+ elseif(APPLE)
+     target_sources(harness PRIVATE os/macos.c)
+-elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
++elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
+     target_sources(harness PRIVATE os/linux.c)
+ else()
+     message(FATAL_ERROR "Unsupported or unknown platform: ${CMAKE_SYSTEM_NAME}")
diff --git a/games/dethrace/files/patch-src_harness_os_linux.c b/games/dethrace/files/patch-src_harness_os_linux.c
new file mode 100644
index 000000000000..74cbe9ffe1ea
--- /dev/null
+++ b/games/dethrace/files/patch-src_harness_os_linux.c
@@ -0,0 +1,10 @@
+--- src/harness/os/linux.c.orig	2026-06-28 21:37:35 UTC
++++ src/harness/os/linux.c
+@@ -32,6 +32,7 @@
+ #include <termios.h>
+ #include <time.h>
+ #include <unistd.h>
++#include <netinet/in.h>
+ 
+ #if SUPPORT_TRACEBACK
+ #include <execinfo.h>
diff --git a/games/dethrace/pkg-descr b/games/dethrace/pkg-descr
new file mode 100644
index 000000000000..c5c6d38ad5bc
--- /dev/null
+++ b/games/dethrace/pkg-descr
@@ -0,0 +1,2 @@
+Dethrace is an attempt to learn how the 1997 driving/mayhem game Carmageddon
+works behind the scenes and rebuild it to run natively on modern systems.