moved cgi in a subdir (would not build with oasis 0.4 otherwise)

This commit is contained in:
Simon Cruanes 2013-12-30 12:20:05 +01:00
parent 239f6af59f
commit 74735a7ad9
13 changed files with 1551 additions and 467 deletions

View file

@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
# DO NOT EDIT (digest: 7b2408909643717852b95f994b273fee)
SETUP = ocaml setup.ml
@ -12,7 +12,7 @@ doc: setup.data build
test: setup.data build
$(SETUP) -test $(TESTFLAGS)
all:
all:
$(SETUP) -all $(ALLFLAGS)
install: setup.data
@ -24,10 +24,10 @@ uninstall: setup.data
reinstall: setup.data
$(SETUP) -reinstall $(REINSTALLFLAGS)
clean:
clean:
$(SETUP) -clean $(CLEANFLAGS)
distclean:
distclean:
$(SETUP) -distclean $(DISTCLEANFLAGS)
setup.data:

7
_oasis
View file

@ -64,7 +64,7 @@ Library "containers_lwt"
XMETARequires: containers,lwt
Library "containers_cgi"
Path: .
Path: cgi
Modules: ToWeb
FindlibName: cgi
FindlibParent: containers
@ -78,6 +78,7 @@ Document containers
Type: ocamlbuild (0.3)
BuildTools+: ocamldoc
Install: true
Build$: flag(lwt)
XOCamlbuildPath: .
XOCamlbuildLibraries: containers,containers.lwt
@ -103,11 +104,11 @@ Executable run_tests
BuildDepends: containers, oUnit, lwt, threads, lwt.unix
Executable web_pwd
Path: examples
Path: examples/cgi/
Install: false
MainIs: web_pwd.ml
Build$: flag(cgi)
BuildDepends: containers.cgi, threads, CamlGI
BuildDepends: containers, containers.cgi, threads, CamlGI
SourceRepository head
Type: git

67
_tags
View file

