Skip to content

Commit

Permalink
cudatoolkit: Move libcudart to a separate output
Browse files Browse the repository at this point in the history
This prevents opensubdiv (and thus blender) from having all of
cudatoolkit in its closure.
  • Loading branch information
edolstra committed Sep 16, 2017
1 parent 63f3b35 commit bb1c9b0
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions pkgs/development/compilers/cudatoolkit/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let
}
else throw "cudatoolkit does not support platform ${stdenv.system}";

outputs = [ "out" "doc" ];
outputs = [ "out" "lib" "doc" ];

buildInputs = [ perl ];

Expand Down Expand Up @@ -51,7 +51,11 @@ let
patchelf \
--set-interpreter "''$(cat $NIX_CC/nix-support/dynamic-linker)" $i
fi
rpath2=$rpath:$lib/lib:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64
if [[ $i =~ libcudart ]]; then
rpath2=
else
rpath2=$rpath:$lib/lib:$out/jre/lib/amd64/jli:$out/lib:$out/lib64:$out/nvvm/lib:$out/nvvm/lib64
fi
patchelf --set-rpath $rpath2 --force-rpath $i
done < <(find . -type f -print0)
'';
Expand Down Expand Up @@ -80,6 +84,11 @@ let
mkdir -p $out/nix-support
echo "cmakeFlags+=' -DCUDA_TOOLKIT_ROOT_DIR=$out'" >> $out/nix-support/setup-hook
# Move some libraries to the lib output so that programs that
# depend on them don't pull in this entire monstrosity.
mkdir -p $lib/lib
mv -v $out/lib64/libcudart* $lib/lib/
# Remove OpenCL libraries as they are provided by ocl-icd and driver.
rm -f $out/lib64/libOpenCL*
Expand Down

0 comments on commit bb1c9b0

Please sign in to comment.