cudnnPackages: Remove statically linked .a files.
This commit is contained in:
parent
86ee8dd8ff
commit
e3c1c3b35b
|
@ -8,6 +8,14 @@
|
||||||
, cudatoolkit
|
, cudatoolkit
|
||||||
, fetchurl
|
, fetchurl
|
||||||
, addOpenGLRunpath
|
, addOpenGLRunpath
|
||||||
|
, # The distributed version of CUDNN includes both dynamically liked .so files,
|
||||||
|
# as well as statically linked .a files. However, CUDNN is quite large
|
||||||
|
# (multiple gigabytes), so you can save some space in your nix store by
|
||||||
|
# removing the statically linked libraries if you are not using them.
|
||||||
|
#
|
||||||
|
# Setting this to true removes the statically linked .a files.
|
||||||
|
# Setting this to false keeps these statically linked .a files.
|
||||||
|
removeStatic ? false
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
|
@ -23,6 +31,8 @@ stdenv.mkDerivation {
|
||||||
nativeBuildInputs = [ addOpenGLRunpath ];
|
nativeBuildInputs = [ addOpenGLRunpath ];
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
|
||||||
function fixRunPath {
|
function fixRunPath {
|
||||||
p=$(patchelf --print-rpath $1)
|
p=$(patchelf --print-rpath $1)
|
||||||
patchelf --set-rpath "''${p:+$p:}${lib.makeLibraryPath [ stdenv.cc.cc ]}:\$ORIGIN/" $1
|
patchelf --set-rpath "''${p:+$p:}${lib.makeLibraryPath [ stdenv.cc.cc ]}:\$ORIGIN/" $1
|
||||||
|
@ -35,6 +45,10 @@ stdenv.mkDerivation {
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
cp -a include $out/include
|
cp -a include $out/include
|
||||||
cp -a lib64 $out/lib64
|
cp -a lib64 $out/lib64
|
||||||
|
'' + lib.optionalString removeStatic ''
|
||||||
|
rm -f $out/lib64/*.a
|
||||||
|
'' + ''
|
||||||
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
|
# Set RUNPATH so that libcuda in /run/opengl-driver(-32)/lib can be found.
|
||||||
|
|
Loading…
Reference in New Issue