bintools-wrapper: Also define RC<suffix>

Additionally, if there is a `windres` but no `rc`, `RC<suffix>` is
defined to point to `WINDRES<suffix>`.

My justification is essentially what I wrote in
https://github.com/mesonbuild/meson/pull/15438. Microsoft recommends
`RC`, CMake only supports `RC`, and Meson now supports both. In
addition, CMake and Meson are fine with "reversed" usage like
`RC=windres` and `WINDRES=rc`, so this simple defaulting logic should be
fine.
This commit is contained in:
John Ericson
2026-01-03 13:12:24 -05:00
parent 5d361f1d1d
commit f47cd80b29
@@ -55,7 +55,7 @@ fi
export NIX_BINTOOLS${role_post}=@out@
for cmd in \
ar as ld nm objcopy objdump readelf ranlib strip strings size windres
ar as ld nm objcopy objdump readelf ranlib strip strings size windres rc
do
if
PATH=$_PATH type -p "@targetPrefix@${cmd}" > /dev/null
@@ -64,6 +64,16 @@ do
fi
done
# If there is no `<prefix>rc`, but there is a `<prefix>windres`, define
# `RC<suffix>=${WINDRES<suffix>}`.
if
[[ ! -v "RC${role_post}" ]] && [[ -v "WINDRES${role_post}" ]]
then
windres_var="WINDRES${role_post}"
export "RC${role_post}=${!windres_var}"
unset -v windres_var
fi
# If unset, assume the default hardening flags.
: ${NIX_HARDENING_ENABLE="@default_hardening_flags_str@"}
export NIX_HARDENING_ENABLE