forked from mirrors/nixpkgs
b86e62d30d
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?
20 lines
612 B
Nix
20 lines
612 B
Nix
{ runCommand, stdenv, llvm, lld, version }:
|
|
|
|
let
|
|
prefix =
|
|
if stdenv.hostPlatform != stdenv.targetPlatform
|
|
then "${stdenv.targetPlatform.config}-"
|
|
else "";
|
|
in runCommand "llvm-binutils-${version}" { preferLocalBuild = true; } ''
|
|
mkdir -p $out/bin
|
|
for prog in ${lld}/bin/*; do
|
|
ln -s $prog $out/bin/${prefix}$(basename $prog)
|
|
done
|
|
for prog in ${llvm}/bin/*; do
|
|
ln -s $prog $out/bin/${prefix}$(echo $(basename $prog) | sed -e "s|llvm-||")
|
|
ln -sf $prog $out/bin/${prefix}$(basename $prog)
|
|
done
|
|
rm -f $out/bin/${prefix}cat
|
|
ln -s ${lld}/bin/lld $out/bin/${prefix}ld
|
|
''
|