Commit 026f1289 authored by John Titor's avatar John Titor Committed by Masum Reza
Browse files

opensubdiv: modernize package



rec -> finalAttrs
sha256 -> hash
rev -> tag

Signed-off-by: default avatarJohn Titor <50095635+JohnRTitor@users.noreply.github.com>
parent 694debe6
Loading
Loading
Loading
Loading
+18 −18
Original line number Diff line number Diff line
@@ -17,15 +17,15 @@
  darwin,
}:

stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "opensubdiv";
  version = "3.6.0";

  src = fetchFromGitHub {
    owner = "PixarAnimationStudios";
    repo = "OpenSubdiv";
    rev = "v${lib.replaceStrings [ "." ] [ "_" ] version}";
    sha256 = "sha256-liy6pQyWMk7rw0usrCoLGzZLO7RAg0z2pV/GF2NnOkE=";
    tag = "v${lib.replaceStrings [ "." ] [ "_" ] finalAttrs.version}";
    hash = "sha256-liy6pQyWMk7rw0usrCoLGzZLO7RAg0z2pV/GF2NnOkE=";
  };

  outputs = [
@@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
      pkg-config
      python3
    ]
    ++ lib.optional cudaSupport [
    ++ lib.optionals cudaSupport [
      cudaPackages.cuda_nvcc
    ];
  buildInputs =
@@ -84,21 +84,21 @@ stdenv.mkDerivation rec {

  cmakeFlags =
    [
      "-DNO_TUTORIALS=1"
      "-DNO_REGRESSION=1"
      "-DNO_EXAMPLES=1"
      (lib.cmakeBool "NO_DX" stdenv.hostPlatform.isWindows)
      (lib.cmakeBool "NO_METAL" (!stdenv.hostPlatform.isDarwin))
      (lib.cmakeBool "NO_OPENCL" (!openclSupport))
      (lib.cmakeBool "NO_CUDA" (!cudaSupport))
      (lib.mapAttrsToList lib.cmakeBool {
        NO_TUTORIALS = true;
        NO_REGRESSION = true;
        NO_EXAMPLES = true;
        NO_DX = stdenv.hostPlatform.isWindows;
        NO_METAL = !stdenv.hostPlatform.isDarwin;
        NO_OPENCL = !openclSupport;
        NO_CUDA = !cudaSupport;
      })
    ]
    ++ lib.optionals (stdenv.hostPlatform.isUnix && !stdenv.hostPlatform.isDarwin) [
      "-DGLEW_INCLUDE_DIR=${glew.dev}/include"
      "-DGLEW_LIBRARY=${glew.dev}/lib"
    ]
    ++ lib.optionals cudaSupport [
    ]
    ++ lib.optionals (!openclSupport) [
      (lib.mapAttrsToList lib.cmakeFeature {
        GLEW_INCLUDE_DIR = "${glew.dev}/include";
        GLEW_LIBRARY = "${glew.dev}/lib";
      })
    ];

  preBuild =
@@ -128,4 +128,4 @@ stdenv.mkDerivation rec {
    maintainers = [ ];
    license = lib.licenses.asl20;
  };
}
})