summary refs log tree commit diff
path: root/pkgs/development/misc
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2023-06-24 01:13:17 +0200
committersternenseemann <sternenseemann@systemli.org>2023-06-30 20:58:54 +0200
commitcf1b7c4d5c027837e71d284a838fbeb05b3fcb7f (patch)
tree211802f803d9398b52e933558e489e6dfca605f5 /pkgs/development/misc
parentcde6a6e96cbd2297c14cba5d70c64844d0a9c148 (diff)
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.
Diffstat (limited to 'pkgs/development/misc')
-rw-r--r--pkgs/development/misc/newlib/default.nix6
1 files changed, 4 insertions, 2 deletions
diff --git a/pkgs/development/misc/newlib/default.nix b/pkgs/development/misc/newlib/default.nix
index 4ec603f250d52..d162753608bdc 100644
--- a/pkgs/development/misc/newlib/default.nix
+++ b/pkgs/development/misc/newlib/default.nix
@@ -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";