Revert "libobs/util: Reject plugins linking Qt5 library for Linux"

This reverts commit 615728fa3b.

Includes partial revert of 62429135ba.
This commit is contained in:
Ryan Foster
2025-09-03 14:59:01 -04:00
parent f31485939c
commit 2004ea6b16

View File

@@ -14,14 +14,6 @@
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include "obsconfig.h"
#if !defined(__APPLE__) && OBS_QT_VERSION == 6
#define _GNU_SOURCE
#include <link.h>
#include <stdlib.h>
#endif
#include <stdio.h>
#include <errno.h>
#include <sys/types.h>
@@ -37,6 +29,8 @@
#include <signal.h>
#include <uuid/uuid.h>
#include "obsconfig.h"
#if !defined(__APPLE__)
#include <sys/times.h>
#include <sys/wait.h>
@@ -110,50 +104,10 @@ void os_dlclose(void *module)
dlclose(module);
}
#if !defined(__APPLE__) && OBS_QT_VERSION == 6
int module_has_qt5_check(const char *path)
{
void *mod = dlopen(path, RTLD_LAZY);
if (mod == NULL) {
return 1;
}
struct link_map *list = NULL;
if (dlinfo(mod, RTLD_DI_LINKMAP, &list) == 0) {
for (struct link_map *ptr = list; ptr; ptr = ptr->l_next) {
if (strstr(ptr->l_name, "libQt5") != NULL) {
return 0;
}
}
}
return 1;
}
bool has_qt5_dependency(const char *path)
{
pid_t pid = fork();
if (pid == 0) {
_exit(module_has_qt5_check(path));
}
if (pid < 0) {
return false;
}
int status;
if (waitpid(pid, &status, 0) < 0) {
return false;
}
return WIFEXITED(status) && WEXITSTATUS(status) == 0;
}
#endif
void get_plugin_info(const char *path, bool *is_obs_plugin, bool *can_load)
{
*is_obs_plugin = true;
*can_load = true;
#if !defined(__APPLE__) && OBS_QT_VERSION == 6
*can_load = !has_qt5_dependency(path);
#endif
UNUSED_PARAMETER(path);
}