1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 fetchpatch,
6 cmake,
7 pkg-config,
8 doxygen,
9 qt6Packages,
10 dtk6core,
11 librsvg,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "dtk6gui";
16 version = "6.0.33";
17
18 src = fetchFromGitHub {
19 owner = "linuxdeepin";
20 repo = "dtk6gui";
21 rev = finalAttrs.version;
22 hash = "sha256-ZnRhrlgrQ7Vusod2diFwVEVnNGHYNq5Ij12GbW6LXWc=";
23 };
24
25 patches = [
26 ./fix-pkgconfig-path.patch
27 ./fix-pri-path.patch
28 (fetchpatch {
29 name = "resolve-compilation-issues-on-Qt-6_9.patch";
30 url = "https://gitlab.archlinux.org/archlinux/packaging/packages/dtk6gui/-/raw/ae64c77a73cdea069579ecf6833be63635237180/qt-6.9.patch";
31 hash = "sha256-45L3ZQ9Hv7tLdDjtazLhVl8XgKBtcHL3CT2nw6GkqgM=";
32 })
33 ];
34
35 postPatch = ''
36 substituteInPlace src/util/dsvgrenderer.cpp \
37 --replace-fail 'QLibrary("rsvg-2", "2")' 'QLibrary("${lib.getLib librsvg}/lib/librsvg-2.so")'
38 sed '1i#include <pwd.h>' \
39 -i 'src/kernel/dguiapplicationhelper.cpp'
40 '';
41
42 nativeBuildInputs = [
43 cmake
44 pkg-config
45 doxygen
46 qt6Packages.qttools
47 qt6Packages.wrapQtAppsHook
48 ];
49
50 buildInputs = [
51 qt6Packages.qtbase
52 qt6Packages.qtwayland
53 librsvg
54 ];
55
56 propagatedBuildInputs = [
57 dtk6core
58 qt6Packages.qtimageformats
59 ];
60
61 cmakeFlags = [
62 "-DDTK_VERSION=${finalAttrs.version}"
63 "-DBUILD_DOCS=ON"
64 "-DMKSPECS_INSTALL_DIR=${placeholder "out"}/mkspecs/modules"
65 "-DQCH_INSTALL_DESTINATION=${placeholder "doc"}/share/doc"
66 ];
67
68 preConfigure = ''
69 # qt.qpa.plugin: Could not find the Qt platform plugin "minimal"
70 # A workaround is to set QT_PLUGIN_PATH explicitly
71 export QT_PLUGIN_PATH=${lib.getBin qt6Packages.qtbase}/${qt6Packages.qtbase.qtPluginPrefix}
72 '';
73
74 outputs = [
75 "out"
76 "dev"
77 "doc"
78 ];
79
80 postFixup = ''
81 for binary in $out/libexec/dtk6/DGui/bin/*; do
82 wrapQtApp $binary
83 done
84 '';
85
86 meta = {
87 description = "Deepin Toolkit, gui module for DDE look and feel";
88 homepage = "https://github.com/linuxdeepin/dtk6gui";
89 license = lib.licenses.lgpl3Plus;
90 platforms = lib.platforms.linux;
91 teams = [ lib.teams.deepin ];
92 };
93})