1{
2 stdenv,
3 lib,
4 fetchFromGitHub,
5 cmake,
6 pkg-config,
7 doxygen,
8 libsForQt5,
9 gsettings-qt,
10 lshw,
11 libuchardet,
12 dtkcommon,
13 dtklog,
14}:
15
16stdenv.mkDerivation rec {
17 pname = "dtkcore";
18 version = "5.6.32";
19
20 src = fetchFromGitHub {
21 owner = "linuxdeepin";
22 repo = pname;
23 rev = version;
24 hash = "sha256-APuBVgewr701wzfTRwaQIg/ERFIhabEs5Jd6+GvD04k=";
25 };
26
27 patches = [
28 ./fix-pkgconfig-path.patch
29 ./fix-pri-path.patch
30 ];
31
32 postPatch = ''
33 substituteInPlace misc/DtkCoreConfig.cmake.in \
34 --subst-var-by PACKAGE_TOOL_INSTALL_DIR ${placeholder "out"}/libexec/dtk5/DCore/bin
35 '';
36
37 nativeBuildInputs = [
38 cmake
39 pkg-config
40 doxygen
41 libsForQt5.qttools
42 libsForQt5.wrapQtAppsHook
43 ];
44
45 dontWrapQtApps = true;
46
47 buildInputs = [
48 libsForQt5.qtbase
49 gsettings-qt
50 lshw
51 libuchardet
52 ];
53
54 propagatedBuildInputs = [
55 dtkcommon
56 dtklog
57 ];
58
59 cmakeFlags = [
60 "-DDTK_VERSION=${version}"
61 "-DBUILD_DOCS=ON"
62 "-DBUILD_EXAMPLES=OFF"
63 "-DQCH_INSTALL_DESTINATION=${placeholder "doc"}/${libsForQt5.qtbase.qtDocPrefix}"
64 "-DDSG_PREFIX_PATH='/run/current-system/sw'"
65 "-DMKSPECS_INSTALL_DIR=${placeholder "out"}/mkspecs/modules"
66 "-DTOOL_INSTALL_DIR=${placeholder "out"}/libexec/dtk5/DCore/bin"
67 "-DD_DSG_APP_DATA_FALLBACK=/var/dsg/appdata"
68 ];
69
70 preConfigure = ''
71 # qt.qpa.plugin: Could not find the Qt platform plugin "minimal"
72 # A workaround is to set QT_PLUGIN_PATH explicitly
73 export QT_PLUGIN_PATH=${libsForQt5.qtbase.bin}/${libsForQt5.qtbase.qtPluginPrefix}
74 '';
75
76 outputs = [
77 "out"
78 "dev"
79 "doc"
80 ];
81
82 postFixup = ''
83 for binary in $out/libexec/dtk5/DCore/bin/*; do
84 wrapQtApp $binary
85 done
86 '';
87
88 meta = with lib; {
89 description = "Deepin tool kit core library";
90 homepage = "https://github.com/linuxdeepin/dtkcore";
91 license = licenses.lgpl3Plus;
92 platforms = platforms.linux;
93 teams = [ teams.deepin ];
94 };
95}