diff --git a/0001-WIP-minimize-the-rust-std-component.patch b/0001-WIP-minimize-the-rust-std-component.patch new file mode 100644 index 0000000..04be717 --- /dev/null +++ b/0001-WIP-minimize-the-rust-std-component.patch @@ -0,0 +1,74 @@ +From 2bf05f208272cd58c57f4d7d8d0e10fdb22e8719 Mon Sep 17 00:00:00 2001 +From: Josh Stone +Date: Fri, 27 Sep 2019 12:33:08 -0700 +Subject: [PATCH] [WIP] minimize the rust-std component + +--- + src/bootstrap/dist.rs | 45 +++++++++++++++---------------------------- + 1 file changed, 16 insertions(+), 29 deletions(-) + +diff --git a/src/bootstrap/dist.rs b/src/bootstrap/dist.rs +index 552965863d10..76fbd07f9fb5 100644 +--- a/src/bootstrap/dist.rs ++++ b/src/bootstrap/dist.rs +@@ -667,41 +667,28 @@ impl Step for Std { + return distdir(builder).join(format!("{}-{}.tar.gz", name, target)); + } + +- // We want to package up as many target libraries as possible +- // for the `rust-std` package, so if this is a host target we +- // depend on librustc and otherwise we just depend on libtest. +- if builder.hosts.iter().any(|t| t == target) { +- builder.ensure(compile::Rustc { compiler, target }); +- } else { +- if builder.no_std(target) == Some(true) { +- // the `test` doesn't compile for no-std targets +- builder.ensure(compile::Std { compiler, target }); +- } else { +- builder.ensure(compile::Test { compiler, target }); +- } +- } ++ builder.ensure(compile::Std { compiler, target }); ++ builder.ensure(compile::Test { compiler, target }); + + let image = tmpdir(builder).join(format!("{}-{}-image", name, target)); + let _ = fs::remove_dir_all(&image); + +- let dst = image.join("lib/rustlib").join(target); ++ let dst = image.join("lib/rustlib").join(target).join("lib"); + t!(fs::create_dir_all(&dst)); +- let mut src = builder.sysroot_libdir(compiler, target).to_path_buf(); +- src.pop(); // Remove the trailing /lib folder from the sysroot_libdir +- builder.cp_filtered(&src, &dst, &|path| { +- if let Some(name) = path.file_name().and_then(|s| s.to_str()) { +- if name == builder.config.rust_codegen_backends_dir.as_str() { +- return false +- } +- if name == "bin" { +- return false +- } +- if name.contains("LLVM") { +- return false +- } ++ ++ let compiler_to_use = builder.compiler_for(compiler.stage, compiler.host, target); ++ let stamp = dbg!(compile::libstd_stamp(builder, compiler_to_use, target)); ++ for (path, host) in builder.read_stamp_file(&stamp) { ++ if !host { ++ builder.copy(&path, &dst.join(path.file_name().unwrap())); + } +- true +- }); ++ } ++ let stamp = dbg!(compile::libtest_stamp(builder, compiler_to_use, target)); ++ for (path, host) in builder.read_stamp_file(&stamp) { ++ if !host { ++ builder.copy(&path, &dst.join(path.file_name().unwrap())); ++ } ++ } + + let mut cmd = rust_installer(builder); + cmd.arg("generate") +-- +2.21.0 + diff --git a/rust.spec b/rust.spec index 4787614..40faed3 100644 --- a/rust.spec +++ b/rust.spec @@ -49,7 +49,7 @@ Name: rust Version: 1.38.0 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Rust Programming Language License: (ASL 2.0 or MIT) and (BSD and MIT) # ^ written as: (rust itself) and (bundled libraries) @@ -70,6 +70,10 @@ Patch1: rust-pr57840-llvm7-debuginfo-variants.patch # Mask a warning-as-error when rebuilding 1.38 with 1.38 Patch2: rustc-1.38.0-rebuild-bootstrap.patch +# Reduce the size of rust-std +# https://github.com/rust-lang/rust/pull/64823 +Patch3: 0001-WIP-minimize-the-rust-std-component.patch + # Get the Rust triple for any arch. %{lua: function rust_triple(arch) local abi = "gnu" @@ -401,6 +405,7 @@ test -f '%{local_rust_root}/bin/rustc' %patch1 -p1 -R %patch2 -p1 +%patch3 -p1 %if "%{python}" == "python3" sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure @@ -542,9 +547,11 @@ find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \ (cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" && find ../../../../%{_lib} -maxdepth 1 -name '*.so' | while read lib; do - # make sure they're actually identical! - cmp "$lib" "${lib##*/}" - ln -v -f -s -t . "$lib" + if [ -f "${lib##*/}" ]; then + # make sure they're actually identical! + cmp "$lib" "${lib##*/}" + ln -v -f -s -t . "$lib" + fi done) # Remove installer artifacts (manifests, uninstall scripts, etc.) @@ -708,6 +715,9 @@ rm -f %{buildroot}%{rustlibdir}/etc/lldb_*.py* %changelog +* Fri Sep 27 2019 Josh Stone - 1.38.0-2 +- Filter the libraries included in rust-std (rhbz1756487) + * Thu Sep 26 2019 Josh Stone - 1.38.0-1 - Update to 1.38.0.