Revision 719f9992
Makefile | ||
---|---|---|
1 | 1 |
# OASIS_START |
2 |
# DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb)
|
|
2 |
# DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954)
|
|
3 | 3 |
|
4 | 4 |
SETUP = ocaml setup.ml |
5 | 5 |
|
... | ... | |
12 | 12 |
test: setup.data build |
13 | 13 |
$(SETUP) -test $(TESTFLAGS) |
14 | 14 |
|
15 |
all:
|
|
15 |
all: |
|
16 | 16 |
$(SETUP) -all $(ALLFLAGS) |
17 | 17 |
|
18 | 18 |
install: setup.data |
... | ... | |
24 | 24 |
reinstall: setup.data |
25 | 25 |
$(SETUP) -reinstall $(REINSTALLFLAGS) |
26 | 26 |
|
27 |
clean:
|
|
27 |
clean: |
|
28 | 28 |
$(SETUP) -clean $(CLEANFLAGS) |
29 | 29 |
|
30 |
distclean:
|
|
30 |
distclean: |
|
31 | 31 |
$(SETUP) -distclean $(DISTCLEANFLAGS) |
32 | 32 |
|
33 | 33 |
setup.data: |
34 | 34 |
$(SETUP) -configure $(CONFIGUREFLAGS) |
35 | 35 |
|
36 |
configure: |
|
37 |
$(SETUP) -configure $(CONFIGUREFLAGS) |
|
38 |
|
|
36 | 39 |
.PHONY: build doc test all install uninstall reinstall clean distclean configure |
37 | 40 |
|
38 | 41 |
# OASIS_STOP |
_tags | ||
---|---|---|
1 | 1 |
# OASIS_START |
2 |
# DO NOT EDIT (digest: 98bcbc21d29d2f6266238c1025fff223)
|
|
3 |
# Ignore VCS directories, you can use the same kind of rule outside
|
|
4 |
# OASIS_START/STOP if you want to exclude directories that contains
|
|
2 |
# DO NOT EDIT (digest: df9189c6c6943133cb99a2bb11ba7f05)
|
|
3 |
# Ignore VCS directories, you can use the same kind of rule outside |
|
4 |
# OASIS_START/STOP if you want to exclude directories that contains |
|
5 | 5 |
# useless stuff for the build process |
6 | 6 |
<**/.svn>: -traverse |
7 | 7 |
<**/.svn>: not_hygienic |
configure | ||
---|---|---|
1 | 1 |
#!/bin/sh |
2 | 2 |
|
3 | 3 |
# OASIS_START |
4 |
# DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7)
|
|
4 |
# DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499)
|
|
5 | 5 |
set -e |
6 | 6 |
|
7 | 7 |
FST=true |
8 |
for i in "$@"; do
|
|
8 |
for i in "$@"; do |
|
9 | 9 |
if $FST; then |
10 | 10 |
set -- |
11 | 11 |
FST=false |
myocamlbuild.ml | ||
---|---|---|
1 | 1 |
(* OASIS_START *) |
2 |
(* DO NOT EDIT (digest: 00359f2e15a7ed8f31f1d7ce086345f9) *)
|
|
2 |
(* DO NOT EDIT (digest: 5a9a2168dcb86db37476d58b8c0e25b3) *)
|
|
3 | 3 |
module OASISGettext = struct |
4 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISGettext.ml" *) |
|
4 |
(* # 22 "src/oasis/OASISGettext.ml" *) |
|
5 |
|
|
5 | 6 |
|
6 | 7 |
let ns_ str = |
7 | 8 |
str |
8 | 9 |
|
10 |
|
|
9 | 11 |
let s_ str = |
10 | 12 |
str |
11 | 13 |
|
12 |
let f_ (str : ('a, 'b, 'c, 'd) format4) = |
|
14 |
|
|
15 |
let f_ (str: ('a, 'b, 'c, 'd) format4) = |
|
13 | 16 |
str |
14 | 17 |
|
18 |
|
|
15 | 19 |
let fn_ fmt1 fmt2 n = |
16 | 20 |
if n = 1 then |
17 | 21 |
fmt1^^"" |
18 | 22 |
else |
19 | 23 |
fmt2^^"" |
20 | 24 |
|
25 |
|
|
21 | 26 |
let init = |
22 | 27 |
[] |
23 | 28 |
|
29 |
|
|
24 | 30 |
end |
25 | 31 |
|
26 | 32 |
module OASISExpr = struct |
27 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISExpr.ml" *) |
|
33 |
(* # 22 "src/oasis/OASISExpr.ml" *) |
|
34 |
|
|
35 |
|
|
28 | 36 |
|
29 | 37 |
|
30 | 38 |
|
31 | 39 |
open OASISGettext |
32 | 40 |
|
33 |
type test = string |
|
34 | 41 |
|
35 |
type flag = string |
|
42 |
type test = string |
|
43 |
|
|
44 |
|
|
45 |
type flag = string |
|
46 |
|
|
36 | 47 |
|
37 | 48 |
type t = |
38 | 49 |
| EBool of bool |
... | ... | |
41 | 52 |
| EOr of t * t |
42 | 53 |
| EFlag of flag |
43 | 54 |
| ETest of test * string |
44 |
|
|
45 | 55 |
|
46 |
type 'a choices = (t * 'a) list |
|
56 |
|
|
57 |
|
|
58 |
type 'a choices = (t * 'a) list |
|
59 |
|
|
47 | 60 |
|
48 | 61 |
let eval var_get t = |
49 | 62 |
let rec eval' = |
... | ... | |
75 | 88 |
in |
76 | 89 |
eval' t |
77 | 90 |
|
91 |
|
|
78 | 92 |
let choose ?printer ?name var_get lst = |
79 | 93 |
let rec choose_aux = |
80 | 94 |
function |
... | ... | |
111 | 125 |
in |
112 | 126 |
choose_aux (List.rev lst) |
113 | 127 |
|
128 |
|
|
114 | 129 |
end |
115 | 130 |
|
116 | 131 |
|
117 |
# 117 "myocamlbuild.ml"
|
|
132 |
# 132 "myocamlbuild.ml"
|
|
118 | 133 |
module BaseEnvLight = struct |
119 |
(* # 21 "/build/buildd/oasis-0.3.0/src/base/BaseEnvLight.ml" *) |
|
134 |
(* # 22 "src/base/BaseEnvLight.ml" *) |
|
135 |
|
|
120 | 136 |
|
121 | 137 |
module MapString = Map.Make(String) |
122 | 138 |
|
139 |
|
|
123 | 140 |
type t = string MapString.t |
124 | 141 |
|
142 |
|
|
125 | 143 |
let default_filename = |
126 | 144 |
Filename.concat |
127 | 145 |
(Sys.getcwd ()) |
128 | 146 |
"setup.data" |
129 | 147 |
|
148 |
|
|
130 | 149 |
let load ?(allow_empty=false) ?(filename=default_filename) () = |
131 | 150 |
if Sys.file_exists filename then |
132 | 151 |
begin |
... | ... | |
184 | 203 |
filename) |
185 | 204 |
end |
186 | 205 |
|
187 |
let var_get name env = |
|
188 |
let rec var_expand str = |
|
189 |
let buff = |
|
190 |
Buffer.create ((String.length str) * 2) |
|
191 |
in |
|
192 |
Buffer.add_substitute |
|
193 |
buff |
|
194 |
(fun var -> |
|
195 |
try |
|
196 |
var_expand (MapString.find var env) |
|
197 |
with Not_found -> |
|
198 |
failwith |
|
199 |
(Printf.sprintf |
|
200 |
"No variable %s defined when trying to expand %S." |
|
201 |
var |
|
202 |
str)) |
|
203 |
str; |
|
204 |
Buffer.contents buff |
|
206 |
|
|
207 |
let rec var_expand str env = |
|
208 |
let buff = |
|
209 |
Buffer.create ((String.length str) * 2) |
|
205 | 210 |
in |
206 |
var_expand (MapString.find name env) |
|
211 |
Buffer.add_substitute |
|
212 |
buff |
|
213 |
(fun var -> |
|
214 |
try |
|
215 |
var_expand (MapString.find var env) env |
|
216 |
with Not_found -> |
|
217 |
failwith |
|
218 |
(Printf.sprintf |
|
219 |
"No variable %s defined when trying to expand %S." |
|
220 |
var |
|
221 |
str)) |
|
222 |
str; |
|
223 |
Buffer.contents buff |
|
224 |
|
|
225 |
|
|
226 |
let var_get name env = |
|
227 |
var_expand (MapString.find name env) env |
|
228 |
|
|
207 | 229 |
|
208 | 230 |
let var_choose lst env = |
209 | 231 |
OASISExpr.choose |
... | ... | |
212 | 234 |
end |
213 | 235 |
|
214 | 236 |
|
215 |
# 215 "myocamlbuild.ml"
|
|
237 |
# 237 "myocamlbuild.ml"
|
|
216 | 238 |
module MyOCamlbuildFindlib = struct |
217 |
(* # 21 "/build/buildd/oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *) |
|
239 |
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" *) |
|
240 |
|
|
218 | 241 |
|
219 |
(** OCamlbuild extension, copied from
|
|
242 |
(** OCamlbuild extension, copied from |
|
220 | 243 |
* http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild |
221 | 244 |
* by N. Pouillard and others |
222 | 245 |
* |
223 | 246 |
* Updated on 2009/02/28 |
224 | 247 |
* |
225 |
* Modified by Sylvain Le Gall
|
|
248 |
* Modified by Sylvain Le Gall |
|
226 | 249 |
*) |
227 | 250 |
open Ocamlbuild_plugin |
228 | 251 |
|
252 |
|
|
229 | 253 |
(* these functions are not really officially exported *) |
230 |
let run_and_read =
|
|
254 |
let run_and_read = |
|
231 | 255 |
Ocamlbuild_pack.My_unix.run_and_read |
232 | 256 |
|
233 |
let blank_sep_strings = |
|
257 |
|
|
258 |
let blank_sep_strings = |
|
234 | 259 |
Ocamlbuild_pack.Lexers.blank_sep_strings |
235 | 260 |
|
236 |
let split s ch = |
|
237 |
let x = |
|
238 |
ref [] |
|
261 |
|
|
262 |
let exec_from_conf exec = |
|
263 |
let exec = |
|
264 |
let env_filename = Pathname.basename BaseEnvLight.default_filename in |
|
265 |
let env = BaseEnvLight.load ~filename:env_filename ~allow_empty:true () in |
|
266 |
try |
|
267 |
BaseEnvLight.var_get exec env |
|
268 |
with Not_found -> |
|
269 |
Printf.eprintf "W: Cannot get variable %s\n" exec; |
|
270 |
exec |
|
271 |
in |
|
272 |
let fix_win32 str = |
|
273 |
if Sys.os_type = "Win32" then begin |
|
274 |
let buff = Buffer.create (String.length str) in |
|
275 |
(* Adapt for windowsi, ocamlbuild + win32 has a hard time to handle '\\'. |
|
276 |
*) |
|
277 |
String.iter |
|
278 |
(fun c -> Buffer.add_char buff (if c = '\\' then '/' else c)) |
|
279 |
str; |
|
280 |
Buffer.contents buff |
|
281 |
end else begin |
|
282 |
str |
|
283 |
end |
|
239 | 284 |
in |
240 |
let rec go s = |
|
241 |
let pos = |
|
242 |
String.index s ch |
|
243 |
in |
|
244 |
x := (String.before s pos)::!x; |
|
245 |
go (String.after s (pos + 1)) |
|
285 |
fix_win32 exec |
|
286 |
|
|
287 |
let split s ch = |
|
288 |
let buf = Buffer.create 13 in |
|
289 |
let x = ref [] in |
|
290 |
let flush () = |
|
291 |
x := (Buffer.contents buf) :: !x; |
|
292 |
Buffer.clear buf |
|
246 | 293 |
in |
247 |
try |
|
248 |
go s |
|
249 |
with Not_found -> !x |
|
294 |
String.iter |
|
295 |
(fun c -> |
|
296 |
if c = ch then |
|
297 |
flush () |
|
298 |
else |
|
299 |
Buffer.add_char buf c) |
|
300 |
s; |
|
301 |
flush (); |
|
302 |
List.rev !x |
|
303 |
|
|
250 | 304 |
|
251 | 305 |
let split_nl s = split s '\n' |
252 | 306 |
|
307 |
|
|
253 | 308 |
let before_space s = |
254 | 309 |
try |
255 | 310 |
String.before s (String.index s ' ') |
256 | 311 |
with Not_found -> s |
257 | 312 |
|
258 |
(* this lists all supported packages *) |
|
313 |
(* ocamlfind command *) |
|
314 |
let ocamlfind x = S[Sh (exec_from_conf "ocamlfind"); x] |
|
315 |
|
|
316 |
(* This lists all supported packages. *) |
|
259 | 317 |
let find_packages () = |
260 | 318 |
List.map before_space (split_nl & run_and_read "ocamlfind list") |
261 | 319 |
|
262 |
(* this is supposed to list available syntaxes, but I don't know how to do it. *) |
|
320 |
|
|
321 |
(* Mock to list available syntaxes. *) |
|
263 | 322 |
let find_syntaxes () = ["camlp4o"; "camlp4r"] |
264 | 323 |
|
265 |
(* ocamlfind command *) |
|
266 |
let ocamlfind x = S[A"ocamlfind"; x] |
|
324 |
|
|
325 |
let well_known_syntax = [ |
|
326 |
"camlp4.quotations.o"; |
|
327 |
"camlp4.quotations.r"; |
|
328 |
"camlp4.exceptiontracer"; |
|
329 |
"camlp4.extend"; |
|
330 |
"camlp4.foldgenerator"; |
|
331 |
"camlp4.listcomprehension"; |
|
332 |
"camlp4.locationstripper"; |
|
333 |
"camlp4.macro"; |
|
334 |
"camlp4.mapgenerator"; |
|
335 |
"camlp4.metagenerator"; |
|
336 |
"camlp4.profiler"; |
|
337 |
"camlp4.tracer" |
|
338 |
] |
|
339 |
|
|
267 | 340 |
|
268 | 341 |
let dispatch = |
269 | 342 |
function |
270 |
| Before_options ->
|
|
271 |
(* by using Before_options one let command line options have an higher priority *)
|
|
272 |
(* on the contrary using After_options will guarantee to have the higher priority *)
|
|
273 |
(* override default commands by ocamlfind ones *)
|
|
343 |
| After_options ->
|
|
344 |
(* By using Before_options one let command line options have an higher
|
|
345 |
* priority on the contrary using After_options will guarantee to have
|
|
346 |
* the higher priority override default commands by ocamlfind ones *)
|
|
274 | 347 |
Options.ocamlc := ocamlfind & A"ocamlc"; |
275 | 348 |
Options.ocamlopt := ocamlfind & A"ocamlopt"; |
276 | 349 |
Options.ocamldep := ocamlfind & A"ocamldep"; |
277 | 350 |
Options.ocamldoc := ocamlfind & A"ocamldoc"; |
278 |
Options.ocamlmktop := ocamlfind & A"ocamlmktop" |
|
279 |
|
|
351 |
Options.ocamlmktop := ocamlfind & A"ocamlmktop"; |
|
352 |
Options.ocamlmklib := ocamlfind & A"ocamlmklib" |
|
353 |
|
|
280 | 354 |
| After_rules -> |
281 |
|
|
282 |
(* When one link an OCaml library/binary/package, one should use -linkpkg *) |
|
355 |
|
|
356 |
(* When one link an OCaml library/binary/package, one should use |
|
357 |
* -linkpkg *) |
|
283 | 358 |
flag ["ocaml"; "link"; "program"] & A"-linkpkg"; |
284 |
|
|
359 |
|
|
285 | 360 |
(* For each ocamlfind package one inject the -package option when |
286 | 361 |
* compiling, computing dependencies, generating documentation and |
287 | 362 |
* linking. *) |
288 |
List.iter
|
|
363 |
List.iter |
|
289 | 364 |
begin fun pkg -> |
290 |
flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
291 |
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
292 |
flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
293 |
flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
294 |
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg]; |
|
295 |
end |
|
365 |
let base_args = [A"-package"; A pkg] in |
|
366 |
(* TODO: consider how to really choose camlp4o or camlp4r. *) |
|
367 |
let syn_args = [A"-syntax"; A "camlp4o"] in |
|
368 |
let args = |
|
369 |
(* Heuristic to identify syntax extensions: whether they end in |
|
370 |
".syntax"; some might not. |
|
371 |
*) |
|
372 |
if Filename.check_suffix pkg "syntax" || |
|
373 |
List.mem pkg well_known_syntax then |
|
374 |
syn_args @ base_args |
|
375 |
else |
|
376 |
base_args |
|
377 |
in |
|
378 |
flag ["ocaml"; "compile"; "pkg_"^pkg] & S args; |
|
379 |
flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args; |
|
380 |
flag ["ocaml"; "doc"; "pkg_"^pkg] & S args; |
|
381 |
flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args; |
|
382 |
flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args; |
|
383 |
end |
|
296 | 384 |
(find_packages ()); |
297 | 385 |
|
298 | 386 |
(* Like -package but for extensions syntax. Morover -syntax is useless |
... | ... | |
301 | 389 |
flag ["ocaml"; "compile"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
302 | 390 |
flag ["ocaml"; "ocamldep"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
303 | 391 |
flag ["ocaml"; "doc"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
304 |
flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & S[A"-syntax"; A syntax]; |
|
392 |
flag ["ocaml"; "infer_interface"; "syntax_"^syntax] & |
|
393 |
S[A"-syntax"; A syntax]; |
|
305 | 394 |
end (find_syntaxes ()); |
306 | 395 |
|
307 | 396 |
(* The default "thread" tag is not compatible with ocamlfind. |
308 | 397 |
* Indeed, the default rules add the "threads.cma" or "threads.cmxa" |
309 | 398 |
* options when using this tag. When using the "-linkpkg" option with |
310 | 399 |
* ocamlfind, this module will then be added twice on the command line. |
311 |
*
|
|
400 |
* |
|
312 | 401 |
* To solve this, one approach is to add the "-thread" option when using |
313 | 402 |
* the "threads" package using the previous plugin. |
314 | 403 |
*) |
315 | 404 |
flag ["ocaml"; "pkg_threads"; "compile"] (S[A "-thread"]); |
316 | 405 |
flag ["ocaml"; "pkg_threads"; "doc"] (S[A "-I"; A "+threads"]); |
317 | 406 |
flag ["ocaml"; "pkg_threads"; "link"] (S[A "-thread"]); |
318 |
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]) |
|
407 |
flag ["ocaml"; "pkg_threads"; "infer_interface"] (S[A "-thread"]); |
|
408 |
flag ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]); |
|
409 |
flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]); |
|
410 |
flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]); |
|
411 |
flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]); |
|
319 | 412 |
|
320 |
| _ ->
|
|
413 |
| _ -> |
|
321 | 414 |
() |
322 |
|
|
323 | 415 |
end |
324 | 416 |
|
325 | 417 |
module MyOCamlbuildBase = struct |
326 |
(* # 21 "/build/buildd/oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
418 |
(* # 22 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
419 |
|
|
327 | 420 |
|
328 | 421 |
(** Base functions for writing myocamlbuild.ml |
329 | 422 |
@author Sylvain Le Gall |
... | ... | |
331 | 424 |
|
332 | 425 |
|
333 | 426 |
|
427 |
|
|
428 |
|
|
334 | 429 |
open Ocamlbuild_plugin |
335 | 430 |
module OC = Ocamlbuild_pack.Ocaml_compiler |
336 | 431 |
|
337 |
type dir = string |
|
338 |
type file = string |
|
339 |
type name = string |
|
340 |
type tag = string |
|
341 | 432 |
|
342 |
(* # 56 "/build/buildd/oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
433 |
type dir = string |
|
434 |
type file = string |
|
435 |
type name = string |
|
436 |
type tag = string |
|
437 |
|
|
438 |
|
|
439 |
(* # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" *) |
|
440 |
|
|
343 | 441 |
|
344 | 442 |
type t = |
345 | 443 |
{ |
346 |
lib_ocaml: (name * dir list) list; |
|
347 |
lib_c: (name * dir * file list) list;
|
|
444 |
lib_ocaml: (name * dir list * string list) list;
|
|
445 |
lib_c: (name * dir * file list) list; |
|
348 | 446 |
flags: (tag list * (spec OASISExpr.choices)) list; |
349 | 447 |
(* Replace the 'dir: include' from _tags by a precise interdepends in |
350 | 448 |
* directory. |
351 | 449 |
*) |
352 |
includes: (dir * dir list) list; |
|
353 |
} |
|
450 |
includes: (dir * dir list) list; |
|
451 |
} |
|
452 |
|
|
354 | 453 |
|
355 | 454 |
let env_filename = |
356 |
Pathname.basename
|
|
455 |
Pathname.basename |
|
357 | 456 |
BaseEnvLight.default_filename |
358 | 457 |
|
458 |
|
|
359 | 459 |
let dispatch_combine lst = |
360 | 460 |
fun e -> |
361 |
List.iter
|
|
461 |
List.iter |
|
362 | 462 |
(fun dispatch -> dispatch e) |
363 |
lst |
|
463 |
lst |
|
464 |
|
|
364 | 465 |
|
365 | 466 |
let tag_libstubs nm = |
366 | 467 |
"use_lib"^nm^"_stubs" |
367 | 468 |
|
469 |
|
|
368 | 470 |
let nm_libstubs nm = |
369 | 471 |
nm^"_stubs" |
370 | 472 |
|
371 |
let dispatch t e = |
|
372 |
let env = |
|
373 |
BaseEnvLight.load |
|
374 |
~filename:env_filename |
|
473 |
|
|
474 |
let dispatch t e = |
|
475 |
let env = |
|
476 |
BaseEnvLight.load |
|
477 |
~filename:env_filename |
|
375 | 478 |
~allow_empty:true |
376 | 479 |
() |
377 | 480 |
in |
378 |
match e with
|
|
481 |
match e with |
|
379 | 482 |
| Before_options -> |
380 | 483 |
let no_trailing_dot s = |
381 | 484 |
if String.length s >= 1 && s.[0] = '.' then |
... | ... | |
385 | 488 |
in |
386 | 489 |
List.iter |
387 | 490 |
(fun (opt, var) -> |
388 |
try
|
|
491 |
try |
|
389 | 492 |
opt := no_trailing_dot (BaseEnvLight.var_get var env) |
390 | 493 |
with Not_found -> |
391 |
Printf.eprintf "W: Cannot get variable %s" var) |
|
494 |
Printf.eprintf "W: Cannot get variable %s\n" var)
|
|
392 | 495 |
[ |
393 | 496 |
Options.ext_obj, "ext_obj"; |
394 | 497 |
Options.ext_lib, "ext_lib"; |
395 | 498 |
Options.ext_dll, "ext_dll"; |
396 | 499 |
] |
397 | 500 |
|
398 |
| After_rules ->
|
|
501 |
| After_rules -> |
|
399 | 502 |
(* Declare OCaml libraries *) |
400 |
List.iter
|
|
503 |
List.iter |
|
401 | 504 |
(function |
402 |
| nm, [] -> |
|
403 |
ocaml_lib nm |
|
404 |
| nm, dir :: tl -> |
|
505 |
| nm, [], intf_modules -> |
|
506 |
ocaml_lib nm; |
|
507 |
let cmis = |
|
508 |
List.map (fun m -> (String.uncapitalize m) ^ ".cmi") |
|
509 |
intf_modules in |
|
510 |
dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis |
|
511 |
| nm, dir :: tl, intf_modules -> |
|
405 | 512 |
ocaml_lib ~dir:dir (dir^"/"^nm); |
406 |
List.iter
|
|
407 |
(fun dir ->
|
|
513 |
List.iter |
|
514 |
(fun dir -> |
|
408 | 515 |
List.iter |
409 | 516 |
(fun str -> |
410 | 517 |
flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir])) |
411 | 518 |
["compile"; "infer_interface"; "doc"]) |
412 |
tl) |
|
519 |
tl; |
|
520 |
let cmis = |
|
521 |
List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi") |
|
522 |
intf_modules in |
|
523 |
dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"] |
|
524 |
cmis) |
|
413 | 525 |
t.lib_ocaml; |
414 | 526 |
|
415 | 527 |
(* Declare directories dependencies, replace "include" in _tags. *) |
416 |
List.iter
|
|
528 |
List.iter |
|
417 | 529 |
(fun (dir, include_dirs) -> |
418 | 530 |
Pathname.define_context dir include_dirs) |
419 | 531 |
t.includes; |
... | ... | |
428 | 540 |
|
429 | 541 |
flag ["link"; "library"; "ocaml"; "native"; tag_libstubs lib] |
430 | 542 |
(S[A"-cclib"; A("-l"^(nm_libstubs lib))]); |
431 |
|
|
543 |
|
|
432 | 544 |
flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib] |
433 | 545 |
(S[A"-dllib"; A("dll"^(nm_libstubs lib))]); |
434 | 546 |
|
... | ... | |
443 | 555 |
|
444 | 556 |
(* TODO: be more specific about what depends on headers *) |
445 | 557 |
(* Depends on .h files *) |
446 |
dep ["compile"; "c"]
|
|
558 |
dep ["compile"; "c"] |
|
447 | 559 |
headers; |
448 | 560 |
|
449 | 561 |
(* Setup search path for lib *) |
450 |
flag ["link"; "ocaml"; "use_"^lib]
|
|
562 |
flag ["link"; "ocaml"; "use_"^lib] |
|
451 | 563 |
(S[A"-I"; P(dir)]); |
452 | 564 |
) |
453 | 565 |
t.lib_c; |
... | ... | |
455 | 567 |
(* Add flags *) |
456 | 568 |
List.iter |
457 | 569 |
(fun (tags, cond_specs) -> |
458 |
let spec = |
|
459 |
BaseEnvLight.var_choose cond_specs env |
|
570 |
let spec = BaseEnvLight.var_choose cond_specs env in |
|
571 |
let rec eval_specs = |
|
572 |
function |
|
573 |
| S lst -> S (List.map eval_specs lst) |
|
574 |
| A str -> A (BaseEnvLight.var_expand str env) |
|
575 |
| spec -> spec |
|
460 | 576 |
in |
461 |
flag tags & spec)
|
|
577 |
flag tags & (eval_specs spec))
|
|
462 | 578 |
t.flags |
463 |
| _ ->
|
|
579 |
| _ -> |
|
464 | 580 |
() |
465 | 581 |
|
582 |
|
|
466 | 583 |
let dispatch_default t = |
467 |
dispatch_combine
|
|
584 |
dispatch_combine |
|
468 | 585 |
[ |
469 | 586 |
dispatch t; |
470 | 587 |
MyOCamlbuildFindlib.dispatch; |
471 | 588 |
] |
472 | 589 |
|
590 |
|
|
473 | 591 |
end |
474 | 592 |
|
475 | 593 |
|
476 |
# 476 "myocamlbuild.ml"
|
|
594 |
# 594 "myocamlbuild.ml"
|
|
477 | 595 |
open Ocamlbuild_plugin;; |
478 | 596 |
let package_default = |
479 |
{MyOCamlbuildBase.lib_ocaml = []; lib_c = []; flags = []; includes = []; }
|
|
597 |
{MyOCamlbuildBase.lib_ocaml = []; lib_c = []; flags = []; includes = []} |
|
480 | 598 |
;; |
481 | 599 |
|
482 | 600 |
let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; |
483 | 601 |
|
484 |
# 485 "myocamlbuild.ml"
|
|
602 |
# 603 "myocamlbuild.ml"
|
|
485 | 603 |
(* OASIS_STOP *) |
486 | 604 |
Ocamlbuild_plugin.dispatch dispatch_default;; |
setup.ml | ||
---|---|---|
1 | 1 |
(* setup.ml generated for the first time by OASIS v0.2.0 *) |
2 | 2 |
|
3 | 3 |
(* OASIS_START *) |
4 |
(* DO NOT EDIT (digest: 243f7ef4ca5fa7182acbe98e77d9c7f4) *)
|
|
4 |
(* DO NOT EDIT (digest: d0957d7fdd9eb6ce163190fb18a724b8) *)
|
|
5 | 5 |
(* |
6 |
Regenerated by OASIS v0.3.0
|
|
6 |
Regenerated by OASIS v0.4.4
|
|
7 | 7 |
Visit http://oasis.forge.ocamlcore.org for more information and |
8 | 8 |
documentation about functions used in this file. |
9 | 9 |
*) |
10 | 10 |
module OASISGettext = struct |
11 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISGettext.ml" *) |
|
11 |
(* # 22 "src/oasis/OASISGettext.ml" *) |
|
12 |
|
|
12 | 13 |
|
13 | 14 |
let ns_ str = |
14 | 15 |
str |
15 | 16 |
|
17 |
|
|
16 | 18 |
let s_ str = |
17 | 19 |
str |
18 | 20 |
|
19 |
let f_ (str : ('a, 'b, 'c, 'd) format4) = |
|
21 |
|
|
22 |
let f_ (str: ('a, 'b, 'c, 'd) format4) = |
|
20 | 23 |
str |
21 | 24 |
|
25 |
|
|
22 | 26 |
let fn_ fmt1 fmt2 n = |
23 | 27 |
if n = 1 then |
24 | 28 |
fmt1^^"" |
25 | 29 |
else |
26 | 30 |
fmt2^^"" |
27 | 31 |
|
32 |
|
|
28 | 33 |
let init = |
29 | 34 |
[] |
30 | 35 |
|
36 |
|
|
31 | 37 |
end |
32 | 38 |
|
33 | 39 |
module OASISContext = struct |
34 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISContext.ml" *) |
|
40 |
(* # 22 "src/oasis/OASISContext.ml" *) |
|
41 |
|
|
35 | 42 |
|
36 | 43 |
open OASISGettext |
37 | 44 |
|
45 |
|
|
38 | 46 |
type level = |
39 | 47 |
[ `Debug |
40 | 48 |
| `Info |
41 | 49 |
| `Warning |
42 | 50 |
| `Error] |
43 | 51 |
|
52 |
|
|
44 | 53 |
type t = |
45 | 54 |
{ |
55 |
(* TODO: replace this by a proplist. *) |
|
46 | 56 |
quiet: bool; |
47 | 57 |
info: bool; |
48 | 58 |
debug: bool; |
... | ... | |
51 | 61 |
printf: level -> string -> unit; |
52 | 62 |
} |
53 | 63 |
|
64 |
|
|
54 | 65 |
let printf lvl str = |
55 | 66 |
let beg = |
56 | 67 |
match lvl with |
... | ... | |
61 | 72 |
in |
62 | 73 |
prerr_endline (beg^str) |
63 | 74 |
|
75 |
|
|
64 | 76 |
let default = |
65 | 77 |
ref |
66 | 78 |
{ |
... | ... | |
72 | 84 |
printf = printf; |
73 | 85 |
} |
74 | 86 |
|
87 |
|
|
75 | 88 |
let quiet = |
76 | 89 |
{!default with quiet = true} |
77 | 90 |
|
78 | 91 |
|
79 |
let args () = |
|
92 |
let fspecs () = |
|
93 |
(* TODO: don't act on default. *) |
|
94 |
let ignore_plugins = ref false in |
|
80 | 95 |
["-quiet", |
81 | 96 |
Arg.Unit (fun () -> default := {!default with quiet = true}), |
82 |
(s_ " Run quietly");
|
|
97 |
s_ " Run quietly";
|
|
83 | 98 |
|
84 | 99 |
"-info", |
85 | 100 |
Arg.Unit (fun () -> default := {!default with info = true}), |
86 |
(s_ " Display information message");
|
|
101 |
s_ " Display information message";
|
|
87 | 102 |
|
88 | 103 |
|
89 | 104 |
"-debug", |
90 | 105 |
Arg.Unit (fun () -> default := {!default with debug = true}), |
91 |
(s_ " Output debug message")] |
|
106 |
s_ " Output debug message"; |
|
107 |
|
|
108 |
"-ignore-plugins", |
|
109 |
Arg.Set ignore_plugins, |
|
110 |
s_ " Ignore plugin's field."; |
|
111 |
|
|
112 |
"-C", |
|
113 |
(* TODO: remove this chdir. *) |
|
114 |
Arg.String (fun str -> Sys.chdir str), |
|
115 |
s_ "dir Change directory before running."], |
|
116 |
fun () -> {!default with ignore_plugins = !ignore_plugins} |
|
92 | 117 |
end |
93 | 118 |
|
94 | 119 |
module OASISString = struct |
95 |
(* # 1 "/build/buildd/oasis-0.3.0/src/oasis/OASISString.ml" *) |
|
96 |
|
|
120 |
(* # 22 "src/oasis/OASISString.ml" *) |
|
97 | 121 |
|
98 | 122 |
|
99 | 123 |
(** Various string utilities. |
100 |
|
|
124 |
|
|
101 | 125 |
Mostly inspired by extlib and batteries ExtString and BatString libraries. |
102 | 126 |
|
103 | 127 |
@author Sylvain Le Gall |
104 | 128 |
*) |
105 | 129 |
|
130 |
|
|
106 | 131 |
let nsplitf str f = |
107 | 132 |
if str = "" then |
108 | 133 |
[] |
... | ... | |
123 | 148 |
push (); |
124 | 149 |
List.rev !lst |
125 | 150 |
|
151 |
|
|
126 | 152 |
(** [nsplit c s] Split the string [s] at char [c]. It doesn't include the |
127 | 153 |
separator. |
128 | 154 |
*) |
129 | 155 |
let nsplit str c = |
130 | 156 |
nsplitf str ((=) c) |
131 | 157 |
|
158 |
|
|
132 | 159 |
let find ~what ?(offset=0) str = |
133 | 160 |
let what_idx = ref 0 in |
134 |
let str_idx = ref offset in
|
|
135 |
while !str_idx < String.length str &&
|
|
161 |
let str_idx = ref offset in |
|
162 |
while !str_idx < String.length str && |
|
136 | 163 |
!what_idx < String.length what do |
137 | 164 |
if str.[!str_idx] = what.[!what_idx] then |
138 | 165 |
incr what_idx |
... | ... | |
142 | 169 |
done; |
143 | 170 |
if !what_idx <> String.length what then |
144 | 171 |
raise Not_found |
145 |
else
|
|
172 |
else |
|
146 | 173 |
!str_idx - !what_idx |
147 | 174 |
|
148 |
let sub_start str len = |
|
175 |
|
|
176 |
let sub_start str len = |
|
149 | 177 |
let str_len = String.length str in |
150 | 178 |
if len >= str_len then |
151 | 179 |
"" |
152 | 180 |
else |
153 | 181 |
String.sub str len (str_len - len) |
154 | 182 |
|
183 |
|
|
155 | 184 |
let sub_end ?(offset=0) str len = |
156 | 185 |
let str_len = String.length str in |
157 | 186 |
if len >= str_len then |
... | ... | |
159 | 188 |
else |
160 | 189 |
String.sub str 0 (str_len - len) |
161 | 190 |
|
191 |
|
|
162 | 192 |
let starts_with ~what ?(offset=0) str = |
163 | 193 |
let what_idx = ref 0 in |
164 | 194 |
let str_idx = ref offset in |
165 | 195 |
let ok = ref true in |
166 | 196 |
while !ok && |
167 |
!str_idx < String.length str &&
|
|
197 |
!str_idx < String.length str && |
|
168 | 198 |
!what_idx < String.length what do |
169 | 199 |
if str.[!str_idx] = what.[!what_idx] then |
170 | 200 |
incr what_idx |
... | ... | |
174 | 204 |
done; |
175 | 205 |
if !what_idx = String.length what then |
176 | 206 |
true |
177 |
else
|
|
207 |
else |
|
178 | 208 |
false |
179 | 209 |
|
210 |
|
|
180 | 211 |
let strip_starts_with ~what str = |
181 | 212 |
if starts_with ~what str then |
182 | 213 |
sub_start str (String.length what) |
183 | 214 |
else |
184 | 215 |
raise Not_found |
185 | 216 |
|
217 |
|
|
186 | 218 |
let ends_with ~what ?(offset=0) str = |
187 | 219 |
let what_idx = ref ((String.length what) - 1) in |
188 | 220 |
let str_idx = ref ((String.length str) - 1) in |
189 | 221 |
let ok = ref true in |
190 | 222 |
while !ok && |
191 |
offset <= !str_idx &&
|
|
223 |
offset <= !str_idx && |
|
192 | 224 |
0 <= !what_idx do |
193 | 225 |
if str.[!str_idx] = what.[!what_idx] then |
194 | 226 |
decr what_idx |
... | ... | |
198 | 230 |
done; |
199 | 231 |
if !what_idx = -1 then |
200 | 232 |
true |
201 |
else
|
|
233 |
else |
|
202 | 234 |
false |
203 | 235 |
|
236 |
|
|
204 | 237 |
let strip_ends_with ~what str = |
205 | 238 |
if ends_with ~what str then |
206 | 239 |
sub_end str (String.length what) |
207 | 240 |
else |
208 | 241 |
raise Not_found |
209 | 242 |
|
243 |
|
|
210 | 244 |
let replace_chars f s = |
211 | 245 |
let buf = String.make (String.length s) 'X' in |
212 | 246 |
for i = 0 to String.length s - 1 do |
... | ... | |
214 | 248 |
done; |
215 | 249 |
buf |
216 | 250 |
|
251 |
|
|
217 | 252 |
end |
218 | 253 |
|
219 | 254 |
module OASISUtils = struct |
220 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISUtils.ml" *) |
|
255 |
(* # 22 "src/oasis/OASISUtils.ml" *) |
|
256 |
|
|
221 | 257 |
|
222 | 258 |
open OASISGettext |
223 | 259 |
|
224 |
module MapString = Map.Make(String) |
|
225 | 260 |
|
226 |
let map_string_of_assoc assoc = |
|
227 |
List.fold_left |
|
228 |
(fun acc (k, v) -> MapString.add k v acc) |
|
229 |
MapString.empty |
|
230 |
assoc |
|
261 |
module MapExt = |
|
262 |
struct |
|
263 |
module type S = |
|
264 |
sig |
|
265 |
include Map.S |
|
266 |
val add_list: 'a t -> (key * 'a) list -> 'a t |
|
267 |
val of_list: (key * 'a) list -> 'a t |
|
268 |
val to_list: 'a t -> (key * 'a) list |
|
269 |
end |
|
270 |
|
|
271 |
module Make (Ord: Map.OrderedType) = |
|
272 |
struct |
|
273 |
include Map.Make(Ord) |
|
274 |
|
|
275 |
let rec add_list t = |
|
276 |
function |
|
277 |
| (k, v) :: tl -> add_list (add k v t) tl |
|
278 |
| [] -> t |
|
231 | 279 |
|
232 |
module SetString = Set.Make(String)
|
|
280 |
let of_list lst = add_list empty lst
|
|
233 | 281 |
|
234 |
let set_string_add_list st lst = |
|
235 |
List.fold_left |
|
236 |
(fun acc e -> SetString.add e acc) |
|
237 |
st |
|
238 |
lst |
|
282 |
let to_list t = fold (fun k v acc -> (k, v) :: acc) t [] |
|
283 |
end |
|
284 |
end |
|
285 |
|
|
286 |
|
|
287 |
module MapString = MapExt.Make(String) |
|
288 |
|
|
289 |
|
|
290 |
module SetExt = |
|
291 |
struct |
|
292 |
module type S = |
|
293 |
sig |
|
294 |
include Set.S |
|
295 |
val add_list: t -> elt list -> t |
|
296 |
val of_list: elt list -> t |
|
297 |
val to_list: t -> elt list |
|
298 |
end |
|
299 |
|
|
300 |
module Make (Ord: Set.OrderedType) = |
|
301 |
struct |
|
302 |
include Set.Make(Ord) |
|
303 |
|
|
304 |
let rec add_list t = |
|
305 |
function |
|
306 |
| e :: tl -> add_list (add e t) tl |
|
307 |
| [] -> t |
|
239 | 308 |
|
240 |
let set_string_of_list = |
|
241 |
set_string_add_list |
|
242 |
SetString.empty |
|
309 |
let of_list lst = add_list empty lst |
|
310 |
|
|
311 |
let to_list = elements |
|
312 |
end |
|
313 |
end |
|
314 |
|
|
315 |
|
|
316 |
module SetString = SetExt.Make(String) |
|
243 | 317 |
|
244 | 318 |
|
245 | 319 |
let compare_csl s1 s2 = |
246 | 320 |
String.compare (String.lowercase s1) (String.lowercase s2) |
247 | 321 |
|
322 |
|
|
248 | 323 |
module HashStringCsl = |
249 | 324 |
Hashtbl.Make |
250 | 325 |
(struct |
... | ... | |
257 | 332 |
Hashtbl.hash (String.lowercase s) |
258 | 333 |
end) |
259 | 334 |
|
335 |
module SetStringCsl = |
|
336 |
SetExt.Make |
|
337 |
(struct |
|
338 |
type t = string |
|
339 |
let compare = compare_csl |
|
340 |
end) |
|
341 |
|
|
342 |
|
|
260 | 343 |
let varname_of_string ?(hyphen='_') s = |
261 | 344 |
if String.length s = 0 then |
262 | 345 |
begin |
... | ... | |
287 | 370 |
String.lowercase buf |
288 | 371 |
end |
289 | 372 |
|
373 |
|
|
290 | 374 |
let varname_concat ?(hyphen='_') p s = |
291 | 375 |
let what = String.make 1 hyphen in |
292 | 376 |
let p = |
... | ... | |
307 | 391 |
let is_varname str = |
308 | 392 |
str = varname_of_string str |
309 | 393 |
|
394 |
|
|
310 | 395 |
let failwithf fmt = Printf.ksprintf failwith fmt |
311 | 396 |
|
397 |
|
|
312 | 398 |
end |
313 | 399 |
|
314 | 400 |
module PropList = struct |
315 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/PropList.ml" *) |
|
401 |
(* # 22 "src/oasis/PropList.ml" *) |
|
402 |
|
|
316 | 403 |
|
317 | 404 |
open OASISGettext |
318 | 405 |
|
406 |
|
|
319 | 407 |
type name = string |
320 | 408 |
|
409 |
|
|
321 | 410 |
exception Not_set of name * string option |
322 | 411 |
exception No_printer of name |
323 | 412 |
exception Unknown_field of name * name |
324 | 413 |
|
414 |
|
|
325 | 415 |
let () = |
326 | 416 |
Printexc.register_printer |
327 | 417 |
(function |
328 | 418 |
| Not_set (nm, Some rsn) -> |
329 |
Some
|
|
419 |
Some |
|
330 | 420 |
(Printf.sprintf (f_ "Field '%s' is not set: %s") nm rsn) |
331 | 421 |
| Not_set (nm, None) -> |
332 |
Some
|
|
422 |
Some |
|
333 | 423 |
(Printf.sprintf (f_ "Field '%s' is not set") nm) |
334 | 424 |
| No_printer nm -> |
335 | 425 |
Some |
336 | 426 |
(Printf.sprintf (f_ "No default printer for value %s") nm) |
337 | 427 |
| Unknown_field (nm, schm) -> |
338 |
Some |
|
339 |
(Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm) |
|
428 |
Some |
|
429 |
(Printf.sprintf |
|
430 |
(f_ "Field %s is not defined in schema %s") nm schm) |
|
340 | 431 |
| _ -> |
341 | 432 |
None) |
342 | 433 |
|
434 |
|
|
343 | 435 |
module Data = |
344 | 436 |
struct |
345 |
|
|
346 | 437 |
type t = |
347 | 438 |
(name, unit -> unit) Hashtbl.t |
348 | 439 |
|
... | ... | |
352 | 443 |
let clear t = |
353 | 444 |
Hashtbl.clear t |
354 | 445 |
|
355 |
(* # 71 "/build/buildd/oasis-0.3.0/src/oasis/PropList.ml" *) |
|
446 |
|
|
447 |
(* # 78 "src/oasis/PropList.ml" *) |
|
356 | 448 |
end |
357 | 449 |
|
450 |
|
|
358 | 451 |
module Schema = |
359 | 452 |
struct |
360 |
|
|
361 | 453 |
type ('ctxt, 'extra) value = |
362 | 454 |
{ |
363 | 455 |
get: Data.t -> string; |
... | ... | |
445 | 537 |
t.name |
446 | 538 |
end |
447 | 539 |
|
540 |
|
|
448 | 541 |
module Field = |
449 | 542 |
struct |
450 |
|
|
451 | 543 |
type ('ctxt, 'value, 'extra) t = |
452 | 544 |
{ |
453 | 545 |
set: Data.t -> ?context:'ctxt -> 'value -> unit; |
... | ... | |
577 | 669 |
|
578 | 670 |
let fgets data t = |
579 | 671 |
t.gets data |
580 |
|
|
581 | 672 |
end |
582 | 673 |
|
674 |
|
|
583 | 675 |
module FieldRO = |
584 | 676 |
struct |
585 |
|
|
586 | 677 |
let create ?schema ?name ?parse ?print ?default ?update ?help extra = |
587 | 678 |
let fld = |
588 | 679 |
Field.create ?schema ?name ?parse ?print ?default ?update ?help extra |
589 | 680 |
in |
590 | 681 |
fun data -> Field.fget data fld |
591 |
|
|
592 | 682 |
end |
593 | 683 |
end |
594 | 684 |
|
595 | 685 |
module OASISMessage = struct |
596 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISMessage.ml" *)
|
|
686 |
(* # 22 "src/oasis/OASISMessage.ml" *)
|
|
597 | 687 |
|
598 | 688 |
|
599 | 689 |
open OASISGettext |
600 | 690 |
open OASISContext |
601 | 691 |
|
692 |
|
|
602 | 693 |
let generic_message ~ctxt lvl fmt = |
603 | 694 |
let cond = |
604 | 695 |
if ctxt.quiet then |
... | ... | |
617 | 708 |
end) |
618 | 709 |
fmt |
619 | 710 |
|
711 |
|
|
620 | 712 |
let debug ~ctxt fmt = |
621 | 713 |
generic_message ~ctxt `Debug fmt |
622 | 714 |
|
715 |
|
|
623 | 716 |
let info ~ctxt fmt = |
624 | 717 |
generic_message ~ctxt `Info fmt |
625 | 718 |
|
719 |
|
|
626 | 720 |
let warning ~ctxt fmt = |
627 | 721 |
generic_message ~ctxt `Warning fmt |
628 | 722 |
|
723 |
|
|
629 | 724 |
let error ~ctxt fmt = |
630 | 725 |
generic_message ~ctxt `Error fmt |
631 | 726 |
|
632 | 727 |
end |
633 | 728 |
|
634 | 729 |
module OASISVersion = struct |
635 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISVersion.ml" *) |
|
730 |
(* # 22 "src/oasis/OASISVersion.ml" *) |
|
731 |
|
|
636 | 732 |
|
637 | 733 |
open OASISGettext |
638 | 734 |
|
639 | 735 |
|
640 | 736 |
|
737 |
|
|
738 |
|
|
641 | 739 |
type s = string |
642 | 740 |
|
643 |
type t = string |
|
741 |
|
|
742 |
type t = string |
|
743 |
|
|
644 | 744 |
|
645 | 745 |
type comparator = |
646 | 746 |
| VGreater of t |
... | ... | |
650 | 750 |
| VLesserEqual of t |
651 | 751 |
| VOr of comparator * comparator |
652 | 752 |
| VAnd of comparator * comparator |
653 |
|
|
753 |
|
|
754 |
|
|
654 | 755 |
|
655 | 756 |
(* Range of allowed characters *) |
656 | 757 |
let is_digit c = |
657 | 758 |
'0' <= c && c <= '9' |
658 | 759 |
|
760 |
|
|
659 | 761 |
let is_alpha c = |
660 | 762 |
('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') |
661 | 763 |
|
764 |
|
|
662 | 765 |
let is_special = |
663 | 766 |
function |
664 | 767 |
| '.' | '+' | '-' | '~' -> true |
665 | 768 |
| _ -> false |
666 | 769 |
|
770 |
|
|
667 | 771 |
let rec version_compare v1 v2 = |
668 | 772 |
if v1 <> "" || v2 <> "" then |
669 | 773 |
begin |
... | ... | |
707 | 811 |
while !p < String.length v && is_digit v.[!p] do |
708 | 812 |
incr p |
709 | 813 |
done; |
710 |
let substr =
|
|
814 |
let substr = |
|
711 | 815 |
String.sub v !p ((String.length v) - !p) |
712 |
in
|
|
713 |
let res =
|
|
714 |
match String.sub v start_p (!p - start_p) with
|
|
816 |
in |
|
817 |
let res = |
|
818 |
match String.sub v start_p (!p - start_p) with |
|
715 | 819 |
| "" -> 0 |
716 | 820 |
| s -> int_of_string s |
717 | 821 |
in |
... | ... | |
747 | 851 |
|
748 | 852 |
let version_of_string str = str |
749 | 853 |
|
854 |
|
|
750 | 855 |
let string_of_version t = t |
751 | 856 |
|
857 |
|
|
858 |
let version_compare_string s1 s2 = |
|
859 |
version_compare (version_of_string s1) (version_of_string s2) |
|
860 |
|
|
861 |
|
|
752 | 862 |
let chop t = |
753 | 863 |
try |
754 | 864 |
let pos = |
... | ... | |
758 | 868 |
with Not_found -> |
759 | 869 |
t |
760 | 870 |
|
871 |
|
|
761 | 872 |
let rec comparator_apply v op = |
762 | 873 |
match op with |
763 | 874 |
| VGreater cv -> |
... | ... | |
775 | 886 |
| VAnd (op1, op2) -> |
776 | 887 |
(comparator_apply v op1) && (comparator_apply v op2) |
777 | 888 |
|
889 |
|
|
778 | 890 |
let rec string_of_comparator = |
779 | 891 |
function |
780 | 892 |
| VGreater v -> "> "^(string_of_version v) |
... | ... | |
787 | 899 |
| VAnd (c1, c2) -> |
788 | 900 |
(string_of_comparator c1)^" && "^(string_of_comparator c2) |
789 | 901 |
|
902 |
|
|
790 | 903 |
let rec varname_of_comparator = |
791 | 904 |
let concat p v = |
792 | 905 |
OASISUtils.varname_concat |
... | ... | |
805 | 918 |
| VAnd (c1, c2) -> |
806 | 919 |
(varname_of_comparator c1)^"_and_"^(varname_of_comparator c2) |
807 | 920 |
|
808 |
let version_0_3_or_after t = |
|
809 |
comparator_apply t (VGreaterEqual (string_of_version "0.3")) |
|
921 |
|
|
922 |
let rec comparator_ge v' = |
|
923 |
let cmp v = version_compare v v' >= 0 in |
|
924 |
function |
|
925 |
| VEqual v |
|
926 |
| VGreaterEqual v |
|
927 |
| VGreater v -> cmp v |
|
928 |
| VLesserEqual _ |
|
929 |
| VLesser _ -> false |
|
930 |
| VOr (c1, c2) -> comparator_ge v' c1 || comparator_ge v' c2 |
|
931 |
| VAnd (c1, c2) -> comparator_ge v' c1 && comparator_ge v' c2 |
|
932 |
|
|
810 | 933 |
|
811 | 934 |
end |
812 | 935 |
|
813 | 936 |
module OASISLicense = struct |
814 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISLicense.ml" *) |
|
937 |
(* # 22 "src/oasis/OASISLicense.ml" *) |
|
938 |
|
|
815 | 939 |
|
816 | 940 |
(** License for _oasis fields |
817 | 941 |
@author Sylvain Le Gall |
... | ... | |
819 | 943 |
|
820 | 944 |
|
821 | 945 |
|
822 |
type license = string |
|
823 | 946 |
|
824 |
type license_exception = string |
|
947 |
|
|
948 |
type license = string |
|
949 |
|
|
950 |
|
|
951 |
type license_exception = string |
|
952 |
|
|
825 | 953 |
|
826 | 954 |
type license_version = |
827 | 955 |
| Version of OASISVersion.t |
828 | 956 |
| VersionOrLater of OASISVersion.t |
829 | 957 |
| NoVersion |
830 |
|
|
958 |
|
|
959 |
|
|
831 | 960 |
|
832 | 961 |
type license_dep_5_unit = |
833 | 962 |
{ |
... | ... | |
835 | 964 |
excption: license_exception option; |
836 | 965 |
version: license_version; |
837 | 966 |
} |
838 |
|
|
967 |
|
|
968 |
|
|
839 | 969 |
|
840 | 970 |
type license_dep_5 = |
841 | 971 |
| DEP5Unit of license_dep_5_unit |
842 | 972 |
| DEP5Or of license_dep_5 list |
843 | 973 |
| DEP5And of license_dep_5 list |
844 |
|
|
974 |
|
|
845 | 975 |
|
846 | 976 |
type t = |
847 | 977 |
| DEP5License of license_dep_5 |
848 | 978 |
| OtherLicense of string (* URL *) |
849 |
|
|
979 |
|
|
980 |
|
|
850 | 981 |
|
851 | 982 |
end |
852 | 983 |
|
853 | 984 |
module OASISExpr = struct |
854 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISExpr.ml" *) |
|
985 |
(* # 22 "src/oasis/OASISExpr.ml" *) |
|
986 |
|
|
987 |
|
|
855 | 988 |
|
856 | 989 |
|
857 | 990 |
|
858 | 991 |
open OASISGettext |
859 | 992 |
|
860 |
type test = string |
|
861 | 993 |
|
862 |
type flag = string |
|
994 |
type test = string |
|
995 |
|
|
996 |
|
|
997 |
type flag = string |
|
998 |
|
|
863 | 999 |
|
864 | 1000 |
type t = |
865 | 1001 |
| EBool of bool |
... | ... | |
868 | 1004 |
| EOr of t * t |
869 | 1005 |
| EFlag of flag |
870 | 1006 |
| ETest of test * string |
871 |
|
|
872 | 1007 |
|
873 |
type 'a choices = (t * 'a) list |
|
1008 |
|
|
1009 |
|
|
1010 |
type 'a choices = (t * 'a) list |
|
1011 |
|
|
874 | 1012 |
|
875 | 1013 |
let eval var_get t = |
876 | 1014 |
let rec eval' = |
... | ... | |
902 | 1040 |
in |
903 | 1041 |
eval' t |
904 | 1042 |
|
1043 |
|
|
905 | 1044 |
let choose ?printer ?name var_get lst = |
906 | 1045 |
let rec choose_aux = |
907 | 1046 |
function |
... | ... | |
938 | 1077 |
in |
939 | 1078 |
choose_aux (List.rev lst) |
940 | 1079 |
|
1080 |
|
|
1081 |
end |
|
1082 |
|
|
1083 |
module OASISText = struct |
|
1084 |
(* # 22 "src/oasis/OASISText.ml" *) |
|
1085 |
|
|
1086 |
|
|
1087 |
|
|
1088 |
type elt = |
|
1089 |
| Para of string |
|
1090 |
| Verbatim of string |
|
1091 |
| BlankLine |
|
1092 |
|
|
1093 |
|
|
1094 |
type t = elt list |
|
1095 |
|
|
941 | 1096 |
end |
942 | 1097 |
|
943 | 1098 |
module OASISTypes = struct |
944 |
(* # 21 "/build/buildd/oasis-0.3.0/src/oasis/OASISTypes.ml" *) |
|
1099 |
(* # 22 "src/oasis/OASISTypes.ml" *) |
|
1100 |
|
|
1101 |
|
|
1102 |
|
|
945 | 1103 |
|
946 | 1104 |
|
1105 |
type name = string |
|
1106 |
type package_name = string |
|
1107 |
type url = string |
|
1108 |
type unix_dirname = string |
|
1109 |
type unix_filename = string |
|
1110 |
type host_dirname = string |
|
1111 |
type host_filename = string |
|
1112 |
type prog = string |
|
1113 |
type arg = string |
|
1114 |
type args = string list |
|
1115 |
type command_line = (prog * arg list) |
|
947 | 1116 |
|
948 | 1117 |
|
949 |
type name = string |
|
950 |
type package_name = string |
|
951 |
type url = string |
|
952 |
type unix_dirname = string |
|
953 |
type unix_filename = string |
|
954 |
type host_dirname = string |
|
955 |
type host_filename = string |
|
956 |
type prog = string |
|
957 |
type arg = string |
|
958 |
type args = string list |
|
959 |
type command_line = (prog * arg list) |
|
1118 |
type findlib_name = string |
|
1119 |
type findlib_full = string |
|
960 | 1120 |
|
961 |
type findlib_name = string |
|
962 |
type findlib_full = string |
|
963 | 1121 |
|
964 | 1122 |
type compiled_object = |
965 | 1123 |
| Byte |
966 | 1124 |
| Native |
967 | 1125 |
| Best |
968 |
|
|
1126 |
|
|
1127 |
|
|
969 | 1128 |
|
970 | 1129 |
type dependency = |
971 | 1130 |
| FindlibPackage of findlib_full * OASISVersion.comparator option |
972 | 1131 |
| InternalLibrary of name |
973 |
|
|
1132 |
|
|
1133 |
|
|
974 | 1134 |
|
975 | 1135 |
type tool = |
976 | 1136 |
| ExternalTool of name |
977 | 1137 |
| InternalExecutable of name |
978 |
|
|
1138 |
|
|
1139 |
|
|
979 | 1140 |
|
980 | 1141 |
type vcs = |
981 | 1142 |
| Darcs |
... | ... | |
987 | 1148 |
| Arch |
988 | 1149 |
| Monotone |
989 | 1150 |
| OtherVCS of url |
990 |
|
|
1151 |
|
|
1152 |
|
|
991 | 1153 |
|
992 | 1154 |
type plugin_kind = |
993 | 1155 |
[ `Configure |
... | ... | |
998 | 1160 |
| `Extra |
999 | 1161 |
] |
1000 | 1162 |
|
1163 |
|
|
1001 | 1164 |
type plugin_data_purpose = |
1002 | 1165 |
[ `Configure |
Also available in: Unified diff