Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Get rid of ocamlgraph.

Ignore-this: 70c0fe9075d2664a5e5d0faee46c0d45

darcs-hash:20120416143943-a43a9-9605222e4c62c2a2a8b858df9e81eb953c02d191
  • Loading branch information...
commit ca067433a7556f6dac784239bcaa9f5bd7c3bcce 1 parent 13d352d
@gildor478 gildor478 authored
View
5 INSTALL.txt
@@ -1,5 +1,5 @@
(* OASIS_START *)
-(* DO NOT EDIT (digest: 82900bd1a971b9e058ec64a8a92bfb8e) *)
+(* DO NOT EDIT (digest: 0ba4956f247cb4642db5ea3d4d15507b) *)
This is the INSTALL file for the oasis distribution.
This package uses OASIS to generate its build system. See section OASIS for
@@ -13,7 +13,6 @@ In order to compile this package, you will need:
doc api-oasis, doc manual
* findlib
* odn (>= 0.0.3) for library oasis
-* ocamlgraph for library oasis
* make for all, test main, test main_loader, test main_userconf,
doc api-oasis, doc manual
* ocamlmod for library base, library oasis
@@ -22,8 +21,6 @@ In order to compile this package, you will need:
executable test_userconf
* fileutils (>= 0.4.2) for executable test, executable test_loader
* expect (>= 0.0.2) for executable test
-* test-userconf for test main_userconf
-* test-loader for test main_loader
Installing
==========
View
9 _oasis
@@ -80,7 +80,8 @@ Library oasis
OASISString,
OASISExec,
OASISFileUtil,
- OASISHostPath
+ OASISHostPath,
+ OASISGraph
InternalModules: OASISVersion_types,
OASISVersion_lexer,
OASISVersion_parser,
@@ -108,7 +109,7 @@ Library oasis
OASISSchema_intern,
OASISPath_intern
CompiledObject: Best
- BuildDepends: unix, odn (>= 0.0.3), ocamlgraph
+ BuildDepends: unix, odn (>= 0.0.3)
BuildTools+: ocamlmod, ocamlyacc, ocamllex, ocamlify
XMETADescription: _oasis file functions
Install$: flag(libraries)
@@ -283,7 +284,7 @@ Executable "test_loader"
Test main_loader
Type: custom (0.3)
Command: $test_loader --pluginloader $pluginloader
- TestTools: test-loader, pluginloader
+ TestTools: test_loader, pluginloader
# Third party: user-conf
@@ -300,4 +301,4 @@ Executable "test_userconf"
Test main_userconf
Type: custom (0.3)
Command: $test_userconf
- TestTools: test-userconf
+ TestTools: test_userconf
View
94 _tags
@@ -20,7 +20,7 @@
################################################################################
# OASIS_START
-# DO NOT EDIT (digest: 8f0ebcf2d4a44f28f4358f85632be174)
+# DO NOT EDIT (digest: 78e5191899b623743d6daa1a319e4768)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# useless stuff for the build process
@@ -38,119 +38,94 @@
"src/oasis/oasis.cmxs": use_oasis
<src/oasis/*.ml{,i}>: pkg_unix
<src/oasis/*.ml{,i}>: pkg_odn
-<src/oasis/*.ml{,i}>: pkg_ocamlgraph
# Library base
"src/base/base.cmxs": use_base
<src/base/*.ml{,i}>: use_oasis
<src/base/*.ml{,i}>: pkg_unix
<src/base/*.ml{,i}>: pkg_odn
-<src/base/*.ml{,i}>: pkg_ocamlgraph
-# Library pluginloaderLib
-"src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.cmxs": use_pluginloaderLib
# Library builtin-plugins
"src/builtin-plugins.cmxs": use_builtin-plugins
<src/*.ml{,i}>: use_base
<src/*.ml{,i}>: use_oasis
<src/*.ml{,i}>: pkg_unix
<src/*.ml{,i}>: pkg_odn
-<src/*.ml{,i}>: pkg_ocamlgraph
<src/plugins/custom/*.ml{,i}>: use_base
<src/plugins/custom/*.ml{,i}>: use_oasis
<src/plugins/custom/*.ml{,i}>: pkg_unix
<src/plugins/custom/*.ml{,i}>: pkg_odn
-<src/plugins/custom/*.ml{,i}>: pkg_ocamlgraph
<src/plugins/extra/META/*.ml{,i}>: use_base
<src/plugins/extra/META/*.ml{,i}>: use_oasis
<src/plugins/extra/META/*.ml{,i}>: pkg_unix
<src/plugins/extra/META/*.ml{,i}>: pkg_odn
-<src/plugins/extra/META/*.ml{,i}>: pkg_ocamlgraph
<src/plugins/extra/devfiles/*.ml{,i}>: use_base
<src/plugins/extra/devfiles/*.ml{,i}>: use_oasis
<src/plugins/extra/devfiles/*.ml{,i}>: pkg_unix
<src/plugins/extra/devfiles/*.ml{,i}>: pkg_odn
-<src/plugins/extra/devfiles/*.ml{,i}>: pkg_ocamlgraph
<src/plugins/extra/stdfiles/*.ml{,i}>: use_base
<src/plugins/extra/stdfiles/*.ml{,i}>: use_oasis
<src/plugins/extra/stdfiles/*.ml{,i}>: pkg_unix
<src/plugins/extra/stdfiles/*.ml{,i}>: pkg_odn
-<src/plugins/extra/stdfiles/*.ml{,i}>: pkg_ocamlgraph
<src/plugins/internal/*.ml{,i}>: use_base
<src/plugins/internal/*.ml{,i}>: use_oasis
<src/plugins/internal/*.ml{,i}>: pkg_unix
<src/plugins/internal/*.ml{,i}>: pkg_odn
-<src/plugins/internal/*.ml{,i}>: pkg_ocamlgraph
<src/plugins/none/*.ml{,i}>: use_base
<src/plugins/none/*.ml{,i}>: use_oasis
<src/plugins/none/*.ml{,i}>: pkg_unix
<src/plugins/none/*.ml{,i}>: pkg_odn
-<src/plugins/none/*.ml{,i}>: pkg_ocamlgraph
<src/plugins/ocamlbuild/*.ml{,i}>: use_base
<src/plugins/ocamlbuild/*.ml{,i}>: use_oasis
<src/plugins/ocamlbuild/*.ml{,i}>: pkg_unix
<src/plugins/ocamlbuild/*.ml{,i}>: pkg_odn
-<src/plugins/ocamlbuild/*.ml{,i}>: pkg_ocamlgraph
-# Library plugin-loader
-"src/ext/plugin-loader/src/plugin-loader.cmxs": use_plugin-loader
-<src/ext/plugin-loader/src/*.ml{,i}>: pkg_findlib
-<src/ext/plugin-loader/src/*.ml{,i}>: pkg_dynlink
# Library cli
"src/cli/cli.cmxs": use_cli
-# Library plugin1
-"src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.cmxs": use_plugin1
-<src/ext/plugin-loader/test/data/findlib/plugin1/*.ml{,i}>: use_pluginloaderLib
# Executable test
"test/test.byte": use_builtin-plugins
"test/test.byte": use_base
"test/test.byte": use_oasis
-"test/test.byte": pkg_unix
-"test/test.byte": pkg_odn
-"test/test.byte": pkg_ocamlgraph
"test/test.byte": pkg_oUnit
-"test/test.byte": pkg_findlib
"test/test.byte": pkg_fileutils
+"test/test.byte": pkg_findlib
"test/test.byte": pkg_expect.pcre
+"test/test.byte": pkg_unix
+"test/test.byte": pkg_odn
<test/*.ml{,i}>: use_builtin-plugins
<test/*.ml{,i}>: use_base
<test/*.ml{,i}>: use_oasis
-<test/*.ml{,i}>: pkg_unix
-<test/*.ml{,i}>: pkg_odn
-<test/*.ml{,i}>: pkg_ocamlgraph
<test/*.ml{,i}>: pkg_oUnit
-<test/*.ml{,i}>: pkg_findlib
<test/*.ml{,i}>: pkg_fileutils
+<test/*.ml{,i}>: pkg_findlib
<test/*.ml{,i}>: pkg_expect.pcre
+<test/*.ml{,i}>: pkg_unix
+<test/*.ml{,i}>: pkg_odn
+# Library plugin-loader
+"src/ext/plugin-loader/src/plugin-loader.cmxs": use_plugin-loader
+<src/ext/plugin-loader/src/*.ml{,i}>: pkg_dynlink
+<src/ext/plugin-loader/src/*.ml{,i}>: pkg_findlib
# Executable oasis
"src/cli/Main.byte": use_cli
-"src/cli/Main.byte": use_plugin-loader
"src/cli/Main.byte": use_builtin-plugins
"src/cli/Main.byte": use_base
"src/cli/Main.byte": use_oasis
+"src/cli/Main.byte": use_plugin-loader
+"src/cli/Main.byte": pkg_dynlink
+"src/cli/Main.byte": pkg_findlib
"src/cli/Main.byte": pkg_unix
"src/cli/Main.byte": pkg_odn
-"src/cli/Main.byte": pkg_ocamlgraph
-"src/cli/Main.byte": pkg_findlib
-"src/cli/Main.byte": pkg_dynlink
<src/cli/*.ml{,i}>: use_cli
-<src/cli/*.ml{,i}>: use_plugin-loader
<src/cli/*.ml{,i}>: use_builtin-plugins
<src/cli/*.ml{,i}>: use_base
<src/cli/*.ml{,i}>: use_oasis
+<src/cli/*.ml{,i}>: use_plugin-loader
+<src/cli/*.ml{,i}>: pkg_dynlink
+<src/cli/*.ml{,i}>: pkg_findlib
<src/cli/*.ml{,i}>: pkg_unix
<src/cli/*.ml{,i}>: pkg_odn
-<src/cli/*.ml{,i}>: pkg_ocamlgraph
-<src/cli/*.ml{,i}>: pkg_findlib
-<src/cli/*.ml{,i}>: pkg_dynlink
-# Executable pluginloader
-"src/ext/plugin-loader/test/data/pluginloader.byte": use_plugin-loader
-"src/ext/plugin-loader/test/data/pluginloader.byte": use_pluginloaderLib
-"src/ext/plugin-loader/test/data/pluginloader.byte": pkg_findlib
-"src/ext/plugin-loader/test/data/pluginloader.byte": pkg_dynlink
-<src/ext/plugin-loader/test/data/*.ml{,i}>: use_plugin-loader
-<src/ext/plugin-loader/test/data/*.ml{,i}>: use_pluginloaderLib
-<src/ext/plugin-loader/test/data/*.ml{,i}>: pkg_findlib
-<src/ext/plugin-loader/test/data/*.ml{,i}>: pkg_dynlink
-# Library userconf
-"src/ext/userconf/src/userconf.cmxs": use_userconf
+# Library pluginloaderLib
+"src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.cmxs": use_pluginloaderLib
+# Library plugin1
+"src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.cmxs": use_plugin1
+<src/ext/plugin-loader/test/data/findlib/plugin1/*.ml{,i}>: use_pluginloaderLib
# Library plugin2
"src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.cmxs": use_plugin2
<src/ext/plugin-loader/test/data/findlib/plugin2/*.ml{,i}>: use_plugin1
@@ -158,22 +133,33 @@
# Library plugin3
"src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.cmxs": use_plugin3
<src/ext/plugin-loader/test/data/findlib/plugin3/*.ml{,i}>: use_pluginloaderLib
-# Executable test_userconf
-"src/ext/userconf/test/TestUserConf.byte": use_userconf
-"src/ext/userconf/test/TestUserConf.byte": pkg_oUnit
-<src/ext/userconf/test/*.ml{,i}>: use_userconf
-<src/ext/userconf/test/*.ml{,i}>: pkg_oUnit
+# Executable pluginloader
+"src/ext/plugin-loader/test/data/pluginloader.byte": use_plugin-loader
+"src/ext/plugin-loader/test/data/pluginloader.byte": use_pluginloaderLib
+"src/ext/plugin-loader/test/data/pluginloader.byte": pkg_dynlink
+"src/ext/plugin-loader/test/data/pluginloader.byte": pkg_findlib
+<src/ext/plugin-loader/test/data/*.ml{,i}>: use_plugin-loader
+<src/ext/plugin-loader/test/data/*.ml{,i}>: use_pluginloaderLib
+<src/ext/plugin-loader/test/data/*.ml{,i}>: pkg_dynlink
+<src/ext/plugin-loader/test/data/*.ml{,i}>: pkg_findlib
# Executable test_loader
"src/ext/plugin-loader/test/TestLoader.byte": use_plugin-loader
"src/ext/plugin-loader/test/TestLoader.byte": pkg_oUnit
-"src/ext/plugin-loader/test/TestLoader.byte": pkg_findlib
"src/ext/plugin-loader/test/TestLoader.byte": pkg_fileutils
"src/ext/plugin-loader/test/TestLoader.byte": pkg_dynlink
+"src/ext/plugin-loader/test/TestLoader.byte": pkg_findlib
<src/ext/plugin-loader/test/*.ml{,i}>: use_plugin-loader
<src/ext/plugin-loader/test/*.ml{,i}>: pkg_oUnit
-<src/ext/plugin-loader/test/*.ml{,i}>: pkg_findlib
<src/ext/plugin-loader/test/*.ml{,i}>: pkg_fileutils
<src/ext/plugin-loader/test/*.ml{,i}>: pkg_dynlink
+<src/ext/plugin-loader/test/*.ml{,i}>: pkg_findlib
+# Library userconf
+"src/ext/userconf/src/userconf.cmxs": use_userconf
+# Executable test_userconf
+"src/ext/userconf/test/TestUserConf.byte": use_userconf
+"src/ext/userconf/test/TestUserConf.byte": pkg_oUnit
+<src/ext/userconf/test/*.ml{,i}>: use_userconf
+<src/ext/userconf/test/*.ml{,i}>: pkg_oUnit
# OASIS_STOP
# Base system and OASIS library
View
4 deps.ml
@@ -1,4 +1,5 @@
+(* TODO: only at post-conf
module MapString = Map.Make(String)
module SetString = Set.Make(String)
@@ -63,7 +64,7 @@ let () =
SetString.fold
(fun fndlb_nm mp ->
let lst =
- BaseExec.run_read_output
+ OASISExec.run_read_output ~ctxt:!BaseContext.default
"ocamlfind"
["query"; fndlb_nm; "-recursive"; "-p-format"]
in
@@ -109,3 +110,4 @@ let () =
())
pkg.sections;
close_out chn
+ *)
View
156 myocamlbuild.ml
@@ -113,41 +113,41 @@ rule "ocamlify: %.mlify & %.mlify.depends -> %.ml"
;;
(* OASIS_START *)
-(* DO NOT EDIT (digest: dd44b9d2f970b9e0b67040da9f5f92ea) *)
+(* DO NOT EDIT (digest: 9a98bd7413f733353a0d977c51f2c80e) *)
module OASISGettext = struct
# 21 "/home/gildor/programmation/oasis/src/oasis/OASISGettext.ml"
-
+
let ns_ str =
str
-
+
let s_ str =
str
-
+
let f_ (str : ('a, 'b, 'c, 'd) format4) =
str
-
+
let fn_ fmt1 fmt2 n =
if n = 1 then
fmt1^^""
else
fmt2^^""
-
+
let init =
[]
-
+
end
module OASISExpr = struct
# 21 "/home/gildor/programmation/oasis/src/oasis/OASISExpr.ml"
-
-
-
+
+
+
open OASISGettext
-
+
type test = string
-
+
type flag = string
-
+
type t =
| EBool of bool
| ENot of t
@@ -156,31 +156,31 @@ module OASISExpr = struct
| EFlag of flag
| ETest of test * string
-
+
type 'a choices = (t * 'a) list
-
+
let eval var_get t =
let rec eval' =
function
| EBool b ->
b
-
+
| ENot e ->
not (eval' e)
-
+
| EAnd (e1, e2) ->
(eval' e1) && (eval' e2)
-
+
| EOr (e1, e2) ->
(eval' e1) || (eval' e2)
-
+
| EFlag nm ->
let v =
var_get nm
in
assert(v = "true" || v = "false");
(v = "true")
-
+
| ETest (nm, vl) ->
let v =
var_get nm
@@ -188,7 +188,7 @@ module OASISExpr = struct
(v = vl)
in
eval' t
-
+
let choose ?printer ?name var_get lst =
let rec choose_aux =
function
@@ -224,23 +224,23 @@ module OASISExpr = struct
str_lst)
in
choose_aux (List.rev lst)
-
+
end
# 117 "myocamlbuild.ml"
module BaseEnvLight = struct
# 21 "/home/gildor/programmation/oasis/src/base/BaseEnvLight.ml"
-
+
module MapString = Map.Make(String)
-
+
type t = string MapString.t
-
+
let default_filename =
Filename.concat
(Sys.getcwd ())
"setup.data"
-
+
let load ?(allow_empty=false) ?(filename=default_filename) () =
if Sys.file_exists filename then
begin
@@ -297,7 +297,7 @@ module BaseEnvLight = struct
"Unable to load environment, the file '%s' doesn't exist."
filename)
end
-
+
let var_get name env =
let rec var_expand str =
let buff =
@@ -318,7 +318,7 @@ module BaseEnvLight = struct
Buffer.contents buff
in
var_expand (MapString.find name env)
-
+
let var_choose lst env =
OASISExpr.choose
(fun nm -> var_get nm env)
@@ -329,7 +329,7 @@ end
# 215 "myocamlbuild.ml"
module MyOCamlbuildFindlib = struct
# 21 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml"
-
+
(** OCamlbuild extension, copied from
* http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild
* by N. Pouillard and others
@@ -339,14 +339,14 @@ module MyOCamlbuildFindlib = struct
* Modified by Sylvain Le Gall
*)
open Ocamlbuild_plugin
-
+
(* these functions are not really officially exported *)
let run_and_read =
Ocamlbuild_pack.My_unix.run_and_read
-
+
let blank_sep_strings =
Ocamlbuild_pack.Lexers.blank_sep_strings
-
+
let split s ch =
let x =
ref []
@@ -361,24 +361,24 @@ module MyOCamlbuildFindlib = struct
try
go s
with Not_found -> !x
-
+
let split_nl s = split s '\n'
-
+
let before_space s =
try
String.before s (String.index s ' ')
with Not_found -> s
-
+
(* this lists all supported packages *)
let find_packages () =
List.map before_space (split_nl & run_and_read "ocamlfind list")
-
+
(* this is supposed to list available syntaxes, but I don't know how to do it. *)
let find_syntaxes () = ["camlp4o"; "camlp4r"]
-
+
(* ocamlfind command *)
let ocamlfind x = S[A"ocamlfind"; x]
-
+
let dispatch =
function
| Before_options ->
@@ -408,7 +408,7 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg];
end
(find_packages ());
-
+
(* Like -package but for extensions syntax. Morover -syntax is useless
* when linking. *)
List.iter begin fun syntax ->
@@ -417,7 +417,7 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
end (find_syntaxes ());
-
+
(* The default "thread" tag is not compatible with ocamlfind.
* Indeed, the default rules add the "threads.cma" or "threads.cmxa"
* options when using this tag. When using the "-linkpkg" option with
@@ -430,31 +430,31 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]);
flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]);
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"])
-
+
| _ ->
()
-
+
end
module MyOCamlbuildBase = struct
# 21 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml"
-
+
(** Base functions for writing myocamlbuild.ml
@author Sylvain Le Gall
*)
-
-
-
+
+
+
open Ocamlbuild_plugin
module OC = Ocamlbuild_pack.Ocaml_compiler
-
+
type dir = string
type file = string
type name = string
type tag = string
-
+
# 56 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml"
-
+
type t =
{
lib_ocaml: (name * dir list) list;
@@ -465,23 +465,23 @@ module MyOCamlbuildBase = struct
*)
includes: (dir * dir list) list;
}
-
+
let env_filename =
Pathname.basename
BaseEnvLight.default_filename
-
+
let dispatch_combine lst =
fun e ->
List.iter
(fun dispatch -> dispatch e)
lst
-
+
let tag_libstubs nm =
"use_lib"^nm^"_stubs"
-
+
let nm_libstubs nm =
nm^"_stubs"
-
+
let dispatch t e =
let env =
BaseEnvLight.load
@@ -508,7 +508,7 @@ module MyOCamlbuildBase = struct
Options.ext_lib, "ext_lib";
Options.ext_dll, "ext_dll";
]
-
+
| Before_rules ->
(* TODO: move this into its own file and conditionnaly include it, if
* needed.
@@ -532,47 +532,47 @@ module MyOCamlbuildBase = struct
let x_p_o = "%.p"-.-ext_obj in
let x_p_a = "%.p"-.-ext_lib in
let x_p_dll = "%.p"-.-ext_dll in
-
+
rule "ocaml: mldylib & p.cmx* & p.o* -> p.cmxs & p.so"
~tags:["ocaml"; "native"; "profile"; "shared"; "library"]
~prods:["%.p.cmxs"; x_p_dll]
~dep:"%.mldylib"
(OC.native_profile_shared_library_link_mldylib
"%.mldylib" "%.p.cmxs");
-
+
rule "ocaml: mldylib & cmx* & o* -> cmxs & so"
~tags:["ocaml"; "native"; "shared"; "library"]
~prods:["%.cmxs"; x_dll]
~dep:"%.mldylib"
(OC.native_shared_library_link_mldylib
"%.mldylib" "%.cmxs");
-
+
rule "ocaml: p.cmx & p.o -> p.cmxs & p.so"
~tags:["ocaml"; "native"; "profile"; "shared"; "library"]
~prods:["%.p.cmxs"; x_p_dll]
~deps:["%.p.cmx"; x_p_o]
(OC.native_shared_library_link ~tags:["profile"]
"%.p.cmx" "%.p.cmxs");
-
+
rule "ocaml: p.cmxa & p.a -> p.cmxs & p.so"
~tags:["ocaml"; "native"; "profile"; "shared"; "library"]
~prods:["%.p.cmxs"; x_p_dll]
~deps:["%.p.cmxa"; x_p_a]
(OC.native_shared_library_link ~tags:["profile"; "linkall"]
"%.p.cmxa" "%.p.cmxs");
-
+
rule "ocaml: cmx & o -> cmxs"
~tags:["ocaml"; "native"; "shared"; "library"]
~prods:["%.cmxs"]
~deps:["%.cmx"; x_o]
(OC.native_shared_library_link "%.cmx" "%.cmxs");
-
+
rule "ocaml: cmx & o -> cmxs & so"
~tags:["ocaml"; "native"; "shared"; "library"]
~prods:["%.cmxs"; x_dll]
~deps:["%.cmx"; x_o]
(OC.native_shared_library_link "%.cmx" "%.cmxs");
-
+
rule "ocaml: cmxa & a -> cmxs & so"
~tags:["ocaml"; "native"; "shared"; "library"]
~prods:["%.cmxs"; x_dll]
@@ -580,7 +580,7 @@ module MyOCamlbuildBase = struct
(OC.native_shared_library_link ~tags:["linkall"]
"%.cmxa" "%.cmxs");
end
-
+
| After_rules ->
(* Declare OCaml libraries *)
List.iter
@@ -597,13 +597,13 @@ module MyOCamlbuildBase = struct
["compile"; "infer_interface"; "doc"])
tl)
t.lib_ocaml;
-
+
(* Declare directories dependencies, replace "include" in _tags. *)
List.iter
(fun (dir, include_dirs) ->
Pathname.define_context dir include_dirs)
t.includes;
-
+
(* Declare C libraries *)
List.iter
(fun (lib, dir, headers) ->
@@ -611,33 +611,33 @@ module MyOCamlbuildBase = struct
flag ["link"; "library"; "ocaml"; "byte"; tag_libstubs lib]
(S[A"-dllib"; A("-l"^(nm_libstubs lib)); A"-cclib";
A("-l"^(nm_libstubs lib))]);
-
+
flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib]
(S[A"-cclib"; A("-l"^(nm_libstubs lib))]);
flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib]
(S[A"-dllib"; A("dll"^(nm_libstubs lib))]);
-
+
(* When ocaml link something that use the C library, then one
need that file to be up to date.
*)
dep ["link"; "ocaml"; "program"; tag_libstubs lib]
[dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
-
+
dep ["compile"; "ocaml"; "program"; tag_libstubs lib]
[dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)];
-
+
(* TODO: be more specific about what depends on headers *)
(* Depends on .h files *)
dep ["compile"; "c"]
headers;
-
+
(* Setup search path for lib *)
flag ["link"; "ocaml"; "use_"^lib]
(S[A"-I"; P(dir)]);
)
t.lib_c;
-
+
(* Add flags *)
List.iter
(fun (tags, cond_specs) ->
@@ -648,14 +648,14 @@ module MyOCamlbuildBase = struct
t.flags
| _ ->
()
-
+
let dispatch_default t =
dispatch_combine
[
dispatch t;
MyOCamlbuildFindlib.dispatch;
]
-
+
end
@@ -667,15 +667,15 @@ let package_default =
[
("oasis", ["src/oasis"]);
("base", ["src/base"]);
- ("pluginloaderLib",
- ["src/ext/plugin-loader/test/data/findlib/pluginloaderLib"]);
("builtin-plugins", ["src"]);
- ("plugin-loader", ["src/ext/plugin-loader/src"]);
("cli", ["src/cli"]);
+ ("plugin-loader", ["src/ext/plugin-loader/src"]);
+ ("pluginloaderLib",
+ ["src/ext/plugin-loader/test/data/findlib/pluginloaderLib"]);
("plugin1", ["src/ext/plugin-loader/test/data/findlib/plugin1"]);
- ("userconf", ["src/ext/userconf/src"]);
("plugin2", ["src/ext/plugin-loader/test/data/findlib/plugin2"]);
- ("plugin3", ["src/ext/plugin-loader/test/data/findlib/plugin3"])
+ ("plugin3", ["src/ext/plugin-loader/test/data/findlib/plugin3"]);
+ ("userconf", ["src/ext/userconf/src"])
];
lib_c = [];
flags = [];
View
3,677 setup.ml
1,889 additions, 1,788 deletions not shown
View
3  src/api-oasis.odocl
@@ -20,7 +20,7 @@
################################################################################
# OASIS_START
-# DO NOT EDIT (digest: b04be3315d57be95ab3927e5edf9ded1)
+# DO NOT EDIT (digest: 0e62ab6c871c5ff24dbe4ca8f3684337)
oasis/FormatExt
oasis/FormatMarkdown
oasis/ODNFunc
@@ -53,6 +53,7 @@ oasis/OASISString
oasis/OASISExec
oasis/OASISFileUtil
oasis/OASISHostPath
+oasis/OASISGraph
base/BaseArgExt
base/BaseBuilt
base/BaseCheck
View
4 src/oasis/META
@@ -20,10 +20,10 @@
################################################################################
# OASIS_START
-# DO NOT EDIT (digest: a59e0ed5d046689bd10dae9d5bf4c4b0)
+# DO NOT EDIT (digest: b5445f5bca6435f54e6285da59206706)
version = "0.3.0~rc3"
description = "_oasis file functions"
-requires = "unix odn ocamlgraph"
+requires = "unix odn"
archive(byte) = "oasis.cma"
archive(byte, plugin) = "oasis.cma"
archive(native) = "oasis.cmxa"
View
277 src/oasis/OASISBuildSection.ml
@@ -24,214 +24,153 @@
open OASISTypes
open OASISUtils
-open Graph
open OASISSection
open OASISSection_intern
-module G = Imperative.Digraph.Concrete(OASISSection.CSection)
-module Bfs = Traverse.Bfs(G)
-module Dfs = Traverse.Dfs(G)
-module Topological = Topological.Make(G)
-module Oper = Oper.I(G)
-
-module Display =
-struct
- include G
- let vertex_name v = varname_of_string (string_of_section v)
- let graph_attributes _ = []
- let default_vertex_attributes _ = []
- let vertex_attributes _ = []
- let default_edge_attributes _ = []
- let edge_attributes _ = []
- let get_subgraph _ = None
-end
-
-module Dot = Graphviz.Dot(Display)
-
-let show g =
- let tmp = Filename.temp_file "graph" ".dot" in
- let oc = open_out tmp in
- Dot.output_graph oc g;
- close_out oc;
- ignore (Sys.command ("dot -Tps " ^ tmp ^ " | gv -"));
- Sys.remove tmp
+module G = OASISGraph
+
+type extended_kind = [section_kind | `ExternalTool | `FindlibPackage]
+type vertex = extended_kind * string
let build_graph pkg =
- let g =
- G.create ()
- in
- let vertex_of_section f =
+ let g : vertex G.t = G.create (2 * List.length pkg.sections) in
+ let sct_of_vrtx = Hashtbl.create (List.length pkg.sections) in
+ let ext_of_vrtx = Hashtbl.create 13 in
+
+ let sections =
+ (* Start by creating all vertexes, because we will need it
+ * to create edges.
+ *)
List.fold_left
(fun acc sct ->
- match f sct with
- | Some cs ->
- MapString.add cs.cs_name (G.V.create sct) acc
- | None ->
- acc)
- MapString.empty
+ let vrtx =
+ G.add_vertex g ((OASISSection.section_id sct) :> vertex)
+ in
+ Hashtbl.add sct_of_vrtx vrtx sct;
+ (vrtx, sct) :: acc)
+ []
pkg.sections
in
- let vertex_of_lib =
- vertex_of_section
- (function Library (cs, _, _) -> Some cs | _ -> None)
- in
- let vertex_of_exec =
- vertex_of_section
- (function Executable (cs, _, _) -> Some cs | _ -> None)
- in
- let find_name nm mp =
- MapString.find nm mp
- in
+
let add_build_tool vrtx lst =
List.iter
(function
| InternalExecutable nm ->
- let dvrtx =
- find_name nm vertex_of_exec
- in
+ let dvrtx = G.vertex_of_value g (`Executable, nm) in
G.add_edge g vrtx dvrtx
- | ExternalTool _ ->
- ())
+ | ExternalTool prog ->
+ let dvrtx = G.add_vertex g (`ExternalTool, prog) in
+ Hashtbl.add ext_of_vrtx dvrtx (`ExternalTool prog);
+ G.add_edge g vrtx dvrtx)
lst
in
+
let add_build_section vrtx bs =
- G.add_vertex g vrtx;
add_build_tool vrtx bs.bs_build_tools;
List.iter
(function
| InternalLibrary nm ->
- let dvrtx =
- find_name nm vertex_of_lib
- in
+ let dvrtx = G.vertex_of_value g (`Library, nm) in
G.add_edge g vrtx dvrtx
- | FindlibPackage _ ->
- ())
+ | FindlibPackage (fndlb_nm, ver_opt) ->
+ let dvrtx = G.add_vertex g (`FindlibPackage, fndlb_nm) in
+ Hashtbl.add ext_of_vrtx dvrtx
+ (`FindlibPackage (fndlb_nm, ver_opt));
+ G.add_edge g vrtx dvrtx)
bs.bs_build_depends
in
+ (* Add all edges. *)
List.iter
- (function
- | Library (cs, bs, _) ->
- add_build_section
- (find_name cs.cs_name vertex_of_lib)
- bs
- | Executable (cs, bs, _) ->
- add_build_section
- (find_name cs.cs_name vertex_of_exec)
- bs
- | Test (cs, {test_tools = build_tools})
- | Doc (cs, {doc_build_tools = build_tools}) as sct ->
- let vrtx =
- G.V.create sct
- in
- G.add_vertex g vrtx;
- add_build_tool
- vrtx
- build_tools
- | Flag _ | SrcRepo _ as sct ->
- G.add_vertex g (G.V.create sct))
- pkg.sections;
-
- g
+ (fun (vrtx, sct) ->
+ match sct with
+ | Library (cs, bs, _)
+ | Executable (cs, bs, _) ->
+ add_build_section vrtx bs
+ | Test (cs, {test_tools = build_tools})
+ | Doc (cs, {doc_build_tools = build_tools}) ->
+ add_build_tool vrtx build_tools
+ | Flag _ | SrcRepo _ ->
+ ())
+ sections;
+
+ sct_of_vrtx, ext_of_vrtx, g
let build_order pkg =
- Topological.fold
- (fun v lst -> v :: lst)
- (build_graph pkg)
- []
-
-module SetDepends =
- Set.Make
- (struct
- type t = dependency
- let compare = compare
- end)
+ let sct_of_vrtx, _, g = build_graph pkg in
+ List.rev
+ (List.fold_left
+ (fun acc vrtx ->
+ try
+ Hashtbl.find sct_of_vrtx vrtx :: acc
+ with Not_found ->
+ acc)
+ []
+ (G.topological_sort g))
let transitive_build_depends pkg =
- let g =
- build_graph pkg
- in
-
- let add_build_depends =
- List.fold_left
- (fun acc dep -> SetDepends.add dep acc)
+ let sct_of_vrtx, ext_of_vrtx, g = build_graph pkg in
+
+ let order =
+ (* Map depends with their build order. *)
+ let hshtbl = Hashtbl.create 13 in
+ let idx = ref 0 in
+ List.iter
+ (fun dep ->
+ Hashtbl.add hshtbl dep !idx;
+ incr idx)
+ (G.topological_sort g);
+ hshtbl
in
let map_deps =
(* Fill the map with empty depends *)
List.fold_left
- (fun mp ->
- function
- | Library (_, bs, _) | Executable (_, bs, _) as sct ->
- MapSection.add
- sct
- (add_build_depends
- SetDepends.empty
- bs.bs_build_depends)
- mp
- | Flag _ | SrcRepo _ | Test _ | Doc _ as sct ->
- MapSection.add sct SetDepends.empty mp)
+ (fun mp sct -> MapSection.add sct [] mp)
MapSection.empty
pkg.sections
in
- let map_deps =
- (* Populate build depends *)
- G.fold_edges
- (fun v1 v2 mp ->
- let deps =
- MapSection.find v1 mp
- in
- let deps =
- match v2 with
- | Library (cs, bs, _) ->
- add_build_depends
- deps
- bs.bs_build_depends
- | Executable _ | Flag _ | SrcRepo _ | Test _ | Doc _ ->
- deps
- in
- MapSection.add v1 deps mp)
- (Oper.transitive_closure g)
- map_deps
- in
-
- let extract_depends =
- let _, order =
- List.fold_left
- (fun (i, mp) sct ->
- i + 1,
- MapSectionId.add
- (section_id sct)
- i
- mp)
- (0, MapSectionId.empty)
- (build_order pkg)
- in
- let compare dep1 dep2 =
- let id =
- function
- | FindlibPackage _ ->
- (* We place findlib package at the very
- * beginning of the list, since they are
- * don't depend on any internal libraries
- * and that their inter-dependencies will
- * be solved by findlib
- *)
- (-1)
- | InternalLibrary nm ->
- MapSectionId.find (`Library, nm) order
- in
- (id dep1) - (id dep2)
+ let map_deps =
+ let add_dep sct dep mp =
+ let lst = try MapSection.find sct mp with Not_found -> [] in
+ MapSection.add sct (dep :: lst) mp
in
- fun k deps ->
- let lst =
- List.sort
- compare
- (SetDepends.elements deps)
- in
- lst
+ let g' = G.copy g in
+ G.transitive_closure g';
+ G.fold_edges
+ (fun vrtx1 vrtx2 mp ->
+ if Hashtbl.mem sct_of_vrtx vrtx1 then
+ begin
+ let sct = Hashtbl.find sct_of_vrtx vrtx1 in
+ let ord = Hashtbl.find order vrtx2 in
+ match G.value_of_vertex g' vrtx2 with
+ | `Library, nm ->
+ add_dep sct (ord, InternalLibrary nm) mp
+ | `FindlibPackage, _ ->
+ begin
+ match Hashtbl.find ext_of_vrtx vrtx2 with
+ | `FindlibPackage (fndlb_nm, ver_opt) ->
+ add_dep
+ sct
+ (ord, FindlibPackage (fndlb_nm, ver_opt))
+ mp
+ | _ ->
+ mp
+ end
+ | _ ->
+ mp
+ end
+ else
+ mp)
+ g'
+ map_deps
in
- MapSection.mapi extract_depends map_deps
-
+ MapSection.mapi
+ (fun k lst ->
+ List.rev_map
+ (fun (_, dep) -> dep)
+ (* Reverse order to match List.rev_map *)
+ (List.sort (fun (o1, _) (o2, _) -> o2 - o1) lst))
+ map_deps
View
139 src/oasis/OASISGraph.ml
@@ -0,0 +1,139 @@
+type vertex = int
+
+module SetInt =
+ Set.Make
+ (struct
+ type t = int
+ let compare = ( - )
+ end)
+
+type 'a t =
+ {
+ mutable vertexes: ('a * SetInt.t ref) array;
+ values: ('a, int) Hashtbl.t;
+ }
+
+let create len =
+ {
+ vertexes = [||];
+ values = Hashtbl.create len;
+ }
+
+let copy t =
+ {
+ vertexes = Array.copy t.vertexes;
+ values = Hashtbl.copy t.values;
+ }
+
+let value_of_vertex t v =
+ if 0 <= v && v < Array.length t.vertexes then
+ fst (Array.unsafe_get t.vertexes v)
+ else
+ invalid_arg "get_vertex"
+
+let vertex_of_value t e =
+ Hashtbl.find t.values e
+
+let add_vertex t e =
+ if Hashtbl.mem t.values e then
+ Hashtbl.find t.values e
+ else
+ begin
+ let v = Array.length t.vertexes in
+ let nvertexes =
+ Array.init
+ (v + 1)
+ (fun i ->
+ if i = v then
+ e, ref SetInt.empty
+ else
+ t.vertexes.(i))
+ in
+ t.vertexes <- nvertexes;
+ Hashtbl.add t.values e v;
+ v
+ end
+
+let add_edge t v1 v2 =
+ let size = Array.length t.vertexes in
+ if 0 <= v1 && v1 < size &&
+ 0 <= v2 && v2 < size then
+ begin
+ let _, edges = t.vertexes.(v1) in
+ edges := SetInt.add v2 !edges
+ end
+ else
+ invalid_arg "add_edge"
+
+let topological_sort t =
+ let size = Array.length t.vertexes in
+
+ (* Empty list that will contain the sorted vertexes *)
+ let l = ref [] in
+
+ (* Visited vertexes *)
+ let visited = Array.make size false in
+
+ let reverted_edges =
+ let arr = Array.make size [] in
+ for v1 = 0 to size - 1 do
+ SetInt.iter
+ (fun v2 -> arr.(v2) <- v1 :: arr.(v2))
+ !(snd t.vertexes.(v1))
+ done;
+ arr
+ in
+
+ let rec visit v =
+ if not visited.(v) then
+ begin
+ visited.(v) <- true;
+ List.iter visit reverted_edges.(v);
+ l := v :: !l
+ end
+ in
+
+ (* Go through all vertexes with no outgoing edges *)
+ for v = 0 to size - 1 do
+ visit v
+ done;
+ !l
+
+let fold_edges f t acc =
+ let racc = ref acc in
+ for v1 = 0 to Array.length t.vertexes - 1 do
+ SetInt.iter
+ (fun v2 -> racc := f v1 v2 !racc)
+ !(snd t.vertexes.(v1))
+ done;
+ !racc
+
+let transitive_closure t =
+ let size = Array.length t.vertexes in
+ let visited = Array.make size false in
+
+ let rec visit set v =
+ if not visited.(v) then
+ begin
+ (* The set of outgoing edges is not complete *)
+ let current_set = snd t.vertexes.(v) in
+ let set' =
+ SetInt.fold
+ (fun v set' -> visit set' v)
+ !current_set !current_set
+ in
+ visited.(v) <- true;
+ current_set := set';
+ SetInt.union set set'
+ end
+ else
+ begin
+ (* The set is complete *)
+ SetInt.union set !(snd t.vertexes.(v))
+ end
+ in
+
+ for v = 0 to size - 1 do
+ let _set : SetInt.t = visit SetInt.empty v in
+ ()
+ done
View
2  src/oasis/OASISSection.mli
@@ -19,7 +19,7 @@
(* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *)
(******************************************************************************)
-(** Manipulate section
+(** Manipulate sections.
@author Sylvain Le Gall
*)
View
3  src/oasis/oasis.mllib
@@ -20,7 +20,7 @@
################################################################################
# OASIS_START
-# DO NOT EDIT (digest: 505ae53242e1347e3af02f7cb1a20dbc)
+# DO NOT EDIT (digest: c5f445c1f016cf2f7563db6d95a3c274)
FormatExt
FormatMarkdown
ODNFunc
@@ -53,6 +53,7 @@ OASISString
OASISExec
OASISFileUtil
OASISHostPath
+OASISGraph
OASISVersion_types
OASISVersion_lexer
OASISVersion_parser

0 comments on commit ca06743

Please sign in to comment.
Something went wrong with that request. Please try again.