summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author B. Watson2022-03-24 18:57:24 +0100
committer Willy Sudiarto Raharjo2022-03-25 19:20:12 +0100
commit031ca49dd10c280fb58a64939da0ee680eaab1fd (patch)
tree6309b17ab1ab64bf05bae58db880805e6b435e11
parent2736a4b96fb6372ac645715ca888f3cb648e6bbd (diff)
downloadslackbuilds-031ca49dd10c280fb58a64939da0ee680eaab1fd.tar.gz
games/eduke32: Fix 32-bit build.
Signed-off-by: B. Watson <yalhcru@gmail.com> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-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 9bae23a3e9..e187b1a639 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 22807c3dc4..da638e62ee 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
+