Skip to content

Commit efd72ca

Browse files
committed
Update cargo-ify.patch for current Rust
On the functionality side, morestack is gone (rust-lang/rust#27338), and rustrt_native is gone (rust-lang/rust#27176). On the implementation side, connect has been renamed to join (rust-lang/rust#26957).
1 parent 0101b2c commit efd72ca

File tree

1 file changed

+6
-73
lines changed

1 file changed

+6
-73
lines changed

cargo-ify.patch

+6-73
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ index 0000000..e161e91
2525
+path = "../liblibc"
2626
diff --git a/src/liballoc/build.rs b/src/liballoc/build.rs
2727
new file mode 100644
28-
index 0000000..7fb1260
28+
index 0000000..ff8a9bd
2929
--- /dev/null
3030
+++ b/src/liballoc/build.rs
3131
@@ -0,0 +1,208 @@
@@ -211,7 +211,7 @@ index 0000000..7fb1260
211211
+ .arg("--disable-fill") // see CFG_JEMALLOC_FLAGS at mk/main.mk
212212
+ .arg(format!("--build={}", ctxt.host()))
213213
+ .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(" ")))
215215
+ .arg(format!("AR={}", ar))
216216
+ .arg(format!("RANLIB={} s", ar))
217217
+ .arg(format!("CPPFLAGS=-I {}", ctxt.src().join("../rt/").display()))
@@ -390,10 +390,10 @@ index 0000000..cb7a399
390390
+path = "../librustc_unicode"
391391
diff --git a/src/libstd/build.rs b/src/libstd/build.rs
392392
new file mode 100644
393-
index 0000000..5f03064
393+
index 0000000..f80df12
394394
--- /dev/null
395395
+++ b/src/libstd/build.rs
396-
@@ -0,0 +1,320 @@
396+
@@ -0,0 +1,253 @@
397397
+#![allow(dead_code)]
398398
+
399399
+extern crate gcc;
@@ -428,8 +428,6 @@ index 0000000..5f03064
428428
+ #[cfg(not(feature = "backtrace"))]
429429
+ () => {},
430430
+ }
431-
+ rustrt_native(ctxt);
432-
+ morestack(ctxt);
433431
+ compiler_rt(ctxt);
434432
+}
435433
+
@@ -596,7 +594,7 @@ index 0000000..5f03064
596594
+ .env("AR", ar)
597595
+ .env("CC", ctxt.cc())
598596
+ .env("RANLIB", format!("{} s", ar))
599-
+ .env("CFLAGS", cflags.connect(" "))
597+
+ .env("CFLAGS", cflags.join(" "))
600598
+ .arg(format!("--target={}", ctxt.target()))
601599
+ .arg(format!("--host={}", ctxt.host()))
602600
+ .status_or_panic().success()
@@ -624,71 +622,6 @@ index 0000000..5f03064
624622
+ println!("cargo:rustc-link-lib=static=backtrace");
625623
+}
626624
+
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-
+
692625
+/// Build `libcompiler_rt.a`
693626
+// We don't really need this to compile libstd, but most binaries that depend on libstd will try
694627
+// to link to this library
@@ -703,7 +636,7 @@ index 0000000..5f03064
703636
+ .arg(format!("CC={}", ctxt.cc()))
704637
+ .arg(format!("AR={}", ar))
705638
+ .arg(format!("RANLIB={} s", ar))
706-
+ .arg(format!("CFLAGS={}", ctxt.cflags().collect::<Vec<_>>().connect(" ")))
639+
+ .arg(format!("CFLAGS={}", ctxt.cflags().collect::<Vec<_>>().join(" ")))
707640
+ .arg("-C").arg(src)
708641
+ .arg(format!("ProjSrcRoot={}", src.display()))
709642
+ .arg(format!("ProjObjRoot={}", build_dir.display()))

0 commit comments

Comments
 (0)