about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/quickflux/default.nix
blob: 9f56e67931911367504f27f10c560d9ffa3611b0 (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
{ stdenv
, lib
, fetchFromGitHub
, cmake
, qtbase
, qtquickcontrols2
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "quickflux";
  version = "1.1-unstable-2020-11-10";

  src = fetchFromGitHub {
    owner = "benlau";
    repo = "quickflux";
    rev = "2a37acff0416c56cb349e5bc1b841b25ff1bb6f8";
    hash = "sha256-c0W3Qj8kY6hMcMy/v5xhwJF9+muZjotmJqhbjqQVab0=";
  };

  outputs = [
    "out"
    "dev"
  ];

  postPatch = ''
    # Don't hardcode static linking, let stdenv decide
    # Use GNUInstallDirs
    substituteInPlace CMakeLists.txt \
      --replace-fail 'quickflux STATIC' 'quickflux' \
      --replace-fail 'DESTINATION include' 'DESTINATION ''${CMAKE_INSTALL_INCLUDEDIR}'
  '';

  strictDeps = true;

  nativeBuildInputs = [
    cmake
  ];

  buildInputs = [
    qtbase
    qtquickcontrols2
  ];

  # Only a QML module
  dontWrapQtApps = true;

  cmakeFlags = [
    (lib.cmakeBool "BUILD_SHARED_LIBS" (!stdenv.hostPlatform.isStatic))
  ];

  preFixup = ''
    # Has extra $out in includes list, breaks usage of module (complains about non-existent path in module includes)
    substituteInPlace $out/lib/cmake/QuickFlux/QuickFluxTargets.cmake \
      --replace "\''${_IMPORT_PREFIX}/include" '${placeholder "dev"}/include'
  '';

  meta = with lib; {
    description = "A Flux implementation for QML";
    homepage = "https://github.com/benlau/quickflux";
    license = licenses.asl20;
    maintainers = with maintainers; [ OPNA2608 ];
    platforms = platforms.unix;
  };
})