git.iko.soy/typeable/nixpkgs
on master help sign in
Move CompCert into coqPackages. (#126214)

* compcert: preparation to move in coqPackages * compcert: move into coqPackages * compcert: remove version 3.7 As a consequence, also remove VST version 2.6 These were broken.

commit2bbf6c86876ecf75fe0ed1d8e3dff413bf255024 authorThéo Zimmermann <theo.zimmermann@inria.fr> dateMon 14 Jun 2021, 14:21 (5 years ago) parent19c5fd7
5 files changed+117−135
pkgs/development/compilers/compcert/default.nix−125 pkgs/development/coq-modules/VST/default.nix−2 pkgs/development/coq-modules/compcert/default.nix+109 pkgs/top-level/all-packages.nix+1−1 pkgs/top-level/coq-packages.nix+7−7
pkgs/development/compilers/compcert/default.nixdeleted−125
@@ -1,125 +0,0 @@
1−{ lib, stdenv, fetchFromGitHub, fetchpatch, makeWrapper
2−, coqPackages, ocamlPackages, coq2html
3−, tools ? stdenv.cc
4−, version ? "3.9"
5−}:
6−
7−let
8− ocaml-pkgs = with ocamlPackages; [ ocaml findlib menhir menhirLib ];
9− ccomp-platform = if stdenv.isDarwin then "x86_64-macosx" else "x86_64-linux";
10− inherit (coqPackages) coq flocq;
11− inherit (lib) optional optionalString;
12−in
13−
14−let param = {
15− "3.7" = {
16− sha256 = "1h4zhk9rrqki193nxs9vjvya7nl9yxjcf07hfqb6g77riy1vd2jr";
17− patches = [
18− (fetchpatch {
19− url = "https://github.com/AbsInt/CompCert/commit/0a2db0269809539ccc66f8ec73637c37fbd23580.patch";
20− sha256 = "0n8qrba70x8f422jdvq9ddgsx6avf2dkg892g4ldh3jiiidyhspy";
21− })
22− (fetchpatch {
23− url = "https://github.com/AbsInt/CompCert/commit/5e29f8b5ba9582ecf2a1d0baeaef195873640607.patch";
24− sha256 = "184nfdgxrkci880lkaj5pgnify3plka7xfgqrgv16275sqppc5hc";
25− })
26− ];
27− };
28− "3.8" = {
29− sha256 = "1gzlyxvw64ca12qql3wnq3bidcx9ygsklv9grjma3ib4hvg7vnr7";
30− patches = [
31− # Support for Coq 8.12.2
32− (fetchpatch {
33− url = "https://github.com/AbsInt/CompCert/commit/06956421b4307054af221c118c5f59593c0e67b9.patch";
34− sha256 = "1f90q6j3xfvnf3z830bkd4d8526issvmdlrjlc95bfsqs78i1yrl";
35− })
36− # Support for Coq 8.13.0
37− (fetchpatch {
38− url = "https://github.com/AbsInt/CompCert/commit/0895388e7ebf9c9f3176d225107e21968919fb97.patch";
39− sha256 = "0qhkzgb2xl5kxys81pldp3mr39gd30lvr2l2wmplij319vp3xavd";
40− })
41− # Support for Coq 8.13.1
42− (fetchpatch {
43− url = "https://github.com/AbsInt/CompCert/commit/6bf310dd678285dc193798e89fc2c441d8430892.patch";
44− sha256 = "026ahhvpj5pksy90f8pnxgmhgwfqk4kwyvcf8x3dsanvz98d4pj5";
45− })
46− # Drop support for Coq < 8.9
47− (fetchpatch {
48− url = "https://github.com/AbsInt/CompCert/commit/7563a5df926a4c6fb1489a7a4c847641c8a35095.patch";
49− sha256 = "05vkslzy399r3dm6dmjs722rrajnyfa30xsyy3djl52isvn4gyfb";
50− })
51− # Support for Coq 8.13.2
52− (fetchpatch {
53− url = "https://github.com/AbsInt/CompCert/commit/48bc183167c4ce01a5c9ea86e49d60530adf7290.patch";
54− sha256 = "0j62lppfk26d1brdp3qwll2wi4gvpx1k70qivpvby5f7dpkrkax1";
55− })
56− ];
57− useExternalFlocq = true;
58− };
59− "3.9" = {
60− sha256 = "1srcz2dqrvmbvv5cl66r34zqkm0hsbryk7gd3i9xx4slahc9zvdb";
61− useExternalFlocq = true;
62− };
63−}."${version}"; in
64−
65−stdenv.mkDerivation rec {
66− pname = "compcert";
67− inherit version;
68−
69− src = fetchFromGitHub {
70− owner = "AbsInt";
71− repo = "CompCert";
72− rev = "v${version}";
73− inherit (param) sha256;
74− };
75−
76− patches = param.patches or [];
77−
78− nativeBuildInputs = [ makeWrapper ];
79− buildInputs = ocaml-pkgs ++ [ coq coq2html ];
80− propagatedBuildInputs = optional (param.useExternalFlocq or false) flocq;
81− enableParallelBuilding = true;
82−
83− postPatch = ''
84− substituteInPlace ./configure \
85− --replace \$\{toolprefix\}ar 'ar' \
86− --replace '{toolprefix}gcc' '{toolprefix}cc'
87− '';
88−
89− configurePhase = ''
90− ./configure -clightgen \
91− -prefix $out \
92− -coqdevdir $lib/lib/coq/${coq.coq-version}/user-contrib/compcert/ \
93− -toolprefix ${tools}/bin/ \
94− ${optionalString (param.useExternalFlocq or false) "-use-external-Flocq"} \
95− ${ccomp-platform}
96− '';
97−
98− installTargets = "documentation install";
99− postInstall = ''
100− # move man into place
101− mkdir -p $man/share
102− mv $out/share/man/ $man/share/
103−
104− # move docs into place
105− mkdir -p $doc/share/doc/compcert
106− mv doc/html $doc/share/doc/compcert/
107−
108− # wrap ccomp to undefine _FORTIFY_SOURCE; ccomp invokes cc1 which sets
109− # _FORTIFY_SOURCE=2 by default, but undefines __GNUC__ (as it should),
110− # which causes a warning in libc. this suppresses it.
111− for x in ccomp clightgen; do
112− wrapProgram $out/bin/$x --add-flags "-U_FORTIFY_SOURCE"
113− done
114− '';
115−
116− outputs = [ "out" "lib" "doc" "man" ];
117−
118− meta = with lib; {
119− description = "Formally verified C compiler";
120− homepage = "https://compcert.org";
121− license = licenses.inria-compcert;
122− platforms = [ "x86_64-linux" "x86_64-darwin" ];
123− maintainers = with maintainers; [ thoughtpolice jwiegley vbgl ];
124− };
125−}
pkgs/development/coq-modules/VST/default.nix−2
@@ -9,10 +9,8 @@ with lib; mkCoqDerivation {
99 inherit version;
1010 defaultVersion = with versions; switch coq.coq-version [
1111 { case = range "8.12" "8.13"; out = "2.7.1"; }
12− { case = "8.11"; out = "2.6"; }
1312 ] null;
1413 release."2.7.1".sha256 = "1674j7bkvihiv19vizm99dp6gj3lryb00zx6a87jz214f3ydcvnj";
15− release."2.6".sha256 = "00bf9hl4pvmsqa08lzjs1mrxyfgfxq4k6778pnldmc8ichm90jgk";
1614 releaseRev = v: "v${v}";
1715 propagatedBuildInputs = [ compcert ];
1816
pkgs/development/coq-modules/compcert/default.nixnew file+109
@@ -0,0 +1,109 @@
1+{ lib, fetchzip, mkCoqDerivation, coq, flocq, compcert
2+, ocamlPackages, fetchpatch, makeWrapper, coq2html
3+, stdenv, tools ? stdenv.cc
4+, version ? null
5+}:
6+
7+with lib;
8+
9+let compcert = mkCoqDerivation rec {
10+
11+ pname = "compcert";
12+ owner = "AbsInt";
13+
14+ inherit version;
15+ releaseRev = v: "v${v}";
16+
17+ defaultVersion = with versions; switch coq.version [
18+ { case = range "8.8" "8.13"; out = "3.8"; }
19+ ] null;
20+
21+ release = {
22+ "3.8".sha256 = "1gzlyxvw64ca12qql3wnq3bidcx9ygsklv9grjma3ib4hvg7vnr7";
23+ "3.9".sha256 = "1srcz2dqrvmbvv5cl66r34zqkm0hsbryk7gd3i9xx4slahc9zvdb";
24+ };
25+
26+ nativeBuildInputs = [ makeWrapper ];
27+ buildInputs = with ocamlPackages; [ ocaml findlib menhir menhirLib ] ++ [ coq coq2html ];
28+ propagatedBuildInputs = [ flocq ];
29+
30+ enableParallelBuilding = true;
31+
32+ postPatch = ''
33+ substituteInPlace ./configure \
34+ --replace \$\{toolprefix\}ar 'ar' \
35+ --replace '{toolprefix}gcc' '{toolprefix}cc'
36+ '';
37+
38+ configurePhase = ''
39+ ./configure -clightgen \
40+ -prefix $out \
41+ -coqdevdir $lib/lib/coq/${coq.coq-version}/user-contrib/compcert/ \
42+ -toolprefix ${tools}/bin/ \
43+ -use-external-Flocq \
44+ ${if stdenv.isDarwin then "x86_64-macosx" else "x86_64-linux"}
45+ '';
46+
47+ installTargets = "documentation install";
48+ postInstall = ''
49+ # move man into place
50+ mkdir -p $man/share
51+ mv $out/share/man/ $man/share/
52+
53+ # move docs into place
54+ mkdir -p $doc/share/doc/compcert
55+ mv doc/html $doc/share/doc/compcert/
56+
57+ # wrap ccomp to undefine _FORTIFY_SOURCE; ccomp invokes cc1 which sets
58+ # _FORTIFY_SOURCE=2 by default, but undefines __GNUC__ (as it should),
59+ # which causes a warning in libc. this suppresses it.
60+ for x in ccomp clightgen; do
61+ wrapProgram $out/bin/$x --add-flags "-U_FORTIFY_SOURCE"
62+ done
63+ '';
64+
65+ outputs = [ "out" "lib" "doc" "man" ];
66+
67+ meta = with lib; {
68+ description = "Formally verified C compiler";
69+ homepage = "https://compcert.org";
70+ license = licenses.inria-compcert;
71+ platforms = [ "x86_64-linux" "x86_64-darwin" ];
72+ maintainers = with maintainers; [ thoughtpolice jwiegley vbgl ];
73+ };
74+}; in
75+compcert.overrideAttrs (o:
76+ {
77+ patches = with versions; switch [ coq.version o.version ] [
78+ { cases = [ (range "8.12.2" "8.13.2") "3.8" ];
79+ out = [
80+ # Support for Coq 8.12.2
81+ (fetchpatch {
82+ url = "https://github.com/AbsInt/CompCert/commit/06956421b4307054af221c118c5f59593c0e67b9.patch";
83+ sha256 = "1f90q6j3xfvnf3z830bkd4d8526issvmdlrjlc95bfsqs78i1yrl";
84+ })
85+ # Support for Coq 8.13.0
86+ (fetchpatch {
87+ url = "https://github.com/AbsInt/CompCert/commit/0895388e7ebf9c9f3176d225107e21968919fb97.patch";
88+ sha256 = "0qhkzgb2xl5kxys81pldp3mr39gd30lvr2l2wmplij319vp3xavd";
89+ })
90+ # Support for Coq 8.13.1
91+ (fetchpatch {
92+ url = "https://github.com/AbsInt/CompCert/commit/6bf310dd678285dc193798e89fc2c441d8430892.patch";
93+ sha256 = "026ahhvpj5pksy90f8pnxgmhgwfqk4kwyvcf8x3dsanvz98d4pj5";
94+ })
95+ # Drop support for Coq < 8.9
96+ (fetchpatch {
97+ url = "https://github.com/AbsInt/CompCert/commit/7563a5df926a4c6fb1489a7a4c847641c8a35095.patch";
98+ sha256 = "05vkslzy399r3dm6dmjs722rrajnyfa30xsyy3djl52isvn4gyfb";
99+ })
100+ # Support for Coq 8.13.2
101+ (fetchpatch {
102+ url = "https://github.com/AbsInt/CompCert/commit/48bc183167c4ce01a5c9ea86e49d60530adf7290.patch";
103+ sha256 = "0j62lppfk26d1brdp3qwll2wi4gvpx1k70qivpvby5f7dpkrkax1";
104+ })
105+ ];
106+ }
107+ ] [];
108+ }
109+)
pkgs/top-level/all-packages.nix+1−1
@@ -10553,7 +10553,7 @@ in
1055310553
1055410554 cmucl_binary = pkgsi686Linux.callPackage ../development/compilers/cmucl/binary.nix { };
1055510555
10556− compcert = callPackage ../development/compilers/compcert {};
10556+ compcert = coqPackages.compcert.override { version = "3.9"; };
1055710557
1055810558 computecpp-unwrapped = callPackage ../development/compilers/computecpp {};
1055910559 computecpp = wrapCCWith rec {
pkgs/top-level/coq-packages.nix+7−7
@@ -1,5 +1,5 @@
1−{ lib, callPackage, newScope, recurseIntoAttrs, ocamlPackages_4_05, ocamlPackages_4_09
2−, ocamlPackages_4_10, compcert
1+{ lib, stdenv, callPackage, newScope, recurseIntoAttrs, ocamlPackages_4_05, ocamlPackages_4_09
2+, ocamlPackages_4_10, fetchpatch, makeWrapper, coq2html
33}@args:
44let lib = import ../build-support/coq/extra-lib.nix {inherit (args) lib;}; in
55let
@@ -21,6 +21,10 @@ let
2121 category-theory = callPackage ../development/coq-modules/category-theory { };
2222 Cheerios = callPackage ../development/coq-modules/Cheerios {};
2323 CoLoR = callPackage ../development/coq-modules/CoLoR {};
24+ compcert = callPackage ../development/coq-modules/compcert {
25+ ocamlPackages = ocamlPackages_4_05;
26+ inherit fetchpatch makeWrapper coq2html lib stdenv;
27+ };
2428 coq-bits = callPackage ../development/coq-modules/coq-bits {};
2529 coq-elpi = callPackage ../development/coq-modules/coq-elpi {};
2630 coq-ext-lib = callPackage ../development/coq-modules/coq-ext-lib {};
@@ -78,11 +82,7 @@ let
7882 topology = callPackage ../development/coq-modules/topology {};
7983 Velisarios = callPackage ../development/coq-modules/Velisarios {};
8084 Verdi = callPackage ../development/coq-modules/Verdi {};
81− VST = callPackage ../development/coq-modules/VST (with lib.versions;
82− lib.switch coq.coq-version [
83− { case = "8.11"; out = { compcert = compcert.override { coqPackages = self; version = "3.7"; }; }; }
84− { case = range "8.12" "8.13"; out = { compcert = compcert.override { coqPackages = self; version = "3.8"; }; }; }
85− ] {});
85+ VST = callPackage ../development/coq-modules/VST {};
8686 zorns-lemma = callPackage ../development/coq-modules/zorns-lemma {};
8787 filterPackages = doesFilter: if doesFilter then filterCoqPackages self else self;
8888 };