mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-01-21 04:13:12 +00:00
4f0dadbf38
After final improvements to the official formatter implementation, this commit now performs the first treewide reformat of Nix files using it. This is part of the implementation of RFC 166. Only "inactive" files are reformatted, meaning only files that aren't being touched by any PR with activity in the past 2 months. This is to avoid conflicts for PRs that might soon be merged. Later we can do a full treewide reformat to get the rest, which should not cause as many conflicts. A CI check has already been running for some time to ensure that new and already-formatted files are formatted, so the files being reformatted here should also stay formatted. This commit was automatically created and can be verified using nix-builda08b3a4d19
.tar.gz \ --argstr baseRevb32a094368
result/bin/apply-formatting $NIXPKGS_PATH
65 lines
2.4 KiB
Nix
65 lines
2.4 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
pkgs,
|
|
callPackage,
|
|
isl_0_20,
|
|
libcCross,
|
|
threadsCross,
|
|
noSysDirs,
|
|
lowPrio,
|
|
wrapCC,
|
|
}@args:
|
|
|
|
let
|
|
versions = import ./versions.nix;
|
|
gccForMajorMinorVersion =
|
|
majorMinorVersion:
|
|
let
|
|
majorVersion = lib.versions.major majorMinorVersion;
|
|
atLeast = lib.versionAtLeast majorMinorVersion;
|
|
attrName = "gcc${lib.replaceStrings [ "." ] [ "" ] majorMinorVersion}";
|
|
pkg = lowPrio (
|
|
wrapCC (
|
|
callPackage ./default.nix {
|
|
inherit noSysDirs;
|
|
inherit majorMinorVersion;
|
|
reproducibleBuild = true;
|
|
profiledCompiler = false;
|
|
libcCross = if stdenv.targetPlatform != stdenv.buildPlatform then args.libcCross else null;
|
|
threadsCross = if stdenv.targetPlatform != stdenv.buildPlatform then threadsCross else { };
|
|
isl = if stdenv.hostPlatform.isDarwin then null else isl_0_20;
|
|
# do not allow version skew when cross-building gcc
|
|
#
|
|
# When `gcc` is cross-built (`build` != `target` && `host` == `target`)
|
|
# `gcc` assumes that it has a compatible cross-compiler in the environment
|
|
# that can build target libraries. Version of a cross-compiler has to
|
|
# match the compiler being cross-built as libraries frequently use fresh
|
|
# compiler features, like `-std=c++26` or target-specific types like
|
|
# `_Bfloat16`.
|
|
# Version mismatch causes build failures like:
|
|
# https://github.com/NixOS/nixpkgs/issues/351905
|
|
#
|
|
# Similar problems (but on a smaller scale) happen when a `gcc`
|
|
# cross-compiler is built (`build` == `host` && `host` != `target`) built
|
|
# by a mismatching version of a native compiler (`build` == `host` &&
|
|
# `host` == `target`).
|
|
#
|
|
# Let's fix both problems by requiring the same compiler version for
|
|
# cross-case.
|
|
stdenv =
|
|
if
|
|
(stdenv.targetPlatform != stdenv.buildPlatform || stdenv.hostPlatform != stdenv.targetPlatform)
|
|
&& stdenv.cc.isGNU
|
|
then
|
|
pkgs."gcc${majorVersion}Stdenv"
|
|
else
|
|
stdenv;
|
|
}
|
|
)
|
|
);
|
|
in
|
|
lib.nameValuePair attrName pkg;
|
|
in
|
|
lib.listToAttrs (map gccForMajorMinorVersion versions.allMajorVersions)
|