about summary refs log tree commit diff
path: root/nixpkgs/pkgs/desktops/lomiri/development/lomiri-api/default.nix
blob: f4a7c968c66f24c79e3c6bacae960c3f5279733d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
{ stdenv
, lib
, fetchFromGitLab
, gitUpdater
, makeFontsConf
, testers
, cmake
, cmake-extras
, dbus
, doxygen
, glib
, graphviz
, gtest
, libqtdbustest
, pkg-config
, python3
, qtbase
, qtdeclarative
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "lomiri-api";
  version = "0.2.1";

  src = fetchFromGitLab {
    owner = "ubports";
    repo = "development/core/lomiri-api";
    rev = finalAttrs.version;
    hash = "sha256-UTl0vObSlEvHuLmDt7vS3yEqZWGklJ9tVwlUAtRSTlU=";
  };

  outputs = [ "out" "dev" "doc" ];

  postPatch = ''
    patchShebangs $(find test -name '*.py')

    substituteInPlace data/*.pc.in \
      --replace "\''${prefix}/@CMAKE_INSTALL_LIBDIR@" "\''${prefix}/lib"

    # Variable is queried via pkg-config by reverse dependencies
    # TODO This is likely not supposed to be the regular Qt QML import prefix
    # but otherwise i.e. lomiri-notifications cannot be found in lomiri
    substituteInPlace CMakeLists.txt \
      --replace 'SHELL_PLUGINDIR ''${CMAKE_INSTALL_LIBDIR}/lomiri/qml' 'SHELL_PLUGINDIR ${qtbase.qtQmlPrefix}'
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
    doxygen
    graphviz
    pkg-config
  ];

  buildInputs = [
    cmake-extras
    glib
    gtest
    libqtdbustest
    qtbase
    qtdeclarative
  ];

  nativeCheckInputs = [
    dbus
    python3
  ];

  dontWrapQtApps = true;

  FONTCONFIG_FILE = makeFontsConf { fontDirectories = [ ]; };

  preBuild = ''
    # Makes fontconfig produce less noise in logs
    export HOME=$TMPDIR
  '';

  doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;

  preCheck = ''
    # needs minimal plugin and QtTest QML
    export QT_PLUGIN_PATH=${lib.getBin qtbase}/${qtbase.qtPluginPrefix}
    export QML2_IMPORT_PATH=${lib.getBin qtdeclarative}/${qtbase.qtQmlPrefix}
  '';

  passthru = {
    tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
    updateScript = gitUpdater { };
  };

  meta = with lib; {
    description = "Lomiri API Library for integrating with the Lomiri shell";
    homepage = "https://gitlab.com/ubports/development/core/lomiri-api";
    license = with licenses; [ lgpl3Only gpl3Only ];
    maintainers = teams.lomiri.members;
    platforms = platforms.linux;
    pkgConfigModules = [
      "liblomiri-api"
      "lomiri-shell-api"
      "lomiri-shell-application"
      "lomiri-shell-launcher"
      "lomiri-shell-notifications"
    ];
  };
})