- Disable Lua bindings as those fail to build

OBS-URL: https://build.opensuse.org/package/show/games:tools/slade?expand=0&rev=33
This commit is contained in:
Jan Engelhardt 2020-10-11 09:19:07 +00:00 committed by Git OBS Bridge
parent e667f8f2e6
commit adcda23619
4 changed files with 268 additions and 3 deletions

View File

@ -0,0 +1,231 @@
From a54f12b4c29e949458949d5bede2f74b1aa8a34a Mon Sep 17 00:00:00 2001
From: jengelh <jengelh@inai.de>
Date: Mon, 29 Jun 2020 03:43:01 +0200
Subject: [PATCH] build: add cmake option to skip Lua components (#1175)
sol.hpp has a lot of templates which, when building with -g
-fsanitize=address -fsanitize=undefined, incur long compile time and
high memory usage (~8500MB) [applies to Scripting/Export/Archive.cpp
and Scripting/Export/Graphics.cpp].
Add a cmake option so I can skip building some parts and focus on
the rest.
Co-authored-by: Simon Judd <sirjuddington@gmail.com>
---
src/Application/App.cpp | 8 ++++++++
src/CMakeLists.txt | 11 ++++++++++-
src/MainEditor/UI/ArchivePanel.cpp | 10 ++++++++++
src/MainEditor/UI/MainWindow.cpp | 2 ++
src/MapEditor/UI/MapEditorWindow.cpp | 6 ++++++
5 files changed, 36 insertions(+), 1 deletion(-)
Index: SLADE-3.1.12/src/Application/App.cpp
===================================================================
--- SLADE-3.1.12.orig/src/Application/App.cpp
+++ SLADE-3.1.12/src/Application/App.cpp
@@ -450,8 +450,10 @@ bool App::init(vector<string>& args, dou
SAction::setBaseWxId(26000);
SAction::initActions();
+#ifdef USE_LUA
// Init lua
Lua::init();
+#endif
// Init UI
UI::init(ui_scale);
@@ -515,8 +517,10 @@ bool App::init(vector<string>& args, dou
Log::info("Loading game configurations");
Game::init();
+#ifdef USE_LUA
// Init script manager
ScriptManager::init();
+#endif
// Show the main window
MainEditor::windowWx()->Show(true);
@@ -644,8 +648,10 @@ void App::exit(bool save_config)
// Save custom special presets
Game::saveCustomSpecialPresets();
+#ifdef USE_LUA
// Save custom scripts
ScriptManager::saveUserScripts();
+#endif
}
// Close all open archives
@@ -666,8 +672,10 @@ void App::exit(bool save_config)
files = temp.GetNext(&filename);
}
+#ifdef USE_LUA
// Close lua
Lua::close();
+#endif
// Close DUMB
dumb_exit();
Index: SLADE-3.1.12/src/CMakeLists.txt
===================================================================
--- SLADE-3.1.12.orig/src/CMakeLists.txt
+++ SLADE-3.1.12/src/CMakeLists.txt
@@ -105,6 +105,9 @@ find_package(OpenGL REQUIRED)
find_package(GLEW REQUIRED)
find_package(Freetype REQUIRED)
find_package(CURL REQUIRED)
+if (NOT NO_LUA)
+ find_package(Lua REQUIRED)
+endif()
include_directories(
${FREEIMAGE_INCLUDE_DIR}
${SFML_INCLUDE_DIR}
@@ -133,6 +136,7 @@ endif ()
set(SLADE_SOURCES
)
+set(SLADE_SCRIPTING_SOURCES)
# Don't include external libraries here as they should be compiled separately
file(GLOB_RECURSE SLADE_SOURCES
Application/*.cpp
@@ -147,9 +151,14 @@ file(GLOB_RECURSE SLADE_SOURCES
OpenGL/*.cpp
UI/*.cpp
Utility/*.cpp
- Scripting/*.cpp
TextEditor/*.cpp
)
+if (NOT NO_LUA)
+ file(GLOB_RECURSE SLADE_SCRIPTING_SOURCES Scripting/*.cpp)
+ set(SLADE_SOURCES ${SLADE_SOURCES} ${SLADE_SCRIPTING_SOURCES})
+ ADD_DEFINITIONS(-DUSE_LUA)
+else ()
+endif ()
set(SLADE_HEADERS
)
file(GLOB_RECURSE SLADE_HEADERS *.h *.hpp)
Index: SLADE-3.1.12/src/MainEditor/UI/ArchivePanel.cpp
===================================================================
--- SLADE-3.1.12.orig/src/MainEditor/UI/ArchivePanel.cpp
+++ SLADE-3.1.12/src/MainEditor/UI/ArchivePanel.cpp
@@ -522,7 +522,9 @@ void ArchivePanel::addMenus()
SAction::fromId("arch_replace_maps")->addToMenu(menu_clean);
menu_archive->AppendSubMenu(menu_clean, "&Maintenance");
auto menu_scripts = new wxMenu();
+#ifdef USE_LUA
ScriptManager::populateEditorScriptMenu(menu_scripts, ScriptManager::ScriptType::Archive, "arch_script");
+#endif
menu_archive->AppendSubMenu(menu_scripts, "&Run Script");
}
if (!menu_entry)
@@ -546,7 +548,9 @@ void ArchivePanel::addMenus()
menu_entry->AppendSeparator();
SAction::fromId("arch_entry_bookmark")->addToMenu(menu_entry);
auto menu_scripts = new wxMenu();
+#ifdef USE_LUA
ScriptManager::populateEditorScriptMenu(menu_scripts, ScriptManager::ScriptType::Entry, "arch_entry_script");
+#endif
menu_entry->AppendSubMenu(menu_scripts, "&Run Script");
}
@@ -3189,9 +3193,11 @@ bool ArchivePanel::handleAction(string i
dlg.ShowModal();
}
+#ifdef USE_LUA
// Archive->Scripts->...
else if (id == "arch_script")
ScriptManager::runArchiveScript(archive_, wx_id_offset);
+#endif
// ------------------------------------------------------------------------
@@ -3269,9 +3275,11 @@ bool ArchivePanel::handleAction(string i
else if (id == "arch_entry_openext")
openEntryExternal();
+#ifdef USE_LUA
// Entry->Run Script
else if (id == "arch_entry_script")
ScriptManager::runEntryScript(entry_list_->getSelectedEntries(), wx_id_offset, MainEditor::windowWx());
+#endif
// Context menu actions
@@ -3785,6 +3793,7 @@ void ArchivePanel::onEntryListRightClick
#endif
}
+#ifdef USE_LUA
// Entry scripts
if (!ScriptManager::editorScripts(ScriptManager::ScriptType::Entry).empty())
{
@@ -3793,6 +3802,7 @@ void ArchivePanel::onEntryListRightClick
context.AppendSeparator();
context.AppendSubMenu(menu_scripts, "Run &Script");
}
+#endif
// Popup the context menu
PopupMenu(&context);
Index: SLADE-3.1.12/src/MainEditor/UI/MainWindow.cpp
===================================================================
--- SLADE-3.1.12.orig/src/MainEditor/UI/MainWindow.cpp
+++ SLADE-3.1.12/src/MainEditor/UI/MainWindow.cpp
@@ -661,12 +661,14 @@ bool MainWindow::handleAction(string id)
if (id == "main_showstartpage")
openStartPageTab();
+#ifdef USE_LUA
// Tools->Run Script
if (id == "main_runscript")
{
ScriptManager::open();
return true;
}
+#endif
// Help->About
if (id == "main_about")
Index: SLADE-3.1.12/src/MapEditor/UI/MapEditorWindow.cpp
===================================================================
--- SLADE-3.1.12.orig/src/MapEditor/UI/MapEditorWindow.cpp
+++ SLADE-3.1.12/src/MapEditor/UI/MapEditorWindow.cpp
@@ -269,7 +269,9 @@ void MapEditorWindow::setupMenu()
// Tools menu
wxMenu* menu_tools = new wxMenu("");
menu_scripts_ = new wxMenu();
+#ifdef USE_LUA
ScriptManager::populateEditorScriptMenu(menu_scripts_, ScriptManager::ScriptType::Map, "mapw_script");
+#endif
menu_tools->AppendSubMenu(menu_scripts_, "Run Script");
SAction::fromId("mapw_runscript")->addToMenu(menu_tools);
menu->Append(menu_tools, "&Tools");
@@ -1136,7 +1138,9 @@ void MapEditorWindow::reloadScriptsMenu(
while (menu_scripts_->FindItemByPosition(0))
menu_scripts_->Delete(menu_scripts_->FindItemByPosition(0));
+#ifdef USE_LUA
ScriptManager::populateEditorScriptMenu(menu_scripts_, ScriptManager::ScriptType::Map, "mapw_script");
+#endif
}
// ----------------------------------------------------------------------------
@@ -1436,6 +1440,7 @@ bool MapEditorWindow::handleAction(strin
return true;
}
+#ifdef USE_LUA
// Tools->Run Script
else if (id == "mapw_script")
{
@@ -1449,6 +1454,7 @@ bool MapEditorWindow::handleAction(strin
ScriptManager::open();
return true;
}
+#endif
return false;
}

22
gcc10.patch Normal file
View File

@ -0,0 +1,22 @@
---
src/External/sol/sol.hpp | 2 ++
1 file changed, 2 insertions(+)
Index: SLADE-3.1.12/src/External/sol/sol.hpp
===================================================================
--- SLADE-3.1.12.orig/src/External/sol/sol.hpp
+++ SLADE-3.1.12/src/External/sol/sol.hpp
@@ -4537,11 +4537,13 @@ namespace sol {
return pusher<meta::unqualified_t<T>>{}.push(L, std::forward<T>(t), std::forward<Args>(args)...);
}
+#if 0
// overload allows to use a pusher of a specific type, but pass in any kind of args
template<typename T, typename Arg, typename... Args, typename = std::enable_if_t<!std::is_same<T, Arg>::value>>
inline int push(lua_State* L, Arg&& arg, Args&&... args) {
return pusher<meta::unqualified_t<T>>{}.push(L, std::forward<Arg>(arg), std::forward<Args>(args)...);
}
+#endif
template<typename T, typename... Args>
inline int push_reference(lua_State* L, T&& t, Args&&... args) {

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sun Oct 11 09:18:41 UTC 2020 - Jan Engelhardt <jengelh@inai.de>
- Disable Lua bindings as those fail to build
- Add 0001-build-add-cmake-option-to-skip-Lua-components-1175.patch
for Factory.
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Jun 28 10:44:36 UTC 2020 - Jan Engelhardt <jengelh@inai.de> Sun Jun 28 10:44:36 UTC 2020 - Jan Engelhardt <jengelh@inai.de>

View File

@ -31,12 +31,13 @@ Patch2: wx.diff
Patch3: clzma.diff Patch3: clzma.diff
Patch4: 0001-build-allow-deactivating-the-crash-handler-at-build-.patch Patch4: 0001-build-allow-deactivating-the-crash-handler-at-build-.patch
Patch10: disable_sse.patch Patch10: disable_sse.patch
Patch11: 0001-build-add-cmake-option-to-skip-Lua-components-1175.patch
# slade 3.2 will need gcc-c++>=8 and pkgconfig(fmt)>=6 # slade 3.2 will need gcc-c++>=8 and pkgconfig(fmt)>=6
BuildRequires: ImageMagick BuildRequires: ImageMagick
BuildRequires: cmake >= 3.1 BuildRequires: cmake >= 3.1
BuildRequires: freeimage-devel BuildRequires: freeimage-devel
BuildRequires: gcc-c++ >= 6 BuildRequires: gcc-c++ >= 6
BuildRequires: pkgconfig BuildRequires: pkg-config
BuildRequires: strip-nondeterminism BuildRequires: strip-nondeterminism
BuildRequires: update-desktop-files BuildRequires: update-desktop-files
BuildRequires: wxWidgets-3_0-devel BuildRequires: wxWidgets-3_0-devel
@ -63,13 +64,17 @@ from/to other generic formats such as PNG.
%ifnarch %ix86 x86_64 %ifnarch %ix86 x86_64
%patch10 -p0 %patch10 -p0
%endif %endif
%if 0%{?suse_version} >= 1550
%patch -P 11 -p1
%endif
%build %build
%define _lto_cflags %nil %define _lto_cflags %nil
%cmake -DNO_WEBVIEW=ON -DWX_GTK3=OFF -DNO_CRASHHANDLER=ON \ %cmake -DNO_WEBVIEW=ON -DWX_GTK3=OFF -DNO_CRASHHANDLER=ON \
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="%optflags" \ -DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING="%optflags" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="%optflags" -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="%optflags" \
make %{?_smp_mflags} -DNO_LUA:BOOL=TRUE
%cmake_build
%install %install
strip-nondeterminism build/slade.pk3 strip-nondeterminism build/slade.pk3