|
| 1 | +{ |
| 2 | + lib, |
| 3 | + buildDunePackage, |
| 4 | + camlp5, |
| 5 | + ocaml, |
| 6 | + menhir, |
| 7 | + menhirLib, |
| 8 | + atdgen, |
| 9 | + atdgen-runtime, |
| 10 | + stdlib-shims, |
| 11 | + re, |
| 12 | + perl, |
| 13 | + ncurses, |
| 14 | + ppx_deriving, |
| 15 | + #ppx_deriving_0_15, |
| 16 | + #ppx_deriving_0_33, |
| 17 | + ppx_optcomp, |
| 18 | + coqPackages, |
| 19 | + version ? |
| 20 | + if lib.versionAtLeast ocaml.version "4.13" then |
| 21 | + "3.4.1" |
| 22 | + else if lib.versionAtLeast ocaml.version "4.08" then |
| 23 | + "1.20.0" |
| 24 | + else |
| 25 | + "1.15.2", |
| 26 | +}: |
| 27 | + |
| 28 | +let |
| 29 | + p5 = camlp5; |
| 30 | +in |
| 31 | +let |
| 32 | + camlp5 = p5.override { legacy = true; }; |
| 33 | +in |
| 34 | + |
| 35 | +let |
| 36 | + fetched = coqPackages.metaFetch { |
| 37 | + release."3.4.1".sha256 = "sha256-3rQPw91dHAqp61KTHk1UOEqh5syWrZZ1V1/1eE8cyI8="; |
| 38 | + release."3.3.0".sha256 = "sha256:963f95eea48b8f853cca9cbe4db49f22343c58e88dc961bc1da303356ef50dcd"; |
| 39 | + release."3.0.1".sha256 = "sha256-r4B0xn6UCVslVW4dHiqq8NBMGfNz44kZy48KDWeGquc="; |
| 40 | + release."2.0.7".sha256 = "sha256-gCM+vZK6vWlhSO1VMjiWHse23mvxVwRarhxwkIQK7e0="; |
| 41 | + release."2.0.6".sha256 = "sha256-tRUYXQZ0VXrjIZBZ1skdzieUsww4rSNEe5ik+iKpk3U="; |
| 42 | + release."2.0.5".sha256 = "sha256-cHgERFqrfSg5WtUX3UxR6L+QkzS7+t6n4V+wweiEacc="; |
| 43 | + release."2.0.3".sha256 = "sha256-t2z0sWPiFgp6LuR6CsH/Zk9qfxW+3QjjFcYrB6qSPgc="; |
| 44 | + release."1.20.0".sha256 = "sha256-lctZAIQgOg5d+LfILtWsBVcsemV3zTZYfJfDlCxHtcA="; |
| 45 | + release."1.19.2".sha256 = "sha256-dBj5Ek7PWq/8Btq/dggJUqa8cUtfvbi6EWo/lJEDOU4="; |
| 46 | + release."1.18.2".sha256 = "sha256-usOYukHQ/h4YBxlhYrAkMTVjNm97hq4IArI9bvDzy/k="; |
| 47 | + release."1.18.1".sha256 = "sha256-rrIv/mVC0Ez3nU7fpnzwduIC3tI6l73DjgAbv1gd2v0="; |
| 48 | + release."1.17.0".sha256 = "sha256-J8FJBeaB+2HtHjrkgNzOZJngZ2AcYU+npL9Y1HNPnzo="; |
| 49 | + release."1.15.2".sha256 = "sha256-+sQYQiN3n+dlzXzi5opOjhkJZqpkNwlHZcUjaUM6+xQ="; |
| 50 | + release."1.15.0".sha256 = "sha256-vpQzbkDqJPCmaBmXcBnzlWGS7djW9wWv8xslkIlXgP0="; |
| 51 | + release."1.13.7".sha256 = "sha256-0QbOEnrRCYA2mXDGRKe+QYCXSESLJvLzRW0Iq+/3P9Y="; |
| 52 | + release."1.12.0".sha256 = "sha256-w4JzLZB8jcxw7nA7AfgU9jTZTr6IYUxPU5E2vNIFC4Q="; |
| 53 | + release."1.11.4".sha256 = "sha256-dyzEpzokgffsF9lt+FZgUlcZEuAb70vGuHfGUtjZYIM="; |
| 54 | + releaseRev = v: "v${v}"; |
| 55 | + releaseArtifact = v: if lib.versionAtLeast v "1.13.8" then "elpi-${v}.tbz" else "elpi-v${v}.tbz"; |
| 56 | + location = { |
| 57 | + domain = "github.com"; |
| 58 | + owner = "LPCIC"; |
| 59 | + repo = "elpi"; |
| 60 | + }; |
| 61 | + } version; |
| 62 | +in |
| 63 | +let |
| 64 | + inherit (fetched) version; |
| 65 | +in |
| 66 | +buildDunePackage { |
| 67 | + pname = "elpi"; |
| 68 | + src = builtins.fetchTarball { |
| 69 | + url = "https://github.com/LPCIC/elpi/archive/refs/heads/fix-bug-chr.zip"; |
| 70 | + }; |
| 71 | + version = "3.4.1"; |
| 72 | + |
| 73 | + patches = lib.optional (version == "1.16.5") ./atd_2_10.patch; |
| 74 | + |
| 75 | + minimalOCamlVersion = "4.07"; |
| 76 | + |
| 77 | + nativeBuildInputs = [ |
| 78 | + perl |
| 79 | + ] |
| 80 | + ++ [ (if lib.versionAtLeast version "1.15" || version == "dev" then menhir else camlp5) ] |
| 81 | + ++ lib.optional (lib.versionAtLeast version "1.16" || version == "dev") atdgen; |
| 82 | + buildInputs = [ |
| 83 | + ncurses |
| 84 | + ] |
| 85 | + ++ lib.optional (lib.versionAtLeast version "3.3.0" || version == "dev") ppx_optcomp |
| 86 | + ++ lib.optional (lib.versionAtLeast version "1.16" || version == "dev") atdgen-runtime; |
| 87 | + |
| 88 | + propagatedBuildInputs = [ |
| 89 | + re |
| 90 | + stdlib-shims |
| 91 | + ] |
| 92 | + ++ (if lib.versionAtLeast version "1.15" || version == "dev" then [ menhirLib ] else [ camlp5 ]) |
| 93 | + ++ ( |
| 94 | + if lib.versionAtLeast version "3.3.0" || version == "dev" then |
| 95 | + [ |
| 96 | + ppx_deriving |
| 97 | + ] |
| 98 | + else if lib.versionAtLeast version "1.13" then |
| 99 | + [ |
| 100 | + #ppx_deriving_0_33 |
| 101 | + ] |
| 102 | + else |
| 103 | + [ |
| 104 | + #ppx_deriving_0_15 |
| 105 | + ] |
| 106 | + ); |
| 107 | + |
| 108 | + meta = with lib; { |
| 109 | + description = "Embeddable λProlog Interpreter"; |
| 110 | + license = licenses.lgpl21Plus; |
| 111 | + maintainers = [ maintainers.vbgl ]; |
| 112 | + homepage = "https://github.com/LPCIC/elpi"; |
| 113 | + }; |
| 114 | + |
| 115 | + postPatch = '' |
| 116 | + substituteInPlace elpi_REPL.ml --replace-warn "tput cols" "${ncurses}/bin/tput cols" |
| 117 | + '' |
| 118 | + + lib.optionalString (lib.versionAtLeast version "1.16" || version == "dev") '' |
| 119 | + substituteInPlace src/dune --replace-warn ' atdgen re' ' atdgen-runtime re' |
| 120 | + ''; |
| 121 | +} |
0 commit comments