summaryrefslogtreecommitdiff
path: root/pkgs/development/libraries/qcustomplot/default.nix
blob: 89f490b70f6f7e060e24067c8b4f093e04bb9740 (plain)
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
{
  stdenv,
  lib,
  fetchFromGitLab,
  fetchurl,
  fixDarwinDylibNames,
  qtbase,
  qmake,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "qcustomplot";
  version = "2.1.1";

  srcs = [
    (fetchFromGitLab {
      owner = "ecme2";
      repo = "QCustomPlot";
      tag = "v${finalAttrs.version}";
      hash = "sha256-BW8H/vDbhK3b8t8oB92icEBemzcdRdrIz2aKqlUi6UU=";
    })
    (fetchurl {
      url = "https://www.qcustomplot.com/release/${finalAttrs.version}/QCustomPlot-source.tar.gz";
      hash = "sha256-Xi0i3sd5248B81fL2yXlT7z5ca2u516ujXrSRESHGC8=";
    })
  ];

  sourceRoot = ".";

  buildInputs = [ qtbase ];

  nativeBuildInputs = [
    qmake
  ]
  ++ lib.optionals stdenv.hostPlatform.isDarwin [
    fixDarwinDylibNames
  ];

  env.LANG = "C.UTF-8";

  qmakeFlags = [ "sharedlib/sharedlib-compilation/sharedlib-compilation.pro" ];

  dontWrapQtApps = true;

  postUnpack = ''
    cp -rv source/* .
    cp -rv qcustomplot-source/* .
  '';

  installPhase = ''
    runHook preInstall

    install -vDm 644 "qcustomplot.h" -t "$out/include/"
    install -vdm 755 "$out/lib/"
    cp -av libqcustomplot*${stdenv.hostPlatform.extensions.sharedLibrary}* "$out/lib/"

    runHook postInstall
  '';

  meta = {
    homepage = "https://qtcustomplot.com/";
    description = "Qt C++ widget for plotting and data visualization";
    license = lib.licenses.gpl3Plus;
    platforms = lib.platforms.unix;
    maintainers = with lib.maintainers; [ Cryolitia ];
  };
})