d/rules.real: Try harder to set the locale to C.UTF-8
The order of precedence for locale variables is:
- LC_ALL
- (for messages only) LANGUAGE
- LC_category
- LANG
Currently we set LC_ALL=C.UTF-8 and undefine LANGUAGE, which by itself should force all locale categories to be "C.UTF-8".
However, the upstrean Makefile sets LC_COLLATE and LC_NUMERIC, and unexports LC_ALL so that it won't override them. This means that for kernel and documentation builds all other locale categories are inherited from the build environment. This can result in a build failure due to a missing locale, as reported in !1038 (closed), and might cause different build output. However reprotest doesn't seem to find any locale-dependent differences.
What we want is:
- Default locale is C.UTF-8
- Upstream can override specific categories as needed
- Build environment never overrides this
To achieve that:
- Set LANG=C.UTF-8 insted of LC_ALL
- Undefine all other locale variables