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