Accepting request 810658 from home:alois:branches:graphics

- Drop qimgv-nosharedlib.patch
- Add qimgv-pluginpath_1.patch, qimgv-pluginpath_2.patch and
  qimgv-pluginpath_3.patch (fixes boo#1172315)

OBS-URL: https://build.opensuse.org/request/show/810658
OBS-URL: https://build.opensuse.org/package/show/graphics/qimgv?expand=0&rev=36
This commit is contained in:
Luigi Baldoni 2020-06-01 17:01:21 +00:00 committed by Git OBS Bridge
parent 5bc5ce7dbd
commit 33f6ebff56
6 changed files with 391 additions and 21 deletions

View File

@ -1,18 +0,0 @@
Index: qimgv-0.9/qimgv_libs/qimgv_player_mpv/CMakeLists.txt
===================================================================
--- qimgv-0.9.orig/qimgv_libs/qimgv_player_mpv/CMakeLists.txt
+++ qimgv-0.9/qimgv_libs/qimgv_player_mpv/CMakeLists.txt
@@ -12,7 +12,7 @@ pkg_check_modules(Mpv REQUIRED IMPORTED_
include(GNUInstallDirs)
-add_library(qimgv_player_mpv SHARED
+add_library(qimgv_player_mpv STATIC
src/videoplayer.cpp
src/mpvwidget.cpp
src/videoplayermpv.cpp
@@ -39,4 +39,3 @@ endif()
target_compile_definitions(qimgv_player_mpv PRIVATE QIMGV_PLAYER_MPV_LIBRARY)
-install(TARGETS qimgv_player_mpv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

212
qimgv-pluginpath_1.patch Normal file
View File

@ -0,0 +1,212 @@
From ac915ba6a9c6a9ad2491eb2d779a3e9de485e93d Mon Sep 17 00:00:00 2001
From: easymodo <easymodofrf@gmail.com>
Date: Sun, 31 May 2020 15:34:48 +0300
Subject: [PATCH] place qimgv librares/plugins in lib/qimgv #231 rename to
player_mpv.so, unversioned
---
CMakeLists.txt | 7 +++++-
.../player_mpv}/CMakeLists.txt | 25 ++++++++++---------
.../player_mpv}/src/mpvwidget.cpp | 0
.../player_mpv}/src/mpvwidget.h | 0
.../player_mpv}/src/qthelper.hpp | 0
.../player_mpv}/src/videoplayer.cpp | 0
.../player_mpv}/src/videoplayer.h | 0
.../player_mpv}/src/videoplayermpv.cpp | 0
.../player_mpv}/src/videoplayermpv.h | 0
qimgv/CMakeLists.txt | 3 +++
qimgv/gui/viewers/videoplayerinitproxy.cpp | 24 +++++++++++++++---
11 files changed, 42 insertions(+), 17 deletions(-)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/CMakeLists.txt (51%)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/src/mpvwidget.cpp (100%)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/src/mpvwidget.h (100%)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/src/qthelper.hpp (100%)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/src/videoplayer.cpp (100%)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/src/videoplayer.h (100%)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/src/videoplayermpv.cpp (100%)
rename {qimgv_libs/qimgv_player_mpv => plugins/player_mpv}/src/videoplayermpv.h (100%)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a97ea91..e7848b9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -12,6 +12,11 @@ project(qimgv
#endif()
message(STATUS "Build configuration: " ${CMAKE_BUILD_TYPE})
+set(QIMGV_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/qimgv")
+ADD_DEFINITIONS(-D_QIMGV_PLUGIN_PATH="${QIMGV_PLUGIN_PATH}/")
+
+message(STATUS "Plugin path: " ${QIMGV_PLUGIN_PATH})
+
# detect if libstdc++ is in use to know if libstdc++fs should be linked
include(CheckCXXSourceCompiles)
check_cxx_source_compiles("#include <iostream>
@@ -67,5 +72,5 @@ endif()
add_subdirectory(qimgv)
if(VIDEO_SUPPORT)
- add_subdirectory(qimgv_libs/qimgv_player_mpv)
+ add_subdirectory(plugins/player_mpv)
endif()
diff --git a/qimgv_libs/qimgv_player_mpv/CMakeLists.txt b/plugins/player_mpv/CMakeLists.txt
similarity index 51%
rename from qimgv_libs/qimgv_player_mpv/CMakeLists.txt
rename to plugins/player_mpv/CMakeLists.txt
index b12ab97..0fdccfd 100644
--- a/qimgv_libs/qimgv_player_mpv/CMakeLists.txt
+++ b/plugins/player_mpv/CMakeLists.txt
@@ -1,10 +1,12 @@
cmake_minimum_required(VERSION 3.11)
-project(qimgv_player_mpv VERSION 1.0
+project(player_mpv
DESCRIPTION "video player widget for qimgv (using mpv)"
LANGUAGES CXX)
set(CMAKE_AUTOMOC ON)
+set(QIMGV_LIBDIR "${CMAKE_INSTALL_LIBDIR}/qimgv")
+
find_package(Qt5 REQUIRED COMPONENTS Core Widgets)
find_package(PkgConfig REQUIRED)
@@ -12,31 +14,30 @@ pkg_check_modules(Mpv REQUIRED IMPORTED_TARGET mpv)
include(GNUInstallDirs)
-add_library(qimgv_player_mpv SHARED
+add_library(player_mpv SHARED
src/videoplayer.cpp
src/mpvwidget.cpp
src/videoplayermpv.cpp
src/qthelper.hpp)
-target_compile_features(qimgv_player_mpv PRIVATE cxx_std_11)
+target_compile_features(player_mpv PRIVATE cxx_std_11)
-target_link_libraries(qimgv_player_mpv PRIVATE
+target_link_libraries(player_mpv PRIVATE
Qt5::Core Qt5::Widgets PkgConfig::Mpv)
-set_target_properties(qimgv_player_mpv PROPERTIES
+set_target_properties(player_mpv PROPERTIES
CXX_EXTENSIONS OFF
- VERSION ${PROJECT_VERSION}
- SOVERSION 1)
+ PREFIX "")
-target_include_directories(qimgv_player_mpv PRIVATE src)
+target_include_directories(player_mpv PRIVATE src)
if(WIN32)
- target_include_directories(qimgv_player_mpv PRIVATE
+ target_include_directories(player_mpv PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/mpv-dev/include)
- target_link_directories(qimgv_player_mpv PRIVATE
+ target_link_directories(player_mpv PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/mpv-dev/$<IF$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x86_64,i686>)
endif()
-target_compile_definitions(qimgv_player_mpv PRIVATE QIMGV_PLAYER_MPV_LIBRARY)
+target_compile_definitions(player_mpv PRIVATE player_mpv_LIBRARY)
-install(TARGETS qimgv_player_mpv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+install(TARGETS player_mpv LIBRARY DESTINATION ${QIMGV_LIBDIR})
diff --git a/qimgv_libs/qimgv_player_mpv/src/mpvwidget.cpp b/plugins/player_mpv/src/mpvwidget.cpp
similarity index 100%
rename from qimgv_libs/qimgv_player_mpv/src/mpvwidget.cpp
rename to plugins/player_mpv/src/mpvwidget.cpp
diff --git a/qimgv_libs/qimgv_player_mpv/src/mpvwidget.h b/plugins/player_mpv/src/mpvwidget.h
similarity index 100%
rename from qimgv_libs/qimgv_player_mpv/src/mpvwidget.h
rename to plugins/player_mpv/src/mpvwidget.h
diff --git a/qimgv_libs/qimgv_player_mpv/src/qthelper.hpp b/plugins/player_mpv/src/qthelper.hpp
similarity index 100%
rename from qimgv_libs/qimgv_player_mpv/src/qthelper.hpp
rename to plugins/player_mpv/src/qthelper.hpp
diff --git a/qimgv_libs/qimgv_player_mpv/src/videoplayer.cpp b/plugins/player_mpv/src/videoplayer.cpp
similarity index 100%
rename from qimgv_libs/qimgv_player_mpv/src/videoplayer.cpp
rename to plugins/player_mpv/src/videoplayer.cpp
diff --git a/qimgv_libs/qimgv_player_mpv/src/videoplayer.h b/plugins/player_mpv/src/videoplayer.h
similarity index 100%
rename from qimgv_libs/qimgv_player_mpv/src/videoplayer.h
rename to plugins/player_mpv/src/videoplayer.h
diff --git a/qimgv_libs/qimgv_player_mpv/src/videoplayermpv.cpp b/plugins/player_mpv/src/videoplayermpv.cpp
similarity index 100%
rename from qimgv_libs/qimgv_player_mpv/src/videoplayermpv.cpp
rename to plugins/player_mpv/src/videoplayermpv.cpp
diff --git a/qimgv_libs/qimgv_player_mpv/src/videoplayermpv.h b/plugins/player_mpv/src/videoplayermpv.h
similarity index 100%
rename from qimgv_libs/qimgv_player_mpv/src/videoplayermpv.h
rename to plugins/player_mpv/src/videoplayermpv.h
diff --git a/qimgv/CMakeLists.txt b/qimgv/CMakeLists.txt
index dcf8ce8..bf95811 100644
--- a/qimgv/CMakeLists.txt
+++ b/qimgv/CMakeLists.txt
@@ -42,6 +42,9 @@ if(KDE_SUPPORT)
endif()
if(VIDEO_SUPPORT)
target_compile_definitions(qimgv PRIVATE USE_MPV)
+ if(NOT WIN32)
+ ADD_DEFINITIONS(-D_QIMGV_PLAYER_PLUGIN="player_mpv.so")
+ endif()
endif()
if(OPENCV_SUPPORT)
target_link_libraries(qimgv PRIVATE ${OpenCV_LIBS})
diff --git a/qimgv/gui/viewers/videoplayerinitproxy.cpp b/qimgv/gui/viewers/videoplayerinitproxy.cpp
index 409d42f..7de3048 100644
--- a/qimgv/gui/viewers/videoplayerinitproxy.cpp
+++ b/qimgv/gui/viewers/videoplayerinitproxy.cpp
@@ -1,5 +1,17 @@
#include "videoplayerinitproxy.h"
+#ifdef _QIMGV_PLUGIN_PATH
+ #define QIMGV_PLUGIN_PATH _QIMGV_PLUGIN_PATH
+#else
+ #define QIMGV_PLUGIN_PATH ""
+#endif
+
+#ifdef _QIMGV_PLAYER_PLUGIN
+ #define QIMGV_PLAYER_PLUGIN _QIMGV_PLAYER_PLUGIN
+#else
+ #define QIMGV_PLAYER_PLUGIN ""
+#endif
+
VideoPlayerInitProxy::VideoPlayerInitProxy(QWidget *parent)
: VideoPlayer(parent),
player(nullptr)
@@ -26,13 +38,19 @@ std::shared_ptr<VideoPlayer> VideoPlayerInitProxy::getPlayer() {
}
inline bool VideoPlayerInitProxy::initPlayer() {
+ QString path = QString(QIMGV_PLUGIN_PATH) + QIMGV_PLAYER_PLUGIN;
#ifndef USE_MPV
return false;
#endif
if(player)
return true;
#ifdef __linux
- playerLib.setFileName("qimgv_player_mpv");
+ if(QFile::exists(path)) {
+ playerLib.setFileName(path);
+ } else {
+ qDebug() << "Plugin at:" << path << "does not exist.";
+ playerLib.setFileName("qimgv_player_mpv"); // let QLibrary try to find it
+ }
#else
playerLib.setFileName("libqimgv_player_mpv.dll");
#endif
@@ -43,11 +61,9 @@ inline bool VideoPlayerInitProxy::initPlayer() {
player.reset(pl);
}
if(!player) {
- qDebug() << "[VideoPlayerInitProxy] Error - could not load player library";
- qDebug() << playerLib.fileName();
+ qDebug() << "Could not load plugin:" << playerLib.fileName();
return false;
}
- //qDebug() << "[VideoPlayerInitProxy] Library load success!";
player->setMuted(!settings->playVideoSounds());
player->setVideoUnscaled(!settings->expandImage());

121
qimgv-pluginpath_2.patch Normal file
View File

@ -0,0 +1,121 @@
From dab45dd74ca2e8c208548f3e21546dc3e91acf34 Mon Sep 17 00:00:00 2001
From: easymodo <easymodofrf@gmail.com>
Date: Sun, 31 May 2020 17:56:31 +0300
Subject: [PATCH] [cmake] use absolute path for player .so; initPlayer() -
tweak file checks & error messages
---
CMakeLists.txt | 6 +++---
qimgv/CMakeLists.txt | 2 +-
qimgv/gui/viewers/videoplayerinitproxy.cpp | 25 +++++++++-------------
qimgv/gui/viewers/videoplayerinitproxy.h | 1 +
4 files changed, 15 insertions(+), 19 deletions(-)
Index: qimgv-0.9.1/CMakeLists.txt
===================================================================
--- qimgv-0.9.1.orig/CMakeLists.txt
+++ qimgv-0.9.1/CMakeLists.txt
@@ -12,10 +12,10 @@ project(qimgv
#endif()
message(STATUS "Build configuration: " ${CMAKE_BUILD_TYPE})
-set(QIMGV_PLUGIN_PATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/qimgv")
-ADD_DEFINITIONS(-D_QIMGV_PLUGIN_PATH="${QIMGV_PLUGIN_PATH}/")
+set(QIMGV_PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/qimgv")
+ADD_DEFINITIONS(-D_QIMGV_PLUGIN_DIR="${QIMGV_PLUGIN_DIR}")
-message(STATUS "Plugin path: " ${QIMGV_PLUGIN_PATH})
+message(STATUS "Plugin dir: " ${QIMGV_PLUGIN_DIR})
# detect if libstdc++ is in use to know if libstdc++fs should be linked
include(CheckCXXSourceCompiles)
Index: qimgv-0.9.1/qimgv/CMakeLists.txt
===================================================================
--- qimgv-0.9.1.orig/qimgv/CMakeLists.txt
+++ qimgv-0.9.1/qimgv/CMakeLists.txt
@@ -46,7 +46,7 @@ endif()
if(VIDEO_SUPPORT)
target_compile_definitions(qimgv PRIVATE USE_MPV)
if(NOT WIN32)
- ADD_DEFINITIONS(-D_QIMGV_PLAYER_PLUGIN="player_mpv.so")
+ ADD_DEFINITIONS(-D_QIMGV_PLAYER_PLUGIN="${QIMGV_PLUGIN_DIR}/player_mpv.so")
endif()
endif()
if(OPENCV_SUPPORT)
Index: qimgv-0.9.1/qimgv/gui/viewers/videoplayerinitproxy.cpp
===================================================================
--- qimgv-0.9.1.orig/qimgv/gui/viewers/videoplayerinitproxy.cpp
+++ qimgv-0.9.1/qimgv/gui/viewers/videoplayerinitproxy.cpp
@@ -1,11 +1,5 @@
#include "videoplayerinitproxy.h"
-#ifdef _QIMGV_PLUGIN_PATH
- #define QIMGV_PLUGIN_PATH _QIMGV_PLUGIN_PATH
-#else
- #define QIMGV_PLUGIN_PATH ""
-#endif
-
#ifdef _QIMGV_PLAYER_PLUGIN
#define QIMGV_PLAYER_PLUGIN _QIMGV_PLAYER_PLUGIN
#else
@@ -38,21 +32,22 @@ std::shared_ptr<VideoPlayer> VideoPlayer
}
inline bool VideoPlayerInitProxy::initPlayer() {
- QString path = QString(QIMGV_PLUGIN_PATH) + QIMGV_PLAYER_PLUGIN;
+ QString path = QIMGV_PLAYER_PLUGIN;
#ifndef USE_MPV
return false;
#endif
if(player)
return true;
-#ifdef __linux
- if(QFile::exists(path)) {
+#ifdef _WIN32
+ playerLib.setFileName("plugins/player_mpv.dll");
+#else
+ QFileInfo pluginFile(path);
+ if(pluginFile.isFile() && pluginFile.isReadable()) {
playerLib.setFileName(path);
} else {
qDebug() << "Plugin at:" << path << "does not exist.";
- playerLib.setFileName("qimgv_player_mpv"); // let QLibrary try to find it
+ return false;
}
-#else
- playerLib.setFileName("libqimgv_player_mpv.dll");
#endif
typedef VideoPlayer* (*createPlayerWidgetFn)();
createPlayerWidgetFn fn = (createPlayerWidgetFn) playerLib.resolve("CreatePlayerWidget");
@@ -61,7 +56,7 @@ inline bool VideoPlayerInitProxy::initPl
player.reset(pl);
}
if(!player) {
- qDebug() << "Could not load plugin:" << playerLib.fileName();
+ qDebug() << "Could not load plugin:" << playerLib.fileName() << ". Last error: " << playerLib.errorString();
return false;
}
@@ -75,8 +70,8 @@ inline bool VideoPlayerInitProxy::initPl
setFocusProxy(player.get());
connect(player.get(), SIGNAL(durationChanged(int)), this, SIGNAL(durationChanged(int)));
connect(player.get(), SIGNAL(positionChanged(int)), this, SIGNAL(positionChanged(int)));
- connect(player.get(), SIGNAL(videoPaused(bool)), this, SIGNAL(videoPaused(bool)));
- connect(player.get(), SIGNAL(playbackFinished()), this, SIGNAL(playbackFinished()));
+ connect(player.get(), SIGNAL(videoPaused(bool)), this, SIGNAL(videoPaused(bool)));
+ connect(player.get(), SIGNAL(playbackFinished()), this, SIGNAL(playbackFinished()));
return true;
}
Index: qimgv-0.9.1/qimgv/gui/viewers/videoplayerinitproxy.h
===================================================================
--- qimgv-0.9.1.orig/qimgv/gui/viewers/videoplayerinitproxy.h
+++ qimgv-0.9.1/qimgv/gui/viewers/videoplayerinitproxy.h
@@ -7,6 +7,7 @@
#include "videoplayer.h"
#include "settings.h"
#include <QLibrary>
+#include <QFileInfo>
#include <QDebug>
class VideoPlayerInitProxy : public VideoPlayer {

41
qimgv-pluginpath_3.patch Normal file
View File

@ -0,0 +1,41 @@
From 7b7f9c1403fd73174ef56237c8032cefac82d437 Mon Sep 17 00:00:00 2001
From: easymodo <easymodofrf@gmail.com>
Date: Mon, 1 Jun 2020 17:27:58 +0300
Subject: [PATCH] [cmake] check for absolute path; change SHARED > MODULE
---
CMakeLists.txt | 7 ++++++-
plugins/player_mpv/CMakeLists.txt | 2 +-
2 files changed, 7 insertions(+), 2 deletions(-)
Index: qimgv-0.9.1/CMakeLists.txt
===================================================================
--- qimgv-0.9.1.orig/CMakeLists.txt
+++ qimgv-0.9.1/CMakeLists.txt
@@ -12,7 +12,12 @@ project(qimgv
#endif()
message(STATUS "Build configuration: " ${CMAKE_BUILD_TYPE})
-set(QIMGV_PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/qimgv")
+if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
+ set(QIMGV_PLUGIN_DIR "${CMAKE_INSTALL_LIBDIR}/qimgv")
+else()
+ set(QIMGV_PLUGIN_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}/qimgv")
+endif()
+
ADD_DEFINITIONS(-D_QIMGV_PLUGIN_DIR="${QIMGV_PLUGIN_DIR}")
message(STATUS "Plugin dir: " ${QIMGV_PLUGIN_DIR})
Index: qimgv-0.9.1/plugins/player_mpv/CMakeLists.txt
===================================================================
--- qimgv-0.9.1.orig/plugins/player_mpv/CMakeLists.txt
+++ qimgv-0.9.1/plugins/player_mpv/CMakeLists.txt
@@ -14,7 +14,7 @@ pkg_check_modules(Mpv REQUIRED IMPORTED_
include(GNUInstallDirs)
-add_library(player_mpv SHARED
+add_library(player_mpv MODULE
src/videoplayer.cpp
src/mpvwidget.cpp
src/videoplayermpv.cpp

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Sun May 31 09:12:40 UTC 2020 - Luigi Baldoni <aloisio@gmx.com>
- Drop qimgv-nosharedlib.patch
- Add qimgv-pluginpath_1.patch, qimgv-pluginpath_2.patch and
qimgv-pluginpath_3.patch (fixes boo#1172315)
-------------------------------------------------------------------
Tue May 5 07:40:11 UTC 2020 - Luigi Baldoni <aloisio@gmx.com>

View File

@ -23,12 +23,16 @@ Summary: Qt5 image viewer
License: GPL-3.0-only
URL: https://github.com/easymodo/qimgv
Source0: https://github.com/easymodo/qimgv/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FEATURE-OPENSUSE qimgv-nosharedlib.patch # aloisio@gmx.com build helper library statically
Patch0: qimgv-nosharedlib.patch
# PATCH-FEATURE-OPENSUSE qimgv-PIE.patch # aloisio@gmx.com add PIE flags
Patch1: qimgv-PIE.patch
# PATCH-FIX-OPENSUSE qimgv-includepath.patch # aloisio@gmx.com use correct path for opencv includes
Patch2: qimgv-includepath.patch
# PATCH-FIX-UPSTREAM qimgv-pluginpath_1.patch
Patch3: qimgv-pluginpath_1.patch
# PATCH-FIX-UPSTREAM qimgv-pluginpath_2.patch
Patch4: qimgv-pluginpath_2.patch
# PATCH-FIX-UPSTREAM qimgv-pluginpath_3.patch
Patch5: qimgv-pluginpath_3.patch
BuildRequires: cmake >= 3.13
%if 0%{?suse_version} > 1500
BuildRequires: gcc-c++
@ -42,6 +46,7 @@ BuildRequires: pkgconfig(Qt5Concurrent) >= 5.9
BuildRequires: pkgconfig(Qt5Widgets)
BuildRequires: pkgconfig(exiv2)
BuildRequires: pkgconfig(mpv) >= 1.22.0
Requires: mpv >= 0.32.0
%description
Qt5 image viewer with webm support.
@ -53,7 +58,7 @@ Qt5 image viewer with webm support.
export CXX=g++
test -x "$(type -p g++-8)" && export CXX=g++-8
%cmake
make %{?_smp_mflags}
%make_jobs
%install
%cmake_install
@ -64,5 +69,7 @@ make %{?_smp_mflags}
%{_bindir}/%{name}
%{_datadir}/applications/%{name}.desktop
%{_datadir}/icons/hicolor/*/apps/%{name}.*
%{_libdir}/%{name}
%{_libdir}/%{name}/player_mpv.so
%changelog