1{
2 stdenv,
3 lib,
4 fetchFromGitLab,
5 gitUpdater,
6 testers,
7 boost186,
8 cmake,
9 dbus,
10 doxygen,
11 graphviz,
12 gtest,
13 libxml2,
14 lomiri,
15 pkg-config,
16 process-cpp,
17 properties-cpp,
18}:
19
20stdenv.mkDerivation (finalAttrs: {
21 pname = "dbus-cpp";
22 version = "5.0.4";
23
24 src = fetchFromGitLab {
25 owner = "ubports";
26 repo = "development/core/lib-cpp/dbus-cpp";
27 tag = finalAttrs.version;
28 hash = "sha256-ki4bnwRpvmB9yzt/Mn3MQs1Dr6Vrcs2D0tvCjvvfmq4=";
29 };
30
31 outputs = [
32 "out"
33 "dev"
34 "doc"
35 "examples"
36 ];
37
38 postPatch =
39 ''
40 substituteInPlace doc/CMakeLists.txt \
41 --replace-fail 'DESTINATION share/''${CMAKE_PROJECT_NAME}/doc' 'DESTINATION ''${CMAKE_INSTALL_DOCDIR}'
42
43 # Warning on aarch64-linux breaks build due to -Werror
44 substituteInPlace CMakeLists.txt \
45 --replace-fail '-Werror' ""
46
47 # pkg-config output patching hook expects prefix variable here
48 substituteInPlace data/dbus-cpp.pc.in \
49 --replace-fail 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
50 ''
51 + lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
52 substituteInPlace CMakeLists.txt \
53 --replace-fail 'add_subdirectory(tests)' '# add_subdirectory(tests)'
54 '';
55
56 strictDeps = true;
57
58 nativeBuildInputs = [
59 cmake
60 doxygen
61 graphviz
62 pkg-config
63 ];
64
65 buildInputs = [
66 boost186 # uses boost/asio/io_service.hpp
67 lomiri.cmake-extras
68 dbus
69 libxml2
70 process-cpp
71 properties-cpp
72 ];
73
74 nativeCheckInputs = [
75 dbus
76 ];
77
78 checkInputs = [
79 gtest
80 ];
81
82 cmakeFlags = [
83 (lib.cmakeBool "DBUS_CPP_ENABLE_DOC_GENERATION" true)
84 ];
85
86 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
87
88 # DBus, parallelism messes with communication
89 enableParallelChecking = false;
90
91 preFixup = ''
92 moveToOutput libexec/examples $examples
93 '';
94
95 passthru = {
96 tests.pkg-config = testers.hasPkgConfigModules {
97 package = finalAttrs.finalPackage;
98 versionCheck = true;
99 };
100 updateScript = gitUpdater { };
101 };
102
103 meta = {
104 description = "Dbus-binding leveraging C++-11";
105 homepage = "https://gitlab.com/ubports/development/core/lib-cpp/dbus-cpp";
106 changelog = "https://gitlab.com/ubports/development/core/lib-cpp/dbus-cpp/-/blob/${finalAttrs.version}/ChangeLog";
107 license = lib.licenses.lgpl3Only;
108 maintainers = with lib.maintainers; [ OPNA2608 ];
109 mainProgram = "dbus-cppc";
110 platforms = lib.platforms.linux;
111 pkgConfigModules = [
112 "dbus-cpp"
113 ];
114 };
115})