minimal-bootstrap: trim binutils-static output
Drop unused installed libraries and headers, avoid building unused gprof/libctf components, and replace duplicate target-prefixed tools with symlinks while keeping the conventional paths available. Size impact against upstream/staging: - binutils-static closure: 42.482 MiB -> 21.093 MiB (-21.389 MiB) Assisted-by: codex with gpt-5.5-high
This commit is contained in:
@@ -46,6 +46,8 @@ let
|
||||
"--enable-deterministic-archives"
|
||||
# depends on bison
|
||||
"--disable-gprofng"
|
||||
# unused downstream
|
||||
"--disable-gprof"
|
||||
|
||||
# Turn on --enable-new-dtags by default to make the linker set
|
||||
# RUNPATH instead of RPATH on binaries. This is important because
|
||||
@@ -57,6 +59,8 @@ let
|
||||
# path to force users to declare their use of these libraries.
|
||||
"--with-lib-path=:"
|
||||
"--disable-gold"
|
||||
# unused in the bootstrap path and removed from the output
|
||||
"--disable-libctf"
|
||||
"--disable-plugins"
|
||||
];
|
||||
in
|
||||
@@ -83,6 +87,7 @@ bash.runCommand "${pname}-${version}"
|
||||
result:
|
||||
bash.runCommand "${pname}-get-version-${version}" { } ''
|
||||
${result}/bin/ld --version
|
||||
${result}/${hostPlatform.config}/bin/ld --version
|
||||
mkdir $out
|
||||
'';
|
||||
}
|
||||
@@ -106,5 +111,17 @@ bash.runCommand "${pname}-${version}"
|
||||
|
||||
# gprof/addr2line/elfedit + man pages are unused downstream.
|
||||
rm -f $out/bin/gprof $out/bin/addr2line $out/bin/elfedit
|
||||
rm -rf $out/share/info $out/share/man
|
||||
rm -rf $out/include $out/lib $out/share
|
||||
|
||||
# The target-prefixed tools duplicate the unprefixed tools byte-for-byte.
|
||||
# Keep the conventional target-prefixed paths, but make them symlinks.
|
||||
targetBin=$out/${hostPlatform.config}/bin
|
||||
if [ -d "$targetBin" ]; then
|
||||
for tool in ar as ld ld.bfd nm objcopy objdump ranlib readelf strip; do
|
||||
if [ -e "$targetBin/$tool" ] && cmp -s "$out/bin/$tool" "$targetBin/$tool"; then
|
||||
rm "$targetBin/$tool"
|
||||
ln -s ../../bin/$tool "$targetBin/$tool"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
''
|
||||
|
||||
Reference in New Issue
Block a user