1{
2 stdenv,
3 lib,
4 fetchFromGitLab,
5 gitUpdater,
6 testers,
7 cmake,
8 pkg-config,
9 cmake-extras,
10 gtest,
11 yaml-cpp,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "deviceinfo";
16 version = "0.2.3";
17
18 src = fetchFromGitLab {
19 owner = "ubports";
20 repo = "development/core/deviceinfo";
21 rev = finalAttrs.version;
22 hash = "sha256-Tc/jbiEoekudfy9Si6Jy51wYue6cqlMigpDHJtFl64I=";
23 };
24
25 outputs = [
26 "out"
27 "dev"
28 "bin"
29 ];
30
31 postPatch = ''
32 # For our automatic pkg-config output patcher to work, prefix must be used here
33 substituteInPlace headers/deviceinfo.pc.in \
34 --replace-fail 'libdir=''${exec_prefix}' 'libdir=''${prefix}'
35 '';
36
37 strictDeps = true;
38
39 nativeBuildInputs = [
40 cmake
41 pkg-config
42 ];
43
44 buildInputs = [
45 cmake-extras
46 yaml-cpp
47 ];
48
49 checkInputs = [
50 gtest
51 ];
52
53 cmakeFlags = [
54 "-DDISABLE_TESTS=${lib.boolToString (!finalAttrs.finalPackage.doCheck)}"
55 ];
56
57 doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
58
59 passthru = {
60 tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
61 updateScript = gitUpdater { };
62 };
63
64 meta = with lib; {
65 description = "Library to detect and configure devices";
66 homepage = "https://gitlab.com/ubports/development/core/deviceinfo";
67 changelog = "https://gitlab.com/ubports/development/core/deviceinfo/-/blob/${finalAttrs.version}/ChangeLog";
68 license = licenses.gpl3Only;
69 teams = [ teams.lomiri ];
70 platforms = platforms.linux;
71 mainProgram = "device-info";
72 pkgConfigModules = [
73 "deviceinfo"
74 ];
75 };
76})