From 15e403b1780206d365dcd98a7b675437b3c6b2f7 Mon Sep 17 00:00:00 2001 From: Milenko <39630670+MrMilenko@users.noreply.github.com> Date: Fri, 22 May 2026 21:03:41 -0400 Subject: [PATCH] another oopsie --- build/Makefile | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/build/Makefile b/build/Makefile index efc56b9..33a5520 100644 --- a/build/Makefile +++ b/build/Makefile @@ -977,14 +977,21 @@ WIN64_DIR = $(BUILDS_ROOT)/desktop-win64 WIN64_TARGET = $(WIN64_DIR)/theseus.exe WIN64_CXX = x86_64-w64-mingw32-g++ -# libwinpthread-1.dll: on macOS/Homebrew it lives in x86_64-w64-mingw32/bin/; -# on Linux/APT it lives in x86_64-w64-mingw32/lib/. Try bin/ first, fall back -# to lib/ so both layouts work without manual configuration. -WIN64_PTHREAD_DLL := $(shell \ +# mingw runtime DLLs. The Theseus exe is -static-libgcc -static-libstdc++, +# but libprojectM-4.dll (cross-built without those flags) drags libgcc_s_seh +# and libstdc++-6 in at load time. Ship all three alongside the exe. +# On macOS/Homebrew these live in x86_64-w64-mingw32/bin/; on Linux/APT they +# live in x86_64-w64-mingw32/lib/. Try bin/ first, fall back to lib/. +define find_mingw_dll +$(shell \ BASE=$$(dirname $$(dirname $$(realpath $$(which x86_64-w64-mingw32-gcc 2>/dev/null)))) ; \ - BIN=$$BASE/x86_64-w64-mingw32/bin/libwinpthread-1.dll ; \ - LIB=$$BASE/x86_64-w64-mingw32/lib/libwinpthread-1.dll ; \ + BIN=$$BASE/x86_64-w64-mingw32/bin/$(1) ; \ + LIB=$$BASE/x86_64-w64-mingw32/lib/$(1) ; \ if [ -f "$$BIN" ]; then echo $$BIN ; elif [ -f "$$LIB" ]; then echo $$LIB ; fi) +endef +WIN64_PTHREAD_DLL := $(call find_mingw_dll,libwinpthread-1.dll) +WIN64_GCC_DLL := $(call find_mingw_dll,libgcc_s_seh-1.dll) +WIN64_STDCPP_DLL := $(call find_mingw_dll,libstdc++-6.dll) SDL2_MINGW_DIR ?= $(HOME)/cross/sdl2-mingw SDL2_MINGW_INC = $(SDL2_MINGW_DIR)/SDL2-2.32.10/x86_64-w64-mingw32/include @@ -1177,6 +1184,8 @@ $(WIN64_TARGET): $(WIN64_OBJS) @cp $(SDL2_MINGW_BIN)/SDL2.dll $(WIN64_DIR)/ @cp $(MIXER_MINGW_BIN)/SDL2_mixer.dll $(WIN64_DIR)/ @cp $(WIN64_PTHREAD_DLL) $(WIN64_DIR)/ + @if [ -n "$(WIN64_GCC_DLL)" ]; then cp $(WIN64_GCC_DLL) $(WIN64_DIR)/ ; fi + @if [ -n "$(WIN64_STDCPP_DLL)" ]; then cp $(WIN64_STDCPP_DLL) $(WIN64_DIR)/ ; fi @if [ -f $(MPV_MINGW_DIR)/libmpv-2.dll ]; then cp $(MPV_MINGW_DIR)/libmpv-2.dll $(WIN64_DIR)/; fi @for f in $(CURL_MINGW_DIR)/bin/libcurl*.dll $(CURL_MINGW_DIR)/libcurl*.dll; do \ [ -f "$$f" ] && cp "$$f" $(WIN64_DIR)/ || true ; \