1 {lib, stdenv, fetchurl, libGLU, libGL, freeglut, glew, libXmu, libXext, libX11
2 , qmake, GLUT, fixDarwinDylibNames }:
4 stdenv.mkDerivation rec {
8 url = "http://www.opencsg.org/OpenCSG-${version}.tar.gz";
9 sha256 = "1ysazynm759gnw1rdhn9xw9nixnzrlzrc462340a6iif79fyqlnr";
12 nativeBuildInputs = [ qmake ]
13 ++ lib.optional stdenv.isDarwin fixDarwinDylibNames;
15 buildInputs = [ glew ]
16 ++ lib.optionals stdenv.isLinux [ libGLU libGL freeglut libXmu libXext libX11 ]
17 ++ lib.optional stdenv.isDarwin GLUT;
21 patches = [ ./fix-pro-files.patch ];
24 rm example/Makefile src/Makefile
25 qmakeFlags=("''${qmakeFlags[@]}" "INSTALLDIR=$out")
29 install -D license.txt "$out/share/doc/opencsg/license.txt"
30 '' + lib.optionalString stdenv.isDarwin ''
31 mkdir -p $out/Applications
32 mv $out/bin/*.app $out/Applications
33 rmdir $out/bin || true
36 dontWrapQtApps = true;
38 postFixup = lib.optionalString stdenv.isDarwin ''
39 app=$out/Applications/opencsgexample.app/Contents/MacOS/opencsgexample
40 install_name_tool -change \
41 $(otool -L $app | awk '/opencsg.+dylib/ { print $1 }') \
42 $(otool -D $out/lib/libopencsg.dylib | tail -n 1) \
47 description = "Constructive Solid Geometry library";
48 homepage = "http://www.opencsg.org/";
49 platforms = platforms.unix;
50 maintainers = [ maintainers.raskin ];
51 license = licenses.gpl2;