rustc: build ARM crates

This commit is contained in:
Sebastien Bourdeauducq 2019-08-26 11:40:30 +08:00
parent 9b99ee9aad
commit 33631c5f85
1 changed files with 21 additions and 0 deletions

View File

@ -50,6 +50,25 @@ let
destdir=$out 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" 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} mkdir -p ''${destdir}
''${rustc} --crate-name core src/libcore/lib.rs ''${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 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/ mkdir -p $out/lib/rustlib/or1k-unknown-none/lib/
cp -r ${or1k-crates}/* $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 cp -r ${rustc_internal}/* $out
'' ''