Fix some qt6 builds

- Fixes build and package for at least Ubuntu 24.04
- Defaulted to building and statically linking mpvqt as most platforms
  lack packages for it.
- Workaround mpvqt requiring qt>=6.5 for wayland support with a few
  workarounds when statically building.
- Additionally, default to xcb on qt<6.5 due to mpvqt using qt>=6.5
  fetures for wayland. Wayland can be forced, but seems to give black
  video.
This commit is contained in:
Andrew Rabert committed 2025-11-23 02:09:33 -05:00
1 parent 6f54621f9d
commit f204676e4b
15 files changed
+123 -11

No files matched your search

+17 -3
View File
@@ -11,6 +11,8 @@ jobs:
runs-on: macos-13
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
brew update
@@ -50,6 +52,8 @@ jobs:
runs-on: macos-14
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
brew update
@@ -78,6 +82,8 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Qt 6
uses: jurplel/install-qt-action@v3
with:
@@ -107,7 +113,7 @@ jobs:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd build
set PATH=%PATH%;C:\Program Files (x86)\WiX Toolset v3.11\bin;%CD%
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=output -DCMAKE_MAKE_PROGRAM=ninja.exe -DQTROOT=%Qt6_DIR% -DMPV_INCLUDE_DIR=mpv/include -DMPV_LIBRARY=mpv/libmpv-2.dll -DCMAKE_INSTALL_PREFIX=output ..
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=output -DCMAKE_MAKE_PROGRAM=ninja.exe -DQTROOT=%Qt6_DIR% -DMPV_INCLUDE_DIR=mpv/include -DMPV_LIBRARY=mpv/libmpv-2.dll ..
lib /def:mpv\mpv.def /out:mpv\libmpv-2.dll.lib /MACHINE:X64
ninja
ninja windows_package
@@ -122,6 +128,8 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Qt 6
uses: jurplel/install-qt-action@v4
with:
@@ -151,7 +159,7 @@ jobs:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
cd build
set PATH=%PATH%;C:\Program Files (x86)\WiX Toolset v3.11\bin;%CD%
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=output -DCMAKE_MAKE_PROGRAM=ninja.exe -DQTROOT=%Qt6_DIR% -DMPV_INCLUDE_DIR=mpv/include -DMPV_LIBRARY=mpv/libmpv-2.dll -DCMAKE_INSTALL_PREFIX=output ..
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=output -DCMAKE_MAKE_PROGRAM=ninja.exe -DQTROOT=%Qt6_DIR% -DMPV_INCLUDE_DIR=mpv/include -DMPV_LIBRARY=mpv/libmpv-2.dll ..
lib /def:mpv\mpv.def /out:mpv\libmpv-2.dll.lib /MACHINE:X64
ninja
ninja windows_package
@@ -166,6 +174,8 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Qt 6
uses: jurplel/install-qt-action@v4
with:
@@ -195,7 +205,7 @@ jobs:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars32.bat"
cd build
set PATH=%PATH%;C:\Program Files (x86)\WiX Toolset v3.11\bin;%CD%
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=output -DCMAKE_MAKE_PROGRAM=ninja.exe -DQTROOT=%Qt6_DIR% -DMPV_INCLUDE_DIR=mpv/include -DMPV_LIBRARY=mpv/libmpv-2.dll -DCMAKE_INSTALL_PREFIX=output ..
cmake -GNinja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=output -DCMAKE_MAKE_PROGRAM=ninja.exe -DQTROOT=%Qt6_DIR% -DMPV_INCLUDE_DIR=mpv/include -DMPV_LIBRARY=mpv/libmpv-2.dll ..
lib /def:mpv\mpv.def /out:mpv\libmpv-2.dll.lib /MACHINE:X86
ninja
ninja windows_package
@@ -214,6 +224,8 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
@@ -285,6 +297,8 @@ jobs:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
run: |
sudo apt-get update
+2
View File
@@ -11,6 +11,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install build dependencies from debian/control
run: |
+3
View File
@@ -0,0 +1,3 @@
[submodule "external/mpvqt"]
path = external/mpvqt
url = https://invent.kde.org/libraries/mpvqt.git
+1
View File
@@ -13,6 +13,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE BOOL "" FORCE)
option(CHECK_FOR_UPDATES "Enable checking for new versions of Jellyfin Media Player" ON)
option(OPENELEC "Make an OpenELEC build" OFF)
option(LINUX_X11POWER "Enable non D-Bus screensaver management" OFF)
option(USE_STATIC_MPVQT "Build MpvQt from bundled submodule instead of using system library" ON)
if (NOT CHECK_FOR_UPDATES)
add_definitions(-DDISABLE_UPDATE_CHECK)
+4 -1
View File
@@ -41,4 +41,7 @@ endif(IS_DIRECTORY ${DEPENDENCY_ROOT})
find_package(Threads REQUIRED)
find_package(PythonInterp REQUIRED)
find_package(MpvQt REQUIRED)
if(NOT USE_STATIC_MPVQT)
find_package(MpvQt REQUIRED)
endif()
+7 -4
View File
@@ -23,7 +23,7 @@ To download the latest stable release, get the latest version tag from the [late
Example:
```bash
git clone https://github.com/jellyfin/jellyfin-media-player.git --branch v1.9.1 --single-branch
git clone --recursive https://github.com/jellyfin/jellyfin-media-player.git --branch v1.9.1 --single-branch
```
@@ -44,7 +44,7 @@ sudo ln -s /usr/local/lib/x86_64-linux-gnu/libmpv.so /usr/local/lib/x86_64-linux
sudo ln -sf /usr/local/lib/x86_64-linux-gnu/libmpv.so /usr/local/lib/libmpv.so.2
sudo ldconfig
cd ~/jmp/
git clone https://github.com/jellyfin/jellyfin-media-player.git
git clone --recursive https://github.com/jellyfin/jellyfin-media-player.git
cd jellyfin-media-player
mkdir build
cd build
@@ -77,7 +77,7 @@ sudo ln -s /usr/local/lib64/libmpv.so /usr/local/lib/x86_64-linux-gnu/libmpv.so.
sudo ln -s /usr/local/lib64/libmpv.so /usr/local/lib/x86_64-linux-gnu/libmpv.so
sudo ldconfig
cd ~/jmp/
git clone https://github.com/jellyfin/jellyfin-media-player.git
git clone --recursive https://github.com/jellyfin/jellyfin-media-player.git
cd jellyfin-media-player/
mkdir build
cd build/
@@ -107,7 +107,7 @@ Please install:
You need to run these commands in git bash.
```bash
git clone https://github.com/jellyfin/jellyfin-media-player
git clone --recursive https://github.com/jellyfin/jellyfin-media-player
cd jellyfin-media-player
mkdir build
cd build
@@ -131,6 +131,9 @@ Then run the following commands (replace <QT_DIR> with your QT installation loca
```bash
brew install mpv ninja
git clone --recursive https://github.com/jellyfin/jellyfin-media-player.git
cd jellyfin-media-player
mkdir build
cd build
cmake -GNinja -DQTROOT=<QT_DIR> -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=output ..
+5 -1
View File
@@ -32,6 +32,7 @@ Build-Depends: debhelper (>= 10),
qt6-webengine-dev,
qt6-declarative-dev,
qt6-base-dev,
qt6-wayland-dev,
libcec-dev,
libmpv-dev,
wget,
@@ -47,6 +48,9 @@ Architecture: any
Depends: ${shlibs:Depends},
qml6-module-qtwebengine,
qml6-module-qtwebchannel,
qml6-module-qtquick-controls
qml6-module-qtquick-controls,
qml6-module-qtquick-window,
qml6-module-qtqml-workerscript,
qml6-module-qtquick-templates
Description: Jellyfin is the Free Software Media System.
This package provides the Jellyfin desktop media player.
+25
View File
@@ -6,3 +6,28 @@ if(APPLE)
add_subdirectory(HIDRemote)
add_subdirectory(letsmove)
endif(APPLE)
if(USE_STATIC_MPVQT)
# Build MpvQt directly from sources
add_library(MpvQt STATIC
mpvqt/src/mpvabstractitem.cpp
mpvqt/src/mpvcontroller.cpp
mpvrenderer-wrapper.cpp
)
target_include_directories(MpvQt PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/mpvqt/src
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/MpvQt
)
target_link_libraries(MpvQt PUBLIC
Qt6::Quick
${MPV_LIBRARY}
)
set_target_properties(MpvQt PROPERTIES
POSITION_INDEPENDENT_CODE ON
AUTOMOC ON
)
# Create Qt-style forwarding headers
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/MpvQt/MpvAbstractItem "#include \"mpvabstractitem.h\"\n")
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/MpvQt/MpvController "#include \"mpvcontroller.h\"\n")
endif()
Vendored Submodule
+1
Submodule external/mpvqt added at 2ebbd38bf6.
+8
View File
@@ -0,0 +1,8 @@
#ifndef MPVQT_EXPORT_H
#define MPVQT_EXPORT_H
// Static library build - no export/import needed
#define MPVQT_EXPORT
#define MPVQT_NO_EXPORT
#endif
+3
View File
@@ -0,0 +1,3 @@
// Wrapper to inject Qt Wayland compatibility for Qt < 6.5
#include "qt-wayland-compat.h"
#include "mpvqt/src/mpvrenderer.cpp"
+26
View File
@@ -0,0 +1,26 @@
// Compatibility header for Qt < 6.5 that lacks QWaylandApplication
#ifndef QT_WAYLAND_COMPAT_H
#define QT_WAYLAND_COMPAT_H
#include <QtCore/qglobal.h>
#if QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
#include <QtCore/qnativeinterface.h>
#include <QtGui/qguiapplication.h>
struct wl_display;
namespace QNativeInterface {
struct Q_GUI_EXPORT QWaylandApplication
{
QT_DECLARE_NATIVE_INTERFACE(QWaylandApplication, 1, QGuiApplication)
virtual wl_display *display() const = 0;
};
}
#endif // QT_VERSION < 6.5.0
#endif // QT_WAYLAND_COMPAT_H
+7 -1
View File
@@ -160,6 +160,12 @@ else()
endif()
endif()
if(USE_STATIC_MPVQT)
set(MPVQT_TARGET MpvQt)
else()
set(MPVQT_TARGET MpvQt::MpvQt)
endif()
target_link_libraries(${MAIN_TARGET}
shared
${MPV_LIBRARY}
@@ -182,7 +188,7 @@ target_link_libraries(${MAIN_TARGET}
Qt6::Xml
Qt6::Gui
Qt6::DBus
MpvQt::MpvQt
${MPVQT_TARGET}
)
install(TARGETS ${MAIN_TARGET} DESTINATION ${INSTALL_BIN_DIR})
+7
View File
@@ -204,6 +204,13 @@ int main(int argc, char *argv[])
{
qputenv("QT_QPA_PLATFORM", platform.toUtf8());
}
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) && !defined(Q_OS_ANDROID) && QT_VERSION < QT_VERSION_CHECK(6, 5, 0)
// Force xcb on Qt < 6.5 due to mpvqt wayland requiring >=6.5
else if (platform.isEmpty() || platform == "default")
{
qputenv("QT_QPA_PLATFORM", "xcb");
}
#endif
auto configDir = parser.value("config-dir");
QString webEngineDataDir;
+7 -1
View File
@@ -16,6 +16,12 @@ add_executable(test_systemcomponent
${ALL_SRCS}
)
if(USE_STATIC_MPVQT)
set(MPVQT_TARGET MpvQt)
else()
set(MPVQT_TARGET MpvQt::MpvQt)
endif()
# Link Qt6 libraries and other dependencies
target_link_libraries(test_systemcomponent
shared
@@ -31,7 +37,7 @@ target_link_libraries(test_systemcomponent
Qt6::WebEngineCore
Qt6::OpenGL
Qt6::DBus
MpvQt::MpvQt
${MPVQT_TARGET}
${QT6_LIBRARIES}
${MPV_LIBRARY}
${OPENGL_LIBS}