-
-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efbce7b
commit b6ef265
Showing
4 changed files
with
94 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
lib, | ||
stdenv, | ||
zig, | ||
runCommand, | ||
makeWrapper, | ||
}: | ||
let | ||
targetPrefix = lib.optionalString ( | ||
stdenv.hostPlatform != stdenv.targetPlatform | ||
) "${stdenv.targetPlatform.config}-"; | ||
in | ||
runCommand "zig-bintools-${zig.version}" | ||
{ | ||
pname = "zig-bintools"; | ||
inherit (zig) version meta; | ||
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
passthru = { | ||
isZig = true; | ||
inherit targetPrefix; | ||
}; | ||
|
||
inherit zig; | ||
} | ||
'' | ||
mkdir -p $out/bin | ||
for tool in ar objcopy ranlib ld.lld; do | ||
makeWrapper "$zig/bin/zig" "$out/bin/${targetPrefix}$tool" \ | ||
--add-flags "$tool" \ | ||
--run "export ZIG_GLOBAL_CACHE_DIR=\''${TMPDIR-/tmp}/zig-cache" | ||
done | ||
mv $out/bin/${targetPrefix}ld.lld $out/bin/${targetPrefix}ld | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,76 +1,37 @@ | ||
{ | ||
lib, | ||
wrapCCWith, | ||
wrapBintoolsWith, | ||
makeWrapper, | ||
stdenv, | ||
runCommand, | ||
stdenv, | ||
targetPackages, | ||
zig, | ||
stdenv, | ||
makeWrapper, | ||
}: | ||
wrapCCWith { | ||
cc = | ||
runCommand "zig-cc-${zig.version}" | ||
{ | ||
pname = "zig-cc"; | ||
inherit (zig) version meta; | ||
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
passthru.isZig = true; | ||
inherit zig; | ||
} | ||
'' | ||
mkdir -p $out/bin | ||
for tool in cc c++; do | ||
makeWrapper "$zig/bin/zig" "$out/bin/$tool" \ | ||
--add-flags "$tool" \ | ||
--run "export ZIG_GLOBAL_CACHE_DIR=\$(mktemp -d)" | ||
done | ||
mv $out/bin/c++ $out/bin/clang++ | ||
mv $out/bin/cc $out/bin/clang | ||
''; | ||
|
||
bintools = | ||
let | ||
targetPrefix = lib.optionalString ( | ||
stdenv.hostPlatform != stdenv.targetPlatform | ||
) "${stdenv.targetPlatform.config}-"; | ||
in | ||
wrapBintoolsWith { | ||
bintools = | ||
runCommand "zig-bintools-${zig.version}" | ||
{ | ||
pname = "zig-bintools"; | ||
inherit (zig) version meta; | ||
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
passthru = { | ||
isZig = true; | ||
inherit targetPrefix; | ||
}; | ||
|
||
inherit zig; | ||
} | ||
'' | ||
mkdir -p $out/bin | ||
for tool in ar objcopy; do | ||
makeWrapper "$zig/bin/zig" "$out/bin/${targetPrefix}-$tool" \ | ||
--add-flags "$tool" \ | ||
--run "export ZIG_GLOBAL_CACHE_DIR=\$(mktemp -d)" | ||
done | ||
''; | ||
let | ||
targetPrefix = lib.optionalString ( | ||
stdenv.hostPlatform != stdenv.targetPlatform | ||
) "${stdenv.targetPlatform.config}-"; | ||
in | ||
runCommand "zig-cc-${zig.version}" | ||
{ | ||
pname = "zig-cc"; | ||
inherit (zig) version meta; | ||
|
||
nativeBuildInputs = [ makeWrapper ]; | ||
|
||
passthru = { | ||
isZig = true; | ||
inherit targetPrefix; | ||
}; | ||
|
||
nixSupport.cc-cflags = | ||
[ | ||
"-target" | ||
"${stdenv.targetPlatform.parsed.cpu.name}-${stdenv.targetPlatform.parsed.kernel.name}-${stdenv.targetPlatform.parsed.abi.name}" | ||
] | ||
++ lib.optional ( | ||
stdenv.targetPlatform.isLinux && !(targetPackages.isStatic or false) | ||
) "-Wl,-dynamic-linker=${targetPackages.stdenv.cc.bintools.dynamicLinker}"; | ||
} | ||
inherit zig; | ||
} | ||
'' | ||
mkdir -p $out/bin | ||
for tool in cc c++; do | ||
makeWrapper "$zig/bin/zig" "$out/bin/$tool" \ | ||
--add-flags "$tool" \ | ||
--run "export ZIG_GLOBAL_CACHE_DIR=\''${TMPDIR-/tmp}/zig-cache" | ||
done | ||
mv $out/bin/c++ $out/bin/clang++ | ||
mv $out/bin/cc $out/bin/clang | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.