-
Notifications
You must be signed in to change notification settings - Fork 399
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to set the library path at configure time (#575)
This allow to drop the dependency on ocamlfind
- Loading branch information
1 parent
2acbc72
commit dfdb6c0
Showing
13 changed files
with
107 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ bootstrap.cmi | |
bootstrap.cmo | ||
bootstrap.exe | ||
Makefile.dev | ||
src/setup.ml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/sh | ||
exec ocaml configure.ml "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/usr/bin/env ocaml | ||
|
||
open StdLabels | ||
open Printf | ||
|
||
let list f l = sprintf "[%s]" (String.concat ~sep:"; " (List.map l ~f)) | ||
let string s = sprintf "%S" s | ||
let option f = function | ||
| None -> "None" | ||
| Some x -> sprintf "Some %s" (f x) | ||
|
||
let () = | ||
let bad fmt = ksprintf (fun s -> raise (Arg.Bad s)) fmt in | ||
let library_path = ref None in | ||
let library_destdir = ref None in | ||
let set_libdir s = | ||
let dir = | ||
if Filename.is_relative s then | ||
Filename.concat (Sys.getcwd ()) s | ||
else | ||
s | ||
in | ||
library_path := Some [dir]; | ||
library_destdir := Some dir | ||
in | ||
let args = | ||
[ "--libdir", Arg.String set_libdir, | ||
"DIR where installed libraries are for the default build context" | ||
] | ||
in | ||
let anon s = | ||
bad "Don't know what to do with %s" s | ||
in | ||
Arg.parse (Arg.align args) | ||
anon "Usage: ocaml configure.ml [OPTRIONS]]\nOptions are:"; | ||
let oc = open_out "src/setup.ml" in | ||
let pr fmt = fprintf oc (fmt ^^ "\n") in | ||
pr "let library_path = %s" (option (list string) !library_path); | ||
pr "let library_destdir = %s" (option string !library_destdir); | ||
close_out oc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let library_path = Some [] | ||
let library_destdir = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
let library_path = None | ||
let library_destdir = None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(** Setup of Jbuilder *) | ||
|
||
(** These parameters are set by [ocaml configure.ml] or copied from | ||
[setup.defaults.ml]. During bootstrap, values from [setup.boot.ml] | ||
are used *) | ||
|
||
(** Where to find installed libraries for the default context. If | ||
[None], auto-detect it using standard tools such as [ocamlfind]. *) | ||
val library_path : string list option | ||
|
||
(** Where to install libraries for the default context. *) | ||
val library_destdir : string option |