@ -1,7 +1,7 @@
# OASIS_START
# DO NOT EDIT (digest: dcf1c0cacacb67335a863b18858eaeb7)
# Ignore VCS directories, you can use the same kind of rule outside
# OASIS_START/STOP if you want to exclude directories that contains
# DO NOT EDIT (digest: 1f5b1920aa5191df724ab0786999e476)
# 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
<**/.svn>: -traverse
<**/.svn>: not_hygienic
@ -52,44 +52,47 @@
"show.cmx": for-pack(Containers)
"tTree.cmx": for-pack(Containers)
"hGraph.cmx": for-pack(Containers)
"automaton.cmx": for-pack(Containers)
# Library containers_thread
"containers_thread.cmxs": use_containers_thread
<*.ml{,i}>: pkg_threads
<*.ml{,i}>: package(threads)
# Library containers_lwt
"containers_lwt.cmxs": use_containers_lwt
<*.ml{,i}>: pkg_lwt
# Library containers_cgi
"containers_cgi.cmxs": use_containers_cgi
<*.ml{,i}>: use_containers
<*.ml{,i}>: pkg_CamlGI
<*.ml{,i}>: pkg_unix
<*.ml{,i}>: package(lwt)
<*.ml{,i}>: package(unix)
# Library containers_cgi
"cgi/containers_cgi.cmxs": use_containers_cgi
<cgi/*.ml{,i}>: use_containers
<cgi/*.ml{,i}>: package(CamlGI)
<cgi/*.ml{,i}>: package(unix)
# Executable benchs
"tests/benchs.native": use_containers
"tests/benchs.native": pkg_bench
"tests/benchs.native": pkg_unix
<tests/*.ml{,i}>: pkg_bench
"tests/benchs.native": package(bench)
"tests/benchs.native": package(unix)
<tests/*.ml{,i}>: package(bench)
# Executable run_tests
"tests/run_tests.native": use_containers
"tests/run_tests.native": pkg_threads
"tests/run_tests.native": pkg_oUnit
"tests/run_tests.native": pkg_lwt
"tests/run_tests.native": pkg_lwt.unix
"tests/run_tests.native": pkg_unix
"tests/run_tests.native": package(threads)
"tests/run_tests.native": package(oUnit)
"tests/run_tests.native": package(lwt)
"tests/run_tests.native": package(lwt.unix)
"tests/run_tests.native": package(unix)
<tests/*.ml{,i}>: use_containers
<tests/*.ml{,i}>: pkg_threads
<tests/*.ml{,i}>: pkg_oUnit
<tests/*.ml{,i}>: pkg_lwt
<tests/*.ml{,i}>: pkg_lwt.unix
<tests/*.ml{,i}>: pkg_unix
<tests/*.ml{,i}>: package(threads)
<tests/*.ml{,i}>: package(oUnit)
<tests/*.ml{,i}>: package(lwt)
<tests/*.ml{,i}>: package(lwt.unix)
<tests/*.ml{,i}>: package(unix)
# Executable web_pwd
"examples/web_pwd.byte": use_containers_cgi
"examples/web_pwd.byte": use_containers
"examples/web_pwd.byte": pkg_threads
"examples/web_pwd.byte": pkg_CamlGI
"examples/web_pwd.byte": pkg_unix
<examples/*.ml{,i}>: use_containers_cgi
<examples/*.ml{,i}>: use_containers
<examples/*.ml{,i}>: pkg_threads
<examples/*.ml{,i}>: pkg_CamlGI
<examples/*.ml{,i}>: pkg_unix
"examples/cgi/web_pwd.byte": use_containers_cgi
"examples/cgi/web_pwd.byte": use_containers
"examples/cgi/web_pwd.byte": package(threads)
"examples/cgi/web_pwd.byte": package(CamlGI)
"examples/cgi/web_pwd.byte": package(unix)
<examples/cgi/*.ml{,i}>: use_containers_cgi
<examples/cgi/*.ml{,i}>: use_containers
<examples/cgi/*.ml{,i}>: package(threads)
<examples/cgi/*.ml{,i}>: package(CamlGI)
<examples/cgi/*.ml{,i}>: package(unix)
# OASIS_STOP

4
cgi/containers_cgi.mllib Normal file
View file

@ -0,0 +1,4 @@
# OASIS_START
# DO NOT EDIT (digest: f5192440033c9e32b425a31804bbddaa)
ToWeb
# OASIS_STOP

4
configure vendored
View file

@ -1,11 +1,11 @@
#!/bin/sh
# OASIS_START
# DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7)
# DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499)
set -e
FST=true
for i in "$@"; do
for i in "$@"; do
if $FST; then
set --
FST=false

4
containers.mllib Normal file
View file

@ -0,0 +1,4 @@
# OASIS_START
# DO NOT EDIT (digest: 5382aaf8b3d2fdeb6717f9805b0dd511)
Containers
# OASIS_STOP

View file

@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: c05f285f4d4b4832b21ddd28863f4edf)
# DO NOT EDIT (digest: 9b329c33930d547bbc92d89a6a2cec77)
Cache
Deque
Gen
@ -37,4 +37,5 @@ BencodeOnDisk
Show
TTree
HGraph
Automaton
# OASIS_STOP

View file

@ -1,5 +1,5 @@
# OASIS_START
# DO NOT EDIT (digest: b68696a2df00165022fe21a389026f4f)
# DO NOT EDIT (digest: 1374a4df6a056c922bd254bb51737f89)
Cache
Deque
Gen
@ -37,5 +37,6 @@ BencodeOnDisk
Show
TTree
HGraph
Automaton
Behavior
# OASIS_STOP

View file

@ -1,39 +1,50 @@
(* OASIS_START *)
(* DO NOT EDIT (digest: 240e1f430a880e29ecae75f577790609) *)
(* DO NOT EDIT (digest: 0ae112fe35eff6babb0408ce917edebb) *)
module OASISGettext = struct
(* # 21 "src/oasis/OASISGettext.ml" *)
(* # 22 "src/oasis/OASISGettext.ml" *)
let ns_ str =
str
let s_ str =
str
let f_ (str : ('a, 'b, 'c, 'd) format4) =
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 "src/oasis/OASISExpr.ml" *)
(* # 22 "src/oasis/OASISExpr.ml" *)
open OASISGettext
type test = string
type flag = string
type t =
| EBool of bool
| ENot of t
@ -43,8 +54,10 @@ module OASISExpr = struct
| ETest of test * string
type 'a choices = (t * 'a) list
let eval var_get t =
let rec eval' =
function
@ -75,6 +88,7 @@ module OASISExpr = struct
in
eval' t
let choose ?printer ?name var_get lst =
let rec choose_aux =
function
@ -111,22 +125,27 @@ module OASISExpr = struct
in
choose_aux (List.rev lst)
end
# 117 "myocamlbuild.ml"
# 132 "myocamlbuild.ml"
module BaseEnvLight = struct
(* # 21 "src/base/BaseEnvLight.ml" *)
(* # 22 "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
@ -184,6 +203,7 @@ module BaseEnvLight = struct
filename)
end
let var_get name env =
let rec var_expand str =
let buff =
@ -205,6 +225,7 @@ module BaseEnvLight = struct
in
var_expand (MapString.find name env)
let var_choose lst env =
OASISExpr.choose
(fun nm -> var_get nm env)
@ -212,87 +233,118 @@ module BaseEnvLight = struct
end
# 215 "myocamlbuild.ml"
# 236 "myocamlbuild.ml"
module MyOCamlbuildFindlib = struct
(* # 21 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *)
(** OCamlbuild extension, copied from
(** OCamlbuild extension, copied from
* http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild
* by N. Pouillard and others
*
* Updated on 2009/02/28
*
* Modified by Sylvain Le Gall
* Modified by Sylvain Le Gall
*)
open Ocamlbuild_plugin
(* these functions are not really officially exported *)
let run_and_read =
let run_and_read =
Ocamlbuild_pack.My_unix.run_and_read
let blank_sep_strings =
let blank_sep_strings =
Ocamlbuild_pack.Lexers.blank_sep_strings
let split s ch =
let x =
ref []
let buf = Buffer.create 13 in
let x = ref [] in
let flush () =
x := (Buffer.contents buf) :: !x;
Buffer.clear buf
in
let rec go s =
let pos =
String.index s ch
in
x := (String.before s pos)::!x;
go (String.after s (pos + 1))
in
try
go s
with Not_found -> !x
String.iter
(fun c ->
if c = ch then
flush ()
else
Buffer.add_char buf c)
s;
flush ();
List.rev !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 *)
(* ocamlfind command *)
let ocamlfind x =
let ocamlfind_prog =
let env_filename = Pathname.basename BaseEnvLight.default_filename in
let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in
try
BaseEnvLight.var_get "ocamlfind" env
with Not_found ->
Printf.eprintf "W: Cannot get variable ocamlfind";
"ocamlfind"
in
S[Sh ocamlfind_prog; x]
(* 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. *)
(* Mock to list available syntaxes. *)
let find_syntaxes () = ["camlp4o"; "camlp4r"]
(* ocamlfind command *)
let ocamlfind x = S[A"ocamlfind"; x]
let dispatch =
function
| Before_options ->
(* by using Before_options one let command line options have an higher priority *)
(* on the contrary using After_options will guarantee to have the higher priority *)
(* override default commands by ocamlfind ones *)
(* By using Before_options one let command line options have an higher
* priority on the contrary using After_options will guarantee to have
* the higher priority override default commands by ocamlfind ones *)
Options.ocamlc := ocamlfind & A"ocamlc";
Options.ocamlopt := ocamlfind & A"ocamlopt";
Options.ocamldep := ocamlfind & A"ocamldep";
Options.ocamldoc := ocamlfind & A"ocamldoc";
Options.ocamlmktop := ocamlfind & A"ocamlmktop"
Options.ocamlmktop := ocamlfind & A"ocamlmktop";
Options.ocamlmklib := ocamlfind & A"ocamlmklib"
| After_rules ->
(* When one link an OCaml library/binary/package, one should use -linkpkg *)
(* When one link an OCaml library/binary/package, one should use
* -linkpkg *)
flag ["ocaml"; "link"; "program"] & A"-linkpkg";
(* For each ocamlfind package one inject the -package option when
* compiling, computing dependencies, generating documentation and
* linking. *)
List.iter
List.iter
begin fun pkg ->
flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg];
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg];
flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg];
flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg];
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg];
end
let base_args = [A"-package"; A pkg] in
let syn_args = [A"-syntax"; A "camlp4o"] in
let args =
(* Heuristic to identify syntax extensions: whether they end in
* ".syntax"; some might not *)
if Filename.check_suffix pkg "syntax"
then syn_args @ base_args
else base_args
in
flag ["ocaml"; "compile"; "pkg_"^pkg] & S args;
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args;
flag ["ocaml"; "doc"; "pkg_"^pkg] & S args;
flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args;
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args;
end
(find_packages ());
(* Like -package but for extensions syntax. Morover -syntax is useless
@ -301,29 +353,34 @@ module MyOCamlbuildFindlib = struct
flag ["ocaml"; "compile"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
flag ["ocaml"; "ocamldep"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax];
flag ["ocaml"; "infer_interface"; "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
* ocamlfind, this module will then be added twice on the command line.
*
*
* To solve this, one approach is to add the "-thread" option when using
* the "threads" package using the previous plugin.
*)
flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]);
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"])
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]);
flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]);
flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]);
| _ ->
| _ ->
()
end
module MyOCamlbuildBase = struct
(* # 21 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
(** Base functions for writing myocamlbuild.ml
@author Sylvain Le Gall
@ -331,51 +388,61 @@ module MyOCamlbuildBase = struct
open Ocamlbuild_plugin
module OC = Ocamlbuild_pack.Ocaml_compiler
type dir = string
type file = string
type name = string
type tag = string
(* # 56 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
(* # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *)
type t =
{
lib_ocaml: (name * dir list) list;
lib_c: (name * dir * file list) list;
lib_ocaml: (name * dir list * string list) list;
lib_c: (name * dir * file list) list;
flags: (tag list * (spec OASISExpr.choices)) list;
(* Replace the 'dir: include' from _tags by a precise interdepends in
* directory.
*)
includes: (dir * dir list) list;
includes: (dir * dir list) list;
}
let env_filename =
Pathname.basename
Pathname.basename
BaseEnvLight.default_filename
let dispatch_combine lst =
fun e ->
List.iter
List.iter
(fun dispatch -> dispatch e)
lst
lst
let tag_libstubs nm =
"use_lib"^nm^"_stubs"
let nm_libstubs nm =
nm^"_stubs"
let dispatch t e =
let env =
BaseEnvLight.load
~filename:env_filename
let dispatch t e =
let env =
BaseEnvLight.load
~filename:env_filename
~allow_empty:true
()
in
match e with
match e with
| Before_options ->
let no_trailing_dot s =
if String.length s >= 1 && s.[0] = '.' then
@ -385,7 +452,7 @@ module MyOCamlbuildBase = struct
in
List.iter
(fun (opt, var) ->
try
try
opt := no_trailing_dot (BaseEnvLight.var_get var env)
with Not_found ->
Printf.eprintf "W: Cannot get variable %s" var)
@ -395,25 +462,34 @@ module MyOCamlbuildBase = struct
Options.ext_dll, "ext_dll";
]
| After_rules ->
| After_rules ->
(* Declare OCaml libraries *)
List.iter
List.iter
(function
| nm, [] ->
ocaml_lib nm
| nm, dir :: tl ->
| nm, [], intf_modules ->
ocaml_lib nm;
let cmis =
List.map (fun m -> (String.uncapitalize m) ^ ".cmi")
intf_modules in
dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis
| nm, dir :: tl, intf_modules ->
ocaml_lib ~dir:dir (dir^"/"^nm);
List.iter
(fun dir ->
List.iter
(fun dir ->
List.iter
(fun str ->
flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir]))
["compile"; "infer_interface"; "doc"])
tl)
tl;
let cmis =
List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi")
intf_modules in
dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"]
cmis)
t.lib_ocaml;
(* Declare directories dependencies, replace "include" in _tags. *)
List.iter
List.iter
(fun (dir, include_dirs) ->
Pathname.define_context dir include_dirs)
t.includes;
@ -428,7 +504,7 @@ module MyOCamlbuildBase = struct
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))]);
@ -443,11 +519,11 @@ module MyOCamlbuildBase = struct
(* TODO: be more specific about what depends on headers *)
(* Depends on .h files *)
dep ["compile"; "c"]
dep ["compile"; "c"]
headers;
(* Setup search path for lib *)
flag ["link"; "ocaml"; "use_"^lib]
flag ["link"; "ocaml"; "use_"^lib]
(S[A"-I"; P(dir)]);
)
t.lib_c;
@ -455,43 +531,45 @@ module MyOCamlbuildBase = struct
(* Add flags *)
List.iter
(fun (tags, cond_specs) ->
let spec =
let spec =
BaseEnvLight.var_choose cond_specs env
in
flag tags & spec)
t.flags
| _ ->
| _ ->
()
let dispatch_default t =
dispatch_combine
dispatch_combine
[
dispatch t;
MyOCamlbuildFindlib.dispatch;
]
end
# 476 "myocamlbuild.ml"
# 554 "myocamlbuild.ml"
open Ocamlbuild_plugin;;
let package_default =
{
MyOCamlbuildBase.lib_ocaml =
[
("containers", []);
("containers_thread", []);
("containers_lwt", []);
("containers_cgi", [])
("containers", [], []);
("containers_thread", [], []);
("containers_lwt", [], []);
("containers_cgi", ["cgi"], [])
];
lib_c = [];
flags = [];
includes = [];
}
includes = [("examples/cgi", ["cgi"])]
}
;;
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;;
# 496 "myocamlbuild.ml"
# 574 "myocamlbuild.ml"
(* OASIS_STOP *)
Ocamlbuild_plugin.dispatch dispatch_default;;

1670
setup.ml

File diff suppressed because it is too large Load diff