diff options
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | ocamlbuild/findlib.ml | 18 |
2 files changed, 18 insertions, 1 deletions
@@ -125,6 +125,7 @@ Bug Fixes: * PR#5312: command-line arguments @reponsefile auto-expansion feature removed from the Windows OCaml runtime, to avoid conflicts with "-w @..." - PR#5313: ocamlopt -g misses optimizations +- PR#5214: ocamlfind plugin invokes 'cut' utility - PR#5316: objinfo now shows ccopts/ccobjs/force_link when applicable - PR#5318: segfault on stack overflow when reading marshaled data - PR#5322: type abbreviations expanding to a universal type variable diff --git a/ocamlbuild/findlib.ml b/ocamlbuild/findlib.ml index 873adbabf..b5ef87810 100644 --- a/ocamlbuild/findlib.ml +++ b/ocamlbuild/findlib.ml @@ -112,8 +112,24 @@ let rec query name = | Lexers.Error s -> error (Cannot_parse_query (name, s)) +let split_nl s = + let x = ref [] in + let rec go s = + let pos = String.index s '\n' in + x := (String.before s pos)::!x; + go (String.after s (pos + 1)) + in + try + go s + with Not_found -> !x + +let before_space s = + try + String.before s (String.index s ' ') + with Not_found -> s + let list () = - run_and_parse Lexers.blank_sep_strings "%s list | cut -d' ' -f1" ocamlfind + List.map before_space (split_nl & run_and_read "%s list" ocamlfind) (* The closure algorithm is easy because the dependencies are already closed and sorted for each package. We only have to make the union. We could also |