summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2024-12-17 17:20:58 +0200
committerEfraim Flashner <efraim@flashner.co.il>2025-01-06 12:15:04 +0200
commit07bdee02778f5b30b341a01de6dd24dfef2fde2c (patch)
treee79ff25c9aa4e362037319830830958bea91ae6f
parent584c79d5dfb10208a9704a01f79af79f7d012544 (diff)
gnu: mrustc: Update to 0.11.0-1.5e01a76.
* gnu/packages/rust.scm (%mrustc-commit): Update to newest commit. (%mrustc-source): Update to 0.11.0-1.5e01a76. Add a patch. Adjust the snippet to not use vendored openssl. (rust-bootstrap)[source]: Remove patch, remove patch-flags. Add to the snippet a substitution for compatibility with llvm-13. [inputs]: Remove input labels. Remove conditional use of clang. [arguments]: Allow parallel building on all architectures. Update the make-flags. Replace the 'unpack phase to unpack the mrustc sources. Delete the custom 'set-mrustc-sources and 'patch-cargo-checksum phases. Adjust the custom 'patch-makefiles phase. Adjust the 'configure and 'build phases to no longer use clang on some architectures. * gnu/packages/patches/mrustc-patches.patch: New file. * gnu/packages/patches/rustc-1.54.0-src.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Update it. Change-Id: I7e444abe4b386b1bb77f05a278ddef45152ddb3c
-rw-r--r--gnu/local.mk2
-rw-r--r--gnu/packages/patches/mrustc-patches.patch19
-rw-r--r--gnu/packages/patches/rustc-1.54.0-src.patch304
-rw-r--r--gnu/packages/rust.scm171
4 files changed, 81 insertions, 415 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index f118fe44420..f7412d055f6 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1849,6 +1849,7 @@ dist_patch_DATA = \
%D%/packages/patches/mono-mcs-patches-from-5.10.0.patch \
%D%/packages/patches/mosaicatcher-unbundle-htslib.patch \
%D%/packages/patches/mrrescue-support-love-11.patch \
+ %D%/packages/patches/mrustc-patches.patch \
%D%/packages/patches/mtools-mformat-uninitialized.patch \
%D%/packages/patches/mupen64plus-ui-console-notice.patch \
%D%/packages/patches/musl-cross-locale.patch \
@@ -2177,7 +2178,6 @@ dist_patch_DATA = \
%D%/packages/patches/ruby-mustache-1.1.1-fix-race-condition-tests.patch \
%D%/packages/patches/ruby-nokogiri.patch \
%D%/packages/patches/ruby-x25519-automatic-fallback-non-x86_64.patch \
- %D%/packages/patches/rustc-1.54.0-src.patch \
%D%/packages/patches/rust-1.64-fix-riscv64-bootstrap.patch \
%D%/packages/patches/rust-1.70-fix-rustix-build.patch \
%D%/packages/patches/rust-1.78-unwinding-fix.patch \
diff --git a/gnu/packages/patches/mrustc-patches.patch b/gnu/packages/patches/mrustc-patches.patch
new file mode 100644
index 00000000000..626945e2a12
--- /dev/null
+++ b/gnu/packages/patches/mrustc-patches.patch
@@ -0,0 +1,19 @@
+diff --git a/rustc-1.54.0-src.patch b/rustc-1.54.0-src.patch
+index 088c723a..d322fd0d 100644
+--- a/rustc-1.54.0-src.patch
++++ b/rustc-1.54.0-src.patch
+@@ -302,14 +302,3 @@
+ use self::generic as arch;
+
+ pub use self::arch::{vec128_storage, vec256_storage, vec512_storage};
+-
+---- src/llvm-project/llvm/include/llvm/Support/Signals.h
+-+++ src/llvm-project/llvm/include/llvm/Support/Signals.h
+-@@ -14,6 +14,7 @@
+- #ifndef LLVM_SUPPORT_SIGNALS_H
+- #define LLVM_SUPPORT_SIGNALS_H
+-
+-+#include <cstdint>
+- #include <string>
+-
+- namespace llvm {
diff --git a/gnu/packages/patches/rustc-1.54.0-src.patch b/gnu/packages/patches/rustc-1.54.0-src.patch
deleted file mode 100644
index d322fd0d499..00000000000
--- a/gnu/packages/patches/rustc-1.54.0-src.patch
+++ /dev/null
@@ -1,304 +0,0 @@
-# mrustc is much better at enum packing, so causes almost all of these to be smaller by one pointer
---- compiler/rustc_ast/src/ast.rs
-+++ compiler/rustc_ast/src/ast.rs
-@@ -1075,7 +1075,7 @@ pub struct Expr {
- }
-
- // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Expr, 104);
-
- impl Expr {
-@@ -2779,7 +2779,7 @@ pub enum AssocItemKind {
- MacCall(MacCall),
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(AssocItemKind, 72);
-
- impl AssocItemKind {
-@@ -2831,7 +2831,7 @@ pub enum ForeignItemKind {
- MacCall(MacCall),
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(ForeignItemKind, 72);
-
- impl From<ForeignItemKind> for ItemKind {
-
---- compiler/rustc_hir/src/hir.rs
-+++ compiler/rustc_hir/src/hir.rs
-@@ -3048,7 +3048,7 @@ impl<'hir> Node<'hir> {
- }
-
- // Some nodes are used a lot. Make sure they don't unintentionally get bigger.
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"),target_arch = "x86_64", target_pointer_width = "64"))]
- mod size_asserts {
- rustc_data_structures::static_assert_size!(super::Block<'static>, 48);
- rustc_data_structures::static_assert_size!(super::Expr<'static>, 64);
-
---- compiler/rustc_middle/src/mir/interpret/error.rs
-+++ compiler/rustc_middle/src/mir/interpret/error.rs
-@@ -449,7 +449,7 @@ impl dyn MachineStopType {
- }
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- static_assert_size!(InterpError<'_>, 64);
-
- pub enum InterpError<'tcx> {
-
---- compiler/rustc_middle/src/mir/mod.rs
-+++ compiler/rustc_middle/src/mir/mod.rs
-@@ -2200,7 +2200,7 @@ pub enum AggregateKind<'tcx> {
- Generator(DefId, SubstsRef<'tcx>, hir::Movability),
- }
-
--#[cfg(target_arch = "x86_64")]
-+#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64"))]
- static_assert_size!(AggregateKind<'_>, 48);
-
- #[derive(Copy, Clone, Debug, PartialEq, PartialOrd, Eq, TyEncodable, TyDecodable, Hash, HashStable)]
-
---- compiler/rustc_middle/src/thir.rs
-+++ compiler/rustc_middle/src/thir.rs
-@@ -144,7 +144,7 @@ pub enum StmtKind<'tcx> {
- }
-
- // `Expr` is used a lot. Make sure it doesn't unintentionally get bigger.
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler="mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Expr<'_>, 144);
-
- /// The Thir trait implementor lowers their expressions (`&'tcx H::Expr`)
-
---- compiler/rustc_mir/src/interpret/operand.rs
-+++ compiler/rustc_mir/src/interpret/operand.rs
-@@ -32,7 +32,7 @@ pub enum Immediate<Tag = ()> {
- ScalarPair(ScalarMaybeUninit<Tag>, ScalarMaybeUninit<Tag>),
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Immediate, 56);
-
- impl<Tag> From<ScalarMaybeUninit<Tag>> for Immediate<Tag> {
-@@ -87,7 +87,7 @@ pub struct ImmTy<'tcx, Tag = ()> {
- pub layout: TyAndLayout<'tcx>,
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(ImmTy<'_>, 72);
-
- impl<Tag: Copy> std::fmt::Display for ImmTy<'tcx, Tag> {
-
---- compiler/rustc_mir/src/interpret/place.rs
-+++ compiler/rustc_mir/src/interpret/place.rs
-@@ -88,7 +88,7 @@ pub enum Place<Tag = ()> {
- Local { frame: usize, local: mir::Local },
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(Place, 64);
-
- #[derive(Copy, Clone, Debug)]
-@@ -97,7 +97,7 @@ pub struct PlaceTy<'tcx, Tag = ()> {
- pub layout: TyAndLayout<'tcx>,
- }
-
--#[cfg(all(target_arch = "x86_64", target_pointer_width = "64"))]
-+#[cfg(all(not(rust_compiler = "mrustc"), target_arch = "x86_64", target_pointer_width = "64"))]
- rustc_data_structures::static_assert_size!(PlaceTy<'_>, 80);
-
- impl<'tcx, Tag> std::ops::Deref for PlaceTy<'tcx, Tag> {
-
-#
-# Disable std_detect's detection logic (use the same logic as miri)
-#
---- library/stdarch/crates/std_detect/src/detect/mod.rs
-+++ library/stdarch/crates/std_detect/src/detect/mod.rs
-@@ -86,7 +86,7 @@ mod bit;
- mod cache;
-
- cfg_if! {
-- if #[cfg(miri)] {
-+ if #[cfg(any(miri, rust_compiler = "mrustc"))] {
- // When running under miri all target-features that are not enabled at
- // compile-time are reported as disabled at run-time.
- //
-
-#
-# Disable crc32fast's use of stdarch
-#
---- vendor/crc32fast/src/specialized/mod.rs
-+++ vendor/crc32fast/src/specialized/mod.rs
-@@ -1,5 +1,6 @@
- cfg_if! {
- if #[cfg(all(
-+ not(rust_compiler = "mrustc"),
- crc32fast_stdarchx86,
- any(target_arch = "x86", target_arch = "x86_64")
- ))] {
-
-#
-# Backport which is required to support arm64 on macOS 12
-# See: https://github.com/alexcrichton/curl-rust/commit/0aea09c428b9bc2bcf46da0fc33959fe3f03c74a
-#
---- vendor/curl/src/lib.rs
-+++ vendor/curl/src/lib.rs
-@@ -82,6 +82,9 @@ pub mod easy;
- pub mod multi;
- mod panic;
-
-+#[cfg(test)]
-+static INITIALIZED: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false);
-+
- /// Initializes the underlying libcurl library.
- ///
- /// The underlying libcurl library must be initialized before use, and must be
-@@ -102,46 +105,62 @@ pub fn init() {
- /// Used to prevent concurrent or duplicate initialization.
- static INIT: Once = Once::new();
-
-- /// An exported constructor function. On supported platforms, this will be
-- /// invoked automatically before the program's `main` is called.
-- #[cfg_attr(
-- any(target_os = "linux", target_os = "freebsd", target_os = "android"),
-- link_section = ".init_array"
-- )]
-- #[cfg_attr(target_os = "macos", link_section = "__DATA,__mod_init_func")]
-- #[cfg_attr(target_os = "windows", link_section = ".CRT$XCU")]
-- static INIT_CTOR: extern "C" fn() = init_inner;
-+ INIT.call_once(|| {
-+ #[cfg(need_openssl_init)]
-+ openssl_probe::init_ssl_cert_env_vars();
-+ #[cfg(need_openssl_init)]
-+ openssl_sys::init();
-+
-+ unsafe {
-+ assert_eq!(curl_sys::curl_global_init(curl_sys::CURL_GLOBAL_ALL), 0);
-+ }
-+
-+ #[cfg(test)]
-+ {
-+ INITIALIZED.store(true, std::sync::atomic::Ordering::SeqCst);
-+ }
-+
-+ // Note that we explicitly don't schedule a call to
-+ // `curl_global_cleanup`. The documentation for that function says
-+ //
-+ // > You must not call it when any other thread in the program (i.e. a
-+ // > thread sharing the same memory) is running. This doesn't just mean
-+ // > no other thread that is using libcurl.
-+ //
-+ // We can't ever be sure of that, so unfortunately we can't call the
-+ // function.
-+ });
-+}
-
-+/// An exported constructor function. On supported platforms, this will be
-+/// invoked automatically before the program's `main` is called. This is done
-+/// for the convenience of library users since otherwise the thread-safety rules
-+/// around initialization can be difficult to fulfill.
-+///
-+/// This is a hidden public item to ensure the symbol isn't optimized away by a
-+/// rustc/LLVM bug: https://github.com/rust-lang/rust/issues/47384. As long as
-+/// any item in this module is used by the final binary (which `init` will be)
-+/// then this symbol should be preserved.
-+#[used]
-+#[doc(hidden)]
-+#[cfg_attr(
-+ any(target_os = "linux", target_os = "freebsd", target_os = "android"),
-+ link_section = ".init_array"
-+)]
-+#[cfg_attr(target_os = "macos", link_section = "__DATA,__mod_init_func")]
-+#[cfg_attr(target_os = "windows", link_section = ".CRT$XCU")]
-+pub static INIT_CTOR: extern "C" fn() = {
- /// This is the body of our constructor function.
- #[cfg_attr(
- any(target_os = "linux", target_os = "android"),
- link_section = ".text.startup"
- )]
-- extern "C" fn init_inner() {
-- INIT.call_once(|| {
-- #[cfg(need_openssl_init)]
-- openssl_sys::init();
--
-- unsafe {
-- assert_eq!(curl_sys::curl_global_init(curl_sys::CURL_GLOBAL_ALL), 0);
-- }
--
-- // Note that we explicitly don't schedule a call to
-- // `curl_global_cleanup`. The documentation for that function says
-- //
-- // > You must not call it when any other thread in the program (i.e.
-- // > a thread sharing the same memory) is running. This doesn't just
-- // > mean no other thread that is using libcurl.
-- //
-- // We can't ever be sure of that, so unfortunately we can't call the
-- // function.
-- });
-+ extern "C" fn init_ctor() {
-+ init();
- }
-
-- // We invoke our init function through our static to ensure the symbol isn't
-- // optimized away by a bug: https://github.com/rust-lang/rust/issues/47384
-- INIT_CTOR();
--}
-+ init_ctor
-+};
-
- unsafe fn opt_str<'a>(ptr: *const libc::c_char) -> Option<&'a str> {
- if ptr.is_null() {
-@@ -158,3 +177,20 @@ fn cvt(r: curl_sys::CURLcode) -> Result<(), Error> {
- Err(Error::new(r))
- }
- }
-+
-+#[cfg(test)]
-+mod tests {
-+ use super::*;
-+
-+ #[test]
-+ #[cfg(any(
-+ target_os = "linux",
-+ target_os = "macos",
-+ target_os = "windows",
-+ target_os = "freebsd",
-+ target_os = "android"
-+ ))]
-+ fn is_initialized_before_main() {
-+ assert!(INITIALIZED.load(std::sync::atomic::Ordering::SeqCst));
-+ }
-+}
-
-# PPV-Lite also needs to know that we're pretending to be miri
---- vendor/ppv-lite86/src/lib.rs
-+++ vendor/ppv-lite86/src/lib.rs
-@@ -9,14 +9,14 @@ mod soft;
- mod types;
- pub use self::types::*;
-
--#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
-+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler = "mrustc")))]
- pub mod x86_64;
--#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri)))]
-+#[cfg(all(feature = "simd", target_arch = "x86_64", not(miri), not(rust_compiler = "mrustc")))]
- use self::x86_64 as arch;
-
--#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
-+#[cfg(any(miri, rust_compiler = "mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
- pub mod generic;
--#[cfg(any(miri, not(all(feature = "simd", any(target_arch = "x86_64")))))]
-+#[cfg(any(miri, rust_compiler = "mrustc", not(all(feature = "simd", any(target_arch = "x86_64")))))]
- use self::generic as arch;
-
- pub use self::arch::{vec128_storage, vec256_storage, vec512_storage};
diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm
index d5da35b5afc..e55b91b1fe4 100644
--- a/gnu/packages/rust.scm
+++ b/gnu/packages/rust.scm
@@ -128,9 +128,9 @@
;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed
;;; to be used in source form.
-(define %mrustc-commit "b6754f574f8846eb842feba4ccbeeecb10bdfacc")
+(define %mrustc-commit "5e01a76097265f4bb27b18885b9af3f2778180f9")
(define %mrustc-source
- (let* ((version "0.10.1")
+ (let* ((version "0.11.0")
(commit %mrustc-commit)
(revision "1")
(name "mrustc"))
@@ -138,11 +138,11 @@
(method git-fetch)
(uri (git-reference
(url "https://github.com/thepowersgang/mrustc")
- (commit (string-append "v" version))))
- (file-name (git-file-name name version))
+ (commit %mrustc-commit)))
+ (file-name (git-file-name name (git-version version revision commit)))
(sha256
- (base32
- "0rqiif7rb5hg6ik3i1flldj311f014q4n9z8wb50cs8kspjz32di"))
+ (base32 "1yyjfl1z6d5r9sv7zl90kqyjw1lqd2cqzwh2syi7yvrpslhihrhy"))
+ (patches (search-patches "mrustc-patches.patch"))
(modules '((guix build utils)))
(snippet
'(begin
@@ -150,7 +150,10 @@
;; by disabling debug by default.
(substitute* (find-files "." "Makefile")
(("LINKFLAGS := -g") "LINKFLAGS :=")
- (("-g ") "")))))))
+ (("-g ") ""))
+ ;; Don't use the vendored openssl sources.
+ (substitute* "minicargo.mk"
+ (("--features vendored-openssl") "")))))))
;;; Rust 1.54 is special in that it is built with mrustc, which shortens the
;;; bootstrap path.
@@ -177,26 +180,24 @@
;; Also remove the bundled (mostly Windows) libraries.
;; find vendor -not -type d -exec file {} \+ | grep PE32
(for-each delete-file
- (find-files "vendor" "\\.(a|dll|exe|lib)$"))))
- (patches (search-patches "rustc-1.54.0-src.patch"))
- (patch-flags '("-p0")))) ;default is -p1
+ (find-files "vendor" "\\.(a|dll|exe|lib)$"))
+ ;; Adjust some sources for llvm-13, see llvm commit
+ ;; acce401068e78a8c5dc9e06802111ffad3da763f
+ (substitute* (find-files "." "powerpc64le_unknown_linux_gnu.rs")
+ (("e-m:e-i64:64-n32:64-v256:256:256-v512:512:512")
+ "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512"))))))
(outputs '("out" "cargo"))
(properties '((hidden? . #t)
(timeout . 129600) ;36 hours
(max-silent-time . 18000))) ;5 hours (for armel)
(build-system gnu-build-system)
(inputs
- `(("bash-minimal" ,bash-minimal)
- ,@(if (or (target-ppc64le?)
- (target-riscv64?))
- `(("clang" ,clang-13))
- `())
- ("llvm" ,llvm-13)
- ("openssl" ,openssl-1.1)
- ("zlib" ,zlib)))
+ (list bash-minimal
+ llvm-13
+ openssl-1.1
+ zlib))
(native-inputs
`(("pkg-config" ,pkg-config)
- ;; Required for the libstd sources.
("mrustc-source" ,%mrustc-source)))
(arguments
`(#:imported-modules ,%cargo-utils-modules ;for `generate-all-checksums'
@@ -207,85 +208,49 @@
;; Rust's own .so library files are not found in any RUNPATH, but
;; that doesn't seem to cause issues.
#:validate-runpath? #f
- ;; We currently see race conditions between various dependant crates.
- ;; TODO: Re-evaluate after moving to a more recent mrustc.
- #:parallel-build? #f
#:make-flags
- (list ,(string-append "RUSTC_TARGET="
- (platform-rust-target
- (lookup-platform-by-target-or-system
- (or (%current-target-system)
- (%current-system)))))
- ,(string-append "RUSTC_VERSION=" version)
- ,(string-append "MRUSTC_TARGET_VER="
- (version-major+minor version))
- ;; mrustc expects a C11 compatible compiler. Use the default
- ;; C language dialect from the GCC-10 compiler.
- ;; This is necessary for some architectures.
- "CFLAGS=-std=gnu11"
- "OUTDIR_SUF=") ;do not add version suffix to output dir
+ ,#~(let ((source #$(package-source this-package)))
+ (list (string-append "RUSTC_TARGET="
+ #$(platform-rust-target
+ (lookup-platform-by-target-or-system
+ (or (%current-target-system)
+ (%current-system)))))
+ (string-append "RUSTC_VERSION=" #$version)
+ (string-append "MRUSTC_TARGET_VER="
+ #$(version-major+minor version))
+ (string-append "RUSTC_SRC_TARBALL=" source)
+ "OUTDIR_SUF=")) ;do not add version suffix to output dir
#:phases
(modify-phases %standard-phases
- ,@(if (target-ppc64le?)
- `((add-after 'unpack 'patch-sources-for-newer-llvm
- (lambda _
- ;; Adjust some sources for llvm-13, see llvm commit
- ;; acce401068e78a8c5dc9e06802111ffad3da763f
- (substitute* (find-files "." "powerpc64le_unknown_linux_gnu.rs")
- (("e-m:e-i64:64-n32:64-v256:256:256-v512:512:512")
- "e-m:e-i64:64-n32:64-S128-v256:256:256-v512:512:512")))))
- '())
- (add-after 'unpack 'setup-mrustc-sources
- (lambda* (#:key inputs #:allow-other-keys)
- (copy-recursively (assoc-ref inputs "mrustc-source") "../mrustc")
- ;; The Makefile of mrustc expects the sources directory of rustc
- ;; to be at this location, and it simplifies things to make it
- ;; so.
- (symlink (getcwd)
- (string-append "../mrustc/rustc-" ,version "-src"))
- (with-output-to-file "dl-version"
- (lambda _
- (format #t "~a~%"
- ,version)))))
- (add-after 'setup-mrustc-sources 'patch-makefiles
+ (replace 'unpack
+ (lambda* (#:key source inputs #:allow-other-keys)
+ ((assoc-ref %standard-phases 'unpack)
+ #:source (assoc-ref inputs "mrustc-source"))))
+ (add-after 'unpack 'patch-makefiles
;; This disables building the (unbundled) LLVM.
- (lambda* (#:key inputs parallel-build? #:allow-other-keys)
- (let ((llvm (assoc-ref inputs "llvm")))
- (with-directory-excursion "../mrustc"
- (substitute* '("minicargo.mk"
- "run_rustc/Makefile")
- ;; Use the system-provided LLVM.
- (("LLVM_CONFIG [:|?]= .*")
- (string-append "LLVM_CONFIG := " llvm "/bin/llvm-config\n")))
- (substitute* "minicargo.mk"
- ;; Do not try to fetch sources from the Internet.
- (("@curl.*") "")
- (("\\$\\(MINICARGO\\) \\$\\(RUSTC_SRC_DL\\)")
- "$(MINICARGO)"))
- (substitute* "Makefile"
- ;; Patch date and git obtained version information.
- ((" -D VERSION_GIT_FULLHASH=.*")
- (string-append
- " -D VERSION_GIT_FULLHASH=\\\"" ,%mrustc-commit "\\\""
- " -D VERSION_GIT_BRANCH=\\\"master\\\""
- " -D VERSION_GIT_SHORTHASH=\\\""
- ,(string-take %mrustc-commit 7) "\\\""
- " -D VERSION_BUILDTIME="
- "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
- " -D VERSION_GIT_ISDIRTY=0\n")))
- (substitute* "run_rustc/Makefile"
- ;; Patch the shebang of a generated wrapper for rustc
- (("#!/bin/sh")
- (string-append "#!" (which "sh"))))
- (substitute* "run_rustc/rustc_proxy.sh"
- (("#!/bin/sh")
- (string-append "#!" (which "sh"))))))))
- (add-after 'patch-generated-file-shebangs 'patch-cargo-checksums
- (lambda _
- (substitute* "Cargo.lock"
- (("(checksum = )\".*\"" all name)
- (string-append name "\"" ,%cargo-reference-hash "\"")))
- (generate-all-checksums "vendor")))
+ (lambda* (#:key inputs #:allow-other-keys)
+ (substitute* '("minicargo.mk"
+ "run_rustc/Makefile")
+ ;; Use the system-provided LLVM.
+ (("LLVM_CONFIG [:|?]= .*")
+ (string-append "LLVM_CONFIG := "
+ (search-input-file inputs "/bin/llvm-config") "\n")))
+ (substitute* "Makefile"
+ ;; Patch date and git obtained version information.
+ ((" -D VERSION_GIT_FULLHASH=.*")
+ (string-append
+ " -D VERSION_GIT_FULLHASH=\\\"" ,%mrustc-commit "\\\""
+ " -D VERSION_GIT_BRANCH=\\\"master\\\""
+ " -D VERSION_GIT_SHORTHASH=\\\""
+ ,(string-take %mrustc-commit 7) "\\\""
+ " -D VERSION_BUILDTIME="
+ "\"\\\"Thu, 01 Jan 1970 00:00:01 +0000\\\"\""
+ " -D VERSION_GIT_ISDIRTY=0\n")))
+ (substitute* '("run_rustc/Makefile"
+ "run_rustc/rustc_proxy.sh")
+ ;; Patch the shebang of a generated wrapper for rustc
+ (("#!/bin/sh")
+ (string-append "#!" (which "sh"))))))
(add-before 'configure 'configure-cargo-home
(lambda _
(let ((cargo-home (string-append (getcwd) "/.cargo")))
@@ -293,12 +258,8 @@
(setenv "CARGO_HOME" cargo-home))))
(replace 'configure
(lambda _
- ,@(if (or (target-ppc64le?)
- (target-riscv64?))
- `((setenv "CC" "clang")
- (setenv "CXX" "clang++"))
- `((setenv "CC" "gcc")
- (setenv "CXX" "g++")))
+ (setenv "CC" "gcc")
+ (setenv "CXX" "g++")
;; The Guix LLVM package installs only shared libraries.
(setenv "LLVM_LINK_SHARED" "1")
;; rustc still insists on having 'cc' on PATH in some places
@@ -314,7 +275,6 @@
1)))
;; Adapted from:
;; https://github.com/dtolnay/bootstrap/blob/master/build-1.54.0.sh.
- (chdir "../mrustc")
;; Use PARLEVEL since both minicargo and mrustc use it
;; to set the level of parallelism.
(setenv "PARLEVEL" (number->string job-count))
@@ -335,15 +295,6 @@
(apply invoke "make" "-f" "minicargo.mk" "output/rustc"
make-flags)
- ;; We can to continue the build with gcc after building rustc.
- ;; librustc_driver.so undefined reference to
- ;; `llvm::cfg::Update<llvm::BasicBlock*>::dump() const'
- ,@(if (or (target-ppc64le?)
- (target-riscv64?))
- `((setenv "CC" "gcc")
- (setenv "CXX" "g++"))
- `())
-
(display "Building cargo...\n")
(apply invoke "make" "-f" "minicargo.mk" "output/cargo"
make-flags)