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