Skip to content

Commit

Permalink
Fixes ocamlscript
Browse files Browse the repository at this point in the history
  • Loading branch information
vbgl committed Nov 8, 2014
1 parent cf4a976 commit aa2fd47
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 1 deletion.
45 changes: 45 additions & 0 deletions pkgs/development/tools/ocaml/ocamlscript/Makefile.patch
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,15 @@
STDBIN = $(shell dirname `which ocamlfind`)
ifndef PREFIX
PREFIX = $(shell dirname $(STDBIN))
@@ -15,7 +17,7 @@
endif
export BINDIR

-PACKS = unix str
+PACKS = unix str findlib
PP = camlp4o -I . -parser pa_tryfinally.cmo -parser pa_opt.cmo
export PP

@@ -36,11 +38,11 @@

common: version.ml
Expand All @@ -23,3 +32,39 @@
cp pa_tryfinally310.cmo pa_tryfinally.cmo && \
cp pa_tryfinally310.cmi pa_tryfinally.cmi

--- a/main.ml 2014-11-08 09:05:12.516401313 +0000
+++ b/main.ml 2014-11-08 09:09:59.801311230 +0000
@@ -250,9 +250,15 @@
Sys.getcwd ())
| `File script_name -> "", get_dir script_name in

+ let findlibdir =
+ Filename.(
+ concat (Findlib.package_directory "findlib") parent_dir_name
+ ) in
+
let file, oc = Filename.open_temp_file "meta" ".ml" in
fprintf oc "\
#%i %S;;
+#directory \"%s\";;
#use \"topfind\";;
#require \"ocamlscript\";;
Ocamlscript.Common.verbose := %s;;
@@ -261,7 +267,7 @@
open Ocamlscript;;
open Utils;;
#%i %S;;\n"
- pos source verbose script_dir extra_args trash pos source;
+ pos source findlibdir verbose script_dir extra_args trash pos source;

List.iter (output_line oc) lines;

@@ -544,6 +550,7 @@
exit compilation_status

let _ =
+ Findlib.init ();
try main ()
with Failure s ->
eprintf "ocamlscript: %s\n%!" s;

2 changes: 1 addition & 1 deletion pkgs/development/tools/ocaml/ocamlscript/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ stdenv.mkDerivation {
sha256 = "1v1i24gijxwris8w4hi95r9swld6dm7jbry0zp72767a3g5ivlrd";
};

buildInputs = [ ocaml findlib camlp4 ];
propagatedBuildInputs = [ ocaml findlib camlp4 ];

patches = [ ./Makefile.patch ];

Expand Down

0 comments on commit aa2fd47

Please sign in to comment.