From bf8b03667fa361bc03ab44fcbc66e99c812c0c68 Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Thu, 20 Oct 2022 09:06:51 +0300 Subject: [PATCH 1/4] gnu: mrustc: Update to 0.10.0-2.597593a. * gnu/packages/rust.scm (mrustc): Update to 0.10.0-2.597593a. [source]: Remove patch. (rust-bootstrap)[arguments]: Adjust custom 'patch-makefiles phase for changes in source. * gnu/packages/patches/mrustc-riscv64-support.patch: Remove file. * gnu/local.mk (dist_patch_DATA): Remove it. --- gnu/local.mk | 1 - .../patches/mrustc-riscv64-support.patch | 48 ------------------- gnu/packages/rust.scm | 9 ++-- 3 files changed, 4 insertions(+), 54 deletions(-) delete mode 100644 gnu/packages/patches/mrustc-riscv64-support.patch diff --git a/gnu/local.mk b/gnu/local.mk index 8247180bef..c721718301 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1544,7 +1544,6 @@ dist_patch_DATA = \ %D%/packages/patches/monero-use-system-miniupnpc.patch \ %D%/packages/patches/mosaicatcher-unbundle-htslib.patch \ %D%/packages/patches/mrrescue-support-love-11.patch \ - %D%/packages/patches/mrustc-riscv64-support.patch \ %D%/packages/patches/mtools-mformat-uninitialized.patch \ %D%/packages/patches/mupen64plus-ui-console-notice.patch \ %D%/packages/patches/mupen64plus-video-z64-glew-correct-path.patch \ diff --git a/gnu/packages/patches/mrustc-riscv64-support.patch b/gnu/packages/patches/mrustc-riscv64-support.patch deleted file mode 100644 index 6312116585..0000000000 --- a/gnu/packages/patches/mrustc-riscv64-support.patch +++ /dev/null @@ -1,48 +0,0 @@ -Patch sent upstream for review: -https://github.com/thepowersgang/mrustc/pull/276 - -diff --git a/src/trans/target.cpp b/src/trans/target.cpp -index 420a2870..4d5eefb3 100644 ---- a/src/trans/target.cpp -+++ b/src/trans/target.cpp -@@ -65,6 +65,13 @@ const TargetArch ARCH_POWERPC64LE = { - { /*atomic(u8)=*/true, true, true, true, true }, - TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8) - }; -+// This is a guess -+const TargetArch ARCH_RISCV64 = { -+ "riscv64", -+ 64, false, -+ { /*atomic(u8)=*/true, true, true, true, true }, -+ TargetArch::Alignments(2, 4, 8, 16, 4, 8, 8) -+}; - TargetSpec g_target; - - -@@ -455,6 +462,13 @@ namespace - ARCH_POWERPC64LE - }; - } -+ else if(target_name == "riscv64-unknown-linux-gnu") -+ { -+ return TargetSpec { -+ "unix", "linux", "gnu", {CodegenMode::Gnu11, false, "riscv64-unknown-linux-gnu", BACKEND_C_OPTS_GNU}, -+ ARCH_RISCV64 -+ }; -+ } - else if(target_name == "i586-pc-windows-gnu") - { - return TargetSpec { -diff --git a/tools/common/target_detect.h b/tools/common/target_detect.h -index a052da6b..42fea91a 100644 ---- a/tools/common/target_detect.h -+++ b/tools/common/target_detect.h -@@ -34,6 +34,8 @@ - # define DEFAULT_TARGET_NAME "powerpc64-unknown-linux-gnu" - # elif defined(__powerpc64__) && defined(__LITTLE_ENDIAN__) - # define DEFAULT_TARGET_NAME "powerpc64le-unknown-linux-gnu" -+# elif defined(__riscv) && __riscv_xlen == 64 -+# define DEFAULT_TARGET_NAME "riscv64-unknown-linux-gnu" - # else - # warning "Unable to detect a suitable default target (linux-gnu)" - # endif diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 25295a283e..d24ecbf2ae 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -124,11 +124,11 @@ ;;; Note: mrustc's only purpose is to be able to bootstap Rust; it's designed ;;; to be used in source form. -(define %mrustc-commit "b364724f15fd6fce8234ad8add68107c23a22151") +(define %mrustc-commit "597593aba86fa2edbea80c6e09f0b1b2a480722d") (define %mrustc-source (let* ((version "0.10") (commit %mrustc-commit) - (revision "1") + (revision "2") (name "mrustc")) (origin (method git-fetch) @@ -138,8 +138,7 @@ (file-name (git-file-name name (git-version version revision commit))) (sha256 (base32 - "0f7kh4n2663sn0z3xib8gzw0s97qpvwag40g2vs3bfjlrbpgi9z0")) - (patches (search-patches "mrustc-riscv64-support.patch"))))) + "09rvm3zgx1d86gippl8qzh13m641ynbw9q0zsc90g0h1khd3z3b6"))))) ;;; Rust 1.54 is special in that it is built with mrustc, which shortens the ;;; bootstrap path. @@ -229,7 +228,7 @@ (substitute* '("minicargo.mk" "run_rustc/Makefile") ;; Use the system-provided LLVM. - (("LLVM_CONFIG := .*") + (("LLVM_CONFIG [:|?]= .*") (string-append "LLVM_CONFIG := " llvm "/bin/llvm-config\n"))) (substitute* "minicargo.mk" ;; Do not try to fetch sources from the Internet. From 01be1973f464cb81cdece54f7858f0dee46abb50 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 20 Oct 2022 10:06:05 +0300 Subject: [PATCH 2/4] gnu: rust-bootstrap: Disable debug info during build. This dramatically reduces the memory required to build Rust, and also speeds up the build. * gnu/packages/rust.scm (mrustc)[source]: Add snippet to remove building debug info with mrustc. --- gnu/packages/rust.scm | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index d24ecbf2ae..6b40423709 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -15,6 +15,7 @@ ;;; Copyright © 2021 (unmatched parenthesis ;;; Copyright © 2022 Zheng Junjie <873216071@qq.com> ;;; Copyright © 2022 Jim Newsome +;;; Copyright © 2022 Mark H Weaver ;;; ;;; This file is part of GNU Guix. ;;; @@ -138,7 +139,14 @@ (file-name (git-file-name name (git-version version revision commit))) (sha256 (base32 - "09rvm3zgx1d86gippl8qzh13m641ynbw9q0zsc90g0h1khd3z3b6"))))) + "09rvm3zgx1d86gippl8qzh13m641ynbw9q0zsc90g0h1khd3z3b6")) + (modules '((guix build utils))) + (snippet + '(begin + ;; Drastically reduces memory and build time requirements + ;; by disabling debug by default. + (substitute* (find-files "." "Makefile") + (("-g ") ""))))))) ;;; Rust 1.54 is special in that it is built with mrustc, which shortens the ;;; bootstrap path. From 3d6f6d3b45b4fc6a448045f64ca098612e3e943a Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Thu, 20 Oct 2022 09:25:31 +0300 Subject: [PATCH 3/4] gnu: rust: Disable debug info to reduce build memory requirements. * gnu/packages/rust.scm (rust-1.55)[arguments]: In custom 'configure phase adjust rust's config.toml to disable debug info. --- gnu/packages/rust.scm | 1 + 1 file changed, 1 insertion(+) diff --git a/gnu/packages/rust.scm b/gnu/packages/rust.scm index 6b40423709..c4bb7d5292 100644 --- a/gnu/packages/rust.scm +++ b/gnu/packages/rust.scm @@ -446,6 +446,7 @@ submodules = false prefix = \"" out "\" sysconfdir = \"etc\" [rust] +debug=false jemalloc=true default-linker = \"" gcc "/bin/gcc" "\" channel = \"stable\" From 408a4ed071c9c52de207d799a698781d49fa727d Mon Sep 17 00:00:00 2001 From: Efraim Flashner Date: Thu, 20 Oct 2022 10:15:29 +0300 Subject: [PATCH 4/4] build-system/cargo: Unpack crates less verbosely. * guix/build/cargo-build-system.scm (configure): Print the crate being unpacked but don't print the contents of each crate. --- guix/build/cargo-build-system.scm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/guix/build/cargo-build-system.scm b/guix/build/cargo-build-system.scm index 0a95672b00..41766228c2 100644 --- a/guix/build/cargo-build-system.scm +++ b/guix/build/cargo-build-system.scm @@ -2,7 +2,7 @@ ;;; Copyright © 2016 David Craven ;;; Copyright © 2017 Mathieu Othacehe ;;; Copyright © 2019 Ivan Petkov -;;; Copyright © 2019, 2020, 2021 Efraim Flashner +;;; Copyright © 2019-2022 Efraim Flashner ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2020 Marius Bakke ;;; @@ -135,7 +135,8 @@ Cargo.toml file present at its root." ;; so that we can generate any cargo checksums. ;; The --strip-components argument is needed to prevent creating ;; an extra directory within `crate-dir`. - (invoke "tar" "xvf" path "-C" crate-dir "--strip-components" "1"))))) + (format #t "Unpacking ~a~%" name) + (invoke "tar" "xf" path "-C" crate-dir "--strip-components" "1"))))) inputs) ;; Configure cargo to actually use this new directory.