summary refs log tree commit diff
path: root/pkgs/development/tools/ocaml/ocamlscript/Makefile.patch
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/tools/ocaml/ocamlscript/Makefile.patch')
-rw-r--r--pkgs/development/tools/ocaml/ocamlscript/Makefile.patch70
1 files changed, 70 insertions, 0 deletions
diff --git a/pkgs/development/tools/ocaml/ocamlscript/Makefile.patch b/pkgs/development/tools/ocaml/ocamlscript/Makefile.patch
new file mode 100644
index 00000000000..4fc887c070d
--- /dev/null
+++ b/pkgs/development/tools/ocaml/ocamlscript/Makefile.patch
@@ -0,0 +1,70 @@
+--- a/Makefile	2012-02-04 01:24:21.000000000 +0000
++++ b/Makefile	2014-10-29 14:42:08.690188302 +0000
+@@ -4,6 +4,8 @@
+   version.ml pipeline.mli pipeline.ml common.mli common.ml \
+   utils.mli utils.ml ocaml.mli ocaml.ml
+ 
++CAMLP4 := $(shell ocamlfind query camlp4)
++
+ 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
+ 	ocamlc -pp 'camlp4orf -loc _loc' -c \
+-		-I +camlp4 pa_opt310.ml && \
++		-I $(CAMLP4) pa_opt310.ml && \
+ 		cp pa_opt310.cmo pa_opt.cmo && \
+ 		cp pa_opt310.cmi pa_opt.cmi
+ 	ocamlc -pp 'camlp4orf -loc _loc' -c \
+-		-I +camlp4 pa_tryfinally310.ml && \
++		-I $(CAMLP4) pa_tryfinally310.ml && \
+ 		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;
+