12 (with stdenv; buildPlatform == hostPlatform && hostPlatform == targetPlatform)
15 && !stdenv.hostPlatform.isDarwin;
21 lib.optionalAttrs enableChecksum {
22 outputs = previousAttrs.outputs ++ lib.optionals enableChecksum [ "checksum" ];
23 # This is a separate phase because gcc assembles its phase scripts
24 # in bash instead of nix (we should fix that).
25 preFixupPhases = (previousAttrs.preFixupPhases or [ ]) ++ [ "postInstallSaveChecksumPhase" ];
27 # gcc uses an auxiliary utility `genchecksum` to md5-hash (most of) its
28 # `.o` and `.a` files prior to linking (in case the linker is
29 # nondeterministic). Since we want to compare across gccs built from two
30 # separate derivations, we wrap `genchecksum` with a `nuke-references`
31 # call. We also stash copies of the inputs to `genchecksum` in
32 # `$checksum/inputs/` -- this is extremely helpful for debugging since
33 # it's hard to get Nix to not delete the $NIX_BUILD_TOP of a successful
36 postInstallSaveChecksumPhase = ''
37 mv gcc/build/genchecksum gcc/build/.genchecksum-wrapped
38 cat > gcc/build/genchecksum <<\EOF
40 ${nukeReferences}/bin/nuke-refs $@
41 for INPUT in "$@"; do install -Dt $INPUT $checksum/inputs/; done
42 exec build/.genchecksum-wrapped $@
44 chmod +x gcc/build/genchecksum
46 make -C gcc cc1-checksum.o cc1plus-checksum.o
47 install -Dt $checksum/checksums/ gcc/cc*-checksum.o