Merge pull request #256423 from Artturin/fixwritecbin

writers.writeCBin: fix binary name when cross-compiling
This commit is contained in:
Jörg Thalheim 2023-09-21 08:36:09 +02:00 committed by GitHub
commit 53204fe466
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -379,21 +379,21 @@ rec {
};
# Create a C binary
writeCBin = name: code:
runCommandCC name
writeCBin = pname: code:
runCommandCC pname
{
inherit name code;
inherit pname code;
executable = true;
passAsFile = ["code"];
# Pointless to do this on a remote machine.
preferLocalBuild = true;
allowSubstitutes = false;
meta = {
mainProgram = name;
mainProgram = pname;
};
}
''
n=$out/bin/$name
n=$out/bin/${pname}
mkdir -p "$(dirname "$n")"
mv "$codePath" code.c
$CC -x c code.c -o "$n"