[boswars] Build against compat-tolua++-5.1 as boswars is not compatible with lua 5.2

Hans de Goede jwrdegoede at fedoraproject.org
Thu Feb 26 09:33:00 UTC 2015


commit 095771035d2b06dd036c2a109d3ce6e9afcb2f1b
Author: Hans de Goede <hdegoede at redhat.com>
Date:   Thu Feb 26 10:32:51 2015 +0100

    Build against compat-tolua++-5.1 as boswars is not compatible with lua 5.2

 boswars-2.6.1-lua-5.2.patch | 100 +++++++++++++++++++++-----------------------
 boswars.spec                |  10 +++--
 2 files changed, 54 insertions(+), 56 deletions(-)
---
diff --git a/boswars-2.6.1-lua-5.2.patch b/boswars-2.6.1-lua-5.2.patch
index 8a6200b..391df18 100644
--- a/boswars-2.6.1-lua-5.2.patch
+++ b/boswars-2.6.1-lua-5.2.patch
@@ -1,39 +1,36 @@
-diff -up boswars-2.6.1-src/engine/ai/ai.cpp.lua-52 boswars-2.6.1-src/engine/ai/ai.cpp
---- boswars-2.6.1-src/engine/ai/ai.cpp.lua-52	2010-04-11 08:12:38.000000000 -0400
-+++ boswars-2.6.1-src/engine/ai/ai.cpp	2013-05-13 10:19:18.322312662 -0400
-@@ -156,8 +156,7 @@ static void AiExecuteScript()
+diff -up boswars-2.7-src/engine/ai/ai.cpp.lua52 boswars-2.7-src/engine/ai/ai.cpp
+--- boswars-2.7-src/engine/ai/ai.cpp.lua52	2013-06-02 14:41:06.000000000 +0200
++++ boswars-2.7-src/engine/ai/ai.cpp	2014-12-17 13:04:50.353074926 +0100
+@@ -160,7 +160,7 @@ static void AiExecuteFunction(const char
  {
- 	if (!AiPlayer->Script.empty())
+ 	if (AiPlayer->AiType != NULL)
  	{
--		lua_pushstring(Lua, "_ai_scripts_");
--		lua_gettable(Lua, LUA_GLOBALSINDEX);
-+		lua_getglobal(Lua, "_ai_scripts_");
- 		lua_pushstring(Lua, AiPlayer->Script.c_str());
- 		lua_rawget(Lua, -2);
- 		LuaCall(0, 1);
-diff -up boswars-2.6.1-src/engine/ai/script_ai.cpp.lua-52 boswars-2.6.1-src/engine/ai/script_ai.cpp
---- boswars-2.6.1-src/engine/ai/script_ai.cpp.lua-52	2010-04-11 08:12:38.000000000 -0400
-+++ boswars-2.6.1-src/engine/ai/script_ai.cpp	2013-05-13 10:19:18.323312662 -0400
-@@ -328,16 +328,13 @@ static int CclDefineAi(lua_State *l)
+-		lua_getfield(Lua, LUA_GLOBALSINDEX, "AiTypes");
++		lua_getglobal(Lua, "AiTypes");
+ 		lua_getfield(Lua, -1, AiPlayer->AiType->Name.c_str());
+ 		lua_getfield(Lua, -1, field);
+ 		if (!lua_isnil(Lua, -1))
+@@ -492,7 +492,7 @@ void AiInit(CPlayer *player)
+ 
+ 	// Initialize the AI state of the player if it has not been
+ 	// already initialized, i.e. we're not loading a saved game.
+-	lua_getfield(Lua, LUA_GLOBALSINDEX, "AiState"); // stack: AiState
++	lua_getglobal(Lua, "AiState"); // stack: AiState
+ 	Assert(lua_istable(Lua, -1));
+ 	lua_pushnumber(Lua, player->Index);             // stack: AiState, player
+ 	lua_gettable(Lua, -2);                          // stack: AiState, AiState[player]
+diff -up boswars-2.7-src/engine/ai/script_ai.cpp.lua52 boswars-2.7-src/engine/ai/script_ai.cpp
+--- boswars-2.7-src/engine/ai/script_ai.cpp.lua52	2013-06-02 14:41:06.000000000 +0200
++++ boswars-2.7-src/engine/ai/script_ai.cpp	2014-12-17 13:04:50.354074903 +0100
+@@ -340,7 +340,7 @@ static int CclDefineAiType(lua_State *l)
  	//
- 	// AI Script
+ 	// Add to the AiTypes Lua variable.
  	//
--	lua_pushstring(l, "_ai_scripts_");
--	lua_gettable(l, LUA_GLOBALSINDEX);
-+	lua_getglobal(l, "_ai_scripts_");
- 	if (lua_isnil(l, -1))
- 	{
- 		lua_pop(l, 1);
--		lua_pushstring(l, "_ai_scripts_");
- 		lua_newtable(l);
--		lua_settable(l, LUA_GLOBALSINDEX);
--		lua_pushstring(l, "_ai_scripts_");
--		lua_gettable(l, LUA_GLOBALSINDEX);
-+		lua_setglobal(l, "_ai_scripts_");
-+		lua_getglobal(l, "_ai_scripts_");
- 	}
- 	aitype->Script = aitype->Name + aitype->Class;
- 	lua_pushstring(l, aitype->Script.c_str());
+-	lua_getfield(l, LUA_GLOBALSINDEX, "AiTypes");
++	lua_getglobal(l, "AiTypes");
+ 	lua_pushvalue(l, ident_index);
+ 	lua_pushvalue(l, aitype_index);
+ 	lua_settable(l, -3);
 diff -up boswars-2.6.1-src/engine/game/trigger.cpp.lua-52 boswars-2.6.1-src/engine/game/trigger.cpp
 --- boswars-2.6.1-src/engine/game/trigger.cpp.lua-52	2013-05-13 10:28:01.768320516 -0400
 +++ boswars-2.6.1-src/engine/game/trigger.cpp	2013-05-13 10:31:23.566323544 -0400
@@ -46,7 +43,7 @@ diff -up boswars-2.6.1-src/engine/game/trigger.cpp.lua-52 boswars-2.6.1-src/engi
 +	lua_getglobal(l, "_triggers_");
  
  	if (lua_isnil(l, -1)) {
- 		puts("Trigger not set, defining trigger");
+ 		DebugPrint("Trigger not set, defining trigger\n");
  		lua_pop(l, 1);
 -		lua_pushstring(l, "_triggers_");
  		lua_newtable(l);
@@ -130,12 +127,12 @@ diff -up boswars-2.6.1-src/engine/sound/music.cpp.lua-52 boswars-2.6.1-src/engin
  		if (!lua_isfunction(Lua, -1)) {
  			fprintf(stderr, "No MusicStopped function in Lua\n");
  			StopMusic();
-diff -up boswars-2.6.1-src/engine/stratagus/script.cpp.lua-52 boswars-2.6.1-src/engine/stratagus/script.cpp
---- boswars-2.6.1-src/engine/stratagus/script.cpp.lua-52	2013-05-13 10:31:34.540323709 -0400
-+++ boswars-2.6.1-src/engine/stratagus/script.cpp	2013-05-13 10:32:52.366324877 -0400
-@@ -144,8 +144,7 @@ static int report(int status, bool exitO
- 
- static int luatraceback(lua_State *L) 
+diff -up boswars-2.7-src/engine/stratagus/script.cpp.lua52 boswars-2.7-src/engine/stratagus/script.cpp
+--- boswars-2.7-src/engine/stratagus/script.cpp.lua52	2013-06-02 14:41:07.000000000 +0200
++++ boswars-2.7-src/engine/stratagus/script.cpp	2014-12-17 13:04:50.354074903 +0100
+@@ -156,8 +156,7 @@ static int report(int status, bool exitO
+ */
+ int luatraceback(lua_State *L)
  {
 -	lua_pushliteral(L, "debug");
 -	lua_gettable(L, LUA_GLOBALSINDEX);
@@ -143,16 +140,15 @@ diff -up boswars-2.6.1-src/engine/stratagus/script.cpp.lua-52 boswars-2.6.1-src/
  	if (!lua_istable(L, -1)) {
  		lua_pop(L, 1);
  		return 1;
-@@ -873,8 +872,7 @@ char *SaveGlobal(lua_State *l, bool is_r
- 	first = true;
- 	res = NULL;
+@@ -1428,7 +1427,7 @@ char *SaveGlobal(lua_State *l, bool is_r
+ {
+ 	CSerializeLua serialize(l);
  	if (is_root) {
--		lua_pushstring(l, "_G");// global table in lua.
--		lua_gettable(l, LUA_GLOBALSINDEX);
-+		lua_getglobal(l, "_G");
+-		lua_pushvalue(l, LUA_GLOBALSINDEX);
++		lua_pushglobaltable(l);
  	}
- 	sep = is_root ? "" : ", ";
- 	Assert(lua_istable(l, -1));
+ 	CSerializeLua::Result result
+ 		= serialize.AppendLuaFields(lua_gettop(l), is_root);
 @@ -1045,8 +1043,7 @@ void SavePreferences(void)
  	FILE *fd;
  	std::string path;
@@ -163,9 +159,9 @@ diff -up boswars-2.6.1-src/engine/stratagus/script.cpp.lua-52 boswars-2.6.1-src/
  	if (lua_type(Lua, -1) == LUA_TTABLE) {
  		path = UserDirectory + "preferences.lua";
  
-diff -up boswars-2.6.1-src/engine/ui/interface.cpp.lua-52 boswars-2.6.1-src/engine/ui/interface.cpp
---- boswars-2.6.1-src/engine/ui/interface.cpp.lua-52	2013-05-13 10:20:44.841313960 -0400
-+++ boswars-2.6.1-src/engine/ui/interface.cpp	2013-05-13 10:21:54.076314999 -0400
+diff -up boswars-2.7-src/engine/ui/interface.cpp.lua52 boswars-2.7-src/engine/ui/interface.cpp
+--- boswars-2.7-src/engine/ui/interface.cpp.lua52	2013-06-02 14:41:08.000000000 +0200
++++ boswars-2.7-src/engine/ui/interface.cpp	2014-12-17 13:04:50.354074903 +0100
 @@ -474,8 +474,7 @@ bool HandleCommandKey(int key)
  	bool ret;
  	int base = lua_gettop(Lua);
@@ -176,7 +172,7 @@ diff -up boswars-2.6.1-src/engine/ui/interface.cpp.lua-52 boswars-2.6.1-src/engi
  	if (!lua_isfunction(Lua, -1)) {
  		DebugPrint("No HandleCommandKey function in lua.\n");
  		return false;
-@@ -719,8 +718,7 @@ int HandleCheats(const std::string &inpu
+@@ -695,8 +695,7 @@ int HandleCheats(const std::string &inpu
  	}
  #endif
  	int base = lua_gettop(Lua);
@@ -185,7 +181,7 @@ diff -up boswars-2.6.1-src/engine/ui/interface.cpp.lua-52 boswars-2.6.1-src/engi
 +	lua_getglobal(Lua, "HandleCheats");
  	if (!lua_isfunction(Lua, -1)) {
  		DebugPrint("No HandleCheats function in lua.\n");
- 		return 0;
+ 	} else {
 diff -up boswars-2.6.1-src/engine/ui/script_ui.cpp.lua-52 boswars-2.6.1-src/engine/ui/script_ui.cpp
 --- boswars-2.6.1-src/engine/ui/script_ui.cpp.lua-52	2013-05-13 10:27:36.691320140 -0400
 +++ boswars-2.6.1-src/engine/ui/script_ui.cpp	2013-05-13 10:27:41.517320212 -0400
diff --git a/boswars.spec b/boswars.spec
index 5d96385..8d34f9f 100644
--- a/boswars.spec
+++ b/boswars.spec
@@ -1,6 +1,6 @@
 Name:           boswars
 Version:        2.7
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Bos Wars is a futuristic real-time strategy game
 Group:          Amusements/Games
 License:        GPLv2
@@ -13,13 +13,12 @@ Patch0:         boswars-2.4.1-SConstruct.patch
 # incomplete patch to port boswars to the system guichan-0.6 instead of
 # using the included guichan-0.4. Incomplete, NOT finished and NOT working!
 #Patch1:         boswars-2.4.1-guichan26.patch
-# Lua 5.2 patch needs to be ported to boswars-2.7, more importantly we first
-# need a tolua++ which works with 5.2
+# Incomplete Lua 5.2 patch, this fixes the C-code but not the actual lua scripts
 #Patch2:         boswars-2.6.1-lua-5.2.patch
 # Use compat-lua51 for now
 Patch3:         boswars-2.7-compat-lua-5.1.patch
 BuildRequires:  libtheora-devel libvorbis-devel SDL-devel libGL-devel
-BuildRequires:  tolua++-devel libpng-devel scons desktop-file-utils
+BuildRequires:  compat-tolua++-devel libpng-devel scons desktop-file-utils
 Requires:       hicolor-icon-theme xorg-x11-utils
 
 %description
@@ -86,6 +85,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 
 
 %changelog
+* Mon Feb 23 2015 Hans de Goede <hdegoede at redhat.com> - 2.7-6
+- Build against compat-tolua++-5.1 as boswars is not compatible with lua 5.2
+
 * Fri Aug 15 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 2.7-5
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 


More information about the scm-commits mailing list