@@ -25,7 +25,7 @@ index 0000000..e161e91
25
25
+ path = "../liblibc"
26
26
diff --git a/src/liballoc/build.rs b/src/liballoc/build.rs
27
27
new file mode 100644
28
- index 0000000..7fb1260
28
+ index 0000000..ff8a9bd
29
29
--- /dev/null
30
30
+++ b/src/liballoc/build.rs
31
31
@@ -0,0 +1,208 @@
@@ -211,7 +211,7 @@ index 0000000..7fb1260
211
211
+ .arg("--disable-fill") // see CFG_JEMALLOC_FLAGS at mk/main.mk
212
212
+ .arg(format!("--build={}", ctxt.host()))
213
213
+ .arg(format!("--host={}", ctxt.target()))
214
- + .arg(format!("CC={} {}", ctxt.cc(), ctxt.cflags().collect::<Vec<_>>().connect (" ")))
214
+ + .arg(format!("CC={} {}", ctxt.cc(), ctxt.cflags().collect::<Vec<_>>().join (" ")))
215
215
+ .arg(format!("AR={}", ar))
216
216
+ .arg(format!("RANLIB={} s", ar))
217
217
+ .arg(format!("CPPFLAGS=-I {}", ctxt.src().join("../rt/").display()))
@@ -390,10 +390,10 @@ index 0000000..cb7a399
390
390
+ path = "../librustc_unicode"
391
391
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
392
392
new file mode 100644
393
- index 0000000..5f03064
393
+ index 0000000..f80df12
394
394
--- /dev/null
395
395
+++ b/src/libstd/build.rs
396
- @@ -0,0 +1,320 @@
396
+ @@ -0,0 +1,253 @@
397
397
+ #![allow(dead_code)]
398
398
+
399
399
+ extern crate gcc;
@@ -428,8 +428,6 @@ index 0000000..5f03064
428
428
+ #[cfg(not(feature = "backtrace"))]
429
429
+ () => {},
430
430
+ }
431
- + rustrt_native(ctxt);
432
- + morestack(ctxt);
433
431
+ compiler_rt(ctxt);
434
432
+ }
435
433
+
@@ -596,7 +594,7 @@ index 0000000..5f03064
596
594
+ .env("AR", ar)
597
595
+ .env("CC", ctxt.cc())
598
596
+ .env("RANLIB", format!("{} s", ar))
599
- + .env("CFLAGS", cflags.connect (" "))
597
+ + .env("CFLAGS", cflags.join (" "))
600
598
+ .arg(format!("--target={}", ctxt.target()))
601
599
+ .arg(format!("--host={}", ctxt.host()))
602
600
+ .status_or_panic().success()
@@ -624,71 +622,6 @@ index 0000000..5f03064
624
622
+ println!("cargo:rustc-link-lib=static=backtrace");
625
623
+ }
626
624
+
627
- + /// Build `librustrt_native`
628
- + // See `mk/rt.mk`
629
- + fn rustrt_native(ctxt: &Ctxt) {
630
- + let dst = ctxt.dst();
631
- + let src = ctxt.src();
632
- +
633
- + assert! {
634
- + Command::new("llc")
635
- + .arg("-filetype=obj")
636
- + .arg(format!("-mtriple={}", ctxt.target()))
637
- + .arg("-relocation-model=pic")
638
- + .arg("-o").arg(dst.join("rust_try.o"))
639
- + .arg(src.join("../rt/rust_try.ll"))
640
- + .status_or_panic().success()
641
- + }
642
- +
643
- + let mut cmd = Command::new(ctxt.cc());
644
- + for flag in ctxt.cflags() {
645
- + cmd.arg(flag);
646
- + }
647
- +
648
- + assert! {
649
- + cmd
650
- + .arg(src.join(format!("../rt/arch/{}/record_sp.S", ctxt.arch())))
651
- + .arg("-c")
652
- + .arg("-o").arg(dst.join("record_sp.o"))
653
- + .status_or_panic().success()
654
- + }
655
- +
656
- + assert! {
657
- + Command::new(ctxt.ar())
658
- + .arg("crus")
659
- + .arg(dst.join("librustrt_native.a"))
660
- + .arg(dst.join("rust_try.o"))
661
- + .arg(dst.join("record_sp.o"))
662
- + .status_or_panic().success()
663
- + }
664
- +
665
- + println!("cargo:rustc-link-lib=static=rustrt_native");
666
- + }
667
- +
668
- + /// Build `libmorestack.a`
669
- + fn morestack(ctxt: &Ctxt) {
670
- + let dst = ctxt.dst();
671
- +
672
- + assert! {
673
- + Command::new("llvm-mc")
674
- + .arg("-assemble")
675
- + .arg("-relocation-model=pic")
676
- + .arg("-filetype=obj")
677
- + .arg(format!("-triple={}", ctxt.target()))
678
- + .arg("-o").arg(dst.join("morestack.o"))
679
- + .arg(ctxt.src().join(format!("../rt/arch/{}/morestack.S", ctxt.arch())))
680
- + .status_or_panic().success()
681
- + }
682
- +
683
- + assert! {
684
- + Command::new(ctxt.ar())
685
- + .arg("crus")
686
- + .arg(dst.join("libmorestack.a"))
687
- + .arg(dst.join("morestack.o"))
688
- + .status_or_panic().success()
689
- + }
690
- + }
691
- +
692
625
+ /// Build `libcompiler_rt.a`
693
626
+ // We don't really need this to compile libstd, but most binaries that depend on libstd will try
694
627
+ // to link to this library
@@ -703,7 +636,7 @@ index 0000000..5f03064
703
636
+ .arg(format!("CC={}", ctxt.cc()))
704
637
+ .arg(format!("AR={}", ar))
705
638
+ .arg(format!("RANLIB={} s", ar))
706
- + .arg(format!("CFLAGS={}", ctxt.cflags().collect::<Vec<_>>().connect (" ")))
639
+ + .arg(format!("CFLAGS={}", ctxt.cflags().collect::<Vec<_>>().join (" ")))
707
640
+ .arg("-C").arg(src)
708
641
+ .arg(format!("ProjSrcRoot={}", src.display()))
709
642
+ .arg(format!("ProjObjRoot={}", build_dir.display()))
0 commit comments