2024-05-15 15:35:15 +00:00
|
|
|
{ lib, fetchurl, buildDunePackage, ocaml, astring, result, camlp-streams, version ? "2.4.2" }:
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2022-01-03 16:56:52 +00:00
|
|
|
let param = {
|
2024-05-15 15:35:15 +00:00
|
|
|
"2.4.2" = {
|
|
|
|
sha256 = "sha256-Vjz9uybsijDnN6nPKFoG4LuulT9I4lu7D2n3qZwrpAs=";
|
|
|
|
};
|
2022-08-12 12:06:08 +00:00
|
|
|
"2.0.0" = {
|
|
|
|
sha256 = "sha256-QHkZ+7DrlXYdb8bsZ3dijZSqGQc0O9ymeLGIC6+zOSI=";
|
|
|
|
};
|
|
|
|
"1.0.1" = {
|
|
|
|
sha256 = "sha256-orvo5CAbYOmAurAeluQfK6CwW6P1C0T3WDfoovuQfSw=";
|
|
|
|
};
|
2022-01-03 16:56:52 +00:00
|
|
|
"1.0.0" = {
|
|
|
|
sha256 = "sha256-tqoI6nGp662bK+vE2h7aDXE882dObVfRBFnZNChueqE=";
|
2023-08-22 20:05:09 +00:00
|
|
|
max_version = "5.0";
|
2022-01-03 16:56:52 +00:00
|
|
|
};
|
|
|
|
"0.9.0" = {
|
|
|
|
sha256 = "sha256-3w2tG605v03mvmZsS2O5c71y66O3W+n3JjFxIbXwvXk=";
|
2023-08-22 20:05:09 +00:00
|
|
|
max_version = "5.0";
|
2022-01-03 16:56:52 +00:00
|
|
|
};
|
|
|
|
}."${version}"; in
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
lib.throwIf (param ? max_version && lib.versionAtLeast ocaml.version param.max_version)
|
|
|
|
"odoc-parser ${version} is not available for OCaml ${ocaml.version}"
|
|
|
|
|
2021-08-05 21:33:18 +00:00
|
|
|
buildDunePackage rec {
|
|
|
|
pname = "odoc-parser";
|
2022-01-03 16:56:52 +00:00
|
|
|
inherit version;
|
2021-08-05 21:33:18 +00:00
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
minimalOCamlVersion = "4.02";
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2024-05-15 15:35:15 +00:00
|
|
|
url = if lib.versionAtLeast version "2.4"
|
|
|
|
then "https://github.com/ocaml/odoc/releases/download/${version}/odoc-${version}.tbz"
|
|
|
|
else "https://github.com/ocaml-doc/odoc-parser/releases/download/${version}/odoc-parser-${version}.tbz";
|
2022-01-03 16:56:52 +00:00
|
|
|
inherit (param) sha256;
|
2021-08-05 21:33:18 +00:00
|
|
|
};
|
|
|
|
|
2024-05-15 15:35:15 +00:00
|
|
|
propagatedBuildInputs = [ astring result ] ++
|
|
|
|
lib.optional (lib.versionAtLeast version "1.0.1") camlp-streams;
|
2021-08-05 21:33:18 +00:00
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "Parser for Ocaml documentation comments";
|
|
|
|
license = lib.licenses.isc;
|
2024-05-15 15:35:15 +00:00
|
|
|
maintainers = [ ];
|
2021-08-05 21:33:18 +00:00
|
|
|
homepage = "https://github.com/ocaml-doc/odoc-parser";
|
|
|
|
changelog = "https://github.com/ocaml-doc/odoc-parser/raw/${version}/CHANGES.md";
|
|
|
|
};
|
|
|
|
}
|