Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / libraries / gsettings-qt / default.nix
blob803ab5e96dc5db74a62d45784e32fb6e45c928e7
1 { lib, stdenv, fetchFromGitLab, pkg-config
2 , qmake, qtbase, qtdeclarative, wrapQtAppsHook
3 , glib, gobject-introspection
4 , gitUpdater
5 }:
7 stdenv.mkDerivation rec {
8   pname = "gsettings-qt";
9   version = "0.2";
11   src = fetchFromGitLab {
12     group = "ubports";
13     owner = "core";
14     repo = pname;
15     rev = "v${version}";
16     sha256 = "14l8xphw4jd9ckqba13cyxq0i362x8lfsd0zlfawwi2z1q1vqm92";
17   };
19   nativeBuildInputs = [
20     pkg-config
21     qmake
22     gobject-introspection
23     wrapQtAppsHook
24   ];
26   buildInputs = [
27     glib
28     qtdeclarative
29   ];
31   patchPhase = ''
32     # force ordered build of subdirs
33     sed -i -e "\$aCONFIG += ordered" gsettings-qt.pro
35     # It seems that there is a bug in qtdeclarative: qmlplugindump fails
36     # because it can not find or load the Qt platform plugin "minimal".
37     # A workaround is to set QT_PLUGIN_PATH and QML2_IMPORT_PATH explicitly.
38     export QT_PLUGIN_PATH=${qtbase.bin}/${qtbase.qtPluginPrefix}
39     export QML2_IMPORT_PATH=${qtdeclarative.bin}/${qtbase.qtQmlPrefix}
41     substituteInPlace GSettings/gsettings-qt.pro \
42       --replace '$$[QT_INSTALL_QML]' "$out/$qtQmlPrefix" \
43       --replace '$$[QT_INSTALL_BINS]/qmlplugindump' "qmlplugindump"
45     substituteInPlace src/gsettings-qt.pro \
46       --replace '$$[QT_INSTALL_LIBS]' "$out/lib" \
47       --replace '$$[QT_INSTALL_HEADERS]' "$out/include"
48   '';
50   preInstall = ''
51     # do not install tests
52     for f in tests/Makefile{,.cpptest}; do
53       substituteInPlace $f \
54         --replace "install: install_target" "install: "
55     done
56   '';
58   passthru.updateScript = gitUpdater {
59     rev-prefix = "v";
60   };
62   meta = with lib; {
63     description = "Library to access GSettings from Qt";
64     homepage = "https://gitlab.com/ubports/core/gsettings-qt";
65     license = licenses.lgpl3;
66     platforms = platforms.linux;
67     maintainers = [ maintainers.romildo ];
68   };