1{ lib, stdenv, fetchurl, fetchFromGitHub, cmake, pkgconfig, xorg, mesa_glu, mesa_noglu, glew
2, cudaSupport ? false, cudatoolkit
3}:
4
5stdenv.mkDerivation {
6 name = "opensubdiv-3.0.4";
7
8 src = fetchFromGitHub {
9 owner = "PixarAnimationStudios";
10 repo = "OpenSubdiv";
11 rev = "v3_0_4";
12 sha256 = "14ylpzk4121gi3fl02dwmqjp5sbaqpkm4gd0lh6jijccdih0xsc0";
13 };
14
15 outputs = [ "out" "dev" ];
16
17 patches =
18 [ # Fix for building with cudatoolkit 7.
19 (fetchurl {
20 url = "https://github.com/opeca64/OpenSubdiv/commit/c3c258d00feaeffe1123f6077179c155e71febfb.patch";
21 sha256 = "0vazhp35v8vsgnvprkzwvfkbalr0kzcwlin9ygyfb77cz7mwicnf";
22 })
23 ];
24
25 buildInputs =
26 [ cmake pkgconfig mesa_glu mesa_noglu
27 # FIXME: these are not actually needed, but the configure script wants them.
28 glew xorg.libX11 xorg.libXrandr xorg.libXxf86vm xorg.libXcursor xorg.libXinerama
29 ]
30 ++ lib.optional cudaSupport cudatoolkit;
31
32 cmakeFlags =
33 [ "-DNO_TUTORIALS=1"
34 "-DNO_REGRESSION=1"
35 "-DNO_EXAMPLES=1"
36 "-DGLEW_INCLUDE_DIR=${glew}/include"
37 "-DGLEW_LIBRARY=${glew}/lib"
38 ];
39
40 enableParallelBuilding = true;
41
42 postInstall = "rm $out/lib/*.a";
43
44 meta = {
45 description = "An Open-Source subdivision surface library";
46 homepage = http://graphics.pixar.com/opensubdiv;
47 platforms = lib.platforms.linux;
48 maintainers = [ lib.maintainers.eelco ];
49 license = lib.licenses.asl20;
50 };
51}