about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/ocaml/ocamlscript/Makefile.patch
blob: e26993f760ae68082131d43c6fe9b6fb3137af55 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
diff --git a/Makefile b/Makefile
index 894e94d..9adc44b 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ ifndef BINDIR
 endif
 export BINDIR
 
-PACKS = unix str
+PACKS = unix str findlib
 # PP = camlp4o -I . -parser pa_opt.cmo
 # export PP
 
diff --git a/main.ml b/main.ml
index 288526a..b67c5e9 100644
--- a/main.ml
+++ b/main.ml
@@ -247,6 +247,11 @@ let write_header ~pos ~source ~source_option ~verbose ~prog_file lines =
 		    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;;
@@ -255,6 +260,7 @@ let () =
   try Topdirs.dir_directory (Sys.getenv \"OCAML_TOPLEVEL_PATH\")
   with Not_found -> ()
 ;;
+#directory \"%s\";;
 #use \"topfind\";;
 #require \"ocamlscript\";;
 Ocamlscript.Common.verbose := %s;;
@@ -263,7 +269,7 @@ Ocamlscript.Common.script_dir := %S;;
 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;
 
@@ -550,6 +556,7 @@ let main () =
       exit compilation_status
 
 let _ =
+  Findlib.init ();
   try main ()
   with Failure s ->
     eprintf "ocamlscript: %s\n%!" s;
diff --git a/ocaml.ml b/ocaml.ml
index a1824c6..b8f287e 100644
--- a/ocaml.ml
+++ b/ocaml.ml
@@ -14,7 +14,7 @@ let ocamlfind = ref "ocamlfind"
 let packs = ref []         (* findlib packages *)
 let sources = ref []       (* extra sources *)
 let use_ocamllex = ref false (* preprocess with ocamllex before camlp4 *)
-let use_camlp4 = ref true  (* by default camlp4 is used *)
+let use_camlp4 = ref false  (* by default camlp4 is not used *)
 let use_ocamlc = ref false (* by default we want native code *)
 let use_ocamlfind = ref false (* used only if necessary *)
 let revised = ref false    (* use this to use the revised syntax *)