newlib: fix build of nano variant on non-ARM architectures

librdimon.a is only available on ARM architectures, therefore building
newlib-nano for other architectures (e.g. RISC-V) fails presently.
This commit fixes this issue by only copying the library files that
actually exist in the for loop body. Alternatively, it would be
theoretically feasible to change the libraries iterated over based
on the targeted architecture.

authored by

Sören Tempel and committed by
sternenseemann
cf1b7c4d cde6a6e9

+4 -2
+4 -2
pkgs/development/misc/newlib/default.nix
··· 73 cd $out${finalAttrs.passthru.libdir} 74 75 for f in librdimon.a libc.a libg.a; do 76 - cp "$f" "''${f%%\.a}_nano.a" 77 done 78 ) 79 - ''; 80 81 passthru = { 82 incdir = "/${stdenv.targetPlatform.config}/include";
··· 73 cd $out${finalAttrs.passthru.libdir} 74 75 for f in librdimon.a libc.a libg.a; do 76 + # Some libraries are only available for specific architectures. 77 + # For example, librdimon.a is only available on ARM. 78 + [ -f "$f" ] && cp "$f" "''${f%%\.a}_nano.a" 79 done 80 ) 81 + '' + ''[ "$(find $out -type f | wc -l)" -gt 0 ] || (echo '$out is empty' 1>&2 && exit 1)''; 82 83 passthru = { 84 incdir = "/${stdenv.targetPlatform.config}/include";