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 substituteInPlace doc/CMakeLists.txt \
40 --replace-fail 'DESTINATION share/''${CMAKE_PROJECT_NAME}/doc' 'DESTINATION ''${CMAKE_INSTALL_DOCDIR}'
41
42 # Warning on aarch64-linux breaks build due to -Werror
43 substituteInPlace CMakeLists.txt \
44 --replace-fail '-Werror' ""
45
46 # pkg-config output patching hook expects prefix variable here
47 substituteInPlace data/dbus-cpp.pc.in \
48 --replace-fail 'includedir=''${exec_prefix}' 'includedir=''${prefix}'
49 ''
50 + lib.optionalString (!finalAttrs.finalPackage.doCheck) ''
51 substituteInPlace CMakeLists.txt \
52 --replace-fail 'add_subdirectory(tests)' '# add_subdirectory(tests)'
53 '';
54
55 strictDeps = true;
56
57 nativeBuildInputs = [
58 cmake
59 doxygen
60 graphviz
61 pkg-config
62 ];
63
64 buildInputs = [
65 boost186 # uses boost/asio/io_service.hpp
66 lomiri.cmake-extras
67 dbus
68 libxml2
69 process-cpp
70 properties-cpp
71 ];
72
73 nativeCheckInputs = [
74 dbus
75 ];
76
77 checkInputs = [
78 gtest
79 ];
80
81 cmakeFlags = [
82 (lib.cmakeBool "DBUS_CPP_ENABLE_DOC_GENERATION" true)
83 ];
84
85 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
86
87 # DBus, parallelism messes with communication
88 enableParallelChecking = false;
89
90 preFixup = ''
91 moveToOutput libexec/examples $examples
92 '';
93
94 passthru = {
95 tests.pkg-config = testers.hasPkgConfigModules {
96 package = finalAttrs.finalPackage;
97 versionCheck = true;
98 };
99 updateScript = gitUpdater { };
100 };
101
102 meta = {
103 description = "Dbus-binding leveraging C++-11";
104 homepage = "https://gitlab.com/ubports/development/core/lib-cpp/dbus-cpp";
105 changelog = "https://gitlab.com/ubports/development/core/lib-cpp/dbus-cpp/-/blob/${finalAttrs.version}/ChangeLog";
106 license = lib.licenses.lgpl3Only;
107 maintainers = with lib.maintainers; [ OPNA2608 ];
108 mainProgram = "dbus-cppc";
109 platforms = lib.platforms.linux;
110 pkgConfigModules = [
111 "dbus-cpp"
112 ];
113 };
114})