1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 qmake,
6 qtbase,
7 libGLU,
8}:
9
10stdenv.mkDerivation (finalAttrs: {
11 pname = "libqglviewer";
12 version = "2.9.1";
13
14 src = fetchFromGitHub {
15 owner = "GillesDebunne";
16 repo = "libQGLViewer";
17 tag = "v${finalAttrs.version}";
18 hash = "sha256-T8KAcw3cXbp0FZm53OjlQBnUvLRFdoj80dIQzQY0/yw=";
19 };
20
21 nativeBuildInputs = [ qmake ];
22 buildInputs = [
23 qtbase
24 libGLU
25 ];
26
27 dontWrapQtApps = true;
28
29 # Fix build on darwin, and install dylib instead of framework
30 postPatch = lib.optionalString stdenv.hostPlatform.isDarwin ''
31 substituteInPlace QGLViewer/QGLViewer.pro \
32 --replace-fail \
33 "LIB_DIR_ = /Library/Frameworks" \
34 "LIB_DIR_ = \$\$""{PREFIX_}/lib" \
35 --replace-fail \
36 "!staticlib: CONFIG *= lib_bundle" \
37 ""
38 '';
39
40 preConfigure = ''
41 cd QGLViewer
42 '';
43
44 meta = {
45 description = "C++ library based on Qt that eases the creation of OpenGL 3D viewers";
46 homepage = "https://github.com/GillesDebunne/libQGLViewer";
47 license = lib.licenses.gpl2;
48 platforms = lib.platforms.all;
49 };
50})