1{
2 stdenv,
3 lib,
4 fetchFromGitLab,
5 fetchpatch,
6 testers,
7 cmake,
8 cmake-extras,
9 pkg-config,
10 wrapQtAppsHook,
11 gsettings-qt,
12 gtest,
13 libqtdbustest,
14 libqtdbusmock,
15 libuuid,
16 lomiri-api,
17 lomiri-app-launch,
18 lomiri-url-dispatcher,
19 lttng-ust,
20 mir_2_15,
21 process-cpp,
22 qtbase,
23 qtdeclarative,
24 qtsensors,
25 valgrind,
26 protobuf,
27 glm,
28 boost,
29 properties-cpp,
30 glib,
31 validatePkgConfig,
32 wayland,
33 xwayland,
34}:
35
36stdenv.mkDerivation (finalAttrs: {
37 # Not regular qtmir, experimental support for Mir 2.x
38 # Currently following https://gitlab.com/ubports/development/core/qtmir/-/tree/personal/sunweaver/debian-upstream
39 pname = "qtmir-debian-upstream";
40 version = "0.8.0-unstable-2024-03-06";
41
42 src = fetchFromGitLab {
43 owner = "ubports";
44 repo = "development/core/qtmir";
45 rev = "de639c3a482ac6c59b9be02abb839a8c96158041";
46 hash = "sha256-AKSzkGl6bAoR4I2lolNRUp67VS/PiZnrPpCYtTlKWKc=";
47 };
48
49 outputs = [
50 "out"
51 "dev"
52 ];
53
54 patches = [
55 # Mir 2.15 compatibility patch
56 # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/70 merged into branch
57 (fetchpatch {
58 name = "0001-qtmir-Update-for-Mir-2.15-removals.patch";
59 url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/ead5cacd4d69094ab956627f4dd94ecaff1fd69e.patch";
60 hash = "sha256-hUUUnYwhNH3gm76J21M8gA5okaRd/Go03ZFJ4qn0JUo=";
61 })
62
63 # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/72 merged in branch
64 (fetchpatch {
65 name = "0002-qtmir-Add-more-better-GNUInstallDirs-variables-usage.patch";
66 url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/87e2cd31052ce15e9625c1327807a320ee5d12af.patch";
67 hash = "sha256-MTE9tHw+xJhraEO1up7dLg0UIcmfHXgWOeuyYrVu2wc=";
68 })
69
70 # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/73 merged in branch
71 (fetchpatch {
72 name = "0003-qtmir-CMakeLists-Only-require-test-dependencies-when-building-tests.patch";
73 url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/b7144e67bcbb4cfbd2283d5d05146fb22b7d8cd4.patch";
74 hash = "sha256-Afbj40MopztchDnk6fphTYk86YrQkiK8L1e/oXiL1Mw=";
75 })
76
77 # Remove when https://gitlab.com/ubports/development/core/qtmir/-/merge_requests/74 merged in branch
78 (fetchpatch {
79 name = "0004-qtmir-CMakeLists-Drop-call-of-Qt-internal-macro.patch";
80 url = "https://gitlab.com/ubports/development/core/qtmir/-/commit/8f9c599a4dbc4cf35e289157fd0c82df55b9f8d9.patch";
81 hash = "sha256-SMAErXnlMtVleWRPgO4xuUI7gAAy6W18LxtgXgetRA4=";
82 })
83 ];
84
85 postPatch = ''
86 # 10s timeout for Mir startup is too tight for VM tests on weaker hardwre (aarch64)
87 substituteInPlace src/platforms/mirserver/qmirserver_p.cpp \
88 --replace-fail 'const int timeout = RUNNING_ON_VALGRIND ? 100 : 10' 'const int timeout = RUNNING_ON_VALGRIND ? 900 : 90' \
89 --replace-fail 'const int timeout = 10' 'const int timeout = 90'
90
91 substituteInPlace CMakeLists.txt \
92 --replace-fail "\''${CMAKE_INSTALL_FULL_LIBDIR}/qt5/qml" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtQmlPrefix}" \
93 --replace-fail "\''${CMAKE_INSTALL_FULL_LIBDIR}/qt5/plugins/platforms" "\''${CMAKE_INSTALL_PREFIX}/${qtbase.qtPluginPrefix}/platforms" \
94
95 substituteInPlace data/xwayland.qtmir.desktop \
96 --replace-fail '/usr/bin/Xwayland' 'Xwayland'
97 '';
98
99 strictDeps = true;
100
101 nativeBuildInputs = [
102 cmake
103 glib # glib-compile-schemas
104 lttng-ust
105 pkg-config
106 validatePkgConfig
107 wrapQtAppsHook
108 ];
109
110 buildInputs = [
111 cmake-extras
112 boost
113 gsettings-qt
114 libuuid
115 lomiri-api
116 lomiri-app-launch
117 lomiri-url-dispatcher
118 lttng-ust
119 mir_2_15
120 process-cpp
121 protobuf
122 qtbase
123 qtdeclarative
124 qtsensors
125 valgrind
126
127 glm # included by mir header
128 wayland # mirwayland asks for this
129 properties-cpp # included by l-a-l header
130 ];
131
132 propagatedBuildInputs = [
133 # Needs Xwayland on PATH for desktop file, else launching X11 applications crashes qtmir
134 xwayland
135 ];
136
137 checkInputs = [
138 gtest
139 libqtdbustest
140 libqtdbusmock
141 ];
142
143 cmakeFlags = [
144 (lib.cmakeBool "NO_TESTS" (!finalAttrs.finalPackage.doCheck))
145 (lib.cmakeBool "WITH_MIR2" true)
146 ];
147
148 postInstall = ''
149 glib-compile-schemas $out/share/glib-2.0/schemas
150 '';
151
152 # Tests currently unavailable when building with Mir2
153 doCheck = false;
154
155 passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
156
157 meta = with lib; {
158 description = "QPA plugin to make Qt a Mir server";
159 homepage = "https://gitlab.com/ubports/development/core/qtmir";
160 license = licenses.lgpl3Only;
161 teams = [ teams.lomiri ];
162 platforms = platforms.linux;
163 pkgConfigModules = [ "qtmirserver" ];
164 };
165})