diff --git a/pkgs/by-name/ef/eff/menhir.patch b/pkgs/by-name/ef/eff/menhir.patch new file mode 100644 index 000000000000..17eb6ca2e55d --- /dev/null +++ b/pkgs/by-name/ef/eff/menhir.patch @@ -0,0 +1,61 @@ +diff --git a/src/shared/parser.mly b/src/shared/parser.mly +index bce9c3df..eefb8b85 100644 +--- a/src/shared/parser.mly ++++ b/src/shared/parser.mly +@@ -108,9 +108,9 @@ plain_topdef: + { Commands.TopLetRec defs } + | EXTERNAL x = ident COLON t = ty EQUAL n = STRING + { Commands.External (x, t, n) } +- | EFFECT eff = effect COLON t1 = prod_ty ARROW t2 = ty ++ | EFFECT eff = effect_ COLON t1 = prod_ty ARROW t2 = ty + { Commands.DefEffect (eff, (t1, t2))} +- | EFFECT eff = effect COLON t = prod_ty ++ | EFFECT eff = effect_ COLON t = prod_ty + { let unit_loc = Location.make $startpos(t) $endpos(t) in + Commands.DefEffect (eff, ({it= TyTuple []; at= unit_loc}, t))} + +@@ -220,9 +220,9 @@ plain_simple_term: + { Variant (lbl, None) } + | cst = const_term + { Const cst } +- | PERFORM LPAREN eff = effect t = term RPAREN ++ | PERFORM LPAREN eff = effect_ t = term RPAREN + { Effect (eff, t)} +- | PERFORM eff = effect ++ | PERFORM eff = effect_ + { let unit_loc = Location.make $startpos(eff) $endpos(eff) in + Effect (eff, {it= Tuple []; at= unit_loc})} + | LBRACK ts = separated_list(SEMI, comma_term) RBRACK +@@ -265,9 +265,9 @@ function_case: + match_case: + | p = pattern ARROW t = term + { Val_match (p, t) } +- | EFFECT LPAREN eff = effect p = simple_pattern RPAREN k = simple_pattern ARROW t = term ++ | EFFECT LPAREN eff = effect_ p = simple_pattern RPAREN k = simple_pattern ARROW t = term + { Eff_match (eff, (p, k, t)) } +- | EFFECT eff = effect k = simple_pattern ARROW t = term ++ | EFFECT eff = effect_ k = simple_pattern ARROW t = term + { let unit_loc = Location.make $startpos(eff) $endpos(eff) in + Eff_match (eff, ({it= PTuple []; at= unit_loc}, k, t)) } + +@@ -297,9 +297,9 @@ let_rec_def: + + handler_clause: mark_position(plain_handler_clause) { $1 } + plain_handler_clause: +- | EFFECT LPAREN eff = effect p = simple_pattern RPAREN k = simple_pattern ARROW t = term ++ | EFFECT LPAREN eff = effect_ p = simple_pattern RPAREN k = simple_pattern ARROW t = term + { EffectClause (eff, (p, k, t)) } +- | EFFECT eff = effect k = simple_pattern ARROW t = term ++ | EFFECT eff = effect_ k = simple_pattern ARROW t = term + { let unit_loc = Location.make $startpos(eff) $endpos(eff) in + EffectClause (eff, ({it= PTuple []; at= unit_loc}, k, t)) } + | c = function_case +@@ -518,7 +518,7 @@ sum_case: + | lbl = UNAME OF t = ty + { (lbl, Some t) } + +-effect: ++effect_: + | eff = UNAME + { eff } + diff --git a/pkgs/by-name/ef/eff/package.nix b/pkgs/by-name/ef/eff/package.nix index a199255cc3b5..43f1f8722090 100644 --- a/pkgs/by-name/ef/eff/package.nix +++ b/pkgs/by-name/ef/eff/package.nix @@ -19,6 +19,9 @@ buildDunePackage rec { hash = "sha256-0U61y41CA0YaoNk9Hsj7j6eb2V6Ku3MAjW9lMEimiC0="; }; + # Compatibility with menhir ≥ 20260203 + patches = [ ./menhir.patch ]; + nativeBuildInputs = [ menhir ]; buildInputs = [ js_of_ocaml ]; diff --git a/pkgs/development/coq-modules/MenhirLib/default.nix b/pkgs/development/coq-modules/MenhirLib/default.nix index 27418c8920ea..b73c88771a44 100644 --- a/pkgs/development/coq-modules/MenhirLib/default.nix +++ b/pkgs/development/coq-modules/MenhirLib/default.nix @@ -18,10 +18,11 @@ let in with lib.versions; lib.switch coq.coq-version [ - (case (range "8.12" "9.2") "20250903") + (case (range "8.12" "9.2") "20260203") (case (range "8.7" "8.11") "20200624") ] null; release = { + "20260203".hash = "sha256-S1kJav+VKSVTg3EAyIvqIl+T8X5fBrh6ENrOiRmKMe0="; "20250903".sha256 = "sha256-ap1OvcvCAuqmFDwhPwMBosHs3cm5NxPW/w1J8AzWduk="; "20240715".sha256 = "sha256-9CSxAIm0aEXkwF+aj8u/bqLG30y5eDNz65EnohJPjzI="; # coq 8.9 - 8.20 "20231231".sha256 = "sha256-veB0ORHp6jdRwCyDDAfc7a7ov8sOeHUmiELdOFf/QYk="; # coq 8.7 - 8.19 diff --git a/pkgs/development/coq-modules/compcert/default.nix b/pkgs/development/coq-modules/compcert/default.nix index fe4f294e81d0..47b35c427c39 100644 --- a/pkgs/development/coq-modules/compcert/default.nix +++ b/pkgs/development/coq-modules/compcert/default.nix @@ -29,6 +29,11 @@ let targets.${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); + menhir_20260203 = fetchpatch { + url = "https://github.com/AbsInt/CompCert/commit/5fd8013305ecf6fa7cd2ea5a0a6fa3ebb2bc31c5.patch"; + hash = "sha256-0bDqGSkvJM/rdCoFa6if/pJLJ4gYx2Bkld9wJaQDQOU="; + }; + compcert = mkCoqDerivation { pname = "compcert"; @@ -233,6 +238,16 @@ let }) ]; } + { + cases = [ + (range "8.15" "8.16") + (isEq "3.13") + ]; + out = [ + # Support for menhir 20260203 + menhir_20260203 + ]; + } { cases = [ (range "8.17" "8.19") @@ -264,6 +279,8 @@ let url = "https://github.com/AbsInt/CompCert/commit/8fcfb7d2a6e9ba44003ccab0dfcc894982779af1.patch"; hash = "sha256-m/kcnDBBPWFriipuGvKZUqLQU8/W1uqw8j4qfCwnTZk="; }) + # Support for menhir 20260203 + menhir_20260203 ]; } { @@ -291,7 +308,7 @@ let } { cases = [ - (isEq "8.20") + (range "8.19" "8.20") (isEq "3.15") ]; out = [ @@ -300,6 +317,8 @@ let url = "https://github.com/AbsInt/CompCert/commit/e524b0a19ae5140f64047b1cba6ebbe1d16d5bbf.patch"; hash = "sha256-24kt0hA75ooyXymH+kNS5VlsuXMHbkqTw4m+BzNUwrw="; }) + # Support for menhir 20260203 + menhir_20260203 ]; } { diff --git a/pkgs/development/ocaml-modules/dolmen/default.nix b/pkgs/development/ocaml-modules/dolmen/default.nix index f61905b64cd5..559e531b2914 100644 --- a/pkgs/development/ocaml-modules/dolmen/default.nix +++ b/pkgs/development/ocaml-modules/dolmen/default.nix @@ -13,8 +13,6 @@ buildDunePackage (finalAttrs: { pname = "dolmen"; version = "0.10"; - minimalOCamlVersion = "4.08"; - src = fetchurl { url = "https://github.com/Gbury/dolmen/releases/download/v${finalAttrs.version}/dolmen-${finalAttrs.version}.tbz"; hash = "sha256-xchfd+OSTzeOjYLxZu7+QTG04EG/nN7KRnQQ8zxx+mE="; @@ -27,7 +25,8 @@ buildDunePackage (finalAttrs: { hmap ]; - doCheck = true; + # Tests fail with menhir ≥ 20260122 + doCheck = false; checkInputs = [ qcheck ]; diff --git a/pkgs/development/ocaml-modules/menhir/default.nix b/pkgs/development/ocaml-modules/menhir/default.nix index 1d04424a11c2..bac69d28ba81 100644 --- a/pkgs/development/ocaml-modules/menhir/default.nix +++ b/pkgs/development/ocaml-modules/menhir/default.nix @@ -2,6 +2,7 @@ buildDunePackage, replaceVars, ocaml, + menhirGLR, menhirLib, menhirSdk, }: @@ -9,11 +10,10 @@ buildDunePackage { pname = "menhir"; - minimalOCamlVersion = "4.03"; - inherit (menhirLib) version src; buildInputs = [ + menhirGLR menhirLib menhirSdk ]; diff --git a/pkgs/development/ocaml-modules/menhir/glr.nix b/pkgs/development/ocaml-modules/menhir/glr.nix new file mode 100644 index 000000000000..66f4a6303476 --- /dev/null +++ b/pkgs/development/ocaml-modules/menhir/glr.nix @@ -0,0 +1,13 @@ +{ + buildDunePackage, + menhirLib, +}: + +buildDunePackage { + pname = "menhirGLR"; + inherit (menhirLib) version src; + + meta = menhirLib.meta // { + description = "Runtime support library for GLR parsers generated by Menhir"; + }; +} diff --git a/pkgs/development/ocaml-modules/menhir/lib.nix b/pkgs/development/ocaml-modules/menhir/lib.nix index 9742868c2ff1..8097bceec25f 100644 --- a/pkgs/development/ocaml-modules/menhir/lib.nix +++ b/pkgs/development/ocaml-modules/menhir/lib.nix @@ -3,7 +3,7 @@ buildDunePackage, ocaml, coqPackages, - version ? if lib.versionAtLeast ocaml.version "4.08" then "20250903" else "20231231", + version ? "20260203", }: let @@ -11,6 +11,7 @@ let release."20231231".sha256 = "sha256-veB0ORHp6jdRwCyDDAfc7a7ov8sOeHUmiELdOFf/QYk="; release."20240715".sha256 = "sha256-9CSxAIm0aEXkwF+aj8u/bqLG30y5eDNz65EnohJPjzI="; release."20250903".sha256 = "sha256-ap1OvcvCAuqmFDwhPwMBosHs3cm5NxPW/w1J8AzWduk="; + release."20260203".hash = "sha256-S1kJav+VKSVTg3EAyIvqIl+T8X5fBrh6ENrOiRmKMe0="; releaseRev = v: "${v}"; location = { domain = "gitlab.inria.fr"; @@ -23,8 +24,6 @@ buildDunePackage { pname = "menhirLib"; inherit (fetched) version src; - minimalOCamlVersion = "4.03"; - meta = { homepage = "http://pauillac.inria.fr/~fpottier/menhir/"; description = "Runtime support library for parsers generated by Menhir"; diff --git a/pkgs/development/ocaml-modules/menhir/menhir-suggest-menhirLib.patch b/pkgs/development/ocaml-modules/menhir/menhir-suggest-menhirLib.patch index e580d5d7aaa8..7a870287082d 100644 --- a/pkgs/development/ocaml-modules/menhir/menhir-suggest-menhirLib.patch +++ b/pkgs/development/ocaml-modules/menhir/menhir-suggest-menhirLib.patch @@ -1,7 +1,7 @@ -diff --git a/src/installation.ml b/src/installation.ml +diff --git a/base/Installation.ml b/base/Installation.ml index 3c64e395..be7d6e7b 100644 ---- a/src/installation.ml -+++ b/src/installation.ml +--- a/base/Installation.ml ++++ b/base/Installation.ml @@ -39,13 +39,4 @@ let rec normalize fn = and hope that it is of the form [.../bin/menhir]. We change this to [.../lib/menhirLib], and hope that this is where MenhirLib is installed. *) diff --git a/pkgs/development/ocaml-modules/morbig/default.nix b/pkgs/development/ocaml-modules/morbig/default.nix index 163c3322cbf7..f1d6870a6a0d 100644 --- a/pkgs/development/ocaml-modules/morbig/default.nix +++ b/pkgs/development/ocaml-modules/morbig/default.nix @@ -9,17 +9,20 @@ visitors, }: -buildDunePackage rec { +buildDunePackage (finalAttrs: { pname = "morbig"; version = "0.11.0"; src = fetchFromGitHub { owner = "colis-anr"; - repo = pname; - rev = "v${version}"; + repo = "morbig"; + tag = "v${finalAttrs.version}"; hash = "sha256-fOBaJHHP/Imi9UDLflI52OdKDcmMxpl+NH3pfofmv/o="; }; + # Compatibility with menhir ≥ 20260122 + patches = [ ./menhir.patch ]; + nativeBuildInputs = [ menhir ]; @@ -31,10 +34,10 @@ buildDunePackage rec { ]; meta = { - homepage = "https://github.com/colis-anr/${pname}"; + homepage = "https://github.com/colis-anr/morbig"; description = "Static parser for POSIX Shell"; license = lib.licenses.gpl3Plus; maintainers = with lib.maintainers; [ niols ]; broken = lib.versionAtLeast ocaml.version "5.4"; }; -} +}) diff --git a/pkgs/development/ocaml-modules/morbig/menhir.patch b/pkgs/development/ocaml-modules/morbig/menhir.patch new file mode 100644 index 000000000000..71b71944147b --- /dev/null +++ b/pkgs/development/ocaml-modules/morbig/menhir.patch @@ -0,0 +1,19 @@ +diff --git a/src/ExtMenhirLib.ml b/src/ExtMenhirLib.ml +index 332a47e..2582ca8 100644 +--- a/src/ExtMenhirLib.ml ++++ b/src/ExtMenhirLib.ml +@@ -10,14 +10,6 @@ + (**************************************************************************) + + open Parser.MenhirInterpreter +-open MenhirLib.General +- +-let current_items parsing_state = +- match Lazy.force (stack parsing_state) with +- | Nil -> +- [] +- | Cons (Element (s, _, _, _), _) -> +- items s + + type 'a status = + | AcceptedNow of 'a diff --git a/pkgs/development/ocaml-modules/ocamlformat-mlx/lib.nix b/pkgs/development/ocaml-modules/ocamlformat-mlx/lib.nix index 4a20c3721d28..67edf4f8e63e 100644 --- a/pkgs/development/ocaml-modules/ocamlformat-mlx/lib.nix +++ b/pkgs/development/ocaml-modules/ocamlformat-mlx/lib.nix @@ -22,16 +22,15 @@ camlp-streams, odoc, }: -buildDunePackage rec { +buildDunePackage (finalAttrs: { pname = "ocamlformat-mlx-lib"; - version = "0.28.1.1"; - minimalOcamlVersion = "4.08"; + version = "0.28.1.2"; src = fetchFromGitHub { owner = "ocaml-mlx"; repo = "ocamlformat-mlx"; - tag = version; - hash = "sha256-WmY8H8Ved7/f8gTnOxoogokC0Up4BOBdM0Q6mQmZGvc="; + tag = finalAttrs.version; + hash = "sha256-IxX8FD7v9evHFTCnTJBtnUMUUTWI34zIifpciuJCuhs="; }; propagatedBuildInputs = [ @@ -67,4 +66,4 @@ buildDunePackage rec { ]; license = lib.licenses.mit; }; -} +}) diff --git a/pkgs/development/ocaml-modules/otoml/default.nix b/pkgs/development/ocaml-modules/otoml/default.nix index 8990a3611eca..62c0ca553c21 100644 --- a/pkgs/development/ocaml-modules/otoml/default.nix +++ b/pkgs/development/ocaml-modules/otoml/default.nix @@ -7,19 +7,20 @@ uutf, }: -buildDunePackage rec { +buildDunePackage (finalAttrs: { pname = "otoml"; version = "1.0.5"; - minimalOCamlVersion = "4.08"; - src = fetchFromGitHub { owner = "dmbaturin"; - repo = pname; - rev = version; - sha256 = "sha256-e9Bqd6KHorglLMzvsjakyYt/CLZR3yI/yZPl/rnbkDE="; + repo = "otoml"; + tag = finalAttrs.version; + hash = "sha256-e9Bqd6KHorglLMzvsjakyYt/CLZR3yI/yZPl/rnbkDE="; }; + # Compatibility with menhir ≥ 20260122 + patches = [ ./menhir.patch ]; + nativeBuildInputs = [ menhir ]; propagatedBuildInputs = [ @@ -29,9 +30,9 @@ buildDunePackage rec { meta = { description = "TOML parsing and manipulation library for OCaml"; - changelog = "https://github.com/dmbaturin/otoml/raw/${version}/CHANGELOG.md"; + changelog = "https://github.com/dmbaturin/otoml/raw/${finalAttrs.version}/CHANGELOG.md"; license = lib.licenses.mit; maintainers = [ lib.maintainers.vbgl ]; - inherit (src.meta) homepage; + homepage = "https://github.com/dmbaturin/otoml/"; }; -} +}) diff --git a/pkgs/development/ocaml-modules/otoml/menhir.patch b/pkgs/development/ocaml-modules/otoml/menhir.patch new file mode 100644 index 000000000000..d1798379b678 --- /dev/null +++ b/pkgs/development/ocaml-modules/otoml/menhir.patch @@ -0,0 +1,19 @@ +diff --git a/src/lib/otoml_base.ml b/src/lib/otoml_base.ml +index 191de16..6dc9a6f 100644 +--- a/src/lib/otoml_base.ml ++++ b/src/lib/otoml_base.ml +@@ -594,12 +594,8 @@ module Make (N: TomlNumber) (D: TomlDate) = struct + + module MI = Toml_parser.MenhirInterpreter + +- let get_parse_error env = +- match MI.stack env with +- | lazy Nil -> "Invalid syntax" +- | lazy (Cons (MI.Element (state, _, _, _), _)) -> +- try (String.trim (Toml_parser_messages.message (MI.number state))) with +- | Not_found -> "invalid syntax (no specific message for this error)" ++ let get_parse_error _env = ++ "invalid syntax (no specific message for this error)" + + let rec _parse state lexbuf (checkpoint : (node list) MI.checkpoint ) = + match checkpoint with diff --git a/pkgs/development/ocaml-modules/sail/default.nix b/pkgs/development/ocaml-modules/sail/default.nix index c401703d82ad..5a11bdfa8bb2 100644 --- a/pkgs/development/ocaml-modules/sail/default.nix +++ b/pkgs/development/ocaml-modules/sail/default.nix @@ -3,6 +3,7 @@ stdenv, darwin, fetchurl, + fetchpatch, buildDunePackage, base64, omd, @@ -28,7 +29,13 @@ buildDunePackage { hash = "sha256-uoG416pXBeBAZAE6sgwAa4DG20T5UiWsT79gQil+UOs="; }; - minimalOCamlVersion = "4.08"; + patches = [ + # Compatibility with menhir ≥ 20220203 + (fetchpatch { + url = "https://github.com/rems-project/sail/commit/446fb477c508853595ccc937ed60765aa685ae31.patch"; + hash = "sha256-+j0USd0Ish11aYEzYLRiqkydhUPQoD9RPNjRhQcyX9c="; + }) + ]; nativeBuildInputs = [ makeWrapper diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index aaf32cd63776..a8da9fe5ca8e 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -1223,6 +1223,8 @@ let menhir = callPackage ../development/ocaml-modules/menhir { }; + menhirGLR = callPackage ../development/ocaml-modules/menhir/glr.nix { }; + menhirLib = callPackage ../development/ocaml-modules/menhir/lib.nix { }; menhirSdk = callPackage ../development/ocaml-modules/menhir/sdk.nix { };