Skip to content

Commit 4633a7c

Browse files
authored
ocamlPackages.menhir: support --suggest-menhirLib (#358146)
2 parents 1044b2c + 32a6049 commit 4633a7c

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

pkgs/development/ocaml-modules/menhir/default.nix

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ buildDunePackage
1+
{ buildDunePackage, substituteAll, ocaml
22
, menhirLib, menhirSdk
33
}:
44

@@ -11,6 +11,13 @@ buildDunePackage rec {
1111

1212
buildInputs = [ menhirLib menhirSdk ];
1313

14+
patches = [
15+
(substituteAll {
16+
src = ./menhir-suggest-menhirLib.patch;
17+
libdir = "${menhirLib}/lib/ocaml/${ocaml.version}/site-lib/menhirLib";
18+
})
19+
];
20+
1421
meta = menhirSdk.meta // {
1522
description = "LR(1) parser generator for OCaml";
1623
mainProgram = "menhir";
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
diff --git a/src/installation.ml b/src/installation.ml
2+
index 3c64e395..be7d6e7b 100644
3+
--- a/src/installation.ml
4+
+++ b/src/installation.ml
5+
@@ -39,13 +39,4 @@ let rec normalize fn =
6+
and hope that it is of the form [.../bin/menhir]. We change this to
7+
[.../lib/menhirLib], and hope that this is where MenhirLib is installed. *)
8+
9+
-let libdir () =
10+
- let root =
11+
- Sys.executable_name
12+
- |> normalize
13+
- |> Filename.dirname (* remove [menhir] *)
14+
- |> Filename.dirname (* remove [bin] *)
15+
- in
16+
- Filename.concat
17+
- root
18+
- (Filename.concat "lib" "menhirLib")
19+
+let libdir () = ignore normalize; "@libdir@"

0 commit comments

Comments
 (0)