gcc: Fix manpage symlinks when architecture tuples are prefixed to the file name #92704
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation for this change
In some cases, building
gcc
generates the binaries and manpages prefixed with their architecture tuples, such asarmv6l-unknown-linux-gnueabihf-gcc
andarmv6l-unknown-linux-gnueabihf-g++.1
. One of these cases is building cross compilers like in the following:Currently, the
gcc
builder creates ag++.1 -> gcc.1
symlink to save space, sinceg++.1
andgcc.1
have the same contents, but in such cases where the architecture tuple is included in the manpage name, this creates a broken symlink (which, coincidentally, leads to file collisions when attempting to add a cross-compiler and nativegcc
to ahome-manager
profile or similar). In such cases,.../share/man/man1
ends up containing a broken symlink like this:This pull request should fix the way the symlink is created to handle the normal situation without any arch tuples prefixing the file, with arch prefixes, and, since I wasn't sure about any other corner cases, it also handles if there are both a prefixed and non-prefixed manpage or if there aren't any manpages.
Things done
sandbox
innix.conf
on non-NixOS linux)nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
./result/bin/
)nix path-info -S
before and after)