cc-wrapper: wrap cpp for cross lust like to native

Without this change $target-cpp is used unwrapped and is missing
standard header search paths among other things).

Example failure:

    $ nix build -f. -L pkgsStatic.netbsd.compat
    ...
       > checking how to run the C preprocessor... x86_64-unknown-linux-musl-cpp
       > configure: error: in `/build/cvs-export/tools/compat':
       > configure: error: C preprocessor "x86_64-unknown-linux-musl-cpp" fails sanity check
       > See `config.log' for more details
This commit is contained in:
Sergei Trofimovich 2023-03-17 15:03:44 +00:00
parent 2394986204
commit 4bdbae5ad1

View File

@ -228,6 +228,10 @@ stdenv.mkDerivation {
if [ -e $ccPath/cpp ]; then
wrap ${targetPrefix}cpp $wrapper $ccPath/cpp
'' + lib.optionalString (hostPlatform != targetPlatform) ''
elif [ -e $ccPath/${targetPrefix}cpp ]; then
wrap ${targetPrefix}cpp $wrapper $ccPath/${targetPrefix}cpp
'' + ''
fi
''