Index | Thread | Search

From:
Stuart Henderson <stu@spacehopper.org>
Subject:
games/stratagus: stop using bundled lua
To:
ports <ports@openbsd.org>
Date:
Fri, 2 Oct 2026 09:41:21 +0100

Download raw body.

Thread
ganes/stratagus has an ugly workaround for not having toluac++ in
ports, which seems to have issues around system lua being installed
and/or junked during build.

this switches to system lua and adds a new port (attached); toluacpp.tgz
(lang/toluacpp).

lua/5.1 is hardcoded for simplicity - this codebase does not support
newer lua major versions and toluac++ is archived upstream - so no
need for extra complexity from the module.

any ok's (at least to import toluacpp)?

post unlock obviously


Index: Makefile
===================================================================
RCS file: /cvs/ports/games/stratagus/Makefile,v
diff -u -p -r1.3 Makefile
--- Makefile	4 Mar 2026 10:21:05 -0000	1.3
+++ Makefile	2 Oct 2026 08:31:53 -0000
@@ -3,6 +3,7 @@ COMMENT=		free cross-platform real-time 
 GH_ACCOUNT=		Wargus
 GH_PROJECT=		stratagus
 GH_TAGNAME=		v3.3.2
+REVISION=		0
 CATEGORIES=		games
 
 HOMEPAGE=		http://stratagus.com/stratagus.html
@@ -10,8 +11,8 @@ HOMEPAGE=		http://stratagus.com/stratagu
 # GPLv2+
 PERMIT_PACKAGE=		Yes
 
-WANTLIB += 		${COMPILER_LIBCXX} SDL2 SDL2_image SDL2_mixer bz2 c m \
-			mng ogg png pthread theora vorbis z
+WANTLIB += ${COMPILER_LIBCXX} SDL2 SDL2_image SDL2_mixer bz2 c
+WANTLIB += lua5.1 m mng ogg png theora toluapp vorbis z
 
 MODULES=		devel/cmake
 
@@ -25,6 +26,7 @@ LIB_DEPENDS=		archivers/bzip2 \
 			devel/sdl2-mixer \
 			devel/sdl2-image \
 			graphics/libmng \
+			lang/toluapp \
 			multimedia/libtheora
 
 CONFIGURE_ARGS=		-DGAMEDIR=${LOCALBASE}/bin/ \
@@ -32,17 +34,8 @@ CONFIGURE_ARGS=		-DGAMEDIR=${LOCALBASE}/
 			-DENABLE_DEV=ON
 
 MODCMAKE_LDFLAGS+=	-L${LOCALBASE}/lib -L${X11BASE}/lib
-CXXFLAGS =		-I${X11BASE}/include
+CXXFLAGS+=		-I${X11BASE}/include
 
-# XXX Depends on tolua++, use bundled lua 51
-CONFIGURE_ARGS+=	-DBUILD_VENDORED_LUA=ON
-pre-build:
-	cd ${WRKBUILD} && exec ${SETENV} ${MAKE_ENV} \
-	cmake --build ${WRKBUILD} ${_MAKE_VERBOSE} -j ${MAKE_JOBS} -t Lua51B
-
-pre-configure:
-	find ${WRKSRC}/ -name "CMakeLists.txt" -type f -exec sed -i \
-	-E 's/cmake_minimum_required\([[:space:]]*VERSION[[:space:]]+[^)]+\)/cmake_minimum_required(VERSION 3.5)/g' \
-	{} \;
+MODCMAKE_POLICY_VERSION_OVERRIDE = Yes
 
 .include <bsd.port.mk>
Index: patches/patch-CMakeLists_txt
===================================================================
RCS file: /cvs/ports/games/stratagus/patches/patch-CMakeLists_txt,v
diff -u -p -r1.1.1.1 patch-CMakeLists_txt
--- patches/patch-CMakeLists_txt	13 Feb 2025 20:07:57 -0000	1.1.1.1
+++ patches/patch-CMakeLists_txt	2 Oct 2026 08:31:53 -0000
@@ -1,15 +1,7 @@
 Index: CMakeLists.txt
 --- CMakeLists.txt.orig
 +++ CMakeLists.txt
-@@ -71,6 +71,7 @@ endif()
- # Stratagus sources
- 
- include_directories(
-+	/usr/X11R6/include
- 	src/include
- 	src/guichan/include
- 	src/guichan/include/guichan
-@@ -656,7 +657,7 @@ if(APPLE)
+@@ -656,7 +656,7 @@ if(APPLE)
  	list(APPEND CMAKE_PREFIX_PATH /opt/homebrew/)
  endif()
  
Index: patches/patch-third-party_lua-5_1_5_src_CMakeLists_txt
===================================================================
RCS file: patches/patch-third-party_lua-5_1_5_src_CMakeLists_txt
diff -N patches/patch-third-party_lua-5_1_5_src_CMakeLists_txt
--- patches/patch-third-party_lua-5_1_5_src_CMakeLists_txt	1 Jul 2025 15:39:03 -0000	1.1
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,9 +0,0 @@
-Index: third-party/lua-5.1.5/src/CMakeLists.txt
---- third-party/lua-5.1.5/src/CMakeLists.txt.orig
-+++ third-party/lua-5.1.5/src/CMakeLists.txt
-@@ -72,4 +72,4 @@ set_target_properties(lua51 PROPERTIES
-         RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}
-     )
- 
--add_custom_command(TARGET lua51_static POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/src/lua.h" "${PROJECT_SOURCE_DIR}/src/luaconf.h" "${PROJECT_SOURCE_DIR}/src/lualib.h" "${PROJECT_SOURCE_DIR}/src/lauxlib.h" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
-+add_custom_command(TARGET lua51_static PRE_LINK COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/src/lua.h" "${PROJECT_SOURCE_DIR}/src/luaconf.h" "${PROJECT_SOURCE_DIR}/src/lualib.h" "${PROJECT_SOURCE_DIR}/src/lauxlib.h" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})