Unverified Commit 484882f6 authored by Kira Bruneau's avatar Kira Bruneau Committed by GitHub
Browse files

Merge pull request #315714 from Nanotwerp/ccache-up

ccache: 4.9.1 -> 4.10
parents a0ccbb58 d148e5a6
Loading
Loading
Loading
Loading
+109 −77
Original line number Diff line number Diff line
{ lib
, stdenv
, fetchFromGitHub
, substituteAll
, binutils
, asciidoctor
, cmake
, perl
, zstd
, bashInteractive
, xcodebuild
, 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: {
  pname = "ccache";
  version = "4.9.1";
  version = "4.10";

  src = fetchFromGitHub {
    owner = "ccache";
    repo = "ccache";
    rev = "refs/tags/v${finalAttrs.version}";
    sha256 = "sha256-n0MTq8x6KNkgwhJQG7F+e3iCOS644nLkMsiRztJe8QU=";
    sha256 = "sha256-0T9iJXnDX8LffhB/5hsfBNyZQ211f0lL/7dvTrjmiE0=";
  };

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

  patches = [
    # When building for Darwin, test/run uses dwarfdump, whereas on
@@ -39,27 +47,42 @@ stdenv.mkDerivation (finalAttrs: {
    })
  ];

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

  nativeBuildInputs = [
    asciidoctor
    cmake
    perl
  ];

  cmakeFlags = [
    # Build system does not autodetect redis library presence.
    # Requires explicit flag.
    "-DREDIS_STORAGE_BACKEND=OFF"
  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.
    bashInteractive
  ] ++ lib.optional stdenv.isDarwin xcodebuild;

  checkInputs = [
    doctest
  ];

  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"
@@ -76,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 = {
@@ -88,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() {
@@ -136,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;
  };
})