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.
This commit is contained in:
Sören Tempel 2023-06-24 01:13:17 +02:00 committed by sternenseemann
parent cde6a6e96c
commit cf1b7c4d5c

View File

@ -73,10 +73,12 @@ stdenv.mkDerivation (finalAttrs: {
cd $out${finalAttrs.passthru.libdir}
for f in librdimon.a libc.a libg.a; do
cp "$f" "''${f%%\.a}_nano.a"
# Some libraries are only available for specific architectures.
# For example, librdimon.a is only available on ARM.
[ -f "$f" ] && cp "$f" "''${f%%\.a}_nano.a"
done
)
'';
'' + ''[ "$(find $out -type f | wc -l)" -gt 0 ] || (echo '$out is empty' 1>&2 && exit 1)'';
passthru = {
incdir = "/${stdenv.targetPlatform.config}/include";