git: bce0c990b951 - main - games/battletanks: allow to build against any supported Lua version

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Mon, 06 Jul 2026 18:15:26 UTC
The branch main has been updated by danfe:

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

commit bce0c990b95106e5f09790082ffb10cc25d2c20b
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2026-07-06 18:13:32 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2026-07-06 18:13:32 +0000

    games/battletanks: allow to build against any supported Lua version
    
    Drop CXXFLAGS+=-fpermissive while here which seems no longer needed
    and sort the `pkg-plist' after commit 2d8f9fb62e9e.
---
 games/battletanks/Makefile                         |  3 +--
 .../battletanks/files/patch-engine_luaxx_state.cpp | 24 ++++++++++++++++++++++
 games/battletanks/pkg-plist                        |  2 +-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/games/battletanks/Makefile b/games/battletanks/Makefile
index 76c29885973a..4efffebc9f31 100644
--- a/games/battletanks/Makefile
+++ b/games/battletanks/Makefile
@@ -17,13 +17,12 @@ LIB_DEPENDS=	libsigc-2.0.so:devel/libsigc++20 \
 		libvorbisfile.so:audio/libvorbis \
 		libsmpeg.so:multimedia/smpeg
 
-USES=		lua:51 openal:al pkgconfig python:build scons sdl tar:bzip2
+USES=		lua openal:al pkgconfig python:build scons sdl tar:bzip2
 USE_CXXSTD=	gnu++98
 USE_LDCONFIG=	yes
 USE_SDL=	image sdl
 MAKE_ARGS=	prefix=${PREFIX} resources_dir=${DATADIR} \
 		--install-sandbox=${STAGEDIR}
-CXXFLAGS+=	-fpermissive
 
 PORTDOCS=	LICENSE LICENSE.EXCEPTION README-en.txt README-linux.txt \
 		donate.url homepage.url project_page.url video.txt
diff --git a/games/battletanks/files/patch-engine_luaxx_state.cpp b/games/battletanks/files/patch-engine_luaxx_state.cpp
new file mode 100644
index 000000000000..61fbb875aa15
--- /dev/null
+++ b/games/battletanks/files/patch-engine_luaxx_state.cpp
@@ -0,0 +1,24 @@
+--- engine/luaxx/state.cpp.orig	2008-06-08 09:02:39 UTC
++++ engine/luaxx/state.cpp
+@@ -59,7 +59,11 @@ static const char * chunk_reader(lua_State *L, void *d
+ void State::load(const std::string &fname, const mrt::Chunk &data) {
+ 	//throw_ex(("implement me[%s]", fname.c_str()));
+ 	reader_state x(data);
+-	int err = lua_load(state, chunk_reader, &x, fname.c_str());
++	int err = lua_load(state, chunk_reader, &x, fname.c_str()
++#if LUA_VERSION_NUM > 501
++	, NULL
++#endif
++	);
+ 	check_error(state, err);
+ }
+ 
+@@ -81,7 +85,7 @@ void State::init() {
+ 	assert(state == NULL);
+ 
+ 	//state = lua_newstate(l_alloc, this);
+-	state = lua_open();
++	state = luaL_newstate();
+ 	if (state == NULL)
+ 		throw_ex(("cannot create lua interpreter"));
+ 
diff --git a/games/battletanks/pkg-plist b/games/battletanks/pkg-plist
index a55a283266ee..ac607a3d55ba 100644
--- a/games/battletanks/pkg-plist
+++ b/games/battletanks/pkg-plist
@@ -1,9 +1,9 @@
 bin/btanks
 bin/bted
-share/man/man6/btanks.6.gz
 lib/btanks/libbt_objects.so
 lib/libbtanks_engine.so
 lib/libclunk.so
 lib/libmrt.so
 lib/libsdlx.so
 %%DATADIR%%/resources.dat
+share/man/man6/btanks.6.gz