Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/Remmina/Remmina.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntenore Gatta (tmow) <antenore@simbiosi.org>2021-01-05 14:36:48 +0300
committerAntenore Gatta (tmow) <antenore@simbiosi.org>2021-01-05 14:36:48 +0300
commitbb456385c8a975fa0faf652258923c0c033eaa7e (patch)
tree34c63e2b9a791b7fd15f0b91f6e30768cfa6bb7f
parentaffd158deaafbe4b76796e5a80a837de8bef5bff (diff)
Disabling Python support by default
- Added a compile switch -DWITH_PYTHON to enable/disable the Python support - Mitigate #2379 Signed-off-by: Antenore Gatta <antenore@simbiosi.org>
-rw-r--r--src/CMakeLists.txt50
-rw-r--r--src/remmina.c2
-rw-r--r--src/remmina_plugin_manager.c10
3 files changed, 48 insertions, 14 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 6eb157721..0cdba7659 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -79,16 +79,6 @@ list(APPEND REMMINA_SRCS
"remmina_plugin_manager.h"
"remmina_plugin_native.c"
"remmina_plugin_native.h"
- "remmina_plugin_python.c"
- "remmina_plugin_python.h"
- "remmina_plugin_python_module.c"
- "remmina_plugin_python_module.h"
- "remmina_plugin_python_remmina.c"
- "remmina_plugin_python_remmina.h"
- "remmina_plugin_python_protocol_widget.c"
- "remmina_plugin_python_protocol_widget.h"
- "remmina_plugin_python_remmina_file.c"
- "remmina_plugin_python_remmina_file.h"
"remmina_ext_exec.c"
"remmina_ext_exec.h"
"remmina_pref.c"
@@ -139,13 +129,47 @@ list(APPEND REMMINA_SRCS
"remmina_stats_sender.h"
)
+option(WITH_PYTHONLIBS "Enable Python plugins support" OFF)
+if(WITH_PYTHONLIBS)
+ message(STATUS "Python plugins support enabled")
+ find_suggested_package(PythonLibs)
+ if(PythonLibs_FOUND)
+ message(STATUS "Python libs found, Python support enabled")
+ add_definitions(-DWITH_PYTHONLIBS)
+ list(FIND REMMINA_SRCS "remmina_exec.c" SRCINDEX)
+ message(DEBUG "remmina_exec.c found at index: " ${SRCINDEX})
+ # Index calculated at "remmina_exec.c" position (43 as of today)
+ list(INSERT REMMINA_SRCS ${SRCINDEX}
+ "remmina_plugin_python.c"
+ "remmina_plugin_python.h"
+ "remmina_plugin_python_module.c"
+ "remmina_plugin_python_module.h"
+ "remmina_plugin_python_remmina.c"
+ "remmina_plugin_python_remmina.h"
+ "remmina_plugin_python_protocol_widget.c"
+ "remmina_plugin_python_protocol_widget.h"
+ "remmina_plugin_python_remmina_file.c"
+ "remmina_plugin_python_remmina_file.h"
+ )
+ else()
+ message(STATUS "Python plugins support enabled, but Python libs not found")
+ endif()
+else()
+ message(STATUS "Python plugins support disabled")
+endif()
+
+message(DEBUG "Source list set to: " ${REMMINA_SRCS})
+
add_executable(remmina ${REMMINA_SRCS})
include_directories(${GTK_INCLUDE_DIRS} ${gio_INCLUDE_DIRS} ${gio-unix_INCLUDE_DIRS})
target_link_libraries(remmina ${GTK_LIBRARIES})
-find_package(PythonLibs REQUIRED)
-include_directories(${PYTHON_INCLUDE_DIRS})
-target_link_libraries(remmina ${PYTHON_LIBRARIES})
+if(WITH_PYTHONLIBS)
+ if(PythonLibs_FOUND)
+ include_directories(${PYTHON_INCLUDE_DIRS})
+ target_link_libraries(remmina ${PYTHON_LIBRARIES})
+ endif()
+endif()
if(WITH_MANPAGES)
install(FILES remmina.1 DESTINATION ${CMAKE_INSTALL_FULL_MANDIR}/man1)
diff --git a/src/remmina.c b/src/remmina.c
index 334509941..0601f7bfa 100644
--- a/src/remmina.c
+++ b/src/remmina.c
@@ -48,7 +48,9 @@
#include "remmina_masterthread_exec.h"
#include "remmina_plugin_manager.h"
#include "remmina_plugin_native.h"
+#ifdef WITH_PYTHONLIBS
#include "remmina_plugin_python.h"
+#endif
#include "remmina_pref.h"
#include "remmina_public.h"
#include "remmina_sftp_plugin.h"
diff --git a/src/remmina_plugin_manager.c b/src/remmina_plugin_manager.c
index 3bdeb51d2..a1b713a81 100644
--- a/src/remmina_plugin_manager.c
+++ b/src/remmina_plugin_manager.c
@@ -54,7 +54,9 @@
#include "rcw.h"
#include "remmina_plugin_manager.h"
#include "remmina_plugin_native.h"
+#ifdef WITH_PYTHONLIBS
#include "remmina_plugin_python.h"
+#endif
#include "remmina_public.h"
#include "remmina_masterthread_exec.h"
#include "remmina/remmina_trace_calls.h"
@@ -264,7 +266,11 @@ static void remmina_plugin_manager_load_plugin(const gchar *name)
if (g_str_equal(G_MODULE_SUFFIX, ext)) {
remmina_plugin_native_load(&remmina_plugin_manager_service, name);
} else if (g_str_equal("py", ext)) {
+#ifdef WITH_PYTHONLIBS
remmina_plugin_python_load(&remmina_plugin_manager_service, name);
+#else
+ REMMINA_DEBUG("Python support not compiled, cannot load Python plugins");
+#endif
} else {
g_print("%s: Skip unsupported file type '%s'\n", name, ext);
}
@@ -297,8 +303,10 @@ void remmina_plugin_manager_init()
GSList *sple;
remmina_plugin_table = g_ptr_array_new();
+#ifdef WITH_PYTHONLIBS
remmina_plugin_python_init();
-
+#endif
+
if (!g_module_supported()) {
g_print("Dynamic loading of plugins is not supported on this platform!\n");
return;