aboutsummaryrefslogtreecommitdiff
path: root/games/eduke32
diff options
context:
space:
mode:
Diffstat (limited to 'games/eduke32')
-rw-r--r--games/eduke32/eduke32.SlackBuild5
-rw-r--r--games/eduke32/tools.diff147
2 files changed, 140 insertions, 12 deletions
diff --git a/games/eduke32/eduke32.SlackBuild b/games/eduke32/eduke32.SlackBuild
index 9bae23a3e927..e187b1a6398b 100644
--- a/games/eduke32/eduke32.SlackBuild
+++ b/games/eduke32/eduke32.SlackBuild
@@ -153,9 +153,10 @@ mkdir -p $PKG/usr/games
installbins $PRGNAM mapster32 voidsw wangulator
# the tools:
-# patch does 2 things: fix linking (add mimalloc as a dep) and
-# get rid of the generateicon tool (which still fails to build).
+# patch is upstream commit a7a6cd043749947773cbf3e85ed66ffd6273f659,
+# thanks to willysr for tracking it down.
patch -p1 < $CWD/tools.diff
+
runmake tools
installbins arttool bsuite cacheinfo givedepth ivfrate kextract kgroup \
kmd2tool makesdlkeytrans map2stl md2tool mkpalette transpal \
diff --git a/games/eduke32/tools.diff b/games/eduke32/tools.diff
index 22807c3dc435..da638e62ee8b 100644
--- a/games/eduke32/tools.diff
+++ b/games/eduke32/tools.diff
@@ -1,7 +1,24 @@
-diff -Naur eduke32_20211102-9751-8970754aa/GNUmakefile eduke32_20211102-9751-8970754aa.patched/GNUmakefile
---- eduke32_20211102-9751-8970754aa/GNUmakefile 2021-11-03 00:31:19.000000000 -0400
-+++ eduke32_20211102-9751-8970754aa.patched/GNUmakefile 2021-11-07 15:41:44.198560499 -0500
-@@ -439,13 +439,12 @@
+From a7a6cd043749947773cbf3e85ed66ffd6273f659 Mon Sep 17 00:00:00 2001
+From: Richard Gobeille <richard@voidpoint.com>
+Date: Mon, 20 Dec 2021 02:58:04 -0800
+Subject: [PATCH] tools: fix compilation of Build utilities
+
+---
+ GNUmakefile | 2 +-
+ source/build/include/baselayer.h | 3 +--
+ source/build/include/compat.h | 13 +++++++++++++
+ source/build/include/sjson.h | 2 --
+ source/build/src/baselayer.cpp | 12 ++----------
+ source/build/src/sdlayer.cpp | 2 +-
+ source/build/src/winlayer.cpp | 2 +-
+ source/tools/src/generateicon.cpp | 1 +
+ 8 files changed, 20 insertions(+), 17 deletions(-)
+
+diff --git a/GNUmakefile b/GNUmakefile
+index 7ebbd71a8..c8c174fb3 100644
+--- a/GNUmakefile
++++ b/GNUmakefile
+@@ -437,7 +437,7 @@ tools_obj := $(obj)/$(tools)
tools_cflags := $(engine_cflags)
@@ -10,9 +27,119 @@ diff -Naur eduke32_20211102-9751-8970754aa/GNUmakefile eduke32_20211102-9751-897
tools_targets := \
arttool \
- bsuite \
- cacheinfo \
-- generateicon \
- givedepth \
- ivfrate \
- kextract \
+diff --git a/source/build/include/baselayer.h b/source/build/include/baselayer.h
+index 008318003..b6d61135c 100644
+--- a/source/build/include/baselayer.h
++++ b/source/build/include/baselayer.h
+@@ -19,8 +19,7 @@ extern int app_main(int argc, char const * const * argv);
+ extern const char* AppProperName;
+ extern const char* AppTechnicalName;
+
+-void engineCreateAllocator(void);
+-void engineDestroyAllocator(void);
++void engineSetupAllocator(void);
+
+ #ifdef DEBUGGINGAIDS
+ # define DEBUG_MASK_DRAWING
+diff --git a/source/build/include/compat.h b/source/build/include/compat.h
+index 5dd6d0b1d..fd536253a 100644
+--- a/source/build/include/compat.h
++++ b/source/build/include/compat.h
+@@ -1297,6 +1297,19 @@ void *handle_memerr(void);
+
+ extern sm_allocator g_sm_heap;
+
++static FORCE_INLINE void engineCreateAllocator(void)
++{
++ // 8 buckets of 2MB each--we don't really need to burn a lot of memory here for this thing to do its job
++ g_sm_heap = _sm_allocator_create(SMM_MAX_BUCKET_COUNT, 2097152);
++ _sm_allocator_thread_cache_create(g_sm_heap, sm::CACHE_HOT, { 20480, 32768, 32768, 1536, 4096, 8192, 128, 4096 });
++}
++
++static FORCE_INLINE void engineDestroyAllocator(void)
++{
++ _sm_allocator_thread_cache_destroy(g_sm_heap);
++ _sm_allocator_destroy(g_sm_heap);
++}
++
+ #ifdef BITNESS64
+ # define ALLOC_ALIGNMENT 16
+ #else
+diff --git a/source/build/include/sjson.h b/source/build/include/sjson.h
+index b691bca2a..74a98ea05 100644
+--- a/source/build/include/sjson.h
++++ b/source/build/include/sjson.h
+@@ -144,8 +144,6 @@
+ #ifndef SJSON_H_
+ #define SJSON_H_
+
+-extern "C" void engineDestroyAllocator(void);
+-
+ #ifdef _MSC_VER
+ # ifndef __cplusplus
+
+diff --git a/source/build/src/baselayer.cpp b/source/build/src/baselayer.cpp
+index c1fe589ee..bc81e0616 100644
+--- a/source/build/src/baselayer.cpp
++++ b/source/build/src/baselayer.cpp
+@@ -139,17 +139,9 @@ static int osdfunc_heapinfo(osdcmdptr_t UNUSED(parm))
+ return OSDCMD_OK;
+ }
+
+-void engineDestroyAllocator(void)
++void engineSetupAllocator(void)
+ {
+- _sm_allocator_thread_cache_destroy(g_sm_heap);
+- _sm_allocator_destroy(g_sm_heap);
+-}
+-
+-void engineCreateAllocator(void)
+-{
+- // 8 buckets of 2MB each--we don't really need to burn a lot of memory here for this thing to do its job
+- g_sm_heap = _sm_allocator_create(SMM_MAX_BUCKET_COUNT, 2097152);
+- _sm_allocator_thread_cache_create(g_sm_heap, sm::CACHE_HOT, { 20480, 32768, 32768, 1536, 4096, 8192, 128, 4096 });
++ engineCreateAllocator();
+
+ #ifdef SMMALLOC_STATS_SUPPORT
+ OSD_RegisterFunction("bucketlist", "bucketlist: list bucket statistics", osdfunc_bucketlist);
+diff --git a/source/build/src/sdlayer.cpp b/source/build/src/sdlayer.cpp
+index 27ab392ea..fa76bebf8 100644
+--- a/source/build/src/sdlayer.cpp
++++ b/source/build/src/sdlayer.cpp
+@@ -452,7 +452,7 @@ int SDL_main(int argc, char *argv[])
+ int main(int argc, char *argv[])
+ #endif
+ {
+- engineCreateAllocator();
++ engineSetupAllocator();
+
+ #if SDL_MAJOR_VERSION >= 2 && (SDL_MINOR_VERSION > 0 || SDL_PATCHLEVEL >= 8)
+ if (EDUKE32_SDL_LINKED_PREREQ(linked, 2, 0, 8))
+diff --git a/source/build/src/winlayer.cpp b/source/build/src/winlayer.cpp
+index 367c0ec03..ccf9fa25f 100644
+--- a/source/build/src/winlayer.cpp
++++ b/source/build/src/winlayer.cpp
+@@ -281,7 +281,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nC
+ _CrtSetDbgFlag(_CRTDBG_CHECK_ALWAYS_DF);
+ #endif
+
+- engineCreateAllocator();
++ engineSetupAllocator();
+
+ mutex_init(&m_initprintf);
+
+diff --git a/source/tools/src/generateicon.cpp b/source/tools/src/generateicon.cpp
+index 16f7096e3..81f46b28b 100644
+--- a/source/tools/src/generateicon.cpp
++++ b/source/tools/src/generateicon.cpp
+@@ -61,6 +61,7 @@ int main(int argc, char **argv)
+
+ memset(&icon, 0, sizeof(icon));
+
++ engineCreateAllocator();
+ kpzload(argv[1], (intptr_t*)&icon.pixels, &icon.width, &icon.height);
+ if (!icon.pixels) {
+ Bfprintf(stderr, "Failure loading %s\n", argv[1]);
+--
+GitLab
+