llvm: support cross compilation with useLLVM flag

You can build (partially) with LLVM toolchain using the useLLVM flag.
This works like so:

  nix-build -A hello --arg crossSystem '{ system =
    "aarch64-unknown-linux-musl"; useLLVM = true }'

also don’t separate debug info in lldClang

It doesn’t work currently with that setup hook. Missing build-id?
This commit is contained in:
Matthew Bauer
2019-02-14 01:17:10 -05:00
parent 77d7d60d8c
commit b86e62d30d
9 changed files with 710 additions and 14 deletions

View File

@@ -26,14 +26,20 @@ let
# We need to remove whitespace, unfortunately
# Windows programs use \r but Unix programs use \n
echo Running native-built program natively
# find expected value natively
${getExecutable hostPkgs pkgFun exec} ${args'} \
| dos2unix > $out/expected
echo Running cross-built program in emulator
# run emulator to get actual value
${emulator} ${getExecutable crossPkgs pkgFun exec} ${args'} \
| dos2unix > $out/actual
echo Comparing results...
if [ "$(cat $out/actual)" != "$(cat $out/expected)" ]; then
echo "${pkgName} did not output expected value:"
cat $out/expected