Commit d148e5a6 authored by Nano Twerpus's avatar Nano Twerpus Committed by Kira Bruneau
Browse files

ccache: format with `nixfmt-rfc-style`

parent 2944aeb2
Loading
Loading
Loading
Loading
+102 −75
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, binutils
, asciidoctor
, cmake
, doctest
, fmt
, hiredis
, perl
, zstd
, bashInteractive
, xcodebuild
, xxHash
, makeWrapper
, nix-update-script
{
  lib,
  stdenv,
  fetchFromGitHub,
  substituteAll,
  binutils,
  asciidoctor,
  cmake,
  perl,
  fmt,
  hiredis,
  xxHash,
  zstd,
  bashInteractive,
  doctest,
  xcodebuild,
  makeWrapper,
  nix-update-script,
}:

stdenv.mkDerivation (finalAttrs: {
@@ -28,7 +29,10 @@ stdenv.mkDerivation (finalAttrs: {
    sha256 = "sha256-0T9iJXnDX8LffhB/5hsfBNyZQ211f0lL/7dvTrjmiE0=";
  };

  outputs = [ "out" "man" ];
  outputs = [
    "out"
    "man"
  ];

  patches = [
    # When building for Darwin, test/run uses dwarfdump, whereas on
@@ -44,12 +48,24 @@ stdenv.mkDerivation (finalAttrs: {
  ];

  strictDeps = true;
  nativeBuildInputs = [ asciidoctor cmake perl ];
  buildInputs = [ fmt hiredis xxHash zstd ];

  nativeBuildInputs = [
    asciidoctor
    cmake
    perl
  ];

  buildInputs = [
    fmt
    hiredis
    xxHash
    zstd
  ];

  cmakeFlags = lib.optional (!finalAttrs.finalPackage.doCheck) "-DENABLE_TESTING=OFF";

  doCheck = true;

  nativeCheckInputs = [
    # test/run requires the compgen function which is available in
    # bashInteractive, but not bash.
@@ -62,9 +78,11 @@ stdenv.mkDerivation (finalAttrs: {

  checkPhase =
    let
      badTests = [
      badTests =
        [
          "test.trim_dir" # flaky on hydra (possibly filesystem-specific?)
      ] ++ lib.optionals stdenv.isDarwin [
        ]
        ++ lib.optionals stdenv.isDarwin [
          "test.basedir"
          "test.fileclone" # flaky on hydra (possibly filesystem-specific?)
          "test.multi_arch"
@@ -81,7 +99,9 @@ stdenv.mkDerivation (finalAttrs: {
  passthru = {
    # A derivation that provides gcc and g++ commands, but that
    # will end up calling ccache for the given cacheDir
    links = { unwrappedCC, extraConfig }: stdenv.mkDerivation {
    links =
      { unwrappedCC, extraConfig }:
      stdenv.mkDerivation {
        pname = "ccache-links";
        inherit (finalAttrs) version;
        passthru = {
@@ -93,13 +113,17 @@ stdenv.mkDerivation (finalAttrs: {
        nativeBuildInputs = [ makeWrapper ];
        # Unwrapped clang does not have a targetPrefix because it is multi-target
        # target is decided with argv0.
      buildCommand = let
        targetPrefix = if unwrappedCC.isClang or false
          then
        buildCommand =
          let
            targetPrefix =
              if unwrappedCC.isClang or false then
                ""
              else
            (lib.optionalString (unwrappedCC ? targetConfig && unwrappedCC.targetConfig != null && unwrappedCC.targetConfig != "") "${unwrappedCC.targetConfig}-");
      in ''
                (lib.optionalString (
                  unwrappedCC ? targetConfig && unwrappedCC.targetConfig != null && unwrappedCC.targetConfig != ""
                ) "${unwrappedCC.targetConfig}-");
          in
          ''
            mkdir -p $out/bin

            wrap() {
@@ -141,7 +165,10 @@ stdenv.mkDerivation (finalAttrs: {
    }";
    license = licenses.gpl3Plus;
    mainProgram = "ccache";
    maintainers = with maintainers; [ kira-bruneau r-burns ];
    maintainers = with maintainers; [
      kira-bruneau
      r-burns
    ];
    platforms = platforms.unix;
  };
})