From 33631c5f85ec6dd2ca7f5e4bd1cc97e7eee113aa Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Mon, 26 Aug 2019 11:40:30 +0800 Subject: [PATCH] rustc: build ARM crates --- artiq-fast/pkgs/rust/default.nix | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/artiq-fast/pkgs/rust/default.nix b/artiq-fast/pkgs/rust/default.nix index 6a4066e..b0708b8 100644 --- a/artiq-fast/pkgs/rust/default.nix +++ b/artiq-fast/pkgs/rust/default.nix @@ -50,6 +50,25 @@ let destdir=$out rustc="${rustc_internal}/bin/rustc --out-dir ''${destdir} -L ''${destdir} --target or1k-unknown-none -g -C target-feature=+mul,+div,+ffl1,+cmov,+addc -C opt-level=s --crate-type rlib" + mkdir -p ''${destdir} + ''${rustc} --crate-name core src/libcore/lib.rs + ''${rustc} --crate-name compiler_builtins src/libcompiler_builtins/src/lib.rs --cfg 'feature="compiler-builtins"' --cfg 'feature="mem"' + ''${rustc} --crate-name std_unicode src/libstd_unicode/lib.rs + ''${rustc} --crate-name alloc src/liballoc/lib.rs + ''${rustc} --crate-name libc src/liblibc_mini/lib.rs + ''${rustc} --crate-name unwind src/libunwind/lib.rs + ''${rustc} -Cpanic=abort --crate-name panic_abort src/libpanic_abort/lib.rs + ''${rustc} -Cpanic=unwind --crate-name panic_unwind src/libpanic_unwind/lib.rs --cfg llvm_libunwind + ''; + }; + arm-crates = stdenv.mkDerivation { + name = "arm-crates"; + inherit src; + phases = [ "unpackPhase" "buildPhase" ]; + buildPhase = '' + destdir=$out + rustc="${rustc_internal}/bin/rustc --out-dir ''${destdir} -L ''${destdir} --target armv7-unknown-linux-gnueabihf -g -C target-feature=+dsp,+fp16,+neon,+vfp3 -C opt-level=s --crate-type rlib" + mkdir -p ''${destdir} ''${rustc} --crate-name core src/libcore/lib.rs ''${rustc} --crate-name compiler_builtins src/libcompiler_builtins/src/lib.rs --cfg 'feature="compiler-builtins"' --cfg 'feature="mem"' @@ -66,5 +85,7 @@ in '' mkdir -p $out/lib/rustlib/or1k-unknown-none/lib/ cp -r ${or1k-crates}/* $out/lib/rustlib/or1k-unknown-none/lib/ + mkdir -p $out/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/ + cp -r ${arm-crates}/* $out/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/ cp -r ${rustc_internal}/* $out ''