git.iko.soy/typeable/nixpkgs
on master help sign in
ccache: 3.7.12 -> 4.0

Additional changes: - Added myself as a maintainer - Generalized ccacheStdenv to allow overriding stdenv

commit82ca111efba63590c65e23019db1c1a6bb7f4bbd authorKira Bruneau <kira.bruneau@gmail.com> dateFri 20 Nov 2020, 15:58 (6 years ago) parent5931f86
3 files changed+103−15
pkgs/development/tools/misc/ccache/default.nix+51−9 pkgs/development/tools/misc/ccache/force-objdump-on-darwin.patch+31 pkgs/top-level/all-packages.nix+21−6
pkgs/development/tools/misc/ccache/default.nix+51−9
@@ -1,23 +1,64 @@
1−{ stdenv, fetchFromGitHub, asciidoc-full, gperf, perl, autoreconfHook, zlib, makeWrapper }:
1+{ lib
2+, stdenv
3+, fetchFromGitHub
4+, fetchpatch
5+, substituteAll
6+, binutils
7+, asciidoc
8+, cmake
9+, perl
10+, zstd
11+, xcodebuild
12+, makeWrapper
13+}:
214
315let ccache = stdenv.mkDerivation rec {
416 pname = "ccache";
5− version = "3.7.12";
17+ version = "4.0";
618
719 src = fetchFromGitHub {
8− owner = "ccache";
9− repo = "ccache";
20+ owner = pname;
21+ repo = pname;
1022 rev = "v${version}";
11− sha256 = "1xnv4g4n1jk1i98sa53k8w6q7hbwbw62svs30lssppysbrv8x3gz";
23+ sha256 = "1frcplrv61m2iwc6jwycpbcz1101xl6s4sh8p87prdj98l60lyrx";
1224 };
1325
14− nativeBuildInputs = [ asciidoc-full autoreconfHook gperf perl ];
26+ # TODO: Remove patches from upstream in next release
27+ patches = [
28+ # Fix badly named man page filename
29+ (fetchpatch {
30+ url = "https://github.com/ccache/ccache/commit/223e706fb24ce86eb0ad86079a97e6f345b9ef40.patch";
31+ sha256 = "1h7amp3ka45a79zwlxh8qnzx6n371gnfpfgijcqljps7skhl5gjg";
32+ })
33+ # Build and install man page by default
34+ (fetchpatch {
35+ url = "https://github.com/ccache/ccache/commit/294ff2face26448afa68e3ef7b68bf4898d6dc77.patch";
36+ sha256 = "0rx69qn41bgksc4m3p59nk5d6rz72rwnfska9mh5j62pzfm8axja";
37+ })
38+ # Fixes use of undeclared identifier 'CLONE_NOOWNERCOPY' on darwin
39+ (fetchpatch {
40+ url = "https://github.com/ccache/ccache/commit/411c010c3a5ee690cd42b23ffcf026ae009e2897.patch";
41+ sha256 = "062s424d0d0psp6wjhmfnfn1s5dsrz403hdid5drm6l2san0jhq0";
42+ })
43+ ] ++ lib.optional stdenv.isDarwin (substituteAll {
44+ src = ./force-objdump-on-darwin.patch;
45+ objdump = "${binutils.bintools}/bin/objdump";
46+ });
1547
16− buildInputs = [ zlib ];
48+ nativeBuildInputs = [ asciidoc cmake perl ];
49+
50+ buildInputs = [ zstd ];
1751
1852 outputs = [ "out" "man" ];
1953
20− doCheck = !stdenv.isDarwin;
54+ doCheck = true;
55+ checkInputs = lib.optional stdenv.isDarwin xcodebuild;
56+ checkPhase = ''
57+ export HOME=$(mktemp -d)
58+ ctest --output-on-failure ${lib.optionalString stdenv.isDarwin ''
59+ -E '^(test.nocpp2|test.modules)$'
60+ ''}
61+ '';
2162
2263 passthru = {
2364 # A derivation that provides gcc and g++ commands, but that
@@ -63,9 +104,10 @@ let ccache = stdenv.mkDerivation rec {
63104
64105 meta = with stdenv.lib; {
65106 description = "Compiler cache for fast recompilation of C/C++ code";
66− homepage = "https://ccache.dev/";
107+ homepage = "https://ccache.dev";
67108 downloadPage = "https://ccache.dev/download.html";
68109 license = licenses.gpl3Plus;
110+ maintainers = with maintainers; [ metadark r-burns ];
69111 platforms = platforms.unix;
70112 };
71113};
pkgs/development/tools/misc/ccache/force-objdump-on-darwin.patchnew file+31
@@ -0,0 +1,31 @@
1+diff --git a/test/run b/test/run
2+index 9623e49d..3df1c5a8 100755
3+--- a/test/run
4++++ b/test/run
5+@@ -126,23 +126,17 @@ file_size() {
6+ objdump_cmd() {
7+ local file="$1"
8+
9+- if $HOST_OS_APPLE; then
10+- xcrun dwarfdump -r 0 "$file"
11+- elif $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
12++ if $HOST_OS_WINDOWS || $HOST_OS_CYGWIN; then
13+ # For some reason objdump only shows the basename of the file, so fall
14+ # back to brute force and ignorance.
15+ strings "$1"
16+ else
17+- objdump -W "$file"
18++ @objdump@ -W "$file"
19+ fi
20+ }
21+
22+ objdump_grep_cmd() {
23+- if $HOST_OS_APPLE; then
24+- fgrep -q "\"$1\""
25+- else
26+- fgrep -q ": $1"
27+- fi
28++ fgrep -q ": $1"
29+ }
30+
31+ expect_stat() {
pkgs/top-level/all-packages.nix+21−6
@@ -10972,7 +10972,9 @@ in
1097210972
1097310973 cc-tool = callPackage ../development/tools/misc/cc-tool { };
1097410974
10975− ccache = callPackage ../development/tools/misc/ccache { };
10975+ ccache = callPackage ../development/tools/misc/ccache {
10976+ asciidoc = asciidoc-full;
10977+ };
1097610978
1097710979 # Wrapper that works as gcc or g++
1097810980 # It can be used by setting in nixpkgs config like this, for example:
@@ -10994,12 +10996,25 @@ in
1099410996 # };
1099510997 # You can use a different directory, but whichever directory you choose
1099610998 # should be owned by user root, group nixbld with permissions 0770.
10997− ccacheWrapper = makeOverridable ({ extraConfig ? "", cc ? stdenv.cc }:
10998− cc.override { cc = ccache.links {
10999+ ccacheWrapper = makeOverridable ({ extraConfig, cc }:
11000+ cc.override {
11001+ cc = ccache.links {
11002+ inherit extraConfig;
11003+ unwrappedCC = cc.cc;
11004+ };
11005+ }) {
11006+ extraConfig = "";
11007+ inherit (stdenv) cc;
11008+ };
11009+
11010+ ccacheStdenv = lowPrio (makeOverridable ({ extraConfig, stdenv }:
11011+ overrideCC stdenv (buildPackages.ccacheWrapper.override {
1099911012 inherit extraConfig;
11000− unwrappedCC = cc.cc;
11001− }; }) {};
11002− ccacheStdenv = lowPrio (overrideCC stdenv buildPackages.ccacheWrapper);
11013+ inherit (stdenv) cc;
11014+ })) {
11015+ extraConfig = "";
11016+ inherit stdenv;
11017+ });
1100311018
1100411019 cccc = callPackage ../development/tools/analysis/cccc { };
1100511020