summaryrefslogtreecommitdiff
path: root/pkgs/development/libraries/libqglviewer/default.nix
blob: f272149898c423560cc34ffc3aa8a7f6b8bdcd02 (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
{
  lib,
  stdenv,
  fetchFromGitHub,
  qmake,
  qtbase,
  libGLU,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "libqglviewer";
  version = "2.9.1";

  src = fetchFromGitHub {
    owner = "GillesDebunne";
    repo = "libQGLViewer";
    tag = "v${finalAttrs.version}";
    hash = "sha256-T8KAcw3cXbp0FZm53OjlQBnUvLRFdoj80dIQzQY0/yw=";
  };

  nativeBuildInputs = [ qmake ];
  buildInputs = [
    qtbase
    libGLU
  ];

  dontWrapQtApps = true;

  # Fix build on darwin, and install dylib instead of framework
  postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
    substituteInPlace QGLViewer/QGLViewer.pro \
      --replace-fail \
        "LIB_DIR_ = /Library/Frameworks" \
        "LIB_DIR_ = \$\$""{PREFIX_}/lib" \
      --replace-fail \
        "!staticlib: CONFIG *= lib_bundle" \
        ""
  '';

  preConfigure = ''
    cd QGLViewer
  '';

  meta = {
    description = "C++ library based on Qt that eases the creation of OpenGL 3D viewers";
    homepage = "https://github.com/GillesDebunne/libQGLViewer";
    license = lib.licenses.gpl2;
    platforms = lib.platforms.all;
  };
})