diff --git a/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix index 23de39257f0a..4ba20f13192e 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/binutils/default.nix @@ -113,4 +113,8 @@ bash.runCommand "${pname}-${version}" # Install make -j $NIX_BUILD_CORES install + + # 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 '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/binutils/static.nix b/pkgs/os-specific/linux/minimal-bootstrap/binutils/static.nix index fe772c8809ea..fd0681ca4d41 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/binutils/static.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/binutils/static.nix @@ -101,4 +101,8 @@ bash.runCommand "${pname}-${version}" # Install # strip to remove build dependency store path references make -j $NIX_BUILD_CORES install-strip + + # 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 '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix index 39651cabbac2..1eb87b40cdae 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/musl.nix @@ -80,4 +80,7 @@ bash.runCommand "${pname}-${version}" # Install make -j $NIX_BUILD_CORES install MAKEINFO="true" SUBDIRS=. + + # Remove documentation not needed in the bootstrap chain. + rm -rf $out/share/info $out/share/man '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/coreutils/static.nix b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/static.nix index c7ef7770b188..22eca3a3c873 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/coreutils/static.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/coreutils/static.nix @@ -78,4 +78,7 @@ bash.runCommand "${pname}-${version}" # Install make -j $NIX_BUILD_CORES install-strip + + # Remove documentation not needed in the bootstrap chain. + rm -rf $out/share/info $out/share/man '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix b/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix index e099469357cd..890098aa66b9 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gcc/glibc.nix @@ -155,4 +155,7 @@ bash.runCommand "${pname}-${version}" # Install make -j $NIX_BUILD_CORES install-strip + + # libstdc++ gdb pretty-printers + man pages are unused downstream. + rm -rf $out/share/gcc-*/python $out/share/man $out/share/info '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix b/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix index 3a4fac6fd138..e55acf5caecd 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/gcc/latest.nix @@ -155,4 +155,7 @@ bash.runCommand "${pname}-${version}" # Install make -j $NIX_BUILD_CORES install-strip + + # libstdc++ gdb pretty-printers + man pages are unused downstream. + rm -rf $out/share/gcc-*/python $out/share/man $out/share/info '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/glibc/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/glibc/default.nix index 15680da46757..29b84a488d0d 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/glibc/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/glibc/default.nix @@ -112,4 +112,7 @@ bash.runCommand "${pname}-${version}" make -j $NIX_BUILD_CORES INSTALL_UNCOMPRESSED=yes install ln -s $(ls -d ${linux-headers}/include/* | grep -v scsi\$) $out/include/ find $out/{bin,sbin,lib,libexec} -type f -exec strip --strip-unneeded {} + || true + + # localedef + iconv() are never invoked downstream of this glibc + rm -rf $out/share/i18n $out/lib/gconv $out/share/locale '' diff --git a/pkgs/os-specific/linux/minimal-bootstrap/python/default.nix b/pkgs/os-specific/linux/minimal-bootstrap/python/default.nix index 15d39dfae116..b09475af37e9 100644 --- a/pkgs/os-specific/linux/minimal-bootstrap/python/default.nix +++ b/pkgs/os-specific/linux/minimal-bootstrap/python/default.nix @@ -98,4 +98,21 @@ bash.runCommand "${pname}-${version}" # Install make -j $NIX_BUILD_CORES install + + # Remove lib-dynload extension modules not needed for glibc's build scripts. + # glibc uses Python only for scripts that import: os, re, subprocess, argparse, + # pathlib, collections, tempfile. Following the import chain: + # subprocess -> selectors -> math, select, fcntl, _posixsubprocess + # pathlib -> grp + # tempfile -> random -> _random, bisect -> _bisect + # Everything else in lib-dynload is dead weight in the bootstrap context. + find $out/lib/python*/lib-dynload -name '*.so' \ + ! -name '_bisect*' \ + ! -name '_posixsubprocess*' \ + ! -name '_random*' \ + ! -name 'fcntl*' \ + ! -name 'grp*' \ + ! -name 'math*' \ + ! -name 'select*' \ + -delete ''