1{ 2 lib, 3 fetchurl, 4 buildDunePackage, 5 ocaml, 6 astring, 7 result, 8 camlp-streams, 9 version ? if lib.versionAtLeast ocaml.version "4.08" then "3.1.0" else "2.4.4", 10}: 11 12let 13 param = 14 { 15 "3.1.0" = { 16 sha256 = "sha256-NVs8//STSQPLrti1HONeMz6GCZMtIwKUIAqfLUL/qRQ="; 17 }; 18 "2.4.4" = { 19 sha256 = "sha256-fiU6VbXI9hD54LSJQOza8hwBVTFDr5O0DJmMMEmeUfM="; 20 }; 21 "2.0.0" = { 22 sha256 = "sha256-QHkZ+7DrlXYdb8bsZ3dijZSqGQc0O9ymeLGIC6+zOSI="; 23 }; 24 "1.0.1" = { 25 sha256 = "sha256-orvo5CAbYOmAurAeluQfK6CwW6P1C0T3WDfoovuQfSw="; 26 }; 27 "1.0.0" = { 28 sha256 = "sha256-tqoI6nGp662bK+vE2h7aDXE882dObVfRBFnZNChueqE="; 29 max_version = "5.0"; 30 }; 31 "0.9.0" = { 32 sha256 = "sha256-3w2tG605v03mvmZsS2O5c71y66O3W+n3JjFxIbXwvXk="; 33 max_version = "5.0"; 34 }; 35 } 36 ."${version}"; 37in 38 39lib.throwIf (param ? max_version && lib.versionAtLeast ocaml.version param.max_version) 40 "odoc-parser ${version} is not available for OCaml ${ocaml.version}" 41 42 buildDunePackage 43 rec { 44 pname = "odoc-parser"; 45 inherit version; 46 47 src = fetchurl { 48 url = 49 if lib.versionAtLeast version "2.4" then 50 "https://github.com/ocaml/odoc/releases/download/${version}/odoc-${version}.tbz" 51 else 52 "https://github.com/ocaml-doc/odoc-parser/releases/download/${version}/odoc-parser-${version}.tbz"; 53 inherit (param) sha256; 54 }; 55 56 propagatedBuildInputs = [ 57 astring 58 ] 59 ++ lib.optional (!lib.versionAtLeast version "3.1.0") result 60 ++ lib.optional (lib.versionAtLeast version "1.0.1") camlp-streams; 61 62 meta = { 63 description = "Parser for Ocaml documentation comments"; 64 license = lib.licenses.isc; 65 maintainers = with lib.maintainers; [ momeemt ]; 66 homepage = "https://github.com/ocaml-doc/odoc-parser"; 67 changelog = "https://github.com/ocaml-doc/odoc-parser/raw/${version}/CHANGES.md"; 68 }; 69 }