gcc: fix manpage symlinks when arch tuple is in the file name

In some cases, such as when building cross compilers, the binaries and
manpages contain the target architecture tuple, such as
`i686-w64-mingw32-g++.1`.

Ensure the symlink created to save space with the duplicated manpage
(`g++.1 -> gcc.1`) properly handles such cases and generates symlinks
such as `i686-w64-mingw32-g++.1 -> i686-w64-mingw32-gcc.1`.
Previously in such cases, a broken `gcc.1` link would be created
instead.
This commit is contained in:
Alexandria Corkwell 2020-07-08 06:35:13 -04:00
parent c54edfed06
commit eed46887ca
No known key found for this signature in database
GPG Key ID: 18EAD8C06EBF0479

View File

@ -277,7 +277,12 @@ postInstall() {
done
# Two identical man pages are shipped (moving and compressing is done later)
ln -sf gcc.1 "$out"/share/man/man1/g++.1
for i in "$out"/share/man/man1/*g++.1; do
if test -e "$i"; then
man_prefix=`echo "$i" | sed "s,.*/\(.*\)g++.1,\1,"`
ln -sf "$man_prefix"gcc.1 "$i"
fi
done
}
genericBuild