oasis-0.4.11/0000755000175000017500000000000013261073606012241 5ustar gildorgildoroasis-0.4.11/test/0000755000175000017500000000000013261073606013220 5ustar gildorgildoroasis-0.4.11/test/test-quickstart/0000755000175000017500000000000013261073606016367 5ustar gildorgildoroasis-0.4.11/test/test-quickstart/TestQuickstart.ml0000644000175000017500000003600213261073606021714 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test quickstart subcommand @author Sylvain Le Gall *) open TestCommon open Expect open ExpectPcre open OUnit2 open OASISTypes let () = METAPlugin.init () module MapString = Map.Make(String) let tests = let assert_exit_code_equal exp_list rel = let string_of_exit_code = function | Unix.WEXITED i | Unix.WSIGNALED i | Unix.WSTOPPED i -> string_of_int i in if not (List.mem rel exp_list) then assert_failure (Printf.sprintf "Got exit code %s but expecting exit of to be in list [%s]." (string_of_exit_code rel) (String.concat ", " (List.map string_of_exit_code exp_list))) in let with_quickstart_spawn test_ctxt args f exp_exit_codes = let args = (oasis_args test_ctxt) @ ["-debug"; "quickstart"; "-machine"] @ args in let _, exit_code = try logf test_ctxt `Info "Quickstart command line: %s" (String.concat " " (oasis_exec test_ctxt :: args)); with_spawn ~verbose:true ~verbose_output:(logf test_ctxt `Info "expect: %s") ~timeout:None (oasis_exec test_ctxt) (Array.of_list args) (fun t () -> f t) () with e -> Printexc.print_backtrace stderr; raise e in assert_exit_code_equal exp_exit_codes exit_code in let run_quickstart test_ctxt args qa = with_quickstart_spawn test_ctxt args (fun t -> let rec continue = function | [] -> begin () end | qa -> begin let expectations = let rec expectations' prev next = match next with | (q, a) :: tl -> (* next QA if we chose this answer *) let qa' = List.rev_append prev tl in let q_pat = match q with | "create_section" -> "create a(nother)? section\\? " | "end" -> "What do you want to do now\\?" | "name" -> "'?name'?\\? " | q -> Printf.sprintf "value for field '%s'\\? " q in let q_rex = Pcre.regexp ~flags:[`CASELESS] q_pat in (`Rex q_rex, Some (a, qa')) :: (`Prefix ("???"^q^" "), Some (a, qa')) :: (expectations' ((q, a) :: prev) tl) | [] -> [] in expectations' [] qa in let exp_q = expect t expectations None in match exp_q with | Some (a, qa) -> send t (a^"\n"); continue qa | None -> let assert_msg = Printf.sprintf "expecting questions: %s" (String.concat ", " (List.map (fun (q, _) -> Printf.sprintf "%S" q) qa)) in assert_failure assert_msg end in continue qa; assert_bool "wait for eof" (expect t [`Eof, true] false)) [Unix.WEXITED 0] in let test_of_vector (nm, args, qa, post) = nm >:: (fun test_ctxt -> let tmpdir = bracket_tmpdir test_ctxt in let () = with_bracket_chdir test_ctxt tmpdir (fun test_ctxt -> run_quickstart test_ctxt args qa) in dbug_file_content test_ctxt (Filename.concat tmpdir "_oasis"); (* TODO: rewrite with chdir *) assert_oasis_cli ~ctxt:test_ctxt ["-C"; tmpdir; "check"]; begin try (* TODO: rewrite with chdir *) assert_oasis_cli ~ctxt:test_ctxt ["-C"; tmpdir; "setup"] with _ -> failwith "'oasis setup' failed but 'oasis check' succeed" end; let pkg = OASISParse.from_file ~ctxt:(oasis_ctxt test_ctxt) (Filename.concat tmpdir "_oasis") in post pkg) in let test_simple_qa = [ "name", "test"; "version", "0.0.1"; "synopsis", "test"; "authors", "me"; "license", "GPL-2+"; "plugins", ""; "create_section", "e"; "name", "test"; "path", "./"; "mainis", "test.ml"; "create_section", "n"; "end", "w"; ] in (List.map test_of_vector [ "simple", [], test_simple_qa, (fun pkg -> let () = assert_equal ~msg:"field name" ~printer:(fun s -> s) "test" pkg.name in let sct = try OASISSection.section_find (`Executable, "test") pkg.sections with Not_found -> failwith "Cannot find executable section 'test'" in match sct with | Executable (_, _, exec) -> assert_equal ~msg:"mainis of test" ~printer:(fun s -> s) "test.ml" exec.exec_main_is | _ -> assert false); "custom", ["-level"; "expert"], [ "name", "test"; "version", "0.1"; "synopsis", "test"; "description", "test"; "licensefile", ""; "authors", "me"; "copyrights", "(C) 2010 Me"; "maintainers", ""; "license", "GPL-3"; "ocamlversion", ""; "findlibversion", ""; "conftype", "custom"; "preconfcommand", ""; "postconfcommand", ""; "buildtype", "custom"; "prebuildcommand", ""; "postbuildcommand", ""; "installtype", ""; "preinstallcommand", ""; "postinstallcommand", ""; "preuninstallcommand", ""; "postuninstallcommand", ""; "precleancommand", ""; "postcleancommand", ""; "predistcleancommand", ""; "postdistcleancommand", ""; "homepage", ""; "bugreports", ""; "tags", ""; "categories", ""; "filesab", ""; "plugins", "stdfiles, devfiles, meta"; "builddepends", ""; "buildtools", ""; "create_section", "n"; "end", "w"; "xcustomconf", "./configure"; "xcustomconfclean", ""; "xcustomconfdistclean", "$rm config.log"; "xcustombuild", "make all"; "xcustombuildclean", "make clean"; "xcustombuilddistclean", "make distclean"; "xstdfilesreadme", ""; "xstdfilesreadmefilename", ""; "xstdfilesinstallfilename", ""; "xstdfilesinstall", ""; "xstdfilesauthorsfilename", ""; "xstdfilesauthors", ""; "xdevfilesmakefilenotargets", ""; "xdevfilesenablemakefile", ""; "xdevfilesenableconfigure", ""; "alphafeatures", ""; "betafeatures", ""; ], (fun pkg -> assert_equal ~msg:"field name" ~printer:(fun s -> s) "test" pkg.name); "meta", ["-level"; "expert"], [ "name", "test"; "version", "0.1"; "synopsis", "test"; "description", "test"; "licensefile", ""; "authors", "me"; "copyrights", "(C) 2010 Me"; "maintainers", ""; "license", "GPL-3"; "ocamlversion", ""; "findlibversion", ""; "conftype", ""; "preconfcommand", ""; "postconfcommand", ""; "buildtype", ""; "prebuildcommand", ""; "postbuildcommand", ""; "installtype", ""; "preinstallcommand", ""; "postinstallcommand", ""; "preuninstallcommand", ""; "postuninstallcommand", ""; "precleancommand", ""; "postcleancommand", ""; "predistcleancommand", ""; "postdistcleancommand", ""; "homepage", ""; "bugreports", ""; "tags", ""; "categories", ""; "filesab", ""; "plugins", "stdfiles, meta"; "builddepends", ""; "buildtools", ""; "create_section", "l"; "name", "libtest"; "path", "."; "build", ""; "install", ""; "datafiles", ""; "builddepends", ""; "buildtools", ""; "compiledobject", ""; "csources", ""; "ccopt", ""; "cclib", ""; "dlllib", ""; "dllpath", ""; "byteopt", ""; "nativeopt", ""; "modules", ""; "internalmodules", ""; "pack", ""; "findlibparent", ""; "findlibname", ""; "findlibcontainers", ""; "xmetaenable", ""; "xmetaextralines", ""; "xmetadescription", "this is a test"; "xmetatype", "syntax"; "xmetarequires", "test.syntax"; "create_section", "l"; "name", "libtest2"; "path", "."; "build", ""; "install", ""; "datafiles", ""; "builddepends", ""; "buildtools", ""; "compiledobject", ""; "csources", ""; "ccopt", ""; "cclib", ""; "dlllib", ""; "dllpath", ""; "byteopt", ""; "nativeopt", ""; "modules", ""; "internalmodules", ""; "pack", ""; "findlibparent", "libtest"; "findlibname", ""; "findlibcontainers", ""; "xmetaenable", ""; "xmetaextralines", ""; "xmetadescription", "this is a test v2"; "xmetatype", ""; "xmetarequires", "test.syntax2"; "create_section", "n"; "end", "w"; "xstdfilesreadme", ""; "xstdfilesreadmefilename", "foo"; "xstdfilesinstall", ""; "xstdfilesinstallfilename", "bar"; "xstdfilesauthors", ""; "xstdfilesauthorsfilename", "baz"; "xocamlbuildplugintags", ""; "xocamlbuildextraargs", ""; "alphafeatures", ""; "betafeatures", ""; ], (fun pkg -> let libtest = let res = OASISSection.section_find (`Library, "libtest") pkg.sections in OASISSection.section_common res in let meta = METAPlugin.generator libtest.cs_data in assert_equal ~msg:"field name" ~printer:(fun s -> s) "test" pkg.name; assert_equal ~msg:"field XMETAType" ~printer:(function | METAPlugin.METASyntax -> "syntax" | METAPlugin.METALibrary -> "library") METAPlugin.METASyntax meta.METAPlugin.meta_type; assert_equal ~msg:"field XMETADescription" ~printer:(function | Some s -> s | None -> "") (Some "this is a test") meta.METAPlugin.description; assert_equal ~msg:"field XMETARequires" ~printer:(function | Some lst -> String.concat ", " lst | None -> "") (Some ["test.syntax"]) meta.METAPlugin.requires; ); ]) @ [ "error" >:: (fun test_ctxt -> with_quickstart_spawn test_ctxt [] (fun t -> let q = `Prefix ("???name "), true in assert_equal ~msg:"First question" true (expect t [q] false); send t "\n"; assert_equal ~msg:"Second question" true (expect t [q] false)) [Unix.WEXITED 2; Unix.WSIGNALED ~-8]); ] let () = OASISBuiltinPlugins.init (); run_test_tt_main ~exit ("Quickstart">::: tests) oasis-0.4.11/test/test-omake/0000755000175000017500000000000013261073606015271 5ustar gildorgildoroasis-0.4.11/test/test-omake/TestPluginOMake.ml0000644000175000017500000002321513261073606020641 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open TestCommon open OASISPlugin open TestFullUtils let oasis_omake_files dirs = let files = ["OMakefile"; "_oasis_build.om"; "_oasis_hier.om"; "_oasis_install.om"] in List.flatten (("OMakeroot" :: "_oasis_lib.om" :: files) :: (List.map (fun dn -> List.map (fun bn -> Filename.concat dn bn) files) dirs)) let all_tests = [ "simplelib", (fun test_ctxt t -> oasis_setup test_ctxt t; register_generated_files t (oasis_omake_files ["src"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("simplelib", ["META"; "bar.mli"; "bar.cmi"; "bar.cmx"; "bar.annot"; "bar.cmt"; "bar.cmti"; "foo.mli"; "foo.cmi"; "foo.cmx"; "foo.annot"; "foo.cmt"; "foo.cmti"; "simplelib.cma"; "simplelib.cmxa"; "simplelib.cmxs"; "simplelib.a"]); InstalledAPIRef("simplelib", ["Foo"; "Bar"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "simplelib" ["Foo"]; ); "complex", (fun test_ctxt t -> skip_if true "Still need some to work on details."; oasis_setup test_ctxt t; register_generated_files t (oasis_omake_files ["src"; "src/liba"; "src/libb"; "src/libc_"; "src/libwithc"; "src/exec"; "src/packedlib"]); register_generated_files t ["src/liba/META"; "src/libb/META"; "src/libc_/META"; "src/libwithc/META"; "src/packedlib/META"]; register_installed_files test_ctxt t [ InstalledBin ["exec"]; InstalledOCamlLibrary ("liba", ["META"; "a1.cmx"; "a2.cmi"; "a2.cmx"; "a2.ml"; "a2.cmt"; "a2.annot"; "liba.a"; "liba.cma"; "liba.cmxa"; "liba.cmxs"]); InstalledOCamlLibrary ("libb", ["META"; "B1.cmi"; "B1.cmx"; "B1.ml"; "B1.cmt"; "B1.annot"; "libb.a"; "libb.cma"; "libb.cmxa"; "libb.cmxs"]); InstalledOCamlLibrary ("libc_", ["META"; "c1.cmi"; "c1.cmx"; "c1.mli"; "c1.cmti"; "c1.cmt"; "c1.annot"; "libc_.a"; "libc_.cma"; "libc_.cmxa"; "libc_.cmxs"]); InstalledOCamlLibrary ("libwithc", ["META"; "dlllibwithc_stubs.so"; "liblibwithc_stubs.a"; "libwithc.a"; "libwithc.cma"; "libwithc.cmxa"; "libwithc.cmxs"; "p.cmi"; "p.cmx"; "p.ml"; "p.cmt"; "p.annot"]); InstalledOCamlLibrary ("packedlib", ["META"; "packedlib.a"; "packedlib.cma"; "packedlib.cmi"; "packedlib.cmt"; "packedlib.cmx"; "packedlib.cmxa"; "packedlib.cmxs"; "q.annot"; "q.cmt"; "q.ml"]); InstalledAPIRef("interdepend", ["A1"; "A2"; "B1"; "C1"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "liba" ["A2"]; try_installed_library test_ctxt t "libb" ["B1"]; try_installed_library test_ctxt t "libc_" ["C1"]; try_installed_library test_ctxt t "libwithc" ["P"]; try_installed_library test_ctxt t "packedlib" ["Packedlib"]; ); "bug1736", (fun test_ctxt t -> oasis_setup test_ctxt t; register_generated_files t (oasis_omake_files ["liba"; "libb"]); register_installed_files test_ctxt t [ InstalledBin ["t"]; InstalledOCamlLibrary ("liba", ["META"; "mod1.cmx"; "mod1.cmi"; "mod1.cmt"; "mod1.ml"; "mod1.annot"; "liba.a"; "liba.cma"; "liba.cmxa"; "liba.cmxs"]); InstalledOCamlLibrary ("libb", ["META"; "mod2.cmi"; "mod2.cmx"; "mod2.cmt"; "mod2.ml"; "mod2.annot"; "libb.a"; "libb.cma"; "libb.cmxa"; "libb.cmxs"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "liba" ["Mod1"]; try_installed_library test_ctxt t "libb" ["Mod2"]; try_installed_exec test_ctxt t "t" []; ); "bug1737", (fun test_ctxt t -> oasis_setup test_ctxt t; register_generated_files t (oasis_omake_files ["liba"; "liba/modules" ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("liba", ["META"; "liba.cmi"; "liba.cmx"; "liba.cmt"; "liba.a"; "liba.cma"; "liba.cmxa"; "liba.cmxs" ]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "liba" ["Liba"]; ); "bug1747", (fun test_ctxt t -> oasis_setup test_ctxt t; register_generated_files t (oasis_omake_files ["liba" ]); register_installed_files test_ctxt t [ InstalledBin ["t"]; ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_exec test_ctxt t "t" []; ); "github105", (fun test_ctxt t -> oasis_setup test_ctxt t; register_generated_files t (oasis_omake_files ["liba"; "libb" ]); register_installed_files test_ctxt t [ InstalledBin ["t"]; ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_exec test_ctxt t "t" []; ); ] let gen_test (nm, f) = nm >: (test_case ~length:OUnitTest.Long (fun test_ctxt -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestPluginOMake"; nm]) in f test_ctxt t)) let tests = "Plugin OMake" >::: List.flatten [ [ "generation" >:: (fun test_ctxt -> let generate ?(want_error=false) bn = let dn = in_testdata_dir test_ctxt ["TestPluginOMake"] in let fn = in_testdata_dir test_ctxt ("TestPluginOMake" :: bn) in let pkg = logf test_ctxt `Info "Parsing file %S." fn; OASISParse.from_file ~ctxt:(oasis_ctxt ~ignore_plugin:true test_ctxt) fn in let ctxt, _ = logf test_ctxt `Info "Generating setup using file %S." fn; with_bracket_chdir test_ctxt dn (fun _ -> BaseSetup.of_package ~ctxt:(oasis_ctxt test_ctxt) ~setup_update:false OASISSetupUpdate.NoUpdate pkg) in if want_error && not ctxt.error then assert_failure "Expecting an error during generation, got none." else if not want_error && ctxt.error then assert_failure "Expecting no error during generation, got one." in generate ["simplelib"; "_oasis"]; generate ["bug1736"; "_oasis"]; generate ["bug1747"; "_oasis"]; generate ["github105"; "_oasis"]; generate ~want_error:true ["noocamlversion.oasis"]; generate ~want_error:true ["ocamlversion312.oasis"]; generate ["ocamlversion401.oasis"]; generate ["ocamlversion402.oasis"]); "all_TestPluginOMake" >:: (fun test_ctxt -> all_subdirectories test_ctxt (in_testdata_dir test_ctxt ["TestPluginOMake"]) (List.rev_append ["noocamlversion.oasis"; "ocamlversion312.oasis"; "ocamlversion401.oasis"; "ocamlversion402.oasis"] (List.map fst all_tests)) (Printf.sprintf "test/data/TestOCamlbuild/%s is not tested.")); ]; List.map gen_test all_tests; ] oasis-0.4.11/test/test-omake/TestOMake.ml0000644000175000017500000000366313261073606017467 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Run tests for OASIS @author Sylvain Le Gall *) open OUnit2 let () = let () = OASISBuiltinPlugins.init () in run_test_tt_main ~exit ("OASIS OMake">::: [ (* Keep sorted. *) TestPluginOMake.tests; ]); oasis-0.4.11/test/test-main/0000755000175000017500000000000013261073606015121 5ustar gildorgildoroasis-0.4.11/test/test-main/TestVersion.ml0000644000175000017500000001262213261073606017743 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Tests for BaseVersion @author Sylvain Le Gall *) open OUnit2 open TestCommon open OASISVersion let tests = let vstr_compare v1 v2 = version_compare (version_of_string v1) (version_of_string v2) in let version_compare_of_vector (v1, v2, exp) = (Printf.sprintf "version_compare %S %S" v1 v2) >:: (fun test_ctxt -> let norm_sign i = if i = 0 then 0 else if i < 0 then -1 else 1 in assert_equal ~msg:(Printf.sprintf "Result of '%s' and '%s' comparison" v1 v2) ~printer:string_of_int exp (norm_sign (vstr_compare v1 v2))) in let comparator_apply_of_vector (v, c, exp) = (Printf.sprintf "comparator_apply %S %S" v c) >:: (fun test_ctxt -> let op = comparator_of_string c in assert_equal ~msg:(Printf.sprintf "Result of applying comparator '%s' to '%s'" c v) ~printer:string_of_bool exp (comparator_apply (version_of_string v) op)) in "Version" >::: [ "compare" >::: (List.map version_compare_of_vector [ "1.0.2", "1.0.2", 0; "1.0.1", "1.0.2", -1; "1.0.3", "1.0.2", 1; "0.6.0", "0.7", -1; "1.2.0", "1.2.0~rc1", 1; "1.2.0~rc1", "1.2.0~rc2", -1; "0.1.0", "0.2.0~alpha1", -1; "0.2.0", "0.2.0~alpha1", 1; "2.0beta", "2.0beta", 0; "0.1.1", "0.1.99", -1; ]); "comparator" >::: (List.map comparator_apply_of_vector [ "1.0.2", ">= 1.0.2", true; "1.0.2", "= 1.0.2", true; "1.0.2", "> 1.0.2", false; "1.0.1", ">= 1.0.2", false; "1.0", ">= 1.0 && < 2.0", true; "0.1.1", "< 0.1.99", true; "4.01.0+dev1_2012-03-31", ">= 3.12", true; ]); "sort" >:: (fun test_ctxt -> let lst = ["0.2.0~rc2"; "0.2.0~alpha1"; "0.1.0"; "0.2.0~alpha2"; "0.2.0~beta1"; "0.2.0"] in assert_equal ~printer:(String.concat "; ") ["0.1.0"; "0.2.0~alpha1"; "0.2.0~alpha2"; "0.2.0~beta1"; "0.2.0~rc2"; "0.2.0"] (List.sort vstr_compare lst)); "back-and-forth" >:: (fun test_ctxt -> List.iter (fun str -> let cmp = comparator_of_string str in let cmp' = comparator_of_string (string_of_comparator cmp) in assert_equal ~printer:string_of_comparator cmp cmp') [ ">= 1.0 && <= 2.0 || = 3.0"; "> 0.5"; ]); "reduce" >:: (fun test_ctxt -> List.iter (fun (scmp1, scmp2) -> let cmp1 = comparator_reduce (comparator_of_string scmp1) in let cmp2 = comparator_of_string scmp2 in non_fatal test_ctxt (fun test_ctxt -> assert_equal ~msg:"comparator_reduce2" ~printer:string_of_comparator cmp2 cmp1)) [ ">= 1.0 && >= 0.5", ">= 1.0"; ">= 1.0 || >= 0.5", ">= 0.5"; "= 1.0 || >= 0.5", ">= 0.5"; "= 1.0 && >= 0.5", "= 1.0"; "<= 1.0 && >= 0.5", ">= 0.5 && <= 1.0"; "< 1.0 && >= 0.5", ">= 0.5 && < 1.0"; "< 1.0 && > 0.5", "> 0.5 && < 1.0"; "<= 1.0 && > 0.5", "> 0.5 && <= 1.0"; "( >= 0.1.0 && <= 0.1.99 ) || ( >= 0.1.1 && <= 0.1.1.99 )", ">= 0.1.0 && <= 0.1.99"; ]); ] oasis-0.4.11/test/test-main/TestValues.ml0000644000175000017500000000776313261073606017567 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test OASISValues defined fields @author Sylvain Le Gall *) open Printf open TestCommon open OASISValues open OUnit2 let tests_url = List.map (fun txt -> test_case (fun test_ctxt -> let _a = url.parse ~ctxt:(oasis_ctxt test_ctxt) txt in ())) ["https://oasis.forge.ocamlcore.org"; "svn://scm.ocamlcore.org/svnroot/cryptokit/tags"; "svn+ssh://scm.ocamlcore.org/svnroot/cryptokit/tags"; "http://foo.org/~bar/baz"; "git+ssh://test.com"; ] let tests_command_line_options = List.map (fun (s, r) -> (sprintf "command_line_options: %S" s) >:: (fun test_ctxt -> let p = command_line_options.parse ~ctxt:(oasis_ctxt test_ctxt) s in assert_equal p r)) ["", []; "a", ["a"]; "a b", ["a"; "b"]; "a b c", ["a"; "b"; "c"]; " a b c ", ["a"; "b"; "c"]; "a'b'", ["ab"]; "a 'b'", ["a"; "b"]; "a'b'c", ["abc"]; "a 'b' c", ["a"; "b"; "c"]; "a\"b\"", ["ab"]; "a \"b\"", ["a"; "b"]; "a'b c'", ["ab c"]; "a 'b c'", ["a"; "b c"]; "a\"b c\"", ["ab c"]; "a \"b c\"", ["a"; "b c"]; "a 'b\"'", ["a"; "b\""]; "a \"b\\\"\"", ["a"; "b\""]; "a\"b\\\"\"c", ["ab\"c"]; "a \"b \\\"\" c", ["a"; "b \""; "c"]; "a\\ b c", ["a b"; "c"]; "\\", []; (* corner case, '\\' consisered as continuation char *) "a\\b \"a\\b\"", ["ab"; "a\\b"]; (* \ in quoted strings *) "a\\ b \"a\\b\\\"\"", ["a b"; "a\\b\""]; "a\\ b \"a\\b\\$\"", ["a b"; "a\\b$"]; "a\\$ b \"a\\b\\\\\"", ["a$"; "b"; "a\\b\\"]; (* Substitutions *) "$a11", ["${a11}"]; "${a1}1", ["${a1}1"]; "$(a}b)", ["$(a}b)"]; "${a)b}", ["${a)b}"]; "$(a '}' b)", ["$(a '}' b)"]; (* Real world problem *) "-DEXTERNAL_EXP10 -L/sw/lib \"-framework vecLib\"", ["-DEXTERNAL_EXP10"; "-L/sw/lib"; "-framework vecLib"]; ] let tests_posix_quoting = List.map (fun s -> (sprintf "OASISUtils.POSIXShell: %S" s) >:: (fun _ -> let q = OASISUtils.POSIXShell.escape s in let u = if q.[0] = '"' then let q' = String.sub q 1 (String.length q - 2) in OASISUtils.POSIXShell.unescape q' else q in assert_equal s u)) [""; "a b"; "a'b"; "echo \'abcd"; "a\\b"] let tests = "Values" >::: (tests_url @ tests_command_line_options @ tests_posix_quoting) oasis-0.4.11/test/test-main/TestQuery.ml0000644000175000017500000000705313261073606017425 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Tests the subcommand query of OASIS @author Sylvain Le Gall *) open TestCommon open OUnit2 let tests = let test_of_vector (fn, qa) = let q, a = List.split qa in let test_name = Printf.sprintf "query('%s', %s)" fn (String.concat ", " q) in test_name >:: (fun test_ctxt -> assert_oasis_cli ~ctxt:test_ctxt ~output:((String.concat "\n" a)^"\n") ~unorder:true (["-quiet"; "query"; "-oasis"; in_testdata_dir test_ctxt ["TestQuery"; fn]] @ q)) in "query" >::: (List.map test_of_vector [ "test1.oasis", ["version", "0.0.1"; "name", "oasis"]; "test1.oasis", ["Flag(devmod).Default", "false"; "Library(toto).Path", "src/stuff"; "Executable(toto).MainIs", "toto.ml"]; "test10.oasis", ["ListSections", "Test(main)\nFlag(test)"]; "test10.oasis", ["ListFields", "OASISFormat\ \nName\ \nVersion\ \nSynopsis\ \nLicenseFile\ \nAuthors\ \nCopyrights\ \nMaintainers\ \nLicense\ \nConfType\ \nBuildType\ \nInstallType\ \nCategories\ \nFilesAB\ \nPlugins\ \nBuildDepends\ \nBuildTools\ \nXDevFilesMakefileNoTargets\ \nXDevFilesEnableMakefile\ \nXDevFilesEnableConfigure\ \nXStdFilesREADME\ \nXStdFilesREADMEFilename\ \nXStdFilesINSTALL\ \nXStdFilesINSTALLFilename\ \nXStdFilesAUTHORS\ \nXStdFilesAUTHORSFilename\ \nXOMakeExtraArgs\ \nTags\ \nTest(main).Run\ \nTest(main).Type\ \nTest(main).TestTools\ \nFlag(test).Description"] ]) oasis-0.4.11/test/test-main/TestPropList.ml0000644000175000017500000000462413261073606020075 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Tests for PropList @author Sylvain Le Gall *) open OUnit2 open TestCommon open PropList open PropList.Field let tests = "PropList" >:: (fun test_ctxt -> let toto = Field.create ~default:1 ~parse:(fun ?context s -> int_of_string s) () in let data = Data.create () in let assert_equal_int = assert_equal ~printer:string_of_int in (* Default *) assert_equal_int 1 (fget data toto); (* Assign *) fset data toto 2; assert_equal_int 2 (fget data toto); (* Parse *) fsets data toto "3"; assert_equal_int 3 (fget data toto); ()) oasis-0.4.11/test/test-main/TestPluginStdFiles.ml0000644000175000017500000001165413261073606021216 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test plugin StdFiles @author Sylvain Le Gall *) open OUnit2 open TestCommon open TestFullUtils open OASISPlugin open OASISFileTemplate module Line = struct type t = string let compare = String.compare let pp_printer fmt = Format.fprintf fmt "%S" let pp_print_sep = Format.pp_print_newline end module DiffFileContent = struct include OUnitDiff.ListSimpleMake (Line) let of_file fn = OASISString.split_newline ~do_trim:false (TestCommon.file_content fn) end let file_match_expectation test_ctxt ctxt dn fn = let digest_filter_out = List.filter (fun line -> not (OASISString.contains ~what:"DO NOT EDIT (digest:" line)) in let tmpl = to_string_list (find fn ctxt.files) in logf test_ctxt `Info "File generated %s" fn; List.iter (logf test_ctxt `Info "%s") tmpl; DiffFileContent.assert_equal ~msg:"README.md" (digest_filter_out (DiffFileContent.of_file (Filename.concat dn (fn ^ ".exp")))) (digest_filter_out (DiffFileContent.of_list (tmpl @ [""] (* eol at eof *)))) let tests = "TestPluginStdFiles" >::: [ "markdown" >:: (fun test_ctxt -> (* Parse string to get OASIS package *) let dn = in_testdata_dir test_ctxt ["TestPluginStdFiles"; "oasis"] in let pkg = OASISParse.from_file ~ctxt:(oasis_ctxt test_ctxt) (Filename.concat dn OASISParse.default_oasis_fn) in let ctxt, _ = with_bracket_chdir test_ctxt dn (fun _ -> BaseSetup.of_package ~setup_update:false OASISSetupUpdate.NoUpdate pkg) in file_match_expectation test_ctxt ctxt dn "README.md"; file_match_expectation test_ctxt ctxt dn "INSTALL.md"; file_match_expectation test_ctxt ctxt dn "AUTHORS.md"); "remove-section" >:: (fun test_ctxt -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestPluginStdFiles"; "remove"]) in let pristine_files = all_files t.src_dir in let expected_files = SetFile.remove (in_src_dir t "AUTHORS.txt") (SetFile.add_list pristine_files (List.rev_map (in_src_dir t) ["README.txt"; "INSTALL.txt.bak"])) in FileUtil.cp [in_src_dir t "README.txt.fst"] (in_src_dir t "README.txt"); FileUtil.cp [in_src_dir t "INSTALL.txt.fst"] (in_src_dir t "INSTALL.txt"); FileUtil.cp [in_src_dir t "AUTHORS.txt.fst"] (in_src_dir t "AUTHORS.txt"); assert_oasis_cli ~ctxt:test_ctxt ~chdir:t.src_dir ["setup-clean"; "-remove"]; DiffFileContent.assert_equal ~msg:"INSTALL.txt.bak = INSTALL.txt.fst" (DiffFileContent.of_file (in_src_dir t "INSTALL.txt.bak")) (DiffFileContent.of_file (in_src_dir t "INSTALL.txt.fst")); DiffFileContent.assert_equal ~msg:"README.txt = README.txt.snd" (DiffFileContent.of_file (in_src_dir t "README.txt")) (DiffFileContent.of_file (in_src_dir t "README.txt.snd")); SetFile.assert_equal ~root:t.src_dir expected_files (all_files t.src_dir)); ] oasis-0.4.11/test/test-main/TestPluginOCamlbuild.ml0000644000175000017500000002345713261073606021520 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open FileUtil open OUnit2 open TestCommon open OASISPlugin open OASISFileTemplate open TestFullUtils let all_tests = [ "set-ocamlfind", (fun test_ctxt t -> let () = skip_if (OASISVersion.StringVersion.compare t.ocaml_version "3.12.1" < 0) "OCaml >= 3.12.1 needed." in let real_ocamlfind = FileUtil.which "ocamlfind" in let fake_ocamlfind = Filename.concat t.bin_dir (Filename.basename real_ocamlfind) in let extra_env = ["REAL_OCAMLFIND", real_ocamlfind] in let () = oasis_setup test_ctxt t; FileUtil.cp [fake_ocamlfind_exec test_ctxt] fake_ocamlfind; Unix.chmod fake_ocamlfind 0o755; run_ocaml_setup_ml ~with_ocaml_env:true ~extra_env test_ctxt t ["-configure"] in let env = BaseEnvLight.load ~filename:(in_src_dir t "setup.data") () in let () = assert_equal ~printer:(Printf.sprintf "%S") fake_ocamlfind (BaseEnvLight.var_get "ocamlfind" env); run_ocaml_setup_ml ~extra_env test_ctxt t ["-build"] in let build_log = file_content (in_src_dir t (Filename.concat "_build" "_log")) in logf test_ctxt `Info "%s" build_log; List.iter (fun line -> if OASISString.contains ~what:"ocamlfind" line then assert_bool (Printf.sprintf "line %S should starts with %S" line fake_ocamlfind) (OASISString.starts_with ~what:fake_ocamlfind line)) (OASISString.nsplit build_log '\n')); "use-ocamlfind", (fun test_ctxt t -> oasis_setup test_ctxt t; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-configure"; "--enable-docs"]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-doc"]); (* This test changes a c-source file and asserts that an executable depending on a library which uses this c-file is re-linked properly TODO: reassert that this test fails without the fix in cb96135a TODO: test is flaky. *) "external-c-rebuild", (fun test_ctxt t -> let () = skip_if true "to be fixed" in (* contain c-source code here to avoid any problems with aborted evaluation *) let code_a = "#include \"header.h\"\n\ CAMLprim value oasis_c_build_test_foo(value x) {\n\ CAMLparam1(x);\n\ CAMLreturn(Val_int(42));\n\ }\n" and code_b = "#include \"header.h\"\n\ CAMLprim value oasis_c_build_test_foo(value x) {\n\ CAMLparam1(x);\n\ CAMLreturn(Val_int(23));\n\ }\n" in let c_source = (in_src_dir t "c_source.c") in oasis_setup test_ctxt t; begin let c = open_out c_source in Printf.fprintf c "%s\n" code_a; close_out c end; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-configure" ]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]; (* first, compile and assert everything worked *) assert_bool "File 'B.native' has been created" (Sys.file_exists (in_src_dir t "B.native")); assert_command ~ctxt:test_ctxt ~chdir:t.src_dir ~exit_code:(Unix.WEXITED 42) (in_src_dir t "B.native") []; (* change c-file, rebuild and assert result-code *) begin let c = open_out c_source in Printf.fprintf c "%s\n" code_b; close_out c end; (* uncomment to make this test succeed *) (* run_ocaml_setup_ml ~check_output:true test_ctxt t ["-clean"]; *) run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]; assert_command ~ctxt:test_ctxt ~chdir:t.src_dir ~exit_code:(Unix.WEXITED 23) (in_src_dir t "B.native") [] ); "env-tags", (fun test_ctxt t -> let tests_tag_detected_fn = in_src_dir t "tests-tag-detected" in oasis_setup test_ctxt t; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-configure"; "--enable-tests"]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]; assert_bool "tests-tag-detected should be existed." (Sys.file_exists tests_tag_detected_fn); rm [tests_tag_detected_fn]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-configure"; "--disable-tests"]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]; assert_bool "tests-tag-detected should not be existed." (not (Sys.file_exists tests_tag_detected_fn))); (* This test checks that the "no_automatic_syntax" AlphaFeature doesn't disable the pkg_* flag injection that is necessary for OCaml < 3.12.1 *) "pr63-no-automatic-syntax", (fun test_ctxt t -> oasis_setup test_ctxt t; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-configure"]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]); "pr61-pass-thread-to-C-files", (fun test_ctxt _ -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestPluginOCamlbuild"; "pr61-pass-thread-to-C-files"]) in oasis_setup test_ctxt t; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-configure"]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]); "bug1659-ocamlbuild-support-plugins", (fun test_ctxt _ -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestPluginOCamlbuild"; "bug1659-ocamlbuild-support-plugins"]) in oasis_setup test_ctxt t; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-configure"]; run_ocaml_setup_ml ~check_output:true test_ctxt t ["-build"]); ] let other_tests = [ "missing-source", (fun test_ctxt -> let dn = in_testdata_dir test_ctxt ["TestPluginOCamlbuild"; "missing-source"] in let fn = Filename.concat dn OASISParse.default_oasis_fn in let pkg = OASISParse.from_file ~ctxt:(oasis_ctxt test_ctxt) fn in let ctxt, _ = with_bracket_chdir test_ctxt dn (fun _ -> BaseSetup.of_package ~setup_update:false OASISSetupUpdate.NoUpdate pkg) in let () = assert_bool "No error during generation." (not ctxt.error) in let tmpl = find "test.mllib" ctxt.files in match tmpl.body with | Body lst | BodyWithDigest (_, lst) -> assert_equal ~printer:(fun lst -> String.concat ", " (List.map (Printf.sprintf "%S") lst)) ["A"; "B"; "C"] (List.sort String.compare lst); | NoBody -> assert_failure "No content for test.mllib."); "quote_parametrized_plugin", (fun _ -> ()); ] let gen_test (nm, f) = nm >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestPluginOCamlbuild"; nm]) in f test_ctxt t) let tests = "Plugin OCamlbuild" >::: List.flatten [ [ "all_TestOCamlbuild" >:: (fun test_ctxt -> all_subdirectories test_ctxt (in_testdata_dir test_ctxt ["TestPluginOCamlbuild"]) ((List.map fst all_tests) @ (List.map fst other_tests)) (Printf.sprintf "test/data/TestPluginOCamlbuild/%s is not tested.")); ]; List.map gen_test all_tests; List.map (fun (nm, f) -> nm >:: f) other_tests; ] oasis-0.4.11/test/test-main/TestPluginMETA.ml0000644000175000017500000002011213261073606020214 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test plugin META @author Sylvain Le Gall *) open OUnit2 open TestCommon open Fl_metascanner open OASISTypes open OASISFindlib let tests = let test_of_vector (nm, oasis_str, pkg_tests) = nm >:: (fun test_ctxt -> let fn, _ = bracket_tmpfile ~prefix:"oasis-meta-" ~suffix:".meta" test_ctxt in (* Parse string to get OASIS package *) let pkg = OASISParse.from_string ~ctxt:(oasis_ctxt test_ctxt) oasis_str in (* Generate META file *) let groups, findlib_name_of_library_name, _ = OASISFindlib.findlib_mapping pkg in let write_meta fndlb_nm = let grp = try (* Find the package in all group *) List.find (fun grp -> match grp with | Container (nm, _) | Package (nm, _, _, _, _, _) -> nm = fndlb_nm) groups with Not_found -> failwith (Printf.sprintf "Cannot find group of name '%s'" fndlb_nm) in let chn = open_out fn in let fmt = Format.formatter_of_out_channel chn in let root_t = let root_cs, _, _ = root_of_group grp in METAPlugin.generator root_cs.cs_data in METAPlugin.pp_print_meta pkg root_t findlib_name_of_library_name fmt grp; close_out chn in (* Check META file *) let rec find_pkg_defs pkg_expr = function | hd :: tl -> begin try find_pkg_defs (List.assoc hd pkg_expr.pkg_children) tl with Not_found -> failwith (Printf.sprintf "Could not find subpackage component '%s'" hd) end | [] -> pkg_expr.pkg_defs in let Some (_, _) | None = List.fold_left (fun former_meta (pkg_name, var, preds, res) -> let pkg_root, pkg_paths = match OASISString.nsplit pkg_name '.' with | hd :: tl -> hd, tl | _ -> assert(false) in let pkg_expr = match former_meta with | Some (nm, pkg_expr) when nm = pkg_root -> pkg_expr | _ -> begin let chn = write_meta pkg_root; dbug_file_content test_ctxt fn; open_in fn in let res = parse chn in close_in chn; res end in let pkg_defs = find_pkg_defs pkg_expr pkg_paths in begin let msg = Printf.sprintf "%s %s(%s)" pkg_name var (String.concat "," preds) in try assert_equal ~msg ~printer:(fun s -> s) res (lookup var preds pkg_defs) with Not_found -> failwith (Printf.sprintf "Cannot find META variable '%s'" msg) end; Some (pkg_root, pkg_expr)) None pkg_tests in ()) in "META" >::: (List.map test_of_vector [ (* TODO: move that to files. *) "2-subpackages", "\ OASISFormat: 0.3 Name: ocaml-data-notation Version: 0.0.1 Synopsis: store data using OCaml notation License: LGPL with OCaml linking exception Authors: me Library odn Path: src Modules: ODN Library pa_odn Path: src Modules: Pa_odn FindlibParent: odn XMETADescription: Syntax extension for odn FindlibContainers: with FindlibName: syntax Library pa_noodn Path: src Modules: Pa_noodn FindlibParent: odn XMETADescription: Syntax extension that removes 'with odn' FindlibContainers: without FindlibName: syntax", [ "odn", "archive", ["byte"], "odn.cma"; "odn.with.syntax", "archive", ["byte"], "pa_odn.cma"; "odn.without.syntax", "description", [], "Syntax extension that removes 'with odn'"; ]; "virtual-root", "\ OASISFormat: 0.3 Name: ocaml-data-notation Version: 0.0.1 Synopsis: store data using OCaml notation License: LGPL with OCaml linking exception Authors: me Library odn Path: src Modules: ODN FindlibContainers: myext.toto", [ "myext.toto.odn", "archive", ["byte"], "odn.cma"; ]; "syntax", "\ OASISFormat: 0.3 Name: ocaml-data-notation Version: 0.0.1 Synopsis: store data using OCaml notation License: LGPL with OCaml linking exception Authors: me Library odn Path: src Modules: ODN Library pa_odn Path: src Modules: Pa_odn FindlibParent: odn XMETADescription: Syntax extension for odn XMETAType: syntax XMETARequires: type-conv.syntax, camlp4 FindlibName: syntax", [ "odn.syntax", "archive", ["syntax"; "preprocessor"], "pa_odn.cma"; "odn.syntax", "archive", ["syntax"; "toploop"], "pa_odn.cma"; "odn.syntax", "requires", [], "type-conv.syntax camlp4"; ]; "long-synopsis", "\ OASISFormat: 0.3 Name: ocaml-data-notation Version: 0.0.1 Synopsis: store data using OCaml notation with a very very very very very \ very very long synopsis and with line breaks License: LGPL with OCaml linking exception Authors: me Library odn Path: src Modules: ODN", [ "odn", "archive", ["byte"], "odn.cma"; ]; ]) oasis-0.4.11/test/test-main/TestPluginInternal.ml0000644000175000017500000000727513261073606021261 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open TestFullUtils open TestCommon let tests = "Plugin Internal" >::: [ "feature findlib_directory" >:: (fun test_ctxt -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestPluginInternal"; "findlib_directory"]) in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; register_generated_files t ["META"; "library.mldylib"; "library.mllib"]; register_installed_files test_ctxt t [InstalledOCamlLibrary ("foobar", ["META"; "lib/L.annot"; "lib/L.cmi"; "lib/L.cmt"; "lib/L.cmx"; "lib/L.ml"; "lib/obj/O.cmi"; "lib/obj/O.cmo"; "lib/obj/O.cmx"; "lib/obj/O.ml"; "lib/obj/O.o"; "lib/library.a"; "lib/library.cma"; "lib/library.cmxa"; "lib/library.cmxs"])]; (* Run standard test. *) standard_test test_ctxt t; try_installed_library test_ctxt t "foobar" ["L"]; try_installed_library test_ctxt t "foobar.object" ["O"]); "feature findlib_iextra_files" >:: (fun test_ctxt -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestPluginInternal"; "findlib_extra_files"]) in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; register_generated_files t ["META"; "library.mldylib"; "library.mllib"]; register_installed_files test_ctxt t [InstalledOCamlLibrary ("foobar", ["META"; "L.annot"; "L.cmi"; "L.cmt"; "L.cmx"; "L.ml"; "_oasis"; "library.a"; "library.cma"; "library.cmxa"; "library.cmxs"])]; (* Run standard test. *) standard_test test_ctxt t); ] oasis-0.4.11/test/test-main/TestPluginDevFiles.ml0000644000175000017500000001571313261073606021202 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test the devfiles plugin @author Sylvain Le Gall *) open OUnit2 open FileUtil open TestCommon open TestFullUtils let run_ocaml_setup_ml ?exit_code ?check_output ?(extra_env=[]) test_ctxt t arg args = (* Speed up for testing, compile setup.ml *) let timer = timer_start ("run_ocaml_setup_ml_compiled " ^ arg) in let cmd, args = let args = if arg = "setup.data" then [] else [Printf.sprintf "%sFLAGS=%s" (OASISString.uppercase_ascii arg) (String.concat " " args) ] in "make", (arg :: args) in assert_command ~ctxt:test_ctxt ?exit_code ?check_output ~extra_env ~chdir:t.src_dir cmd args; timer_stop test_ctxt timer let standard_test_compiled test_ctxt t = (* Standard checks. *) standard_checks test_ctxt t; (* Quick test. *) run_ocaml_setup_ml test_ctxt t "all" ["--"; "--override"; "is_native"; string_of_bool t.is_native]; check_myocamlbuild_ml test_ctxt t; (* Distclean. *) run_ocaml_setup_ml test_ctxt t "distclean" []; check_generated_files "after distclean" t; assert_command ~ctxt:test_ctxt ~chdir:t.src_dir "make" ["setup.exe"]; register_generated_files t ["setup.exe"]; check_generated_files "after make setup.exe" t; (* Run configure target *) run_ocaml_setup_ml test_ctxt t "configure" ["--prefix"; t.build_dir; "--docdir"; t.doc_dir; "--htmldir"; t.html_dir; "--override"; "is_native"; string_of_bool t.is_native]; assert_bool "File 'setup.data' has been created" (Sys.file_exists (in_src_dir t "setup.data")); (* Run build target *) run_ocaml_setup_ml test_ctxt t "build" []; (* Clean *) run_ocaml_setup_ml test_ctxt t "clean" []; (* Run build target *) run_ocaml_setup_ml test_ctxt t "build" []; (* Run test target *) run_ocaml_setup_ml test_ctxt t "test" []; (* Run documentation target *) run_ocaml_setup_ml test_ctxt t "doc" []; (* 1st install *) run_ocaml_setup_ml test_ctxt t "install" []; check_installed_files test_ctxt t "1st install"; run_ocaml_setup_ml test_ctxt t "uninstall" []; check_nothing_installed test_ctxt t "1st uninstall"; (* 2nd install *) run_ocaml_setup_ml test_ctxt t "install" []; check_installed_files test_ctxt t "2nd install"; run_ocaml_setup_ml test_ctxt t "uninstall" []; check_nothing_installed test_ctxt t "2nd uninstall"; (* Run install/uninstall target with destdir *) if Sys.os_type <> "Win32" then begin (* Prepending something at the beginning of a Win32 path * doesn't work because it will create a filename like: * c:\a\b\c:\c, which is illegal * TODO: find a solution for DESTDIR on Win32 *) let destdir = bracket_tmpdir test_ctxt in let () = List.iter (fun lst -> mkdir ~parent:true (FilePath.make_filename (destdir :: lst))) [ ["bin"]; ["lib"; "ocaml"]; ["share"; "doc"; "html"] ] in let t = {t with (* This will change OCAMLPATH as well when running setup.ml. *) ocaml_lib_dir = FilePath.make_filename [destdir; "lib"; "ocaml"]} in run_ocaml_setup_ml test_ctxt t ~extra_env:["destdir", destdir] "install" []; assert_equal ~msg:"Same number of files installed with destdir and without." ~printer:string_of_int (SetFile.cardinal t.installed_files) (SetFile.cardinal (all_files destdir)) end; (* 3rd install *) run_ocaml_setup_ml test_ctxt t "reinstall" []; check_installed_files test_ctxt t "3rd install" (* TODO: auto-test installed libraries. *) let gen_tests ~is_native = let setup_test_directories test_ctxt fpath path = setup_test_directories test_ctxt ~is_native ~native_dynlink:(native_dynlink test_ctxt) (fpath test_ctxt path) in [ "DevFiles" >:: (fun test_ctxt -> let tmpdir = bracket_tmpdir test_ctxt in FileUtil.cp [in_testdata_dir test_ctxt ["TestPluginDevFiles"; "test-devfiles1.oasis"]] (Filename.concat tmpdir "_oasis"); assert_oasis_cli ~ctxt:test_ctxt ["-C"; tmpdir; "setup"]; if Sys.os_type <> "Win32" then assert_command ~ctxt:test_ctxt ~chdir:tmpdir "./configure" ["--prefix=/usr"; "--mandir=/usr/share/man"; "--infodir=/usr/share/info"; "--datadir=/usr/share"; "--sysconfdir=/etc"; "--localstatedir=/var/lib"]; ()); "compiled_setup_ml">:: (fun test_ctxt -> let t = setup_test_directories test_ctxt in_testdata_dir ["TestPluginDevFiles"; "compiled_setup_ml"] in oasis_setup ~dynamic:true test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; register_generated_files t ["configure"; "Makefile"]; (* Run standard test. *) standard_test_compiled test_ctxt t; let makefile_content = file_content (t.src_dir ^ "/Makefile") in assert_bool "Test the SETUP variable in the Makefile for compiled_setup_ml." (OASISString.contains ~what:"SETUP = ./setup.exe" makefile_content) ); ] let tests = "Plguin DevFiles" >::: [ "best=native" >::: (skip_test_on_non_native_arch (gen_tests ~is_native:true)); "best=byte" >::: (gen_tests ~is_native:false); ] oasis-0.4.11/test/test-main/TestOASISValues.ml0000644000175000017500000000436513261073606020361 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open OASISValues open TestCommon let tests = let expect_failure v s test_ctxt= try let ctxt = oasis_ctxt test_ctxt in let _ = v.parse ~ctxt s in assert_failure "expected an exception" with Failure _ -> () in "OASISValues" >::: [ "findlib_full_invalid_empty" >:: expect_failure findlib_full ""; "comma_separated_findlib_full_with_one_invalid_empty" >:: expect_failure (comma_separated (with_optional_parentheses findlib_full OASISVersion.comparator_value)) "pkg1, pkg2,"; ] oasis-0.4.11/test/test-main/TestOASISText.ml0000644000175000017500000000631413261073606020042 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open OASISText let printer_oasis_text t = String.concat ", " (List.map (function | Para str -> Printf.sprintf "Para %S" str | Verbatim str -> Printf.sprintf "Verbatim %S" str | BlankLine -> "BlankLine") t) let check_roundtrip ~input ~want ?input_roundtrip text_ctxt = let text = OASISText.of_string input in let output = OASISText.to_string text in let input_roundtrip = match input_roundtrip with | Some str -> str | None -> input in assert_equal ~printer:printer_oasis_text want text; assert_equal ~printer:(Printf.sprintf "%S") input_roundtrip output let tests = "OASISText" >::: [ "empty" >:: check_roundtrip ~input:"" ~want:[]; "blank line" >:: check_roundtrip ~input:"\n" ~want:[BlankLine]; "para" >:: check_roundtrip ~input:"abcd\nefgh" ~want:[Para "abcd efgh"] ~input_roundtrip:"abcd efgh"; "para blank" >:: check_roundtrip ~input:"abcd\nefgh\n" ~want:[Para "abcd efgh"; BlankLine] ~input_roundtrip:"abcd efgh\n"; "2 para" >:: check_roundtrip ~input:"abcd\n\ efgh\n\ \n\ ijkl" ~want:[Para "abcd efgh"; Para "ijkl"] ~input_roundtrip:"abcd efgh\n\nijkl"; "verbatim" >:: check_roundtrip ~input:"abcd\n\ efgh\n\ \n\ \ ijkl" ~want:[Para "abcd efgh"; BlankLine; Verbatim "ijkl"] ~input_roundtrip:"abcd efgh\n\n ijkl"; ] oasis-0.4.11/test/test-main/TestOASISString.ml0000644000175000017500000000435213261073606020364 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open OASISString let tests = "OASISString" >::: [ "split_newline" >:: (fun test_ctxt -> let assert_string_list_equal = assert_equal ~printer:(fun lst -> String.concat ", " (List.map (Printf.sprintf "%S") lst)) in assert_string_list_equal [] (split_newline ""); assert_string_list_equal [""; ""] (split_newline "\n"); assert_string_list_equal ["abcd"; ""] (split_newline "abcd\n"); ()); ] oasis-0.4.11/test/test-main/TestOASISSourcePatterns.ml0000644000175000017500000000520713261073606022077 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open OASISSourcePatterns let tests = "OASISSourcePatterns" >:: (fun test_ctxt -> let exp = "abcd.ml" in let modul = "Abcd" in let fs_lst = ["abcd.ml"] in let fs = new TestCommon.spy_fs test_ctxt (new TestCommon.mem_fs) in (* Populate filesystem *) List.iter (fun fn -> OASISFileSystem.defer_close (fs#open_out (OASISFileSystem.of_unix_filename fn)) ignore) fs_lst; try assert_equal ~printer:(Printf.sprintf "%S") exp (List.find (fun ufn -> fs#file_exists (OASISFileSystem.of_unix_filename ufn)) (all_possible_files implementation ~path:OASISUnixPath.current_dir_name ~modul:"Abcd")) with Not_found -> assert_failure (Printf.sprintf "Unable to find module %S among files: %s" modul (String.concat ", " (List.map (Printf.sprintf "%S") fs_lst)))) oasis-0.4.11/test/test-main/TestOASISParse.ml0000644000175000017500000004012613261073606020167 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Tests for OASIS @author Sylvain Le Gall *) open OUnit2 open TestCommon open OASISTypes open OASISParse open OASISValues open OASISVersion open FileUtil let tests = (* Check flag equality *) let assert_flag nm pkg = try let _ = List.find (function | Flag (cs, _) -> cs.cs_name = nm | _ -> false) pkg.sections in () with Not_found -> assert_failure (Printf.sprintf "No flag '%s' defined" nm) in (* Check that at least one alternative doesn't raise an exception *) let assert_alternative msg lst e = let found_one = List.fold_left (fun r t -> if not r then try t e; true with _ -> false else r) false lst in if not found_one then assert_failure msg in let check_one test_ctxt (fn, test) = let pkg = from_file ~ctxt:(oasis_ctxt ~ignore_plugin:true test_ctxt) fn in test pkg in let test_file_of_vector (fn, test) = fn >:: (fun test_ctxt -> check_one test_ctxt (in_testdata_dir test_ctxt ["TestOASISParse"; fn], test)) in let test_value_parser_of_vector (str, value_parse, fail) = str >:: (fun test_ctxt -> try let _s: comparator = value_parse ~ctxt:(oasis_ctxt test_ctxt) str in if fail then assert_failure (Printf.sprintf "Parsing '%s' should have failed" str) with _ -> if not fail then assert_failure (Printf.sprintf "Parsing '%s' should not have failed" str)) in let printer_optional_string = function | Some str -> Printf.sprintf "%S" str | None -> "" in let printer_description = function | Some txt -> Printf.sprintf "%S" (OASISText.to_string txt) | None -> "" in "OASIS" >::: [ "ValueParser" >::: (List.map test_value_parser_of_vector (List.map (fun (v, f) -> (v, OASISVersion.comparator_value.parse, f)) [ ">= 3.11.1", false; ">= 3.11", false; "<= 3.11.1", false; "> 3.11.1", false; "< 3.11.1", false; "= 3.11.1", false; ">= 3.11 && <= 3.12", false; "= 3.11 || = 3.12", false; "= || = 3.12", true; ]) ); "File" >::: (List.map test_file_of_vector [ "test1.oasis", (fun pkg -> assert_flag "devmod" pkg; assert_alternative "At least one of ostest, linuxtest64 and linuxtest32 is defined" (List.map (fun nm -> (fun () -> assert_flag nm pkg)) [ "ostest"; "linuxtest64"; "linuxtest32"; ]) ()); "test2.oasis", ignore; "test3.oasis", ignore; "test4.oasis", ignore; "test5.oasis", ignore; "test6.oasis", ignore; "test7.oasis", ignore; "test8.oasis", ignore; "test9.oasis", (fun pkg -> let deps = List.fold_left (fun acc -> function | Executable (cs, bs, _) -> if cs.cs_name = "test" then bs.bs_build_depends @ acc else acc | _ -> acc) [] pkg.sections in List.iter (fun lib -> assert_bool (Printf.sprintf "Existence of library %s" (match lib with | InternalLibrary s -> s | FindlibPackage (s, _) -> s)) (List.mem lib deps)) ((List.map (fun s -> FindlibPackage(s, None)) ["test1"; "pa_test1"; "test_with_str"]) @ (List.map (fun s -> InternalLibrary s) ["test1"; "pa_test1"; "test_with_str"]))); "test10.oasis", (fun pkg -> let flag_test = match OASISSection.section_find (`Flag, "test") pkg.sections with | Flag (_, e) -> e | _ -> assert false in let test_main = match OASISSection.section_find (`Test, "main") pkg.sections with | Test (_, e)-> e | _ -> assert false in let choose_with_env ?(vars=[]) v = OASISExpr.choose (fun nm -> try List.assoc nm vars with Not_found -> failwith ("Unable to find var "^nm)) v in assert_equal ~msg:"Default for flag 'test' when os_type='win32'" ~printer:string_of_bool true (choose_with_env ~vars:["os_type", "win32"] flag_test.flag_default); assert_equal ~msg:"Default for flag 'test' when os_type='linux'" ~printer:string_of_bool false (choose_with_env ~vars:["os_type", "linux"] flag_test.flag_default); assert_equal ~msg:"Default for authors" ~printer:(String.concat ", ") ["Sylvain Le Gall"; "Another one"] pkg.authors; assert_equal ~msg:"Synopsis" ~printer:(fun s -> s) "Just a test with extra text" pkg.synopsis; assert_equal ~msg:"Command of test 'main' with test='true'" ~printer:(fun (cmd, args) -> String.concat " " (cmd :: args)) ("main", ["-test"]) (choose_with_env ~vars:["test", "true"] test_main.test_command); assert_equal ~msg:"Command of test 'main' with test='false'" ~printer:(fun (cmd, args) -> String.concat " " (cmd :: args)) ("main", []) (choose_with_env ~vars:["test", "false"] test_main.test_command); ); "comment-in-field.oasis", ignore; "bug571.oasis", ignore; "test-freeform.oasis", (fun pkg -> assert_equal ~printer:printer_description (Some (OASISText.of_string "a\nb\n\nc")) pkg.description); "test11.oasis", ignore; "test12.oasis", (fun pkg -> assert_equal ~printer:printer_description (Some (OASISText.of_string "Thin bindings to various low-level system APIs \ (often non-portable)\n\ which are not covered by Unix module.\n\ \n\ Example functions:\n\ \ * uname\n\ \ * statvfs\n\ \ * fsync")) pkg.description; assert_equal ~printer:printer_optional_string (Some "Foo is a great library for:\n\ \ * pattern matching\n\ \ * GC") (match OASISSection.section_find (`Doc, "foo") pkg.sections with | Doc (_, doc) -> doc.doc_abstract | _ -> assert false)); "test14.oasis", (fun pkg -> let _, _, lib_name_of_findlib_name = OASISFindlib.findlib_mapping pkg in List.iter (fun (fndlb_nm, lib_nm) -> assert_equal ~msg:(Printf.sprintf "library name of findlib package %s" fndlb_nm) ~printer:(fun s -> s) lib_nm (lib_name_of_findlib_name fndlb_nm)) ["test", "test1"; "test.test2", "test2"; "test.test2.test3", "test3"; "test.test2.test3.test4.test5p", "test5"; "test.test2.test3.test4.test5p.test6", "test6"]); "test16.oasis", ignore; "bug1239.oasis", (fun pkg -> let template_by_fn l fn = try Some (List.find (fun t -> t.OASISFileTemplate.fn = fn) l) with Not_found -> None in let template_body x = match x.OASISFileTemplate.body with | OASISFileTemplate.NoBody -> [] | OASISFileTemplate.Body l -> l | OASISFileTemplate.BodyWithDigest (_, l) -> l in let initial_ctxt = { OASISPlugin.ctxt = OASISContext.quiet ; update = OASISSetupUpdate.NoUpdate; error = false ; files = OASISFileTemplate.create ~disable_oasis_section:[] (); other_actions = [] } in let ctxt = OCamlbuildPlugin.add_ocamlbuild_files initial_ctxt pkg in let templates = OASISFileTemplate.fold (fun t accu -> t :: accu) ctxt.OASISPlugin.files [] in let mllib = match template_by_fn templates "src/bar/bar.mllib" with | None -> let msg = Printf.sprintf "Missing mllib file for packed library bar, \ here is the list of generated files:\n%s\n" (String.concat "\n" (List.map (fun t -> t.OASISFileTemplate.fn) templates)) in assert_failure msg | Some x -> x in assert_equal ~msg:"The mllib of a packed library should contain the name \ of the pack" ~printer:(fun x -> Printf.sprintf "[ %s ]" (String.concat " ; " (List.map (Printf.sprintf "%S") x))) [ "Bar" ] (template_body mllib) ); "test-extra-blanks.oasis", ignore; ]) @ [ "Examples" >:: (fun test_ctxt -> let lst_examples = (find (* Collect _oasis in examples/ *) (Basename_is "_oasis") (example_dir test_ctxt) (fun a e -> e :: a) []) @ (filter (* Collect examples/oasis/*.oasis *) (Has_extension "oasis") (ls (example_dir test_ctxt))) in List.iter (fun fn -> check_one test_ctxt (fn, ignore)) lst_examples); "SinceVersion" >:: (fun test_ctxt -> assert_raises ~msg:"Pack is supported only in 0.3" (Failure "Field BetaFeatures in package is only valid since \ OASIS v0.4, update OASISFormat field from '0.3' to \ '0.4' after checking OASIS changelog.") (fun () -> let _pkg = from_file ~ctxt:(oasis_ctxt ~ignore_plugin:true test_ctxt) (in_testdata_dir test_ctxt ["TestOASISParse"; "test13.oasis"]) in ())); "test15.oasis" >:: (fun test_ctxt -> try let _pkg: OASISTypes.package = from_file ~ctxt:(oasis_ctxt ~ignore_plugin:true test_ctxt) (in_testdata_dir test_ctxt ["TestOASISParse"; "test15.oasis"]) in assert_string "test15.oasis should fail to parse" with Failure _ -> ()); "bug1236.oasis" >:: (fun test_ctxt -> assert_raises ~msg:"Not allowed to use lowercase module name." (Failure "Module name 'lib', must be capitalized ('Lib').") (fun () -> let _pkg = from_file ~ctxt:(oasis_ctxt ~ignore_plugin:true test_ctxt) (in_testdata_dir test_ctxt ["TestOASISParse"; "bug1236.oasis"]) in ())); "bug1295.oasis" >:: (fun test_ctxt -> let fn = in_testdata_dir test_ctxt ["TestOASISParse"; "bug1295.oasis"] in let txt = Printf.sprintf "file %S, line 17, characters 0-3: extraneous blanks at the \ beginning of the line" fn in let has_warnings_with_text = ref false in let ctxt = let super_ctxt = oasis_ctxt ~ignore_plugin:true test_ctxt in let open OASISContext in { super_ctxt with printf = fun lvl str -> if str = txt then has_warnings_with_text := true; super_ctxt.printf lvl str } in let _pkg = from_file ~ctxt fn in assert_bool (Printf.sprintf "Warning about extraneous blanks present") !has_warnings_with_text); ] ] oasis-0.4.11/test/test-main/TestOASISObject.ml0000644000175000017500000000533413261073606020325 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open TestCommon open OASISTypes let tests = "OASISObject" >:: (fun test_ctxt -> let in_dir lst = in_testdata_dir test_ctxt (["TestOASISObject"; "source_patterns"] @ lst) in let ctxt = oasis_ctxt test_ctxt in let sfs = new OASISFileSystem.host_fs (in_dir []) in let pkg = OASISParse.from_file ~ctxt (in_dir ["_oasis"]) in let lst = List.fold_left (fun acc sct -> match sct with | Object (cs, bs, obj) -> let lst = OASISObject.source_unix_files ~ctxt (cs, bs, obj) (fun fn -> sfs#file_exists (OASISFileSystem.of_unix_filename fn)) in (List.flatten (List.rev_map snd lst)) @ acc | Library _ | Executable _ | Flag _ | SrcRepo _ | Test _ | Doc _ -> acc) [] pkg.sections in DiffSetOutput.assert_equal (DiffSetOutput.of_list ["O1.eliom"; "O1.eliomi"; "O2.ml"]) (DiffSetOutput.of_list lst)) oasis-0.4.11/test/test-main/TestOASISLibrary.ml0000644000175000017500000000533413261073606020523 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open TestCommon open OASISTypes let tests = "OASISLibrary" >:: (fun test_ctxt -> let in_dir lst = in_testdata_dir test_ctxt (["TestOASISLibrary"; "source_patterns"] @ lst) in let ctxt = oasis_ctxt test_ctxt in let sfs = new OASISFileSystem.host_fs (in_dir []) in let pkg = OASISParse.from_file ~ctxt (in_dir ["_oasis"]) in let lst = List.fold_left (fun acc sct -> match sct with | Library (cs, bs, lib) -> let lst = OASISLibrary.source_unix_files ~ctxt (cs, bs, lib) (fun fn -> sfs#file_exists (OASISFileSystem.of_unix_filename fn)) in (List.flatten (List.rev_map snd lst)) @ acc | Object _ | Executable _ | Flag _ | SrcRepo _ | Test _ | Doc _ -> acc) [] pkg.sections in DiffSetOutput.assert_equal (DiffSetOutput.of_list ["L1.ml"; "L2.mli"; "L3.mlify"]) (DiffSetOutput.of_list lst)) oasis-0.4.11/test/test-main/TestOASISFileSystem.ml0000644000175000017500000001141413261073606021177 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test for OASISFileSystem. @author Sylvain Le Gall *) open OUnit2 open OASISFileSystem let tests = "OASISFileSystem" >::: [ "defer_close" >:: (fun _ -> let tester msg = let clsr = object val count = ref 0 method close = incr count method get_count = !count end in clsr, fun () -> assert_equal ~msg:(msg ^ ": number of time #close has been called.") ~printer:string_of_int 1 clsr#get_count in let clsr, assrt = tester "normal" in let () = defer_close clsr ignore; assrt () in let clsr, assrt = tester "raise exception" in let exc = Failure "foobar" in let () = try defer_close clsr (fun _ -> if true then raise exc; ()); assert_failure "raise exception should have raised an exception" with e when e = exc -> assrt () in ()); "host_fs" >:: (fun test_ctxt -> let tmpdir = bracket_tmpdir test_ctxt in let hfs = new host_fs tmpdir in let fn = of_unix_filename "foobar" in let content = "abcd" in let assert_present fn = assert_bool (Printf.sprintf "File %S should exist." (hfs#string_of_filename fn)) (hfs#file_exists fn) in let assert_absent fn = assert_bool (Printf.sprintf "File %S should not exist." (hfs#string_of_filename fn)) (not (hfs#file_exists fn)) in let buf = Buffer.create (String.length content) in assert_absent fn; defer_close (hfs#open_out fn) ignore; assert_present fn; defer_close (hfs#open_out fn) (fun wrtr -> Buffer.clear buf; Buffer.add_string buf content; wrtr#output buf); Buffer.clear buf; defer_close (hfs#open_in fn) (read_all buf); assert_equal ~msg:"File content" ~printer:(Printf.sprintf "%S") content (Buffer.contents buf); hfs#remove fn; assert_absent fn; ()); "stream_of_reader" >:: (fun test_ctxt -> let tmpdir = bracket_tmpdir test_ctxt in let fn = of_unix_filename "test.txt" in let hfs = new host_fs tmpdir in let buf = Buffer.create 13 in let test_one len = let str = Buffer.clear buf; for i = 0 to len - 1 do Buffer.add_char buf (Char.chr ((Char.code 'a') + (i mod 26))) done; defer_close (hfs#open_out fn) (fun wrtr -> wrtr#output buf); Buffer.contents buf in defer_close (hfs#open_in fn) (fun rdr -> let strm = stream_of_reader rdr in Buffer.clear buf; Stream.iter (Buffer.add_char buf) strm); assert_equal ~printer:(Printf.sprintf "%S") str (Buffer.contents buf) in test_one 15; test_one 15000); ] oasis-0.4.11/test/test-main/TestOASISAst.ml0000644000175000017500000002256613261073606017654 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Tests for OASISAst_* @author Sylvain Le Gall *) open OUnit2 open TestCommon let token_to_string = let open OASISAst_parser in function | EOF -> "EOF" | QSTRING s -> Printf.sprintf "%S" s | PLUS_COLON s -> Printf.sprintf "+: %S" s | DOLLAR_COLON -> "$:" | COLON s -> Printf.sprintf ": %S" s | IF -> "if" | LBRACE -> "{" | RBRACE -> "}" | ELSE -> "else" | SECTION knd -> (OASISSection.string_of_section_kind knd) | NOT -> "!" | AND -> "&&" | OR -> "||" | LPAREN -> "(" | RPAREN -> ")" | TRUE -> "true" | FALSE -> "false" | IDENT s -> Printf.sprintf "IDENT %S" s | FLAG -> "flag" let string_of_top_stmt = let open OASISAst_types in let ppf fmt = Format.fprintf fmt in let rec ppf_top_stmt fmt = function | TSSection(sct_knd, nm, stmt) -> ppf fmt "TSSection(@[%s,@ %S,@ %a@])" (OASISSection.string_of_section_kind sct_knd) nm ppf_stmt stmt | TSStmt stmt -> ppf fmt "TSStmt(@[%a@])" ppf_stmt stmt | TSBlock (hd :: tl) -> ppf fmt "TSBlock(@[%a" ppf_top_stmt hd; List.iter (ppf fmt ",@ %a" ppf_top_stmt) tl; ppf fmt "@])" | TSBlock [] -> ppf fmt "SBlock([])" and ppf_stmt fmt = function | SField(nm, fop) -> ppf fmt "SField(@[%S,@ %a@])" nm ppf_field_op fop | SIfThenElse(expr, stmt1, stmt2) -> ppf fmt "SIfThenElse(@[%S,@ %a,@ %a@])" (OASISExpr.to_string expr) ppf_stmt stmt1 ppf_stmt stmt2 | SBlock (hd :: tl) -> ppf fmt "SBlock(@[%a" ppf_stmt hd; List.iter (ppf fmt ",@ %a" ppf_stmt) tl; ppf fmt "@])" | SBlock [] -> ppf fmt "SBlock([])" and ppf_field_op fmt = function | FSet s -> ppf fmt "FSet(%S)" s | FAdd s -> ppf fmt "FAdd(%S)" s | FEval expr -> ppf fmt "FEval(%S)" (OASISExpr.to_string expr) in fun top_stmt -> ppf Format.str_formatter "%a@." ppf_top_stmt top_stmt; Format.flush_str_formatter () let pp_diff_top_stmt = let open OASISAst_types in let cond_prepend b v l = if b then v :: l else l in let rec diff_top_stmt = function | tstmt1, tstmt2 when tstmt1 = tstmt2 -> [] | TSSection(sct_knd1, nm1, stmt1), TSSection(sct_knd2, nm2, stmt2) -> if sct_knd1 <> sct_knd2 then [Printf.sprintf "section kind %s -> %s" (OASISSection.string_of_section_kind sct_knd1) (OASISSection.string_of_section_kind sct_knd2)] else cond_prepend (nm1 <> nm2) (Printf.sprintf "name %S -> %S" nm1 nm2) (diff_stmt (stmt1, stmt2)) | TSStmt stmt1, TSStmt stmt2 -> diff_stmt (stmt1, stmt2) | TSBlock lst1, TSBlock lst2 -> if List.length lst1 <> List.length lst2 then [Printf.sprintf "length %d -> %d" (List.length lst1) (List.length lst2)] else List.fold_left2 (fun l tstmt1 tstmt2 -> l @ diff_top_stmt (tstmt1, tstmt2)) [] lst1 lst2 | tstmt1, tstmt2 -> [Printf.sprintf "%s -> %s" (string_of_top_stmt tstmt1) (string_of_top_stmt tstmt2)] and diff_stmt = function | stmt1, stmt2 when stmt1 = stmt2 -> [] | SField(nm1, fop1), SField(nm2, fop2) -> cond_prepend (nm1 <> nm2) (Printf.sprintf "name %S -> %S" nm1 nm2) (diff_field_op (fop1, fop2)) | SIfThenElse(expr1, stmt11, stmt12), SIfThenElse(expr2, stmt21, stmt22) -> cond_prepend (expr1 <> expr2) (Printf.sprintf "eval %s -> %s" (OASISExpr.to_string expr1) (OASISExpr.to_string expr2)) (diff_stmt (stmt11, stmt21)) @ (diff_stmt (stmt12, stmt22)) | SBlock lst1, SBlock lst2 -> if List.length lst1 <> List.length lst2 then [Printf.sprintf "length %d -> %d" (List.length lst1) (List.length lst2)] else List.fold_left2 (fun l stmt1 stmt2 -> l @ diff_stmt (stmt1, stmt2)) [] lst1 lst2 | _, _ -> ["statement change"] and diff_field_op = function | fop1, fop2 when fop1 = fop2 -> [] | FSet s1, FSet s2 | FAdd s1, FAdd s2 -> [Printf.sprintf "field %S -> %S" s1 s2] | FEval expr1, FEval expr2 -> [Printf.sprintf "eval %s -> %s" (OASISExpr.to_string expr1) (OASISExpr.to_string expr2)] | _, _ -> ["field operation change"] in fun fmt (tstmt1, tstmt2) -> let open Format in let _b : bool = fprintf fmt "@["; List.fold_left (fun first str -> if not first then fprintf fmt "@,"; fprintf fmt "%s" str; false) true (diff_top_stmt (tstmt1, tstmt2)); in fprintf fmt "@]" let tests = "OASISAst" >::: [ "OASISAst_lexer" >:: (fun test_ctxt -> let open OASISAst_parser in let printer lst = String.concat "; " (List.map token_to_string lst) in let rec all lst lexer lexbuf = match lexer lexbuf with | OASISAst_parser.EOF as tok -> List.rev (tok :: lst) | tok -> all (tok :: lst) lexer lexbuf in List.iter (fun (str, exp) -> let lexer = OASISAst_lexer.token ~ctxt:(oasis_ctxt ~ignore_plugin:true test_ctxt) () in assert_equal ~printer exp (all [] lexer (Lexing.from_string str))) [ (* Empty *) "", [EOF]; (* Simple keyword *) "true", [TRUE; EOF]; (* Empty field *) "foobar:", [IDENT "foobar"; COLON ""; EOF]; (* Empty field + padding *) "foobar: ", [IDENT "foobar"; COLON ""; EOF]; (* Simple field *) "foobar: this is a test", [IDENT "foobar"; COLON "this is a test"; EOF]; (* Multiline field *) "foobar: a\n b", [IDENT "foobar"; COLON "a\nb"; EOF]; (* Multiline field + padding *) "foobar: a\n b\n c", [IDENT "foobar"; COLON "a\nb\n c"; EOF]; (* Multiline field + empty line *) "foobar: a\n .\n c", [IDENT "foobar"; COLON "a\n\nc"; EOF]; (* Comment *) "# comment", [EOF]; (* Comment + padding *) " # comment\nfoobar: a", [IDENT "foobar"; COLON "a"; EOF]; (* Comment in field *) "foobar: a # for b", [IDENT "foobar"; COLON "a"; EOF]; (* Comment in multiline *) "foobar: a \n# for b\n c", [IDENT "foobar"; COLON "a\nc"; EOF]; (* Comment in multiline *) "foobar: a \n b\n# c\n d", [IDENT "foobar"; COLON "a\nb\nd"; EOF]; (* Complex. *) "OASISVersion: >= 3.12.0\n\ \n\ Flag abcd\n\ \ Description: This is a text", [IDENT "OASISVersion"; COLON ">= 3.12.0"; SECTION `Flag; IDENT "abcd"; LBRACE; IDENT "Description"; COLON "This is a text"; RBRACE; EOF]; ]); "OASISAst" >:: (fun test_ctxt -> let open OASISAst_types in let open OASISExpr in List.iter (fun (str, exp) -> let lexbuf = Lexing.from_string str in let ctxt = oasis_ctxt test_ctxt in let ast = OASISAst_parser.main (OASISAst_lexer.token ~ctxt ()) lexbuf in non_fatal test_ctxt (fun _ -> assert_equal ~ctxt:test_ctxt ~printer:string_of_top_stmt ~pp_diff:pp_diff_top_stmt exp ast)) [ "FieldName: Value", TSStmt(SField("FieldName", FSet("Value"))); "if ocaml_version(\"4.02\")\n\ \ FieldName: Value", TSStmt( SIfThenElse( ETest(test_of_string "ocaml_version", "4.02"), SField("FieldName", FSet("Value")), SBlock [])); ]); ] oasis-0.4.11/test/test-main/TestLicense.ml0000644000175000017500000001102513261073606017674 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test for OASISLicense @author Sylvain Le Gall *) open OUnit2 open TestCommon open OASISValues open OASISTypes open OASISLicense let tests = let ver = OASISVersion.version_of_string in let mk_base ?(v=NoVersion) ?e lic = (DEP5Unit { license = lic; version = v; excption = e; }) in let mk ?v ?e lic = Some (DEP5License (mk_base ?v ?e lic)) in "License" >::: (List.map (fun (txt, res) -> txt >:: (fun test_ctxt -> match res with | Some exp -> assert_equal ~printer:(fun v -> Printf.sprintf "%S" (to_string v)) exp (value.parse ~ctxt:(oasis_ctxt test_ctxt) txt) | None -> try ignore (value.parse ~ctxt:(oasis_ctxt test_ctxt) txt); assert_failure (Printf.sprintf "License '%s' is not valid but parse without problem" txt) with e -> ())) [ "BSD-4-clause", mk bsd4; "BSD-4-clause-1.0+", None; (* TODO: Test also BSD3 because it was a deprecated synonym BSD-3-clause, same for BSD2. *) "BSD-3-clause", mk bsd3; "BSD3", mk bsd3; "GPL", mk gpl; "GPL-2", mk ~v:(Version (ver "2")) gpl; "GPL-2+", mk ~v:(VersionOrLater (ver "2")) gpl; "LGPL-2.1 with OCaml linking exception", mk ~v:(Version (ver "2.1")) ~e:ocaml_linking_exception lgpl; "http://some.stuff.com/license", Some (OtherLicense "http://some.stuff.com/license"); "CeCILL", mk cecill; "CeCILL-B", mk cecillb; "CeCILL-C", mk cecillc; "LGPL-2.1 with OCaml drinking exception", None; "CeCILLB2000", None; "CMU/MIT", None; "GPL-1+ or Artistic", Some (DEP5License (DEP5Or [ mk_base ~v:(VersionOrLater (ver "1")) gpl; mk_base artistic; ])); "GPL-2+ and BSD-3-clause", Some (DEP5License (DEP5And [ mk_base ~v:(VersionOrLater (ver "2")) gpl; mk_base bsd3; ])); "GPL-2+ or Artistic-2.0, and BSD-3-clause", Some (DEP5License (DEP5And [DEP5Or [ mk_base ~v:(VersionOrLater (ver "2")) gpl; mk_base ~v:(Version (ver "2.0")) artistic; ]; mk_base bsd3])); ] ) oasis-0.4.11/test/test-main/TestFull.ml0000644000175000017500000005137613261073606017231 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Run full OASIS use cases @author Sylvain Le Gall *) open FileUtil open OUnit2 open TestCommon open TestFullUtils let all_tests = [ (* Single level package *) "1level", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "META"; "with-a.mllib"; "with-a.mldylib"; "with-a.odocl"; ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("with-a", ["META"; "A.ml"; "A.cmi"; "with-a.cma"; "A.cmx"; "with-a.cmxa"; "with-a.cmxs"; "with-a.a"; "A.annot"; "A.cmt"]); InstalledBin ["test-with-a"]; InstalledAPIRef("with-a", ["A"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "with-a" ["A"]; try_installed_exec test_ctxt t "test-with-a" []); (* Try custom document build *) "customdoc", (fun test_ctxt t -> (* TODO: check custom install as well. *) oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["META"; "with-a.mllib"; "with-a.mldylib"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("with-a", ["META"; "A.ml"; "A.cmi"; "A.annot"; "A.cmt"; "with-a.cma"]); ]; (* Run standard test. *) standard_test test_ctxt t); (* Use cclib option *) "with-cclib", (fun test_ctxt t -> skip_if (not (Sys.file_exists "/usr/include/stringprep.h")) "Cannot find 'stringprep.h'"; oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/META"; "Makefile"; "configure"; "src/libtest_oasis_c_dependency_stubs.clib"; "src/test_oasis_c_dependency.mllib"; "src/test_oasis_c_dependency.mldylib"; ]); (* Run standard test. *) standard_test test_ctxt t); (* With a documentation that is not built *) "no-install-doc" , (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); (* Need to create a a parent directory *) "create-parent-dir", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; register_installed_files test_ctxt t [InstalledData ["toto/toto/toto.txt"]]; (* Run standard test. *) standard_test test_ctxt t); "bug588", (fun test_ctxt t -> (* Copy initial version of the _oasis. *) cp [in_src_dir t "_tags_manual"] (in_src_dir t "_tags"); oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["libtest.mllib"; "libtest.mldylib"; "libtest.odocl"]); (* Run standard test. *) standard_test test_ctxt t); "bug619", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); "bug571", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); "flag-ccopt", (fun test_ctxt t -> let () = skip_if (Sys.os_type = "Win32") "UNIX only test"; skip_if (Sys.command "pkg-config zlib --exists" <> 0) "zlib not installed" in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["cryptokit.mllib"; "cryptokit.mldylib"]); (* Run standard test. *) standard_test test_ctxt t); "bug738", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["src/test.mllib"; "src/test.mldylib"; "src/META"]); register_installed_files test_ctxt t [InstalledOCamlLibrary ("test", ["META"; "foo.cmi"; "test.cma"; "foo.annot"; "foo.cmt"])]; (* Run standard test. *) standard_test test_ctxt t); "bug982", (fun test_ctxt t -> let () = skip_if (Sys.os_type = "Win32") "UNIX only test" in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); "bug823", (fun test_ctxt t -> let () = skip_if (Sys.os_type = "Win32") "UNIX only test" in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); "bugClib", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["META"; "mylib.mlpack"; "mylib.mllib"; "mylib.mldylib"; "libmylib_stubs.clib"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("mylib", ["META"; "dllmylib_stubs.so"; "foo.ml"; "mylib.cma"; "mylib.cmi"; "foo.annot"; "foo.cmt"; "bar.annot"; "bar.cmt"; "mylib.cmxa"; "mylib.cmxs"; "mylib.cmx"; "mylib.a"; "libmylib_stubs.a"]) ]; if OASISVersion.StringVersion.compare t.ocaml_version "4.02" >= 0 then begin register_installed_files test_ctxt t [InstalledOCamlLibrary("mylib", ["mylib.cmt"])] end; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "mylib" ["Mylib.Foo"; "Mylib.Bar"]); "bug791", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["src/testA.mllib"; "src/testA.mldylib"]); (* Run standard test. *) standard_test test_ctxt t); "bug938", (fun test_ctxt t -> let () = skip_if (Sys.os_type = "Win32") "UNIX test" in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Check everything ok. *) standard_checks test_ctxt t; (* Try to run. *) (* TODO: quid of the use of this test. Check and comment. *) run_ocaml_setup_ml test_ctxt t ["-configure"; "--enable-all"; "--disable-over"]); "ver0.3", (fun test_ctxt t -> let doc_done_fn = in_src_dir t "doc-done" in let test_done_fn = in_src_dir t "test-done" in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Check everything ok. *) standard_checks test_ctxt t; (* Run test. *) run_ocaml_setup_ml test_ctxt t ["-configure"]; run_ocaml_setup_ml test_ctxt t ["-test"]; assert_bool "test not run." (not (Sys.file_exists test_done_fn)); run_ocaml_setup_ml test_ctxt t ["-doc"]; assert_bool "doc done." (Sys.file_exists doc_done_fn); run_ocaml_setup_ml test_ctxt t ["-distclean"]; rm [doc_done_fn; test_done_fn]; run_ocaml_setup_ml test_ctxt t ["-configure"; "--enable-tests"; "--disable-docs"]; run_ocaml_setup_ml test_ctxt t ["-test"]; assert_bool "test run." (Sys.file_exists test_done_fn); run_ocaml_setup_ml test_ctxt t ["-doc"]; assert_bool "doc not done." (not (Sys.file_exists doc_done_fn)); run_ocaml_setup_ml test_ctxt t ["-distclean"]); "bug1358", (fun test_ctxt t -> let () = skip_if (OASISVersion.StringVersion.compare t.ocaml_version "4.00" < 0) "OCaml >= 4.00 needed." in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); "dynrun_for_release", (fun test_ctxt t -> oasis_setup ~dev:true ~dynamic:true test_ctxt t; (* Setup expectation. *) register_generated_files t ["INSTALL.txt"]; (* Run standard test. *) standard_test test_ctxt t; dbug_file_content test_ctxt (in_src_dir t "INSTALL.txt")); "dynlink", (fun test_ctxt t -> let has_native = t.is_native && (native_dynlink test_ctxt) in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["META"; "entry_point.mllib"; "entry_point.mldylib"; "dyn_loaded.mllib"; "dyn_loaded.mldylib"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("entry_point", ["META"; "entry_point.cma"; "entry_point.cmi"; "entry_point.cmxa"; "entry_point.cmxs"; "entry_point.cmx"; "entry_point.a"; "entry_point.ml"; "dyn_loaded.cma"; "dyn_loaded.cmxa"; "dyn_loaded.cmxs"; "dyn_loaded.a"; "dyn_loaded.cmx"; "dyn_loaded.cmi"; "dyn_loaded.ml"; "dyn_loaded_ext.cmx"; "dyn_loaded_ext.cmi"; "dyn_loaded_ext.ml"; "dyn_loaded.annot"; "dyn_loaded.cmt"; "dyn_loaded_ext.annot"; "dyn_loaded_ext.cmt"; "entry_point.annot"; "entry_point.cmt"; ]); InstalledBin ["dynlink-test-byte"]; ]; if has_native then register_installed_files test_ctxt t [InstalledBin ["dynlink-test-native"]]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_exec test_ctxt t "dynlink-test-byte" ["-load"; FilePath.make_filename [t.ocaml_lib_dir; "entry_point"; "dyn_loaded.cma"]]; if has_native then try_installed_exec test_ctxt t "dynlink-test-native" ["-load"; FilePath.make_filename [t.ocaml_lib_dir; "entry_point"; "dyn_loaded.cmxs"]]; ()); "recurselib", (fun test_ctxt t -> (* The test is that 'oasis setup' should not fail. *) oasis_setup test_ctxt t); "cppcc", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["META"; "cppcc.mldylib"; "cppcc.mllib"; "libcppcc_stubs.clib"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("cppcc", ["META"; "cppcc.a"; "cppcc.annot"; "cppcc.cma"; "cppcc.cmi"; "cppcc.cmt"; "cppcc.cmx"; "cppcc.cmxa"; "cppcc.cmxs"; "cppcc.ml"; "dllcppcc_stubs.so"; "libcppcc_stubs.a"; ]); ]; (* Run standard test. *) standard_test test_ctxt t); "bug1239", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["src/META"; "src/bar/META"; "src/bar/bar.mldylib"; "src/bar/bar.mllib"; "src/bar/bar.mlpack"; "src/foo.mldylib"; "src/foo.mllib"; ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("bar", ["META"; "a.annot"; "a.cmt"; "a.ml"; "bar.a"; "bar.cma"; "bar.cmi"; "bar.cmx"; "bar.cmxa"; "bar.cmxs"; ]); InstalledOCamlLibrary ("foo", ["META"; "foo.a"; "foo.cma"; "foo.cmxa"; "foo.cmxs"; "m.annot"; "m.cmi"; "m.cmt"; "m.ml"; "m.cmx"; ]); ]; if OASISVersion.StringVersion.compare t.ocaml_version "4.02" >= 0 then begin register_installed_files test_ctxt t [InstalledOCamlLibrary("bar", ["bar.cmt"])] end; (* Run standard test. *) standard_test test_ctxt t); "bug623", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["empty.mldylib"; "empty.mllib"]); (* Run standard test. *) run_ocaml_setup_ml test_ctxt t ["-configure"; "--enable-tests"]; run_ocaml_setup_ml test_ctxt t ~exit_code:(Unix.WEXITED 1) ["-test"]); (* Use -C to change directory in 'ocaml setup.ml'. *) "bug1473", (fun test_ctxt t -> let tmpdir = bracket_tmpdir test_ctxt in let hfs = new OASISFileSystem.host_fs t.src_dir in let setup_log = BaseLog.default_filename in let setup_data = BaseEnv.default_filename in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["empty.mldylib"; "empty.mllib"]); assert_command ~chdir:tmpdir ~ctxt:test_ctxt "ocaml" [Filename.concat t.src_dir setup_ml; "-C"; t.src_dir; "-configure"]; assert_command ~chdir:tmpdir ~ctxt:test_ctxt "ocaml" [Filename.concat t.src_dir setup_ml; "-C"; t.src_dir; "-build"]; assert_equal ~msg:(Printf.sprintf "Temporary directory %S should be empty." tmpdir) ~printer:(fun a -> "["^(String.concat "; " (Array.to_list a))^"]") [||] (Sys.readdir tmpdir); assert_bool (Printf.sprintf "File %S and %S should exist." (hfs#string_of_filename setup_log) (hfs#string_of_filename setup_data)) (hfs#file_exists setup_log && hfs#file_exists setup_data)); (* Use --destdir to install. *) "issue107", (fun test_ctxt t -> let destdir = bracket_tmpdir test_ctxt in oasis_setup test_ctxt t; run_ocaml_setup_ml test_ctxt t ["-configure"; "--destdir"; destdir]; run_ocaml_setup_ml test_ctxt t ["-build"]; run_ocaml_setup_ml test_ctxt t ["-install"]); ] let different_directory_tests = [ "TEMP=a b", "bug571", (fun test_ctxt t -> let tmpdir = bracket_tmpdir test_ctxt in let dn = Filename.concat tmpdir "a b" in mkdir dn; oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Check everything ok. *) standard_checks test_ctxt t; (* Run the test, try to use a temporary directory with space in the * filename. *) run_ocaml_setup_ml test_ctxt t ~extra_env:[if Sys.os_type = "Win32" then "TEMP", dn else "TMPDIR", dn] ["-configure"]); "setup with dev mode (weak)", "dev", (fun test_ctxt t -> let () = skip_if (Sys.os_type = "Win32") "UNIX test" in (* Copy initial version of the _oasis. *) cp [in_src_dir t "_oasis.v1"] (in_src_dir t "_oasis"); oasis_setup ~dev:true test_ctxt t; (* Setup expectation. *) register_generated_files t ("_oasis" :: oasis_ocamlbuild_files); (* Check everything ok. *) standard_checks test_ctxt t; (* Run test. *) run_ocaml_setup_ml test_ctxt t ["-all"]; assert_bool "Library .cma not created." (not (Sys.file_exists (in_src_dir t "_build/mylib.cma"))); cp [in_src_dir t "_oasis.v2"] (in_src_dir t "_oasis"); run_ocaml_setup_ml test_ctxt t ["-all"]; assert_bool "Library .cma created." (Sys.file_exists (in_src_dir t "_build/mylib.cma"))); "setup with dev mode (light)", "dev", (fun test_ctxt t -> (* Copy initial version of the _oasis. *) cp [in_src_dir t "_oasis.v2"] (in_src_dir t "_oasis"); oasis_setup ~dev:true ~dynamic:true test_ctxt t; (* Setup expectation. *) register_generated_files t ["_oasis"]; (* Check everything ok. *) standard_checks test_ctxt t; (* Run test. *) assert_bool "setup.ml is smaller than 3kB" (let chn = open_in (in_src_dir t setup_ml) in try let size = in_channel_length chn in close_in chn; size < 3072 (* 3kB *) with e -> close_in chn; raise e); run_ocaml_setup_ml test_ctxt t ["-all"]; assert_bool "Library .cma created." (Sys.file_exists (in_src_dir t "_build/mylib.cma"))); "setup with no dev mode", "dev", (fun test_ctxt t -> (* Copy initial version of the _oasis. *) cp [in_src_dir t "_oasis.v1"] (in_src_dir t "_oasis"); oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t ("_oasis" :: oasis_ocamlbuild_files); (* Check everything ok. *) standard_checks test_ctxt t; (* Run test. *) run_ocaml_setup_ml test_ctxt t ["-all"]; assert_bool "Library .cma not created." (not (Sys.file_exists (in_src_dir t "_build/mylib.cma"))); cp [in_src_dir t "_oasis.v2"] (in_src_dir t "_oasis"); run_ocaml_setup_ml test_ctxt t ["-all"]; assert_bool "Library .cma still not created." (not (Sys.file_exists (in_src_dir t "_build/mylib.cma")))); ] let gen_tests ~is_native () = let runner (nm, dn, f) = nm >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt ~is_native ~native_dynlink:(is_native && (native_dynlink test_ctxt)) (in_testdata_dir test_ctxt ["TestFull"; dn]) in f test_ctxt t) in List.map runner (List.flatten [ List.map (fun (a, b) -> a, a, b) all_tests; different_directory_tests; ]) let tests = "TestFull" >::: [ "all_TestFull" >:: (fun test_ctxt -> all_subdirectories test_ctxt (in_testdata_dir test_ctxt ["TestFull"]) ((List.map fst all_tests) @ (List.map (fun (_, a, _) -> a) different_directory_tests)) (Printf.sprintf "test/data/TestFull/%s is not tested.")); "best=native" >::: (skip_test_on_non_native_arch (gen_tests ~is_native:true ())); "best=byte" >::: (gen_tests ~is_native:false ()); ] oasis-0.4.11/test/test-main/TestFileTemplate.ml0000644000175000017500000001435313261073606020674 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Tests for OASISFileTemplate @author Sylvain Le Gall *) open OUnit2 open TestCommon open OASISFileTemplate let printer_change = function | Create fn -> Printf.sprintf "Create %S" fn | Change (fn, Some fn') -> Printf.sprintf "Change (%S, Some %s)" fn fn' | Change (fn, None) -> Printf.sprintf "Change (%S, None)" fn | NoChange -> "NoChange" let tests = let test_of_vector (fn, content_lst, comment_fmt) = fn >:: (fun test_ctxt -> let real_fn = in_testdata_dir test_ctxt ["TestFileTemplate"; fn] in let tmpdir = bracket_tmpdir test_ctxt in let expected_fn = real_fn ^ "-exp" in let tmp_fn = (* Copy file to temporary. *) if Sys.file_exists real_fn then FileUtil.cp [real_fn] tmpdir; Filename.concat tmpdir (Filename.basename real_fn) in let chng: file_generate_change = file_generate ~ctxt:(oasis_ctxt test_ctxt) ~backup:true (template_of_string_list ~ctxt:(oasis_ctxt test_ctxt) ~template:true tmp_fn comment_fmt content_lst) in assert_equal ~msg:"File content" ~printer:(Printf.sprintf "%S") (file_content expected_fn) (file_content tmp_fn); file_rollback ~ctxt:(oasis_ctxt test_ctxt) chng; if Sys.file_exists real_fn then begin assert_equal ~msg:"File content back to pristine." (file_content real_fn) (file_content tmp_fn); FileUtil.rm [tmp_fn]; end; assert_equal ~msg:"Temporary directory empty." 0 (List.length (FileUtil.ls tmpdir))) in "FileTemplate" >::: ( List.map test_of_vector [ "filetemplate1.txt", [ "toto"; "# OASIS_START "; "# OASIS_STOP "; ], comment_sh; "filetemplate2.txt", [ "toto"; "# OASIS_START "; "# OASIS_STOP "; ], comment_sh; "filetemplate3.txt", [ "toto"; "# OASIS_START "; "# OASIS_STOP "; ], comment_sh; "filetemplate4.txt", [ "toto"; "# OASIS_START "; "# OASIS_STOP "; ], comment_sh; "filetemplate5.txt", [ "toto"; "# OASIS_START "; "tata"; "# OASIS_STOP "; ], comment_sh; ] ) @ [ "Keep file rights" >:: (fun test_ctxt -> let () = skip_if (Sys.os_type = "Win32") "UNIX only test" in let dn = bracket_tmpdir test_ctxt in let fn = Filename.concat dn "foo.sh" in let chn = open_out fn in let () = output_string chn "# OASIS_START\n\ # OASIS_STOP\n"; close_out chn in let own, grp_org = let st = Unix.stat fn in st.Unix.st_uid, st.Unix.st_gid in let grp = let lst = Array.to_list (Unix.getgroups ()) in (* Try to find a group accessible to the user * and different from the current group *) try List.find (fun gid' -> grp_org <> gid') lst with Not_found -> skip_if true "No available group to change group of the file"; grp_org in let () = Unix.chown fn own grp in let chng = file_generate ~ctxt:(oasis_ctxt test_ctxt) ~backup:true (template_make fn comment_sh [] ["echo Hello"] []) in file_rollback ~ctxt:(oasis_ctxt test_ctxt) chng; assert_equal ~msg:"File chgrp" ~printer:string_of_int grp ((Unix.stat fn).Unix.st_gid)); "bug1382-keep all eol" >:: (fun test_ctxt -> let dn = bracket_tmpdir test_ctxt in let fn = Filename.concat dn "foo.txt" in let ghost_meta_template = template_make fn comment_meta [] ["nothing"; ""; "bar"] [] in assert_equal ~printer:printer_change (Create fn) (file_generate ~ctxt:(oasis_ctxt test_ctxt) ~backup:false ghost_meta_template); assert_equal ~printer:printer_change NoChange (file_generate ~ctxt:(oasis_ctxt test_ctxt) ~backup:false ghost_meta_template); ()); ] oasis-0.4.11/test/test-main/TestExamples.ml0000644000175000017500000005115613261073606020101 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** End to end tests for examples/ sub-directories. Tests in this file run end to end compilation with OASIS for sub-directories found in examples/. @author Sylvain Le Gall *) open OUnit2 open TestCommon open TestFullUtils let all_tests = [ "flags", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/simplelib/simplelib.mllib"; "src/simplelib/simplelib.mldylib"; "src/simplelib/simplelib.odocl"; "src/simplelibext/simplelibext.mllib"; "src/simplelibext/simplelibext.mldylib"; "src/simplelibext/simplelibext.odocl"; ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("simplelib", ["simplelib.cma"; "Foo.cmi"; "Foo.ml"; "Foo.annot"; "Foo.cmt"; "Bar.cmi"; "Bar.ml"; "Bar.annot"; "Bar.cmt"; "META"; "simplelib.cmxa"; "simplelib.cmxs"; "Foo.cmx"; "Bar.cmx"; "simplelib.a"]); InstalledOCamlLibrary ("simplelibext", ["simplelibext.cma"; "FooExt.cmi"; "FooExt.ml"; "FooExt.annot"; "FooExt.cmt"; "BarExt.cmi"; "BarExt.ml"; "BarExt.annot"; "BarExt.cmt"; "META"; "simplelibext.cmxa"; "simplelibext.cmxs"; "FooExt.cmx"; "BarExt.cmx"; "simplelibext.a"]); InstalledAPIRef("simplelib", ["Foo"; "Bar"]); InstalledAPIRef("simplelibext", ["FooExt"; "BarExt"]); ]; (* Run standard test. *) standard_test test_ctxt t); (* Complete library *) "simplelib", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/simplelib.mllib"; "src/simplelib.mldylib"; "src/simplelib.odocl"; ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("simplelib" , ["simplelib.cma"; "foo.cmi"; "foo.mli"; "foo.annot"; "foo.cmt"; "foo.cmti"; "bar.cmi"; "bar.mli"; "bar.annot"; "bar.cmt"; "bar.cmti"; "META"; "simplelib.cmxa"; "simplelib.cmxs"; "foo.cmx"; "bar.cmx"; "simplelib.a"]); InstalledAPIRef("simplelib", ["Bar"; "Foo"]); ]; (* Run standard test. *) standard_test test_ctxt t); (* Packed library *) "packedlib", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["src/packedlib.mlpack"; "src/packedlib.mllib"; "src/packedlib.mldylib"; "src/META"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("packedlib", ["packedlib.cma"; "packedlib.cmi"; "packedlib.cmx"; "foo.mli"; "bar.mli"; "Baz.ml"; "META"; "packedlib.cmxa"; "packedlib.cmxs"; "packedlib.a"; "Baz.annot"; "Baz.cmt"; "bar.annot"; "bar.cmt"; "bar.cmti"; "foo.annot"; "foo.cmt"; "foo.cmti"]) ]; if OASISVersion.StringVersion.compare t.ocaml_version "4.02" >= 0 then begin register_installed_files test_ctxt t [InstalledOCamlLibrary("packedlib", ["packedlib.cmt"])] end; (* Run standard test. *) standard_test test_ctxt t; try_installed_library test_ctxt t "packedlib" ["Packedlib.Foo"]); (* Complete library with findlib package to check *) "findlib", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); (* Complete library with custom build system *) "custom", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_installed_files test_ctxt t [ InstalledOCamlLibrary ("simplelib", ["simplelib.cma"; "foo.cmi"; "foo.mli"; "bar.cmi"; "bar.mli"; "META"]) ]; (* Run standard test. *) standard_test test_ctxt t); (* Library/executable using C files *) "with-c", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/META"; "src/libtest-with-c-custom_stubs.clib"; "src/libtest-with-c-native_stubs.clib"; "src/libtest-with-c_stubs.clib"; "src/libwith-c_stubs.clib"; "src/with-c.mllib"; "src/with-c.mldylib"; "src/with-c.odocl"; ]); if t.is_native then register_installed_files test_ctxt t [InstalledBin ["test-with-c-native"]]; register_installed_files test_ctxt t [ InstalledBin ["test-with-c"; "test-with-c-custom"]; InstalledLibrary ["with-c/dlltest-with-c_stubs.so"]; InstalledOCamlLibrary ("with-c", ["A.cmi"; "A.ml"; "META"; "with-c.cma"; "libwith-c_stubs.a"; "dllwith-c_stubs.so"; "with-c.a"; "A.cmx"; "with-c.cmxa"; "with-c.cmxs"; "A.annot"; "A.cmt"]); InstalledAPIRef("with-c", ["A"]); ]; if OASISVersion.StringVersion.compare t.ocaml_version "4.00" < 0 then register_installed_files test_ctxt t [InstalledHTML("with-c", ["code_VALA.ident.html"])]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) if t.is_native then try_installed_exec test_ctxt t "test-with-c-native" []; try_installed_exec test_ctxt t "test-with-c-custom" []; try_installed_exec test_ctxt t "test-with-c" []; try_installed_library test_ctxt t "with-c" ["A"]); (* Library/executable using data files *) "with-data", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/META"; "src/test.mllib"; "src/test.mldylib"; "src/test.odocl"; ]); register_installed_files test_ctxt t [ InstalledBin ["test"]; InstalledOCamlLibrary ("test", [ "test.ml"; "test.cmi"; "META"; "test.cma"; "test.annot"; "test.cmt" ]); InstalledData ["with-data/test.txt"; "doc/html/test.html"; "with-data-0.1/test.txt"]; InstalledAPIRef("test", ["Test"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "test" ["Test"]); (* Library with a pure interface module in subdirectory. *) "with-interface-module", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/META"; "src/pimlib.mllib"; "src/pimlib.mldylib"; ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("pimlib", ["META"; "pimlib.cma"; "pimlib.cmxa"; "pimlib.a"; "pimlib.cmxs"; "pim_impl.mli"; "pim_impl.cmi"; "pim_impl.cmx"; "pim_intf.mli"; "pim_intf.cmi"; "pim_types.mli"; "pim_types.cmi"; "pim_impl.annot"; "pim_impl.cmt"; "pim_impl.cmti"; "pim_intf.cmti"; "pim_types.cmti"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "pimlib" ["Pim_intf"; "Pim_impl"]); (* Test executable *) "with-test", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t oasis_ocamlbuild_files; (* Run standard test. *) standard_test test_ctxt t); (* Use sub-packages *) "with-subpackage", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/META"; "src/test.mllib"; "src/test.mldylib"; "src/test.odocl"; "src/syntax/pa_test.mllib"; "src/syntax/pa_test.mldylib"; ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("test", ["META"; "test.cma"; "pa_test.cma"; "A.ml"; "A.cmi"; "B.ml"; "B.cmi"; "pa_test.ml"; "pa_test.cmi"; "test.cmxa"; "test.cmxs"; "A.cmx"; "B.cmx"; "test.a"; "A.annot"; "A.cmt"; "B.annot"; "B.cmt"; "pa_test.annot"; "pa_test.cmt"]); InstalledAPIRef ("test", ["A"; "B"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Try the result. *) try_installed_library test_ctxt t "test" ["A"; "B"]); (* Interdependencies *) "interdepend-libraries", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/interdepend.odocl"; "src/liba/liba.mllib"; "src/liba/liba.mldylib"; "src/libb/libb.mllib"; "src/libb/libb.mldylib"; "src/libc/libc.mllib"; "src/libc/libc.mldylib"; "src/libd/libd.mllib"; "src/libd/libd.mldylib"; "src/libe/libe.mllib"; "src/libe/libe.mldylib"; ]); (* Run standard test. *) standard_test test_ctxt t); (* Build order *) "order-matter", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/order-matter.odocl"; "src/foo/foo.mllib"; "src/foo/foo.mldylib"; "src/bar/bar.mllib"; "src/bar/bar.mldylib"; "src/baz/baz.mllib"; "src/baz/baz.mldylib"; ]); (* Run standard test. *) standard_test test_ctxt t); "syntax-camlp4", (fun test_ctxt t -> let () = oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/META"; "src/pi.mllib"; "src/pi.mldylib"; ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("syntax-camlp4", ["META"; "pi.ml"; "pi.cmi"; "pi.cma"; "pi.cmx"; "pi.cmxa"; "pi.cmxs"; "pi.a"; "pi.annot"; "pi.cmt"]); ]; (* Run standard test. *) standard_test test_ctxt t; try_installed_library test_ctxt t "syntax-camlp4.syntax" [] in (* Check what happens when link all is set. *) let srcdir = bracket_tmpdir test_ctxt in let fn = FilePath.concat srcdir "foo.ml" in let exec_byte = FilePath.replace_extension fn "byte" in FileUtil.cp [in_example_dir test_ctxt ["syntax-camlp4"; "test"; "data"; "foo.ml"]] fn; assert_compile test_ctxt t "syntax-camlp4.syntax" "ocamlc" ["-o"; exec_byte; "-linkall"; "-linkpkg"; "-syntax"; "camlp4o"; fn]; assert_bool ("Executable is not linked with camlp4") (not (contains_string fn "Camlp4"))); "object", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ ["src1/META"; "src2/META"; "src2/packed_modules.mlpack"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("single_module", ["META"; "single.o" ; "single.mli"; "single.cmx"; "single.cmo"; "single.cmi"]); InstalledOCamlLibrary ("packed_modules", ["packed_modules.o"; "packed_modules.cmx"; "packed_modules.cmo"; "packed_modules.cmi"; "m1.ml"; "m2.mli"; "META"]); ]; (* Run standard test. *) standard_test test_ctxt t); "ocamlbuild", (fun test_ctxt t -> oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/test.mldylib"; "src/test.mllib"; "src/META"]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("test", ["test.ml"; "test.a"; "test.annot"; "test.cma"; "test.cmi"; "test.cmt"; "test.cmx"; "test.cmxa"; "test.cmxs"; "META"]); ]; (* Run standard test. *) standard_test test_ctxt t); ] let tests_match_native = [ "plugins/oasis-plugin-print-hello", (fun test_ctxt t -> let assert_oasis_cli_output_contains args lst = let _, extra_env = TestFullUtils.ocaml_env test_ctxt t in assert_oasis_cli ~extra_env ~ctxt:test_ctxt ~output_contains:lst args in let t = install_oasis_library test_ctxt t in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/lib/oasis-plugin-print-hello/oasis-plugin-print-hello.mldylib"; "src/lib/oasis-plugin-print-hello/oasis-plugin-print-hello.mllib"; "src/lib/oasis-plugin-print-hello/META" ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("oasis-plugin-print-hello", ["OASISPluginPrintHello.ml"; "OASISPluginPrintHello.annot"; "OASISPluginPrintHello.cmi"; "OASISPluginPrintHello.cmt"; "OASISPluginPrintHello.cmx"; "oasis-plugin-print-hello.a"; "oasis-plugin-print-hello.cma"; "oasis-plugin-print-hello.cmxa"; "oasis-plugin-print-hello.cmxs"; "META"]); ]; (* Run standard test. *) standard_test test_ctxt t; assert_oasis_cli_output_contains ["--help"] ["print-hello"]; assert_oasis_cli_output_contains ["print-hello"] ["Hello"]); "plugins/oasis-plugin-versionfile", (fun test_ctxt t -> let t = install_oasis_library test_ctxt t in let with_versionfile_plugin_dir = Filename.concat t.src_dir "with-versionfile-plugin" in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t (oasis_ocamlbuild_files @ [ "src/lib/oasis-plugin-versionfile/oasis-plugin-versionfile.mldylib"; "src/lib/oasis-plugin-versionfile/oasis-plugin-versionfile.mllib"; "src/lib/oasis-plugin-versionfile/META" ]); register_installed_files test_ctxt t [ InstalledOCamlLibrary ("oasis-plugin-versionfile", ["OASISPluginVersionFile.ml"; "OASISPluginVersionFile.annot"; "OASISPluginVersionFile.cmi"; "OASISPluginVersionFile.cmt"; "OASISPluginVersionFile.cmx"; "OASISPluginVersionFileConf.cmx"; "OASISPluginVersionFileData.cmx"; "OASISPluginVersionFileGettext.cmx"; "oasis-plugin-versionfile.a"; "oasis-plugin-versionfile.cma"; "oasis-plugin-versionfile.cmxa"; "oasis-plugin-versionfile.cmxs"; "META"]); ]; (* Run standard test. *) standard_test test_ctxt t; (* Copy the other package into the temporary source, to test it. *) FileUtil.cp ~recurse:true [in_example_dir test_ctxt ["plugins"; "with-plugin-versionfile"]] with_versionfile_plugin_dir; (* Try to setup the package. *) assert_oasis_cli ~chdir:with_versionfile_plugin_dir ~extra_env:(snd (TestFullUtils.ocaml_env test_ctxt t)) ~ctxt:test_ctxt ["setup"]; begin let tgt = Filename.concat with_versionfile_plugin_dir "myversion.ml" in assert_bool (Printf.sprintf "File %S hasn't been created" tgt) (Sys.file_exists tgt) end; ) ] let gen_tests ?is_native tests = let runner (nm, f) = ("examples/"^nm) >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let is_native = match is_native with | Some b -> b | None -> TestCommon.is_native test_ctxt in let t = setup_test_directories test_ctxt ~is_native ~native_dynlink:is_native (in_example_dir test_ctxt [nm]) in let pkg = OASISParse.from_file ~ctxt:(oasis_ctxt test_ctxt) (in_src_dir t OASISParse.default_oasis_fn) in assert_equal ~msg:"Latest OASIS version" ~cmp:(fun v1 v2 -> OASISVersion.version_compare v1 v2 = 0) OASISConf.version_short pkg.OASISTypes.oasis_version; f test_ctxt t) in List.map runner tests let tests = "TestExamples" >::: [ "best=native">::: (skip_test_on_non_native_arch (gen_tests ~is_native:true all_tests)); "best=byte">::: (gen_tests ~is_native:false all_tests); "best=matching" >::: (gen_tests tests_match_native); "all_examples">:: (fun test_ctxt -> all_subdirectories test_ctxt (in_example_dir test_ctxt []) ("plugins" :: "oasis" :: List.map fst all_tests) (Printf.sprintf "examples/%s is not tested.")); "examples/oasis">:: (fun test_ctxt -> let dn = in_example_dir test_ctxt ["oasis"] in Array.iter (fun bn -> let fn = Filename.concat dn bn in non_fatal test_ctxt (fun test_ctxt -> try let _pkg: OASISTypes.package = OASISParse.from_file ~ctxt:(oasis_ctxt test_ctxt) fn in () with e -> assert_failure (Printf.sprintf "Parsing error of %s: %s." ("oasis/"^bn) (Printexc.to_string e)))) (Sys.readdir dn)); ] oasis-0.4.11/test/test-main/TestBasic.ml0000644000175000017500000000721013261073606017334 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open TestCommon let tests = "Basic" >::: [ "Help1" >:: (fun test_ctxt -> assert_oasis_cli ~ctxt:test_ctxt ["--help"]); "Help2" >:: (fun test_ctxt -> assert_oasis_cli ~ctxt:test_ctxt ["help"]); "Manual" >:: (fun test_ctxt -> assert_oasis_cli ~ctxt:test_ctxt ["-ignore-plugins"; "manual"]); "Env dump/load" >:: (fun test_ctxt -> let ctxt = {(TestCommon.oasis_ctxt test_ctxt) with OASISContext.srcfs = new OASISFileSystem.host_fs (in_testdata_dir test_ctxt ["TestBasic"])} in (* TODO: lock *) BaseEnv.unload (); BaseEnv.load ~ctxt ~filename:(OASISFileSystem.of_unix_filename "dir.data") (); (* Reset lazy values ? *) assert_equal ~printer:(fun s -> s) "toto" (BaseStandardVar.bindir ())); "OCaml dev version" >:: (fun _ -> PropList.Schema.set BaseEnv.schema BaseEnv.env ~context:BaseEnv.OCommandLine "ocamlc_config_map" (Marshal.to_string (MapString.add "version" "3.13.0+dev2 (2010-10-22)" MapString.empty) []); assert_equal ~printer:(fun s -> s) "3.13.0" (BaseStandardVar.ocaml_version ())); "Compileable BaseSysBundle.ml" >:: (fun test_ctxt -> let dn = bracket_tmpdir test_ctxt in let chn = open_out (Filename.concat dn "bundle.ml") in output_string chn OASISData.oasissysbundle_ml; output_string chn BaseData.basesysbundle_ml; close_out chn; assert_command ~ctxt:test_ctxt "ocamlc" ["-o"; (Filename.concat dn "bundle"); (Filename.concat dn "bundle.ml")]); "Sync OASISParse/BaseSetup.default_oasis_fn" >:: (fun _ -> assert_equal ~printer:(fun s -> s) OASISParse.default_oasis_fn BaseSetup.default_oasis_fn); ] oasis-0.4.11/test/test-main/TestBaseLog.ml0000644000175000017500000000660013261073606017631 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** BaseLog tests @author Sylvain Le Gall *) open OUnit2 open TestCommon open BaseLog open OASISContext let tests = let tmp_ctxt test_ctxt = let tmpdir = bracket_tmpdir test_ctxt in {(oasis_ctxt test_ctxt) with srcfs = new OASISFileSystem.host_fs tmpdir} in let assert_equal_log ~ctxt msg exp = assert_equal ~msg ~printer:(fun lst -> String.concat ", " (List.map (fun (e, d) -> Printf.sprintf "%S %S" e d) lst)) exp (load ~ctxt ()) in let assert_load ~msg test_ctxt fn exp = let ctxt = {(oasis_ctxt test_ctxt) with srcfs = new OASISFileSystem.host_fs (in_testdata_dir test_ctxt ["TestBaseLog"; fn])} in assert_equal_log ~ctxt msg exp in "BaseLog" >::: [ "load" >:: (fun test_ctxt -> let content = ["foo", "bar"; "bar", "baz"] in assert_load ~msg:"from a Win32 file" test_ctxt "win32" content; assert_load ~msg:"from an Unix file" test_ctxt "unix" content); "normal" >:: (fun test_ctxt -> let ctxt = tmp_ctxt test_ctxt in register ~ctxt "toto" "mytoto"; assert_bool "Event toto exists" (exists ~ctxt "toto" "mytoto"); unregister ~ctxt "toto" "mytoto"; assert_bool "Event toto doesn't exist" (not (exists ~ctxt "toto" "mytoto"))); "double" >:: (fun test_ctxt -> let ctxt = tmp_ctxt test_ctxt in register ~ctxt "toto" "mytoto"; assert_equal_log ~ctxt "Log contains 1 element" ["toto", "mytoto"]; register ~ctxt "toto" "mytoto"; assert_equal_log ~ctxt "Log still contains 1 element" ["toto", "mytoto"]); ] oasis-0.4.11/test/test-main/TestBaseEnv.ml0000644000175000017500000000406513261073606017643 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Tests for BaseEnv. @author Sylvain Le Gall *) open OUnit2 open OASISContext let tests = "BaseEnv" >::: [ "default_filename synced" >:: (fun test_ctxt -> let ctxt = TestCommon.oasis_ctxt test_ctxt in assert_equal ~printer:(Printf.sprintf "%S") (ctxt.srcfs#string_of_filename BaseEnv.default_filename) BaseEnvLight.default_filename); ] oasis-0.4.11/test/test-main/TestBaseCompat.ml0000644000175000017500000001050413261073606020331 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open TestCommon open TestFullUtils let test_one ?dev ?dynamic ?nocompat ?setup_ml_org test_ctxt fn = let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestBaseCompat"]) in begin match setup_ml_org with | Some fn -> FileUtil.cp [in_src_dir t fn] (in_src_dir t setup_ml) | None -> () end; FileUtil.cp [in_src_dir t fn] (in_src_dir t OASISParse.default_oasis_fn); oasis_setup ?dev ?dynamic ?nocompat test_ctxt t; (in_src_dir t setup_ml), t let assert_contains fn what = assert_bool (Printf.sprintf "File %S should contain %S." fn what) (OASISString.contains ~what (file_content fn)) let assert_doesnt_contain fn what = assert_bool (Printf.sprintf "File %S shouldn't contain %S." fn what) (not (OASISString.contains ~what (file_content fn))) let assert_present fn = assert_bool (Printf.sprintf "File %s should be present." fn) (Sys.file_exists fn) let assert_absent fn = assert_bool (Printf.sprintf "File %s should not be present." fn) (not (Sys.file_exists fn)) let tests = "BaseCompat" >::: [ "oasis-0.3" >:: (fun test_ctxt -> let setup_ml, _ = test_one test_ctxt "_oasis-0.3" in assert_contains setup_ml "open BaseCompat.Compat_0_3"; assert_doesnt_contain setup_ml "open BaseCompat.Compat_0_4"); "oasis-0.4" >:: (fun test_ctxt -> let setup_ml, t = test_one test_ctxt ~setup_ml_org:"setup-0.4.ml" "_oasis-0.4" in let test_fn = in_src_dir t "foobar" in assert_doesnt_contain setup_ml "open BaseCompat.Compat_0_3"; assert_contains setup_ml "open BaseCompat.Compat_0_4"; run_ocaml_setup_ml test_ctxt t ["-version"]; assert_absent test_fn; run_ocaml_setup_ml test_ctxt t ["-configure"]; assert_present test_fn; run_ocaml_setup_ml test_ctxt t ["-distclean"]; assert_absent test_fn); "oasis-nocompat" >:: (fun test_ctxt -> let setup_ml, _ = test_one ~nocompat:true test_ctxt "_oasis-0.4" in assert_doesnt_contain setup_ml "open BaseCompat.Compat_0_3"; assert_doesnt_contain setup_ml "open BaseCompat.Compat_0_4"); "oasis-dynrun" >:: (fun test_ctxt -> let setup_ml, t = test_one ~setup_ml_org:"setup-0.4.ml" ~dev:true ~dynamic:true test_ctxt "_oasis-0.4" in let test_fn = in_src_dir t "foobar" in dbug_file_content test_ctxt setup_ml; assert_absent test_fn; run_ocaml_setup_ml test_ctxt t ["-configure"]; assert_present test_fn); ] oasis-0.4.11/test/test-main/Test.ml0000644000175000017500000001116413261073606016375 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Run tests for OASIS @author Sylvain Le Gall *) open OUnit2 let extract_timings () = let log_fn j = Filename.concat OUnitUtils.buildir (Printf.sprintf "oUnit-OASIS-%s.log" (OUnitUtils.shardf j)) in let j = ref 0 in let timings = Hashtbl.create 13 in let () = ignore "(*(*" in let rex = Pcre.regexp "Time spent in '(.*)': (.*)s" in let total_time = ref 0.0 in let () = while Sys.file_exists (log_fn !j) do let chn = open_in (log_fn !j) in incr j; try while true do let ln = input_line chn in try let substr = Pcre.exec ~rex ln in let name = Pcre.get_substring substr 1 in let time = float_of_string (Pcre.get_substring substr 2) in let count', time' = try Hashtbl.find timings name with Not_found -> 0, 0.0 in total_time := !total_time +. time; Hashtbl.replace timings name (count' + 1, time' +. time) with Not_found -> () done with End_of_file -> close_in chn done in let output_dir = "../dist" in let output_fn = Filename.concat output_dir "timings.csv" in if Sys.file_exists output_dir && Sys.is_directory output_dir then begin let chn = open_out output_fn in Printf.fprintf chn "name,time,count\n"; Hashtbl.iter (fun name (count, time) -> Printf.fprintf chn "%S,%f,%d\n" name time count) timings; close_out chn end; try ignore(Sys.getenv "TIMINGS"); Hashtbl.iter (fun name (count, time) -> Printf.printf "Time spent in '%s':\n % 7.2fs (% 3d time, % 6.2f%%, %5.2fs/call)\n" name time count ((time /. !total_time) *. 100.0) (time /. (float_of_int count))) timings; Printf.printf "Total time accounted: %fs\n" !total_time with Not_found -> () let () = let () = OASISBuiltinPlugins.init () in run_test_tt_main ~exit ("OASIS">::: [ (* Keep sorted. *) TestBaseCompat.tests; TestBaseEnv.tests; TestBaseLog.tests; TestBasic.tests; TestExamples.tests; TestFileTemplate.tests; TestFull.tests; TestLicense.tests; TestOASISAst.tests; TestOASISFileSystem.tests; TestOASISLibrary.tests; TestOASISObject.tests; TestOASISParse.tests; TestOASISSourcePatterns.tests; TestOASISString.tests; TestOASISText.tests; TestOASISValues.tests; TestPluginDevFiles.tests; TestPluginInternal.tests; TestPluginMETA.tests; TestPluginOCamlbuild.tests; TestPluginStdFiles.tests; TestPropList.tests; TestQuery.tests; TestValues.tests; TestVersion.tests; ]); extract_timings () oasis-0.4.11/test/test-devel/0000755000175000017500000000000013261073606015274 5ustar gildorgildoroasis-0.4.11/test/test-devel/TestSelfCompile.ml0000644000175000017500000001166013261073606020674 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Compile OASIS itself using the version under tests. *) open OUnit2 open TestCommon let tests = "SelfCompile" >: (test_case ~length:OUnitTest.Long (fun test_ctxt -> let () = skip_long_test test_ctxt in let pwd = FileUtil.pwd () in let src_dir = Filename.dirname pwd in let in_src_dir fn = Filename.concat src_dir fn in let () = skip_if (Sys.os_type <> "Unix" || not (Sys.file_exists (in_src_dir ".git"))) "Only compile for particular dev configurations." in let tmpdir = bracket_tmpdir test_ctxt in let rlst = let ignore_dot_git fn' = OASISString.starts_with ~what:(in_src_dir ".git") fn' in ref [ignore_dot_git] in let () = (* Take into .gitignore to prevent copying some files. *) let chn = open_in (in_src_dir ".gitignore") in try while true do let pat = input_line chn in let test = if pat <> "" then begin let pat_len = String.length pat in let no_first_char = String.sub pat 1 (pat_len - 1) in match String.get pat 0, String.get pat (pat_len - 1) with | '/', '/' -> if pat_len = 1 then fun _ -> true else let fn = in_src_dir (String.sub pat 1 (pat_len - 2)) in fun s -> OASISString.starts_with ~what:fn s | '/', _ -> let fn = in_src_dir no_first_char in fun s -> fn = s | '*', _ -> fun s -> OASISString.ends_with ~what:no_first_char s | _ -> fun s -> OASISString.ends_with ~what:pat s end else begin fun _ -> false end in rlst := test :: !rlst done; with End_of_file -> close_in chn in let is_ignored fn = List.exists (fun test -> test fn) !rlst in (* List all files that should be copied. *) let files = FileUtil.find FileUtil.Is_file src_dir (fun lst fn -> fn :: lst) [] in (* Copy all files to a temporary directory. *) let () = List.iter (fun fn -> if not (is_ignored fn) then begin let target_fn = FilePath.reparent src_dir tmpdir fn in let dn = Filename.dirname target_fn in logf test_ctxt `Info "Copy %s -> %s." fn target_fn; if not (Sys.file_exists dn) then FileUtil.mkdir ~parent:true dn; FileUtil.cp [fn] target_fn end) files in (* Regenerate setup.ml and try to compile. *) assert_oasis_cli ~ctxt:test_ctxt ~chdir:tmpdir ["setup"]; assert_command ~ctxt:test_ctxt ~chdir:tmpdir "ocaml" ["setup.ml"; "-configure"; "--override"; "is_native"; string_of_bool (is_native test_ctxt); "--override"; "native_dynlink"; string_of_bool (native_dynlink test_ctxt)]; assert_command ~ctxt:test_ctxt ~chdir:tmpdir "ocaml" ["setup.ml"; "-build"])) oasis-0.4.11/test/test-devel/TestDevel.ml0000644000175000017500000000552713261073606017536 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Run tests for OASIS @author Sylvain Le Gall *) open OUnit2 let () = run_test_tt_main ~exit ("OASIS">::: [ (* Keep sorted. *) TestSelfCompile.tests; (* Extra small tests. *) "setup.ml has been generated with a previous version of oasis" >:: (fun test_ctxt -> let oasis_version_for_setup_ml = let buf = Buffer.create 13 in OUnit2.assert_command ~chdir:".." ~ctxt:test_ctxt ~foutput:(Stream.iter (Buffer.add_char buf)) "ocaml" ["setup.ml"; "-version"]; OASISString.trim (Buffer.contents buf) in let oasis_version_current = OASISVersion.string_of_version OASISConf.version_full in assert_bool (Printf.sprintf "The OASIS version for the generated setup.ml should be '< %s', \ but this is currently %S." oasis_version_current oasis_version_for_setup_ml) (0 < (OASISVersion.StringVersion.compare oasis_version_current oasis_version_for_setup_ml))); ]); oasis-0.4.11/test/test-common/0000755000175000017500000000000013261073606015465 5ustar gildorgildoroasis-0.4.11/test/test-common/test-common.mllib0000644000175000017500000000342313261073606020755 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 85a207d4e9316f4a64b7d4c67c1167e5) TestCommon TestFullUtils # OASIS_STOP oasis-0.4.11/test/test-common/test-common.mldylib0000644000175000017500000000342313261073606021312 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 85a207d4e9316f4a64b7d4c67c1167e5) TestCommon TestFullUtils # OASIS_STOP oasis-0.4.11/test/test-common/TestFullUtils.ml0000644000175000017500000007362413261073606020616 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Utilities to run full OASIS use cases @author Sylvain Le Gall *) open FileUtil open OUnit2 open TestCommon type filename = FilePath.filename let exec fn = if Sys.os_type = "Win32" then fn^".exe" else fn (* Print a short version of the filename *) let fn_printer ~root fn = FilePath.make_relative root fn module SetFileElement = struct type t = filename let compare = if Sys.os_type = "Win32" then (* Win32 FS is case insensitive *) OASISUtils.compare_csl else String.compare let pp_printer = Format.pp_print_string let pp_print_sep = OUnitDiff.pp_comma_separator end module SetFile = struct include OASISUtils.SetExt.Make(SetFileElement) module Diff = OUnitDiff.SetMake(SetFileElement) let assert_equal ?msg ~root exp act = Diff.assert_equal ?msg (Diff.of_list (List.rev_map (fn_printer ~root) (elements exp))) (Diff.of_list (List.rev_map (fn_printer ~root) (elements act))) end module SetFileDigestElement = struct type t = filename * Digest.t let compare (f1, d1) (f2, d2) = match SetFileElement.compare f1 f2 with | 0 -> String.compare d1 d2 | n -> n let pp_printer frmtr (filename, digest) = Format.fprintf frmtr "(%S, %s)" filename (Digest.to_hex digest) let pp_print_sep = OUnitDiff.pp_comma_separator end module SetFileDigest = struct include OASISUtils.SetExt.Make(SetFileDigestElement) module Diff = OUnitDiff.SetMake(SetFileDigestElement) let assert_equal ?msg ~root exp act = let convert lst = Diff.of_list (List.rev_map (fun (fn, digest) -> fn_printer ~root fn, digest) (elements lst)) in Diff.assert_equal ?msg (convert exp) (convert act) end let setup_ml = BaseSetup.default_filename (* List all files in directory. *) let all_files dir = find Is_file dir (fun st fn -> SetFile.add fn st) SetFile.empty (* Create a set of file/digest of the current directory. *) let all_file_digests dn = SetFile.fold (fun fn st -> SetFileDigest.add (fn, Digest.file fn) st) (all_files dn) SetFileDigest.empty (* Verify that generated files follow some style rules. *) let check_file_style test_ctxt fn = let chn = open_in fn in let line_number = ref 0 in try while true do let line = input_line chn in incr line_number; non_fatal test_ctxt (fun _ -> let strlen = String.length line in if strlen > 0 && line.[strlen - 1] = ' ' then if strlen = 1 || strlen > 1 && line.[strlen - 2] != '\\' then assert_failure (Printf.sprintf "Found a blank at the end of line in file '%s' line %d: %S" (Filename.basename fn) !line_number line)); done with End_of_file -> close_in chn (* Find and test the style of all files in a directory. *) let check_all_files_style test_ctxt dn = let ocamlmod_version = try let buff = Buffer.create 10 in OUnit2.assert_command ~ctxt:test_ctxt ~foutput:(fun strm -> Stream.iter (Buffer.add_char buff) strm) (TestCommon.ocamlmod_exec test_ctxt) ["-version"]; Buffer.contents buff with _ -> "0.0.6" in logf test_ctxt `Info "Using ocamlmod version %s." ocamlmod_version; if OASISVersion.StringVersion.compare ocamlmod_version "0.0.7" >= 0 then FileUtil.find Is_file dn (fun () fn -> check_file_style test_ctxt fn) () else logf test_ctxt `Warning "Skipping style check because using ocamlmod version %s (< 0.0.7)." ocamlmod_version type t = { is_native: bool; native_dynlink: bool; src_dir: filename; build_dir: filename; ocaml_lib_dir: filename; bin_dir: filename; lib_dir: filename; data_dir: filename; doc_dir: filename; html_dir: filename; precompile_dir: filename; pristine: SetFileDigest.t; pristine_build: SetFile.t; ocaml_version: string; mutable generated_files: SetFile.t; mutable installed_files: SetFile.t; mutable setup_ml_precompiled: [`Not_tried|`Not_possible|`Done_for of Digest.t]; } (* Create tree structure for a test project and copy it there. *) let setup_test_directories test_ctxt ~is_native ~native_dynlink dn = (* Create a temporary directory. *) let tmpdir = bracket_tmpdir test_ctxt in (* Copy sources in this temporary directory. *) let src_dir = OASISFileUtil.cp ~ctxt:(oasis_ctxt test_ctxt) ~recurse:true dn tmpdir; Filename.concat tmpdir (Filename.basename dn) in (* Directory where we store precompiled setup.ml. *) let precompile_dir = let dn = Filename.concat tmpdir "precompile" in mkdir dn; dn in (* Create the build_dir. *) let build_dir = Filename.concat tmpdir "build" in (* Create a directory in build_dir and return its name *) let mkdir_return fn_parts = let fn = FilePath.make_filename (build_dir :: fn_parts) in mkdir ~parent:true fn; fn in (* Evaluate the ocaml version, in the current environment. *) let ocaml_version = let buff = Buffer.create 10 in OUnit2.assert_command ~ctxt:test_ctxt ~foutput:(Stream.iter (function '\n' -> () | c -> Buffer.add_char buff c)) "ocamlc" ["-version"]; Buffer.contents buff in { is_native = is_native; native_dynlink = native_dynlink; src_dir = src_dir; build_dir = build_dir; ocaml_lib_dir = mkdir_return ["lib"; "ocaml"]; bin_dir = mkdir_return ["bin"]; lib_dir = mkdir_return ["lib"]; data_dir = mkdir_return ["share"]; doc_dir = mkdir_return ["share"; "doc"]; html_dir = mkdir_return ["share"; "doc"; "html"]; precompile_dir = precompile_dir; pristine = all_file_digests src_dir; pristine_build = SetFile.empty; ocaml_version = ocaml_version; generated_files = SetFile.empty; installed_files = SetFile.empty; setup_ml_precompiled = `Not_tried; } (* Locate the given [fn] in src_dir. *) let in_src_dir t fn = Filename.concat t.src_dir fn (* Precompile setup.ml to speedup the tests, if possible. *) let rec precompile_setup_ml test_ctxt t = let setup_exe = Filename.concat t.precompile_dir (Filename.chop_extension setup_ml) in let full_setup_ml = in_src_dir t setup_ml in let can_compile () = let chn = open_in full_setup_ml in let hash_load = ref false in let () = try while not !hash_load do if OASISString.starts_with ~what:"#load" (input_line chn) then hash_load := true done with End_of_file -> () in close_in chn; not !hash_load in let compile () = let timer = timer_start "precompile_setup_ml" in let exit_code = FileUtil.cp ~force:FileUtil.Force [full_setup_ml] t.precompile_dir; Sys.command ("ocamlfind ocamlc -o "^setup_exe^" " ^(Filename.concat t.precompile_dir setup_ml)) in timer_stop test_ctxt timer; if exit_code = 0 then begin (* Compilation succeed, update the digest *) logf test_ctxt `Info "Compilation of setup.ml succeeds."; `Done_for (Digest.file full_setup_ml) end else begin logf test_ctxt `Warning "Compilation of setup.ml doesn't succeed."; `Not_possible end in match t.setup_ml_precompiled with | `Not_tried -> if can_compile () then begin t.setup_ml_precompiled <- compile () end else begin logf test_ctxt `Info "Compilation of setup.ml not possible."; t.setup_ml_precompiled <- `Not_possible end; precompile_setup_ml test_ctxt t | `Not_possible -> None | `Done_for digest -> if (Digest.file full_setup_ml) = digest then begin Some (exec setup_exe) end else begin t.setup_ml_precompiled <- compile (); precompile_setup_ml test_ctxt t end let ocaml_env ?(extra_env=[]) _ t = (* Libraries located inside the test directory *) let local_lib_paths = find Is_dir t.lib_dir (fun acc fn -> fn :: acc) (find Is_dir t.ocaml_lib_dir (fun acc fn -> fn :: acc) []) in let env_paths = try FilePath.path_of_string (Unix.getenv "PATH") with Not_found -> [] in let paths, extra_paths = if Sys.os_type = "Win32" then begin (t.bin_dir :: (local_lib_paths @ env_paths)), [] end else begin let paths = t.bin_dir :: env_paths in let ld_library_paths = local_lib_paths @ (try FilePath.path_of_string (Unix.getenv "LD_LIBRARY_PATH") with Not_found -> []) in paths, ["LD_LIBRARY_PATH", ld_library_paths] end in (* Add a path to a path like environment varialbe. *) let add_path nm dir = nm, try FilePath.string_of_path ((FilePath.path_of_string (Sys.getenv nm)) @ [dir]) with Not_found -> dir in let extra_env = (add_path "OCAMLPATH" t.ocaml_lib_dir) :: (List.map (fun (v, lst) -> v, FilePath.string_of_path lst) (("PATH", paths) :: extra_paths)) @ extra_env in paths, extra_env (* Run a command after setting everything to run using binaries and libraries as generated by "ocaml setup.ml -install" of a test project. *) let assert_command_with_ocaml_env ?extra_env ?exit_code ?chdir ?check_output test_ctxt t cmd args = let paths, extra_env = ocaml_env ?extra_env test_ctxt t in let real_cmd = try if not (Sys.file_exists cmd) then which ~path:paths cmd else cmd with Not_found -> assert_failure (Printf.sprintf "Command '%s' cannot be found in %s." cmd (String.concat ";" paths)) in assert_command ~ctxt:test_ctxt ?exit_code ?chdir ?check_output ~extra_env real_cmd args (* Run setup.ml *) let run_ocaml_setup_ml ?(with_ocaml_env=false) ?exit_code ?check_output ?(extra_env=[]) test_ctxt t args = (* Speed up for testing, compile setup.ml *) let timer = timer_start ("run_ocaml_setup_ml "^(List.hd args)) in let toplevel_path = try Sys.getenv "OCAML_TOPLEVEL_PATH" with Not_found -> "" in let _, extra_env = ocaml_env ~extra_env: (("OCAMLFIND_DESTDIR", t.ocaml_lib_dir) :: ("OCAMLFIND_LDCONF", "ignore") :: ("OCAML_TOPLEVEL_PATH", toplevel_path) :: ("HOME", t.build_dir) :: extra_env) test_ctxt t in let cmd, args = match precompile_setup_ml test_ctxt t with | Some setup_exe -> setup_exe, ("-info" :: "-debug" :: args) | None -> "ocaml", ((in_src_dir t setup_ml) :: "-info" :: "-debug" :: args) in if with_ocaml_env then assert_command_with_ocaml_env ?exit_code ?check_output ~extra_env ~chdir:t.src_dir test_ctxt t cmd args else assert_command ~ctxt:test_ctxt ?exit_code ?check_output ~extra_env ~chdir:t.src_dir cmd args; timer_stop test_ctxt timer (* Try to run an installed executable *) let try_installed_exec ?exit_code test_ctxt t cmd args = assert_command_with_ocaml_env test_ctxt ?exit_code t cmd args (* Compile with the given package. *) let assert_compile test_ctxt t pkg cmd args = assert_command_with_ocaml_env test_ctxt t "ocamlfind" (cmd :: "-package" :: pkg :: args) (* Try to run an installed library. *) let try_installed_library test_ctxt t pkg modules = (* Create a file that contains every modules *) let srcdir = bracket_tmpdir test_ctxt in let fn = FilePath.concat srcdir "testZZZ.ml" in let () = (* Fill the file with open statement *) let chn_out = open_out fn in List.iter (Printf.fprintf chn_out "open %s;;\n") modules; close_out chn_out in let exec_byte = FilePath.replace_extension fn "byte" in let exec_native = FilePath.replace_extension fn "native" in (* Library + bytecode compilation *) assert_compile test_ctxt t pkg "ocamlc" ["-a"; "-o"; FilePath.replace_extension fn "cma"; fn]; (* Program + bytecode compilation *) assert_compile test_ctxt t pkg "ocamlc" ["-o"; exec_byte; "-linkpkg"; fn]; if t.is_native then begin (* Library + native compilation *) assert_compile test_ctxt t pkg "ocamlopt" ["-a"; "-o"; FilePath.replace_extension fn "cmxa"; fn]; (* Program + native compilation *) assert_compile test_ctxt t pkg "ocamlopt" ["-o"; exec_native; "-linkpkg"; fn]; end let contains_string fn str = let rex = Pcre.regexp (Pcre.quote str) in let has_string = ref false in let chn = open_in fn in Pcre.foreach_line ~ic:chn (fun l -> if not !has_string then has_string := Pcre.pmatch ~rex l); close_in chn; !has_string (* Files generated when ocamlbuild buildsys is used *) let oasis_ocamlbuild_files = ["myocamlbuild.ml"; "_tags"] (* Add files to the list of generated files. *) let register_generated_files t lst = List.iter (fun fn -> t.generated_files <- SetFile.add (in_src_dir t fn) t.generated_files) lst (* Check presence of generated files. *) let check_generated_files location t = let expected_files = SetFileDigest.fold (fun (fn, _) st -> SetFile.add fn st) t.pristine t.generated_files in (* Check generated files *) SetFile.assert_equal ~msg:("Generated files ("^location^")") ~root:t.src_dir expected_files (all_files t.src_dir) (* Remove generated files and check that we are back to pristine. *) let back_to_pristine t = (* Remove generated files. *) rm (SetFile.elements t.generated_files); (* Check that we are back to pristine. *) SetFileDigest.assert_equal ~msg:"Source directory back to pristine" ~root:t.src_dir t.pristine (all_file_digests t.src_dir) type installed_files = | InstalledLibrary of filename list | InstalledOCamlLibrary of string * filename list (* lib * files *) | InstalledHTML of string * filename list (* lib * files *) | InstalledAPIRef of string * string list (* lib * module name *) | InstalledData of filename list | InstalledBin of filename list (* Register a set of files expected to be built. *) let register_installed_files test_ctxt t installed_files_lst = let rec file_list = function | InstalledLibrary fn_lst -> List.rev_map (FilePath.concat t.lib_dir) fn_lst | InstalledOCamlLibrary (lib, fn_lst) -> List.rev_map (fun fn -> FilePath.make_filename [t.ocaml_lib_dir; lib; fn]) fn_lst | InstalledHTML (lib, fn_lst) -> List.rev_map (fun fn -> FilePath.make_filename [t.html_dir; lib; fn]) fn_lst | InstalledAPIRef (lib, modules) -> let files = List.rev_append [ "index.html"; "index_extensions.html"; "index_attributes.html"; "index_class_types.html"; "index_classes.html"; "index_exceptions.html"; "index_methods.html"; "index_module_types.html"; "index_modules.html"; "index_types.html"; "index_values.html"; "style.css"; ] (List.flatten (List.rev_map (fun modul -> ["type_"^modul^".html"; modul^".html"]) modules)) in file_list (InstalledHTML (lib, files)) | InstalledData fn_lst -> List.rev_map (FilePath.concat t.data_dir) fn_lst | InstalledBin fn_lst -> List.rev_map (fun fn -> exec (FilePath.concat t.bin_dir fn)) fn_lst in (** Filter out and transform an expected file list to be compatible with the * target platform. *) let adapt_files_to_platform _ lst = let is_win32 = Sys.os_type = "Win32" in List.fold_left (fun acc fn -> let ext = try FilePath.get_extension fn with Not_found -> "" in match ext with | "cmx" | "cmxa" | "o" when not t.is_native -> acc | "cmxs" when not t.native_dynlink -> acc | "annot" when OASISVersion.StringVersion.compare t.ocaml_version "3.11" < 0 -> acc | "cmt" | "cmti" when OASISVersion.StringVersion.compare t.ocaml_version "4.01" < 0 -> acc | "a" -> let fn = if is_win32 then FilePath.replace_extension fn "lib" else fn in if (* library matching the .cmxa *) t.is_native || (* stubs library *) OASISString.starts_with ~what:"lib" (Filename.basename fn) then fn :: acc else (* no .a matching bytecode only library. *) acc | "so" when is_win32 -> (FilePath.replace_extension fn ".dll") :: acc | "html" when FilePath.basename fn = "index_extensions.html" && OASISVersion.StringVersion.compare t.ocaml_version "4.02" < 0 -> acc | _ -> fn :: acc) [] lst in t.installed_files <- List.fold_left (fun set fn -> SetFile.add fn set) t.installed_files (adapt_files_to_platform test_ctxt (List.flatten (List.rev_map file_list installed_files_lst))) (* Check that we have installed everything as expected. *) let check_installed_files _ t id = SetFile.assert_equal ~msg:(Printf.sprintf "Installed files (%s)" id) ~root:t.build_dir SetFile.(union t.installed_files t.pristine_build) (all_files t.build_dir) (* Check build_dir is empty. *) let check_nothing_installed _ t id = SetFile.assert_equal ~msg:(Printf.sprintf "Build directory is empty after uninstall (%s)" id) ~root:t.build_dir t.pristine_build (all_files t.build_dir) (* Extract ocamlbuild flags and check that they are correct. *) let check_myocamlbuild_ml test_ctxt t = if Sys.file_exists (in_src_dir t "myocamlbuild.ml") then begin let timer = timer_start "check_myocamlbuild_ml" in let () = dbug_file_content test_ctxt (in_src_dir t "myocamlbuild.ml") in let documentation_output = let buf = Buffer.create 16000 in OUnit2.assert_command ~chdir:t.src_dir ~ctxt:test_ctxt ~foutput:(Stream.iter (Buffer.add_char buf)) "ocamlbuild" ["-documentation"]; Buffer.contents buf in let lst = OASISString.split_newline documentation_output in let rst = ref SetString.empty in let () = List.iter (fun line -> try let _ = "(*" in let substr = Pcre.exec ~pat:"flag {\\. (.*) \\.}" line in let lst = Pcre.split ~pat:"\\s*,\\s*" (Pcre.get_substring substr 1) in rst := List.fold_left (fun st e -> SetString.add e st) !rst lst with Not_found -> ()) lst in if !rst = SetString.empty then assert_failure ("Set of flags should not be empty."); SetString.iter (fun flag -> String.iter (function | 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '.' | ':' | '-' | '+' | '(' | ')' | '@' -> () | c -> assert_failure (Printf.sprintf "flag %S contains %C which is illegal." flag c)) flag) !rst; timer_stop test_ctxt timer end (* If a _tags file exists, try to test its content. *) let check_tags test_ctxt t = if Sys.file_exists (in_src_dir t "_tags") then begin let () = dbug_file_content test_ctxt (in_src_dir t "_tags") in let _, lst = List.fold_right (fun line (lineno, lst) -> lineno + 1, (lineno, line) :: lst) (OASISString.nsplit (file_content (in_src_dir t "_tags")) '\n') (1, []) in List.iter (fun (lineno, line) -> let assert_file_exists fn = if not (Sys.file_exists (in_src_dir t fn)) then assert_failure (Printf.sprintf "file '%s' doesn't exist in _tags file line %d (%S)" fn lineno line) in try let _ = "(*" in let substr = Pcre.exec ~pat:"^\\s*\"(.*)\"\\s*:" line in let fn = Pcre.get_substring substr 1 in if List.mem fn [".git"; ".bzr"; ".hg"; "_darcs"] || List.mem (FilePath.get_extension fn) ["byte"; "native"; "lib"; "dll"; "a"; "so"; "cmxs"] then () else if FilePath.get_extension fn = "cmx" then begin assert_file_exists (FilePath.replace_extension fn "ml") end else begin assert_file_exists fn end with Not_found -> (* TODO: handle ocamlbuild wildcard *) ()) lst end (* Run oasis setup and fix generated files accordingly. *) let oasis_setup ?(dev=false) ?(dynamic=false) ?(nocompat=false) test_ctxt t = let () = let pkg = OASISParse.from_file ~ctxt:(oasis_ctxt test_ctxt) (in_src_dir t OASISParse.default_oasis_fn) in match pkg.OASISTypes.ocaml_version with | Some ver_cmp -> skip_if (not (OASISVersion.comparator_apply (OASISVersion.version_of_string t.ocaml_version) ver_cmp)) (Printf.sprintf "Need ocaml version %s." (OASISVersion.string_of_comparator ver_cmp)) | None -> () in let timer = timer_start "oasis_setup" in (* Create build system using OASIS *) assert_oasis_cli ~ctxt:test_ctxt ~chdir:t.src_dir (List.flatten [ ["setup"]; (if dev then ["-real-oasis"; "-setup-update"; if dynamic then "dynamic" else "weak"] else []); (if nocompat then ["-nocompat"] else []); ]); timer_stop test_ctxt timer; register_generated_files t [setup_ml]; (* Fix #require in dynamic *) if dynamic then begin let load lst = let cma = FilePath.make_filename ([FileUtil.pwd (); ".."; "_build"; "src"] @ lst) in Printf.sprintf "#load %S;;\n#directory %S;;" cma (Filename.dirname cma) in let orig_lst = OASISString.nsplit (file_content (in_src_dir t setup_ml)) '\n' in let fixed_lst = List.fold_left (fun fixed_lst line -> match line with | "#require \"oasis.dynrun\";;" -> List.rev_append [ "#require \"unix\";;"; "#require \"ocamlbuild\";;"; load ["oasis"; "oasis.cma"]; load ["base"; "base.cma"]; load ["builtin-plugins.cma"]; load ["dynrun"; "dynrun.cma"]; ] fixed_lst | " let _str : string = Findlib.package_directory \ \"oasis.dynrun\" in" -> (* For dynrun_for_release. *) " let _str : string = Findlib.package_directory \ \"unix\" in" :: fixed_lst | line -> line :: fixed_lst) [] orig_lst in let chn = open_out (in_src_dir t setup_ml) in List.iter (fun line -> output_string chn line; output_char chn '\n') (List.rev fixed_lst); close_out chn; dbug_file_content test_ctxt (in_src_dir t setup_ml) end; check_all_files_style test_ctxt t.src_dir let standard_checks test_ctxt t = let timer = timer_start "standard_checks" in check_generated_files "standard_checks" t; check_tags test_ctxt t; timer_stop test_ctxt timer let standard_test test_ctxt t = (* Standard checks. *) standard_checks test_ctxt t; (* Quick test. *) run_ocaml_setup_ml test_ctxt t ["-all"; "--"; "--override"; "is_native"; string_of_bool t.is_native]; check_myocamlbuild_ml test_ctxt t; (* Distclean. *) run_ocaml_setup_ml test_ctxt t ["-distclean"]; check_generated_files "after distclean" t; (* Run configure target *) run_ocaml_setup_ml test_ctxt t ["-configure"; "--prefix"; t.build_dir; "--docdir"; t.doc_dir; "--htmldir"; t.html_dir; "--override"; "is_native"; string_of_bool t.is_native]; assert_bool "File 'setup.data' has been created" (Sys.file_exists (in_src_dir t "setup.data")); (* Run build target *) run_ocaml_setup_ml test_ctxt t ["-build"]; (* Clean *) run_ocaml_setup_ml test_ctxt t ["-clean"]; (* Run build target *) run_ocaml_setup_ml test_ctxt t ["-build"]; (* Run test target *) run_ocaml_setup_ml test_ctxt t ["-test"]; (* Run documentation target *) run_ocaml_setup_ml test_ctxt t ["-doc"]; (* 1st install *) run_ocaml_setup_ml test_ctxt t ["-install"]; check_installed_files test_ctxt t "1st install"; run_ocaml_setup_ml test_ctxt t ["-uninstall"]; check_nothing_installed test_ctxt t "1st uninstall"; (* 2nd install *) run_ocaml_setup_ml test_ctxt t ["-install"]; check_installed_files test_ctxt t "2nd install"; run_ocaml_setup_ml test_ctxt t ["-uninstall"]; check_nothing_installed test_ctxt t "2nd uninstall"; (* Run install/uninstall target with destdir *) if Sys.os_type <> "Win32" then begin (* Prepending something at the beginning of a Win32 path * doesn't work because it will create a filename like: * c:\a\b\c:\c, which is illegal * TODO: find a solution for DESTDIR on Win32 *) let destdir = bracket_tmpdir test_ctxt in (* This will change OCAMLPATH as well when running setup.ml. *) let t = {t with ocaml_lib_dir = FilePath.concat destdir t.ocaml_lib_dir} in mkdir ~parent:true t.ocaml_lib_dir; run_ocaml_setup_ml test_ctxt t ~extra_env:["destdir", destdir] ["-install"]; SetFile.assert_equal ~msg:"Same files installed with destdir and without." ~root:destdir (SetFile.fold (fun fn -> SetFile.add (Filename.concat destdir fn)) t.installed_files SetFile.empty) (all_files destdir) end; (* 3rd install *) run_ocaml_setup_ml test_ctxt t ["-reinstall"]; check_installed_files test_ctxt t "3rd install" (* TODO: auto-test installed libraries. *) (* Install the findlib oasis package using the one under test. *) let install_oasis_library test_ctxt t = let source_dir = source_dir test_ctxt in let in_source_dir = Filename.concat source_dir in let ocamlfind_install nm meta files = let files_to_install = List.filter Sys.file_exists (List.flatten (List.map (fun (dn, lst) -> List.map (fun fn -> in_source_dir (Filename.concat dn fn)) lst) files)) in assert_command_with_ocaml_env test_ctxt t "ocamlfind" (["install"; nm; in_source_dir meta; "-destdir"; t.ocaml_lib_dir] @ files_to_install) in let file_set_before = all_files t.build_dir in let file_set_after = ocamlfind_install "oasis" "src/oasis/META" [ "_build/src/cli", [ "CLISubCommand.cmi"; "cli.cma"; ]; "_build/src/oasis", [ "OASISFeatures.cmi"; "OASISFileTemplate.cmi"; "OASISPackage.cmi"; "OASISPlugin.cmi"; "OASISSchema.cmi"; "OASISTypes.cmi"; "OASISUnixPath.cmi"; "OASISValues.cmi"; "OASISVersion.cmi"; "oasis.cma"; ]; "_build/src/base", [ "base.cma" ]; ]; ocamlfind_install "plugin-loader" "src/ext/plugin-loader/src/META" [ "_build/src/ext/plugin-loader/src", [ "plugin-loader.cma" ]; ]; all_files t.build_dir in {t with pristine_build = let open SetFile in union t.pristine_build (diff file_set_after file_set_before)} oasis-0.4.11/test/test-common/TestCommon.ml0000644000175000017500000002344713261073606020121 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Common utilities for testing @author Sylvain Le Gall *) open OUnit2 module MapString = Map.Make(String) module SetString = Set.Make(String) let is_native = Conf.make_bool "is_native" (bool_of_string (BaseStandardVar.is_native ())) "Wether native compilation possible." let native_dynlink = Conf.make_bool "native_dynlink" (bool_of_string (BaseStandardVar.native_dynlink ())) "Wether native dynlink is possible." let oasis_exec = Conf.make_exec "oasis" let ocamlmod_exec = Conf.make_exec "ocamlmod" let fake_ocamlfind_exec = Conf.make_exec "fake_ocamlfind" (* TODO: add make_string_list to OUnit2 and use it to define oasis_args. *) let oasis_args _ = [] let oasis_ctxt ?(ignore_plugin=false) test_ctxt = OASISContext.( {!default with ignore_plugins = ignore_plugin; quiet = false; debug = true; info = true; printf = (fun lvl str -> match lvl with | `Error | `Info | `Warning as lvl'-> logf test_ctxt lvl' "%s" str | `Debug -> (* TODO: output when OUnit will support debug. *) ())}) let long = Conf.make_bool "long" true "Don't run long tests." let skip_long_test ctxt = skip_if (not (long ctxt)) "Long test." let example_dir = let value = Conf.make_string "example_dir" "../examples/" "Examples directory." in fun ctxt -> let fn = value ctxt in if FilePath.is_relative fn then FilePath.make_absolute (FileUtil.pwd ()) fn else fn let in_example_dir test_ctxt lst = FilePath.make_filename ((example_dir test_ctxt) :: lst) (* TODO: set in _oasis. *) let source_dir = let value = Conf.make_string "source_dir" "../" "Top level source directory." in fun ctxt -> let fn = value ctxt in if FilePath.is_relative fn then FilePath.make_absolute (FileUtil.pwd ()) fn else fn module Output = struct type t = string let compare = String.compare let pp_printer = Format.pp_print_string let pp_print_sep = OUnitDiff.pp_comma_separator end module DiffSetOutput = OUnitDiff.SetMake (Output) module DiffListOutput = OUnitDiff.ListSimpleMake (Output) (* Assert checking that command run well *) let assert_command ~ctxt ?chdir ?exit_code ?output ?(output_contains=[]) ?extra_env ?(unorder=false) (* TODO: this should be true, but too many errors: fix this. *) ?(check_output=false) cmd args = let foutput = let read_check_output strm = let output = let buff = Buffer.create 13 in Stream.iter (Buffer.add_char buff) strm; Buffer.contents buff in let lines = OASISString.nsplit output '\n' in (* Check for output_contains strings. *) List.iter (fun str -> try let _i : int = OASISString.find ~what:str output in () with Not_found -> assert_failure (Printf.sprintf "Unable to find %S in output of command %S." str (Printf.sprintf "%s %s" cmd (String.concat " " args)))) output_contains; (* Check for warnings/errors. *) if check_output then List.iter (fun line -> non_fatal ctxt (fun _ -> List.iter (fun (what, fmt) -> if OASISString.starts_with ~what line then assert_failure (Printf.sprintf fmt line)) ["E:", ""^^"Error in line %S"; "W:", ""^^"Warning in line %S"; "Warning", ""^^"Warning in line %S"])) lines; lines in match output with | Some exp_output -> let foutput strm = let rel_output = read_check_output strm in let exp_output = OASISString.nsplit exp_output '\n' in let assert_equal_diff ~msg t1 t2 = if unorder then DiffSetOutput.assert_equal ~msg (DiffSetOutput.of_list t1) (DiffSetOutput.of_list t2) else DiffListOutput.assert_equal ~msg (DiffListOutput.of_list t1) (DiffListOutput.of_list t2) in assert_equal_diff ~msg:(Printf.sprintf "'%s' command output" (String.concat " " (cmd :: args))) exp_output rel_output in Some foutput | None -> Some (fun strm -> let _lst: string list = read_check_output strm in ()) in let env = let readd lst nm = try (nm^"="^(Sys.getenv nm)) :: lst with Not_found -> lst in let min_env = if Sys.os_type = "Win32" then Array.to_list (Unix.environment ()) else List.fold_left readd [] ["PATH"; "OCAMLPATH"] in let extra_env = match extra_env with | Some lst -> List.map (fun (k, v) -> k^"="^v) lst | None -> [] in Some (Array.of_list (extra_env @ min_env)) in assert_command ~ctxt ?chdir ?foutput ?env ?exit_code ~use_stderr:true cmd args let assert_oasis_cli ~ctxt ?chdir ?exit_code ?output ?output_contains ?extra_env ?unorder args = (* TODO: transfert chdir to -C chdir. *) assert_command ~ctxt ?chdir ?exit_code ?output ?extra_env ?unorder ?output_contains (oasis_exec ctxt) ((oasis_args ctxt) @ args) let file_content fn = let chn = open_in_bin fn in let size = in_channel_length chn in let buff = Buffer.create size in Buffer.add_channel buff chn size; close_in chn; Buffer.contents buff let dbug_file_content _ _ = () (* TODO: re-enable when OUnit will discard it for JUnit.xml. let dbug_file_content test_ctxt fn = logf test_ctxt `Info "Content of %S:" fn; logf test_ctxt `Info "%s" (file_content fn) *) (* Start a timer for [str]. *) let timer_start str = Unix.gettimeofday (), str (* Stop a timer and output its data in the log. *) let timer_stop test_ctxt (time_start, str) = logf test_ctxt `Info "Time spent in '%s': %fs" str ((Unix.gettimeofday ()) -. time_start) let skip_test_on_non_native_arch lst = let skip_non_native = OUnitTest.test_decorate (fun f -> fun test_ctxt -> skip_if (* Use the real is_native function and skip if on non native * arch. *) (not (is_native test_ctxt)) "only run on native arch"; f test_ctxt) in List.map skip_non_native lst (* Check all subdirectories are listed. *) let all_subdirectories test_ctxt dn lst fmt = let st = List.fold_left (fun st e -> SetString.add e st) SetString.empty lst in Array.iter (fun dn -> non_fatal test_ctxt (fun _ -> assert_bool (fmt dn) (SetString.mem dn st))) (Sys.readdir dn) class ['a] mem_fs : ['a] OASISFileSystem.fs = object val tbl = Hashtbl.create 13 method string_of_filename s = OASISFileSystem.to_unix_filename s method open_out ?mode:_ ?perm:_ fn = Hashtbl.add tbl fn (); object method close = () method output _ = () end method open_in ?mode:_ ?perm:_ _ = object method close = () method input _ _ = raise End_of_file end method file_exists fn = Hashtbl.mem tbl fn method remove fn = Hashtbl.remove tbl fn end class ['a] spy_fs test_ctxt fs : ['a] OASISFileSystem.fs = object(self) method private log op fn = logf test_ctxt `Info "%s(%S)" op (fs#string_of_filename fn) method string_of_filename = fs#string_of_filename method open_out ?mode ?perm fn = self#log "open_out" fn; fs#open_out ?mode ?perm fn method open_in ?mode ?perm fn = self#log "open_in" fn; fs#open_in ?mode ?perm fn method file_exists fn = self#log "file_exists" fn; fs#file_exists fn method remove fn = self#log "remove" fn; fs#remove fn end oasis-0.4.11/test/test-common/META0000644000175000017500000000407513261073627016147 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: b2bc0a47a4d4ed679c670e31a1986eaa) version = "0.4.11" description = "Tooling for building OCaml libraries and applications" requires = "oUnit oasis.base fileutils pcre" archive(byte) = "test-common.cma" archive(byte, plugin) = "test-common.cma" archive(native) = "test-common.cmxa" archive(native, plugin) = "test-common.cmxs" exists_if = "test-common.cma" # OASIS_STOP oasis-0.4.11/test/ounit.conf0000644000175000017500000000005613261073606015226 0ustar gildorgildor# Disable long test (dev only). #long = false oasis-0.4.11/test/fake-ocamlfind/0000755000175000017500000000000013261073606016060 5ustar gildorgildoroasis-0.4.11/test/fake-ocamlfind/FakeOCamlfind.ml0000644000175000017500000000370313261073606021040 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Fake ocamlfind program. *) let () = let real_ocamlfind = try Sys.getenv "REAL_OCAMLFIND" with Not_found -> failwith "You need to set REAL_OCAMLFIND env variable." in let args = Sys.argv in args.(0) <- real_ocamlfind; Unix.execv real_ocamlfind args oasis-0.4.11/test/data/0000755000175000017500000000000013261073606014131 5ustar gildorgildoroasis-0.4.11/test/data/TestQuery/0000755000175000017500000000000013261073606016076 5ustar gildorgildoroasis-0.4.11/test/data/TestQuery/test10.oasis0000644000175000017500000000052713261073606020262 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test Synopsis+: with extra text License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Authors+: Another one Flag "test" Description: this is a test Default$: os_type(win32) Test main Command: main if flag(test) Command+: -test oasis-0.4.11/test/data/TestQuery/test1.oasis0000644000175000017500000000222113261073606020173 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BuildType: None (0.2) BuildDepends: oUnit (>= 0.1.2), benchmark (>= 0.6) Description: This is a test to check that everything is working great with this kind of parser. . Coucou. Flag devmod Description: build for developper Default: false # Only available on i386 Flag ostest Description: Test on OS Default: false if system(hurd) && architecture(i386) Default: true Flag linuxtest64 Description: Linux 64bits only Default: false if system(linux) && architecture(amd64) Default: true else Default: false Flag linuxtest32 Description: Linux 32bits only Default: false if system(linux_elf) && architecture(i386) Default: true Library toto Path: src/stuff if architecture(amd64) Build: true if architecture(amd64) Build: false else Build: true if flag(linuxtest32) || flag(linuxtest64) || flag(ostest) Build: false else Build: true Library stuff Path: src/stuff Modules: A, B, C Executable toto Path: src MainIs: toto.ml oasis-0.4.11/test/data/TestPluginStdFiles/0000755000175000017500000000000013261073606017665 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginStdFiles/remove/0000755000175000017500000000000013261073606021162 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginStdFiles/remove/_oasis0000644000175000017500000000023613261073606022363 0ustar gildorgildorOASISFormat: 0.4 Name: remove Version: 1.0 Synopsis: Test case for oasis setup-clean -remove Authors: David Allsopp License: GPL-3.0 Plugins: StdFiles (0.4) oasis-0.4.11/test/data/TestPluginStdFiles/remove/README.txt.snd0000644000175000017500000000015413261073606023443 0ustar gildorgildorHeader line (* OASIS_START *) (* DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) *) (* OASIS_STOP *) oasis-0.4.11/test/data/TestPluginStdFiles/remove/README.txt.fst0000644000175000017500000000042413261073606023453 0ustar gildorgildorHeader line (* OASIS_START *) (* DO NOT EDIT (digest: 4b53103ccaa50a50153e977717a683ae) *) This is the README file for the remove distribution. Test case for oasis setup-clean -remove See the files INSTALL.txt for building and installation instructions. (* OASIS_STOP *) oasis-0.4.11/test/data/TestPluginStdFiles/remove/INSTALL.txt.fst0000644000175000017500000000150613261073606023626 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: b1dbca36bfeecf269e4bf3d4535c30cc) *) This is the INSTALL file for the remove distribution. This package uses OASIS to generate its build system. See section OASIS for full information. Dependencies ============ In order to compile this package, you will need: * ocaml * findlib Installing ========== 1. Uncompress the source archive and go to the root of the package 2. Run 'ocaml setup.ml -configure' 3. Run 'ocaml setup.ml -build' 4. Run 'ocaml setup.ml -install' Uninstalling ============ 1. Go to the root of the package 2. Run 'ocaml setup.ml -uninstall' OASIS ===== OASIS is a program that generates a setup.ml file using a simple '_oasis' configuration file. The generated setup only depends on the standard OCaml installation: no additional library is required. (* OASIS_STOP *) oasis-0.4.11/test/data/TestPluginStdFiles/remove/AUTHORS.txt.fst0000644000175000017500000000020013261073606023633 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: c059f06033422d4d358b297c74f106ff) *) Authors of remove David Allsopp (* OASIS_STOP *) oasis-0.4.11/test/data/TestPluginStdFiles/oasis/0000755000175000017500000000000013261073606021003 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginStdFiles/oasis/foo.ml0000644000175000017500000000324613261073606022125 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginStdFiles/oasis/_oasis0000644000175000017500000000310313261073606022200 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 3.11.2 FindlibVersion: >= 1.3.1 AlphaFeatures: stdfiles_markdown Name: oasis Version: 0.4.3 LicenseFile: COPYING.txt License: LGPL-2.1 with OCaml linking exception BuildType: ocamlbuild (0.4) Authors: Sylvain Le Gall Maintainers: Sylvain Le Gall Copyrights: (C) 2008-2010 OCamlCore SARL Homepage: http://oasis.forge.ocamlcore.org/ BugReports: https://forge.ocamlcore.org/bugs Tags: build, development Plugins: StdFiles (0.4) BuildTools: ocamlbuild, make Synopsis: Architecture for building OCaml libraries and applications Description: OASIS generates a full configure, build and install system for your application. It starts with a simple `_oasis` file at the toplevel of your project and creates everything required. . It uses external tools like OCamlbuild and it can be considered as the glue between various subsystems that do the job. It should support the following tools: . * OCamlbuild * OMake (todo) * OCamlMakefile (todo) * ocaml-autoconf (todo) . It also features a do-it-yourself command line invocation and an internal configure/install scheme. Libraries are managed through findlib. It has been tested on GNU Linux and Windows. . It also allows to have standard entry points and description. It helps to integrates your libraries and software with third parties tools like GODI. Library oasis Path: . Modules: Foo CompiledObject: Best BuildDepends: unix, odn (>= 0.0.11) BuildTools+: ocamlmod, ocamlyacc, ocamllex, ocamlify oasis-0.4.11/test/data/TestPluginStdFiles/oasis/README.md.exp0000644000175000017500000000263513261073606023063 0ustar gildorgildor oasis - Architecture for building OCaml libraries and applications ================================================================== OASIS generates a full configure, build and install system for your application. It starts with a simple `_oasis` file at the toplevel of your project and creates everything required. It uses external tools like OCamlbuild and it can be considered as the glue between various subsystems that do the job. It should support the following tools: * OCamlbuild * OMake (todo) * OCamlMakefile (todo) * ocaml-autoconf (todo) It also features a do-it-yourself command line invocation and an internal configure/install scheme. Libraries are managed through findlib. It has been tested on GNU Linux and Windows. It also allows to have standard entry points and description. It helps to integrates your libraries and software with third parties tools like GODI. See the file [INSTALL.md](INSTALL.md) for building and installation instructions. [Home page](http://oasis.forge.ocamlcore.org/) [Bug reports](https://forge.ocamlcore.org/bugs) Copyright and license --------------------- (C) 2008-2010 OCamlCore SARL oasis is distributed under the terms of the GNU Lesser General Public License version 2.1 with OCaml linking exception. See [COPYING.txt](COPYING.txt) for more information. oasis-0.4.11/test/data/TestPluginStdFiles/oasis/INSTALL.md.exp0000644000175000017500000000163513261073606023233 0ustar gildorgildor This is the INSTALL file for the oasis distribution. This package uses OASIS to generate its build system. See section OASIS for full information. Dependencies ============ In order to compile this package, you will need: * ocaml (>= 3.11.2) * findlib (>= 1.3.1) * odn (>= 0.0.11) * make * ocamlmod * ocamlify Installing ========== 1. Uncompress the source archive and go to the root of the package 2. Run 'ocaml setup.ml -configure' 3. Run 'ocaml setup.ml -build' 4. Run 'ocaml setup.ml -install' Uninstalling ============ 1. Go to the root of the package 2. Run 'ocaml setup.ml -uninstall' OASIS ===== OASIS is a program that generates a setup.ml file using a simple '_oasis' configuration file. The generated setup only depends on the standard OCaml installation: no additional library is required. oasis-0.4.11/test/data/TestPluginStdFiles/oasis/AUTHORS.md.exp0000644000175000017500000000033713261073606023250 0ustar gildorgildor Authors of oasis: * Sylvain Le Gall Current maintainers of oasis: * Sylvain Le Gall oasis-0.4.11/test/data/TestPluginOMake/0000755000175000017500000000000013261073606017144 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/simplelib/0000755000175000017500000000000013261073606021124 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/simplelib/src/0000755000175000017500000000000013261073606021713 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/simplelib/src/foo.mli0000644000175000017500000000332713261073606023206 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: int -> t val value: t -> int oasis-0.4.11/test/data/TestPluginOMake/simplelib/src/foo.ml0000644000175000017500000000336013261073606023032 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = int let create n = int_of_float (Unix.time()) let value n = n oasis-0.4.11/test/data/TestPluginOMake/simplelib/src/bar.mli0000644000175000017500000000333513261073606023166 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.11/test/data/TestPluginOMake/simplelib/src/bar.ml0000644000175000017500000000333213261073606023012 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.11/test/data/TestPluginOMake/simplelib/src/META0000644000175000017500000000337313261073606022372 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ requires = "unix" archive(byte) = "simplelib.cma" archive(native) = "simplelib.cmxa" oasis-0.4.11/test/data/TestPluginOMake/simplelib/_oasis0000644000175000017500000000143413261073606022326 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 4.01 Name: simplelib Version: 0.0.1 Authors: Mauricio Fernandez Maintainers: Mauricio Fernandez Copyrights: (C) 2008 Mauricio Fernandez LicenseFile: LICENSE License: LGPL with OCaml linking exception BuildTools: omake BuildType: omake (0.4) BuildDepends: unix InstallType: omake (0.4) Synopsis: Minimal ADT just to illustrate how libs work. Description: Minimal ADT just to illustrate how libs work. . Not much more to say Library simplelib Path: src Modules: Foo, Bar Document simplelib Title: API reference for simplelib Type: omake (0.4) InstallDir: $htmldir/simplelib BuildTools+: ocamldoc XOMakePath: src XOMakeLibraries: simplelib oasis-0.4.11/test/data/TestPluginOMake/simplelib/LICENSE0000644000175000017500000000324613261073606022136 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/test/data/TestPluginOMake/ocamlversion402.oasis0000644000175000017500000000105213261073606023131 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 4.02 Name: simplelib Version: 0.0.1 Authors: Mauricio Fernandez Maintainers: Mauricio Fernandez Copyrights: (C) 2008 Mauricio Fernandez LicenseFile: LICENSE License: LGPL with OCaml linking exception BuildTools: omake BuildType: omake (0.4) BuildDepends: unix Synopsis: Minimal ADT just to illustrate how libs work. Description: Minimal ADT just to illustrate how libs work. . Not much more to say Library simplelib Path: src Modules: Foo, Bar oasis-0.4.11/test/data/TestPluginOMake/ocamlversion401.oasis0000644000175000017500000000105213261073606023130 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 4.01 Name: simplelib Version: 0.0.1 Authors: Mauricio Fernandez Maintainers: Mauricio Fernandez Copyrights: (C) 2008 Mauricio Fernandez LicenseFile: LICENSE License: LGPL with OCaml linking exception BuildTools: omake BuildType: omake (0.4) BuildDepends: unix Synopsis: Minimal ADT just to illustrate how libs work. Description: Minimal ADT just to illustrate how libs work. . Not much more to say Library simplelib Path: src Modules: Foo, Bar oasis-0.4.11/test/data/TestPluginOMake/ocamlversion312.oasis0000644000175000017500000000105213261073606023131 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 3.12 Name: simplelib Version: 0.0.1 Authors: Mauricio Fernandez Maintainers: Mauricio Fernandez Copyrights: (C) 2008 Mauricio Fernandez LicenseFile: LICENSE License: LGPL with OCaml linking exception BuildTools: omake BuildType: omake (0.4) BuildDepends: unix Synopsis: Minimal ADT just to illustrate how libs work. Description: Minimal ADT just to illustrate how libs work. . Not much more to say Library simplelib Path: src Modules: Foo, Bar oasis-0.4.11/test/data/TestPluginOMake/noocamlversion.oasis0000644000175000017500000000102413261073606023237 0ustar gildorgildorOASISFormat: 0.4 Name: simplelib Version: 0.0.1 Authors: Mauricio Fernandez Maintainers: Mauricio Fernandez Copyrights: (C) 2008 Mauricio Fernandez LicenseFile: LICENSE License: LGPL with OCaml linking exception BuildTools: omake BuildType: omake (0.4) BuildDepends: unix Synopsis: Minimal ADT just to illustrate how libs work. Description: Minimal ADT just to illustrate how libs work. . Not much more to say Library simplelib Path: src Modules: Foo, Bar oasis-0.4.11/test/data/TestPluginOMake/github105/0000755000175000017500000000000013261073606020654 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/github105/main.ml0000644000175000017500000000327513261073606022141 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = Caller.call() oasis-0.4.11/test/data/TestPluginOMake/github105/libb/0000755000175000017500000000000013261073606021564 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/github105/libb/mod2.ml0000644000175000017500000000330513261073606022760 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let number = Liba.Mod1.number oasis-0.4.11/test/data/TestPluginOMake/github105/libb/META0000644000175000017500000000332413261073606022237 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ requires = "liba" archive(byte) = "libb.cma" oasis-0.4.11/test/data/TestPluginOMake/github105/liba/0000755000175000017500000000000013261073606021563 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/github105/liba/mod1.ml0000644000175000017500000000326713261073606022765 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let number = 42 oasis-0.4.11/test/data/TestPluginOMake/github105/liba/liba.mli0000644000175000017500000000332013261073606023173 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) module Mod1 : sig val number : int end oasis-0.4.11/test/data/TestPluginOMake/github105/liba/META0000644000175000017500000000330213261073606022232 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ archive(byte) = "liba.cma" oasis-0.4.11/test/data/TestPluginOMake/github105/caller.ml0000644000175000017500000000334013261073606022450 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let call() = print_endline (string_of_int Mod2.number) oasis-0.4.11/test/data/TestPluginOMake/github105/_oasis0000644000175000017500000000141013261073606022050 0ustar gildorgildorOASISFormat: 0.4 Name: github105 Version: 0.0 Synopsis: Problem with case-insensitive filesystem Authors: Gerd Stolpmann License: GPL BuildTools+: omake BuildType: OMake (0.4) OCamlVersion: >= 4.01 Library liba Modules: Mod1 Path: liba Pack: true Build: true Install: false Library libb Modules: Mod2 Path: libb BuildDepends: liba Build: true Install: false Executable t Path: . MainIs: main.ml BuildDepends: libb Build: true Install: true oasis-0.4.11/test/data/TestPluginOMake/complex/0000755000175000017500000000000013261073606020613 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/0000755000175000017500000000000013261073606021402 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/packedlib/0000755000175000017500000000000013261073606023320 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/packedlib/q.ml0000644000175000017500000000327213261073606024116 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let f x y = x / y oasis-0.4.11/test/data/TestPluginOMake/complex/src/libwithc/0000755000175000017500000000000013261073606023207 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/libwithc/pc.c0000644000175000017500000000350213261073606023755 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include CAMLprim value oasis_f (value va, value vb) { CAMLparam2(va, vb); CAMLreturn(va); } oasis-0.4.11/test/data/TestPluginOMake/complex/src/libwithc/p.ml0000644000175000017500000000332213261073606024000 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) external f : int -> int -> int = "oasis_f" oasis-0.4.11/test/data/TestPluginOMake/complex/src/libc_/0000755000175000017500000000000013261073606022452 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/libc_/c1.mli0000644000175000017500000000330213261073606023456 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) val f : int -> int -> float oasis-0.4.11/test/data/TestPluginOMake/complex/src/libc_/c1.ml0000644000175000017500000000330513261073606023310 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let f x y = float (B1.f x y) oasis-0.4.11/test/data/TestPluginOMake/complex/src/libb/0000755000175000017500000000000013261073606022312 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/libb/B1.ml0000644000175000017500000000331013261073606023103 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let f x y = A2.f x y * A1.f x y oasis-0.4.11/test/data/TestPluginOMake/complex/src/liba/0000755000175000017500000000000013261073606022311 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/liba/a2.ml0000644000175000017500000000330213261073606023143 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let f x y = A1.f x y + 42 oasis-0.4.11/test/data/TestPluginOMake/complex/src/liba/a1.ml0000644000175000017500000000333313261073606023146 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let f x y = x + y let re = Str.regexp "something" oasis-0.4.11/test/data/TestPluginOMake/complex/src/exec/0000755000175000017500000000000013261073606022326 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/complex/src/exec/x2.ml0000644000175000017500000000342213261073606023212 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = X1.hello(); print_float (C1.f 4 5); print_int (P.f 43 1); print_int (Packedlib.Q.f 65 5) oasis-0.4.11/test/data/TestPluginOMake/complex/src/exec/x1.ml0000644000175000017500000000332213261073606023210 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let hello() = print_endline "Hello there" oasis-0.4.11/test/data/TestPluginOMake/complex/_oasis0000644000175000017500000000251413261073606022015 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 4.01 Name: complex Version: 0.1 Synopsis: Libraries and executables Authors: Gerd Stolpmann License: LGPL with OCaml linking exception BuildTools: omake BuildType: OMake (0.4) InstallType: OMake (0.4) Plugins: META (0.4) Library liba Modules: A2 InternalModules: A1 Path: src/liba BuildDepends: str Install: true Library libb Modules: B1 Path: src/libb BuildDepends: liba Install: true Library libc_ Modules: C1 Path: src/libc_ BuildDepends: libb Install: true Library libwithc Modules: P CSources: pc.c Path: src/libwithc Install: true Library packedlib Modules: Q Path: src/packedlib Pack: true Install: true # -bin-annot only available for OCaml >= 4.00.0 ByteOpt: -bin-annot NativeOpt: -bin-annot Executable exec MainIs: x2.ml Path: src/exec BuildDepends: libc_, libwithc, packedlib Install: true Document interdepend Title: API reference for interdepend Type: omake (0.4) InstallDir: $htmldir/interdepend Install: true BuildTools+: ocamldoc XOMakePath: src XOMakeLibraries: liba, libb, libc_ oasis-0.4.11/test/data/TestPluginOMake/bug1747/0000755000175000017500000000000013261073606020244 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1747/main.ml0000644000175000017500000000327713261073606021533 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = print_int 42 oasis-0.4.11/test/data/TestPluginOMake/bug1747/liba/0000755000175000017500000000000013261073606021153 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1747/liba/mod1.ml0000644000175000017500000000327713261073606022356 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let compute x = x + 1 oasis-0.4.11/test/data/TestPluginOMake/bug1747/liba/META0000644000175000017500000000342213261073606021625 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ requires = "" archive(byte) = "liba.cma" archive(native) = "liba.cmxa" archive(native,plugin) = "liba.cmxs" oasis-0.4.11/test/data/TestPluginOMake/bug1747/_oasis0000644000175000017500000000156013261073606021446 0ustar gildorgildorOASISFormat: 0.4 Name: bug1747 Version: 0.0 Synopsis: Only link libraries we depend on Authors: Gerd Stolpmann License: GPL BuildTools+: omake BuildType: OMake (0.4) OCamlVersion: >= 4.01 Library liba Modules: Mod1 Path: liba Build: true CompiledObject: byte CCLib: -linvalid Install: false Executable t Path: . MainIs: main.ml Build: true CompiledObject: byte Install: true # The point is here that "t" doesn't have any dependencies. # We also have a library liba which is broken, and cannot # be used (because of -linvalid), although the build is # expected to succeed. # The wrong behavior is that it is tried to link liba into t. oasis-0.4.11/test/data/TestPluginOMake/bug1737/0000755000175000017500000000000013261073606020243 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1737/liba/0000755000175000017500000000000013261073606021152 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1737/liba/modules/0000755000175000017500000000000013261073606022622 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1737/liba/modules/mod1.ml0000644000175000017500000000332613261073606024020 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = print_endline "Hello, this is mod1" oasis-0.4.11/test/data/TestPluginOMake/bug1737/liba/META0000644000175000017500000000340513261073606021625 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ archive(byte) = "liba.cma" archive(native) = "liba.cmxa" archive(native,plugin) = "liba.cmxs" oasis-0.4.11/test/data/TestPluginOMake/bug1737/_oasis0000644000175000017500000000055513261073606021450 0ustar gildorgildorOASISFormat: 0.4 Name: expomake Version: 0.0 Synopsis: Experimental omake reimplementation Authors: Gerd Stolpmann License: GPL BuildTools+: omake BuildType: OMake (0.4) InstallType: OMake (0.4) OCamlVersion: >= 4.01 Library liba Pack: true Modules: modules/Mod1 Path: liba oasis-0.4.11/test/data/TestPluginOMake/bug1736/0000755000175000017500000000000013261073606020242 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1736/main.ml0000644000175000017500000000331613261073606021523 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = print_int (Mod1.compute 67) oasis-0.4.11/test/data/TestPluginOMake/bug1736/libb/0000755000175000017500000000000013261073606021152 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1736/libb/mod2.ml0000644000175000017500000000327713261073606022356 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let compute x = 5 * x oasis-0.4.11/test/data/TestPluginOMake/bug1736/libb/META0000644000175000017500000000340413261073606021624 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ archive(byte) = "libb.cma" archive(native) = "libb.cmxa" archive(native,plugin) = "libb.cmxs" oasis-0.4.11/test/data/TestPluginOMake/bug1736/liba/0000755000175000017500000000000013261073606021151 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOMake/bug1736/liba/mod1.ml0000644000175000017500000000331413261073606022344 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let compute x = Mod2.compute x + 1 oasis-0.4.11/test/data/TestPluginOMake/bug1736/liba/META0000644000175000017500000000342613261073606021627 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ requires = "libb" archive(byte) = "liba.cma" archive(native) = "liba.cmxa" archive(native,plugin) = "liba.cmxs" oasis-0.4.11/test/data/TestPluginOMake/bug1736/_oasis0000644000175000017500000000142013261073606021437 0ustar gildorgildorOASISFormat: 0.4 Name: expomake Version: 0.0 Synopsis: Experimental omake reimplementation Authors: Gerd Stolpmann License: GPL BuildTools+: omake BuildType: OMake (0.4) OCamlVersion: >= 4.01 Library liba Modules: Mod1 Path: liba BuildDepends: libb Library libb Modules: Mod2 Path: libb Executable t Path: . MainIs: main.ml BuildDepends: liba # Crucial here with regard to the bug: t needs liba which needs libb. # Buggy versions of the omake plugin computed the deps of t as # "liba libb" (in alphabetical order), but the correct deps are "libb liba". # With the wrong deps, t cannot be linked. oasis-0.4.11/test/data/TestPluginOCamlbuild/0000755000175000017500000000000013261073606020163 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/use-ocamlfind/0000755000175000017500000000000013261073606022711 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/use-ocamlfind/_oasis0000644000175000017500000000074413261073606024116 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 3.12.1 Name: use-ocamlfind Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project. BuildTools: ocamlbuild Library foo Path: . Modules: A BuildDepends: oUnit Document api Title: API reference for foo Type: ocamlbuild (0.4) BuildTools+: ocamldoc XOCamlbuildPath: . XOCamlbuildLibraries: foo oasis-0.4.11/test/data/TestPluginOCamlbuild/use-ocamlfind/A.ml0000644000175000017500000000324613261073606023430 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginOCamlbuild/set-ocamlfind/0000755000175000017500000000000013261073606022710 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/set-ocamlfind/main.ml0000644000175000017500000000324613261073606024173 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginOCamlbuild/set-ocamlfind/_oasis0000644000175000017500000000045013261073606024107 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 3.12.1 Name: set-ocamlfind Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project. BuildTools: ocamlbuild Executable "myexec" Path: . MainIs: main.ml oasis-0.4.11/test/data/TestPluginOCamlbuild/pr63-no-automatic-syntax/0000755000175000017500000000000013261073606024677 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/pr63-no-automatic-syntax/_tags0000644000175000017500000000333013261073606025716 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # OASIS_STOP : syntax_camlp4r oasis-0.4.11/test/data/TestPluginOCamlbuild/pr63-no-automatic-syntax/_oasis0000644000175000017500000000037413261073606026103 0ustar gildorgildorOASISFormat: 0.4 Name: test Version: 0 Synopsis: test Authors: foo License: MIT BuildTools: ocamlbuild, camlp4 AlphaFeatures: no_automatic_syntax Executable test Path: ./ MainIs: A.ml BuildDepends: camlp4 CompiledObject: byte Install: false oasis-0.4.11/test/data/TestPluginOCamlbuild/pr63-no-automatic-syntax/A.ml0000644000175000017500000000335513261073606025417 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Revised syntax sample *) value () = do { print_endline "test" }; oasis-0.4.11/test/data/TestPluginOCamlbuild/pr61-pass-thread-to-C-files/0000755000175000017500000000000013261073606025064 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/pr61-pass-thread-to-C-files/src/0000755000175000017500000000000013261073606025653 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/pr61-pass-thread-to-C-files/src/test.c0000644000175000017500000000332013261073606026774 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ oasis-0.4.11/test/data/TestPluginOCamlbuild/pr61-pass-thread-to-C-files/src/dummy.ml0000644000175000017500000000324613261073606027345 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginOCamlbuild/pr61-pass-thread-to-C-files/_oasis0000644000175000017500000000064513261073606026271 0ustar gildorgildorOASISFormat: 0.3 Name: test-pass-threads-to-c-files Version: 0.1 Synopsis: test oasis with c files and dependency on threads Authors: test License: LGPL-2.1 with OCaml linking exception Plugins: DevFiles (0.1), Meta (0.1) BuildTools: ocamlbuild Library test_pass_threads_to_c_files Path: src Modules: Dummy CSources: test.c BuildDepends: threads Install: false oasis-0.4.11/test/data/TestPluginOCamlbuild/missing-source/0000755000175000017500000000000013261073606023132 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/missing-source/_oasis0000644000175000017500000000027113261073606024332 0ustar gildorgildorOASISFormat: 0.3 Name: missing-source Version: 0 BuildType: OCamlbuild (0.3) License: GPL-3 Authors: foo Synopsis: foo BuildTools: ocamlbuild Library test Path: . Modules: A, B, C oasis-0.4.11/test/data/TestPluginOCamlbuild/missing-source/C.ml0000644000175000017500000000324613261073606023653 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginOCamlbuild/missing-source/B.mli0000644000175000017500000000324613261073606024023 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginOCamlbuild/missing-source/A.ml0000644000175000017500000000324613261073606023651 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginOCamlbuild/external-c-rebuild/0000755000175000017500000000000013261073606023651 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/external-c-rebuild/header.h0000644000175000017500000000351413261073606025255 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include #include #include #include #include oasis-0.4.11/test/data/TestPluginOCamlbuild/external-c-rebuild/c_source.c0000644000175000017500000000362713261073606025627 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include "header.h" CAMLprim value oasis_c_build_test_foo(value x) { CAMLparam1(x); CAMLreturn(Val_int(42)); } oasis-0.4.11/test/data/TestPluginOCamlbuild/external-c-rebuild/_oasis0000644000175000017500000000063513261073606025055 0ustar gildorgildorOASISFormat: 0.4 Name: missing-source Version: 0 BuildType: OCamlbuild (0.3) License: GPL-3 Authors: foo Synopsis: foo Plugins: META (0.4), StdFiles (0.4), DevFiles (0.4) Library a_test Path: . BuildTools: ocamlbuild CompiledObject: best CSources: c_source.c CCOpt: -I.. Modules: A Executable b_test Path: . BuildTools: ocamlbuild CompiledObject: best BuildDepends: a_test MainIs: B.mloasis-0.4.11/test/data/TestPluginOCamlbuild/external-c-rebuild/B.ml0000644000175000017500000000330513261073606024365 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open A let () = exit (foo 42) oasis-0.4.11/test/data/TestPluginOCamlbuild/external-c-rebuild/A.ml0000644000175000017500000000333413261073606024366 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) external foo : int -> int = "oasis_c_build_test_foo" oasis-0.4.11/test/data/TestPluginOCamlbuild/env-tags/0000755000175000017500000000000013261073606021707 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/env-tags/myocamlbuild.ml0000644000175000017500000000371313261073606024726 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* OASIS_START *) (* OASIS_STOP *) open Ocamlbuild_plugin let () = dispatch begin fun hook -> dispatch_default hook; match hook with | After_rules -> if Tags.mem "tests" (tags_of_pathname "A.ml") then close_out (open_out "tests-tag-detected") | _ -> () end oasis-0.4.11/test/data/TestPluginOCamlbuild/env-tags/_oasis0000644000175000017500000000042013261073606023103 0ustar gildorgildorOASISFormat: 0.4 OCamlVersion: >= 3.12.1 Name: env-tags Version: 0.0.1 Authors: Tomohiro Matsuyama LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project. BuildTools: ocamlbuild Library foo Path: . Modules: A oasis-0.4.11/test/data/TestPluginOCamlbuild/env-tags/A.ml0000644000175000017500000000324613261073606022426 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginOCamlbuild/bug1659-ocamlbuild-support-plugins/0000755000175000017500000000000013261073606026567 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginOCamlbuild/bug1659-ocamlbuild-support-plugins/myocamlbuild.ml0000644000175000017500000000340413261073606031603 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 (* OASIS_START *) (* OASIS_STOP *) Ocamlbuild_plugin.dispatch dispatch_default;; oasis-0.4.11/test/data/TestPluginOCamlbuild/bug1659-ocamlbuild-support-plugins/_oasis0000644000175000017500000000064013261073606027767 0ustar gildorgildorOASISFormat: 0.4 Name: b1659-ocamlbuild-support-plugins Version: 0.1 License: LGPL-2.1 with OCaml linking exception BuildType: ocamlbuild (0.4) Authors: Sylvain Le Gall Synopsis: Check that '-plugin package(x)' works. AlphaFeatures: ocamlbuild_more_args BuildTools: ocamlbuild OCamlVersion: >= 4.01 XOCamlbuildPluginTags: package(oUnit) Library foo Path: . Modules: A oasis-0.4.11/test/data/TestPluginOCamlbuild/bug1659-ocamlbuild-support-plugins/A.ml0000644000175000017500000000324613261073606027306 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginInternal/0000755000175000017500000000000013261073606017724 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginInternal/findlib_extra_files/0000755000175000017500000000000013261073606023720 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginInternal/findlib_extra_files/_oasis0000644000175000017500000000052513261073606025122 0ustar gildorgildorOASISFormat: 0.4 Name: findlib_extra_files Version: 0.0.1 Authors: Foo Bar BuildTools: ocamlbuild License: LGPL with OCaml linking exception Synopsis: Test installation of extra files with findlib. BetaFeatures: findlib_extra_files Plugins: META(0.4) Library library Path: . Modules: L FindlibName: foobar FindlibExtraFiles: _oasis oasis-0.4.11/test/data/TestPluginInternal/findlib_extra_files/L.ml0000644000175000017500000000324613261073606024452 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestPluginInternal/findlib_directory/0000755000175000017500000000000013261073606023417 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginInternal/findlib_directory/_oasis0000644000175000017500000000067613261073606024630 0ustar gildorgildorOASISFormat: 0.4 Name: findlib_directory Version: 0.0.1 Authors: Foo Bar BuildTools: ocamlbuild License: LGPL with OCaml linking exception Synopsis: Test installation in sub-directories of findlib. BetaFeatures: section_object, findlib_directory Plugins: META(0.4) Library library Path: . Modules: L FindlibName: foobar FindlibDirectory: lib Object object Path: . Modules: O FindlibFullName: foobar.object FindlibDirectory: obj oasis-0.4.11/test/data/TestPluginInternal/findlib_directory/O.ml0000644000175000017500000000326213261073606024152 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = () oasis-0.4.11/test/data/TestPluginInternal/findlib_directory/L.ml0000644000175000017500000000326213261073606024147 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = () oasis-0.4.11/test/data/TestPluginDevFiles/0000755000175000017500000000000013261073606017651 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginDevFiles/test-devfiles1.oasis0000644000175000017500000000056113261073606023552 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BuildType: None (0.2) BuildDepends: oUnit (>= 0.1.2), benchmark (>= 0.6) Plugins: DevFiles (0.2) Description: This is a test to check that everything is working great with this kind of parser. . Coucou. oasis-0.4.11/test/data/TestPluginDevFiles/compiled_setup_ml/0000755000175000017500000000000013261073606023355 5ustar gildorgildoroasis-0.4.11/test/data/TestPluginDevFiles/compiled_setup_ml/foo.ml0000644000175000017500000000330313261073606024471 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = prerr_endline "Foo" oasis-0.4.11/test/data/TestPluginDevFiles/compiled_setup_ml/_oasis0000644000175000017500000000047213261073606024560 0ustar gildorgildorOASISFormat: 0.4 AlphaFeatures: compiled_setup_ml Name: foo Version: 1.0 Synopsis: Foo Authors: Jacques-Pascal Deplaix License: GPL-3.0 Plugins: DevFiles (0.4) Executable foo Path: . BuildTools: ocamlbuild MainIs: foo.ml Install: false oasis-0.4.11/test/data/TestOASISParse/0000755000175000017500000000000013261073606016642 5ustar gildorgildoroasis-0.4.11/test/data/TestOASISParse/test9.oasis0000644000175000017500000000102013261073606020743 0ustar gildorgildorOASISFormat: 0.3 Name: foo Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Library test1 FindlibName: test Path: src/ Library pa_test1 FindlibName: syntax FindlibParent: test1 Path: src/test Library test_with_str FindlibName: str FindlibParent: test1 Path: src/str Executable test Path: test MainIs: main.ml BuildDepends: oUnit, test, test.syntax, test.str, test1, pa_test1, test_with_str oasis-0.4.11/test/data/TestOASISParse/test8.oasis0000644000175000017500000000062513261073606020754 0ustar gildorgildorOASISFormat: 0.3 Name: foo Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall SourceRepository head Type: darcs Location: http://darcs.ocamlcore.org/repos/foo Browser: http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=foo SourceRepository this Type: darcs Location: http://darcs.ocamlcore.org/repos/foo Tag: $version oasis-0.4.11/test/data/TestOASISParse/test7.oasis0000644000175000017500000000070113261073606020746 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BuildType: None (0.0.1) BuildDepends: oUnit (>= 0.1.2), benchmark (>= 0.6) Description: This is a test to check that everything is working great with this kind of parser. . Coucou. Library "toto-test" Path: src/stuff Build: true Executable "toto-test" Path: src MainIs: toto.ml oasis-0.4.11/test/data/TestOASISParse/test6.oasis0000644000175000017500000000027613261073606020754 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Homepage: http://toto-acme.org oasis-0.4.11/test/data/TestOASISParse/test5.oasis0000644000175000017500000000023313261073606020744 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall oasis-0.4.11/test/data/TestOASISParse/test4.oasis0000644000175000017500000000101413261073606020741 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BuildType: None (0.0.1) XTest: true Description: This is a test to check that everything is working great with this kind of parser. . Coucou. BuildDepends: extlib Library stuff Path: src/stuff Modules: A, B, C XTest: true Flag devmod Description: build for developper Default: false XToto: true if architecture(amd64) Default: true oasis-0.4.11/test/data/TestOASISParse/test3.oasis0000644000175000017500000000074613261073606020753 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BuildType: None (0.0.1) Description: This is a test to check that everything is working great with this kind of parser. . Coucou. BuildDepends: extlib Library stuff Path: src/stuff Modules: A, B, C Flag devmod Description: build for developper if architecture(amd64) Default: true else Default: false oasis-0.4.11/test/data/TestOASISParse/test2.oasis0000644000175000017500000000073513261073606020750 0ustar gildorgildorOASISFormat: 0.3 Name: Stuff Version: 1.2.3.0 Copyrights: (C) 2003-2008 J. R. Hacker Homepage: http://foo.com Authors: J. R. Hacker Maintainers: J. R. Hacker LicenseFile: LICENSE License: LGPL with OCaml linking exception Buildtype: None (0.0.1) # blank lines are ignored, as are comments Synopsis: some stuff Description: This is a rather short desc. . (with an empty line) Library stuff Path: src/stuff Modules: A, B, C oasis-0.4.11/test/data/TestOASISParse/test16.oasis0000644000175000017500000001142613261073606021034 0ustar gildorgildorOASISFormat: 0.4 BetaFeatures: section_object Name: archimedes Version: 0.4.12 Synopsis: Extensible 2D plotting library. Description: Archimedes is a high quality, platform-independent, extensible 2D plotting library. It provides dynamically loaded backends such as Graphics and Cairo. Authors: Christophe Troestler , Pierre Hauweele , Fabian Pijcke , Noémie Meunier , Bertrand Desmons , Xavier Deschuyteneer License: LGPL-3.0 with OCaml linking exception Homepage: http://forge.ocamlcore.org/projects/archimedes/ Plugins: META (0.3), StdFiles (0.3) FilesAB: src/conf.ml.ab, src/archimedes_cairo.dep.ab, src/archimedes_graphics.dep.ab, src/archimedes_header.mli.ab, tests/tests.ml.ab PreBuildCommand: ocaml src/public_interface.ml > src/archimedes.mli Flag graphics Description: Use the graphics plugin? Default: true Flag cairo Description: Use the cairo (PNG, PS, PDF) plugin? Default: true Flag tikz Description: Use the tikz (TeX) plugin? Default: false Library "archimedes" Path: src BuildTools: ocamlbuild Modules: Archimedes InternalModules: Archimedes_internals BuildDepends: dynlink, bigarray # "internal" functions, potentially useful to backends Object archimedes_internals Path: src Modules: Conf, Utils, String_utils, PriorityQueue, Matrix, Color, Path, Backend, Coordinate, Viewport, Marker, Sampler, Arrows, Tics, Axes, Plot, Piechart BuildDepends: dynlink, bigarray Install: false Library "archimedes_graphics" Build$: flag(graphics) Path: src BuildTools: ocamlbuild Modules: Archimedes_graphics BuildDepends: graphics, archimedes DataFiles: archimedes_graphics.dep FindlibParent: archimedes FindlibName: graphics Library "archimedes_cairo" Build$: flag(cairo) Path: src BuildTools: ocamlbuild Modules: Archimedes_cairo BuildDepends: cairo2, archimedes DataFiles: archimedes_cairo.dep FindlibParent: archimedes FindlibName: cairo Library "archimedes_tikz" Build$: flag(tikz) Path: src BuildTools: ocamlbuild Modules: Archimedes_tikz BuildDepends: archimedes FindlibParent: archimedes FindlibName: tikz Library "archimedes_toploop" Path: src BuildTools: ocamlbuild Modules: Archimedes_toploop ByteOpt: -I +compiler-libs NativeOpt: -I +compiler-libs BuildDepends: archimedes FindlibParent: archimedes FindlibName: top Document API Title: API reference for Archimedes Type: OCamlbuild (0.3) InstallDir: $docdir/api BuildTools: ocamldoc, ocamlbuild XOCamlbuildPath: src XOCamlbuildLibraries: archimedes Executable "test_main" Path: tests Build$: flag(tests) MainIs: tests.ml BuildDepends: archimedes BuildTools: ocamlbuild Install: false Test main Type: Custom (0.2) Command: $test_main # Examples ###################################################################### Executable "pythagoras_tree" Path: examples/ BuildTools: ocamlbuild MainIs: pythagoras_tree.ml BuildDepends: archimedes Install: false Executable "coordinate_pairs" Path: examples/ BuildTools: ocamlbuild MainIs: coordinate_pairs.ml BuildDepends: archimedes Install: false Executable "pkg_chart" Path: examples/ BuildTools: ocamlbuild MainIs: pkg_chart.ml BuildDepends: archimedes Install: false Executable "anscombe" Path: examples/ BuildTools: ocamlbuild MainIs: anscombe.ml BuildDepends: archimedes Install: false Executable "scatter_hist" Path: examples/ BuildTools: ocamlbuild MainIs: scatter_hist.ml BuildDepends: archimedes Install: false Executable "coords_report.ml" Path: examples/ BuildTools: ocamlbuild MainIs: coords_report.ml BuildDepends: archimedes Install: false Executable "taylor.ml" Path: examples/ BuildTools: ocamlbuild MainIs: taylor.ml BuildDepends: archimedes Install: false Executable "spiral.ml" Path: examples/ BuildTools: ocamlbuild MainIs: spiral.ml BuildDepends: archimedes Install: false Executable "multi_hue.ml" Path: examples/ BuildTools: ocamlbuild MainIs: multi_hue.ml BuildDepends: archimedes Install: false SourceRepository trunk Type: git Location: http://forge.ocamlcore.org/anonscm/git/archimedes/archimedes.git Browser: https://forge.ocamlcore.org/scm/browser.php?group_id=105 oasis-0.4.11/test/data/TestOASISParse/test15.oasis0000644000175000017500000000536113261073606021034 0ustar gildorgildorOASISFormat: 0.3 Name: extunix Version: 0.0.3 #LicenseFile: ? License: LGPL-2.1 with OCaml linking exception Authors: ygrek, Sylvain Le Gall, Stéphane Glondu, Kaustuv Chaudhuri, Joshua Smith, Niki Yoshiuchi, Gerd Stolpmann, Goswin von Brederlow Copyrights: (C) 2010 ygrek, (C) 2009 Sylvain Le Gall, (C) 2008-2009 Talend Inc., (C) 2010 Stéphane Glondu, (C) 2005 Joshua Smith, (C) 2010 Niki Yoshiuchi, (C) 2001 Gerd Stolpmann, (C) 2012 Goswin von Brederlow Homepage: http://extunix.forge.ocamlcore.org/ BuildTools: ocamlbuild, camlp4 Plugins: DevFiles (0.2), META (0.2) Synopsis: Extended functions for OCaml Unix module Description: Thin bindings to various low-level system APIs (often non-portable) which are not covered by Unix module. . Some of the implemented functions : uname, statvfs, fsync, fadvise, fallocate, openat, dirfd, eventfd, signalfd, setrlimit, mlockall, etc PostConfCommand: ocaml src/discover.ml -ocamlc $ocamlc -ext_obj $ext_obj PreDistCleanCommand: $rm $(utoh "src/config.h") PostDistCleanCommand: $rm $(utoh "src/config.ml") # [FORGE#742] Flag strict Description: Strict compile-time checks Default: true Library extunix Path: src/ Modules: ExtUnix InternalModules: ExtUnixAll, ExtUnixSpecific if flag(strict) && ccomp_type(cc) CCOpt: -std=c89 -pedantic -Wno-long-long CSources: config.h, eventfd.c, dirfd.c, fsync.c, statvfs.c, atfile.c, ioctl_siocgifconf.c, uname.c, fadvise.c, fallocate.c, tty_ioctl.c, unistd.c, stdlib.c, signalfd.c, ptrace.c, resource.c, mman.c, time.c, pts.c, execinfo.c, malloc.c, endian.c BuildDepends: unix Library extunix Path: src Modules: ExtUnixBA InternalModules: ExtUnixBAAll, ExtUnixBASpecific if flag(strict) && ccomp_type(cc) CCOpt: -std=c89 -pedantic -Wno-long-long CSources: config.h, memalign.c BuildDepends: unix, bigarray FindlibParent: extunix FindlibName: bigarray Executable test Path: test/ Install: false Custom: true CompiledObject: best MainIs: test.ml BuildDepends: extunix, oUnit (>= 1.0.3) Executable testba Path: test/ Install: false Custom: true CompiledObject: best MainIs: testba.ml BuildDepends: extunix, extunix.bigarray, oUnit (>= 1.0.3) Test main Command: $test && $testba TestTools: test, testba Document api Title: API reference for extunix Type: ocamlbuild (0.2) Authors: ygrek, Sylvain Le Gall, Stéphane Glondu, Kaustuv Chaudhuri, Joshua Smith, Niki Yoshiuchi, Gerd Stolpmann, Goswin von Brederlow BuildTools: ocamldoc Format: HTML Index: index.html XOCamlbuildPath: src/ XOCamlbuildLibraries: extunix, extunix.bigarray XOCamlbuildModules: ExtUnixAll, ExtUnixSpecific, ExtUnixBAAll, ExtUnixBASpecific #Document changelog # Title: Changelog # Path: CHANGES.txt oasis-0.4.11/test/data/TestOASISParse/test14.oasis0000644000175000017500000000105213261073606021024 0ustar gildorgildorOASISFormat: 0.3 Name: foo Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Plugins: META (0.2) BuildTools: ocamlbuild Library test1 FindlibName: test Modules: A Path: . Library test2 FindlibParent: test1 Modules: B Path: . Library test3 FindlibParent: test2 Modules: C Path: . Library test5 FindlibParent: test3 FindlibContainers: test4 FindlibName: test5p Modules: D Path: . Library test6 FindlibParent: test5 Modules: E Path: . oasis-0.4.11/test/data/TestOASISParse/test13.oasis0000644000175000017500000000036413261073606021030 0ustar gildorgildorOASISFormat: 0.3 Name: foo Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BetaFeatures: section_object Library test1 FindlibName: test Path: src/ oasis-0.4.11/test/data/TestOASISParse/test12.oasis0000644000175000017500000000071513261073606021027 0ustar gildorgildor# Bug 811 OASISFormat: 0.3 Name: foo Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Description: Thin bindings to various low-level system APIs (often non-portable) which are not covered by Unix module. . Example functions: * uname * statvfs * fsync Document foo Title: my foo thesis Abstract: Foo is a great library for: * pattern matching * GC oasis-0.4.11/test/data/TestOASISParse/test11.oasis0000644000175000017500000000050013261073606021016 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall ConfType: MyConf BuildType: MyNone (0.2) InstallType: MyInstall Test main Type: MyTest Command: false Document changelog Type: MyDoc Title: changes oasis-0.4.11/test/data/TestOASISParse/test10.oasis0000644000175000017500000000052713261073606021026 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test Synopsis+: with extra text License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Authors+: Another one Flag "test" Description: this is a test Default$: os_type(win32) Test main Command: main if flag(test) Command+: -test oasis-0.4.11/test/data/TestOASISParse/test1.oasis0000644000175000017500000000222113261073606020737 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 0.3 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BuildType: None (0.2) BuildDepends: oUnit (>= 0.1.2), benchmark (>= 0.6) Description: This is a test to check that everything is working great with this kind of parser. . Coucou. Flag devmod Description: build for developper Default: false # Only available on i386 Flag ostest Description: Test on OS Default: false if system(hurd) && architecture(i386) Default: true Flag linuxtest64 Description: Linux 64bits only Default: false if system(linux) && architecture(amd64) Default: true else Default: false Flag linuxtest32 Description: Linux 32bits only Default: false if system(linux_elf) && architecture(i386) Default: true Library toto Path: src/stuff if architecture(amd64) Build: true if architecture(amd64) Build: false else Build: true if flag(linuxtest32) || flag(linuxtest64) || flag(ostest) Build: false else Build: true Library stuff Path: src/stuff Modules: A, B, C Executable toto Path: src MainIs: toto.ml oasis-0.4.11/test/data/TestOASISParse/test-freeform.oasis0000644000175000017500000000040113261073606022457 0ustar gildorgildorOASISFormat: 0.3 Name: oasis Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall BuildType: None (0.0.1) BuildDepends: oUnit (>= 0.1.2), benchmark (>= 0.6) Description: a b . c oasis-0.4.11/test/data/TestOASISParse/test-extra-blanks.oasis0000644000175000017500000000226013261073606023252 0ustar gildorgildorOASISFormat: 0.4 Name: hamt Version: 0.1 Synopsis: Hash Array Mapped Tries Authors: Thibault Suzanne, Gabriel Scherer, Rudi Grinberg BuildTools: ocamlbuild License: MIT Plugins: META (0.4) Library hamt Path: lib BuildTools: ocamlbuild Modules: Hamt Findlibname: hamt InternalModules: BitUtils BuildDepends: monomorphic Executable test_runner Path: lib_test MainIs: test.ml Build$: flag(tests) Custom: true CompiledObject: best Install: false BuildDepends: hamt,oUnit Executable param Path: lib_test MainIs: param.ml Build$: flag(tests) Custom: true CompiledObject: best Install: false BuildDepends: hamt Test test Run$: flag(tests) Command: $test_runner WorkingDirectory: lib_test Executable bench1 Path: lib_test MainIs: bench1.ml Build$: flag(tests) Custom: true CompiledObject: best Install: false BuildDepends: threads, hamt, core_bench oasis-0.4.11/test/data/TestOASISParse/src/0000755000175000017500000000000013261073606017431 5ustar gildorgildoroasis-0.4.11/test/data/TestOASISParse/src/toto.ml0000644000175000017500000000324613261073606020755 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestOASISParse/src/stuff/0000755000175000017500000000000013261073606020560 5ustar gildorgildoroasis-0.4.11/test/data/TestOASISParse/src/stuff/META0000644000175000017500000000324613261073606021236 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ oasis-0.4.11/test/data/TestOASISParse/src/stuff/C.ml0000644000175000017500000000324613261073606021301 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestOASISParse/src/stuff/B.mli0000644000175000017500000000324613261073606021451 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestOASISParse/src/stuff/A.ml0000644000175000017500000000324613261073606021277 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestOASISParse/comment-in-field.oasis0000644000175000017500000000034313261073606023031 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: test Synopsis: test Authors: test License: GPL Synopsis: toto et toto Plugins: META (0.1), # StdFiles (0.1), DevFiles (0.1) oasis-0.4.11/test/data/TestOASISParse/bug571.oasis0000644000175000017500000000064613261073606020722 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0 Synopsis: test Authors: me License: GPL BuildTools: ocamlbuild Executable test Path: ./ MainIs: A.ml ByteOpt: -package num BuildDepends: oUnit CompiledObject: byte Install: false Executable "test-opt" Path: ./ Build$: flag(is_native) MainIs: A.ml NativeOpt: -package num BuildDepends: oUnit CompiledObject: native Install: false oasis-0.4.11/test/data/TestOASISParse/bug1295.oasis0000644000175000017500000000134413261073606021002 0ustar gildorgildorOASISFormat: 0.3 Name: lightspeed Version: 0.0.0 #LicenseFile: ? License: GPL-3+ with OCaml linking exception Authors: Goswin von Brederlow Copyrights: (C) 2012 Goswin von Brederlow #Homepage: http://???/ BuildTools: ocamlbuild Plugins: DevFiles (0.2), META (0.2) Synopsis: Turn based strategy game in a galaxy with lightspeed limit Description: Game in the style of the Master of Orion but with the speed of light introducing a time lag for distant star systems. Flag strict Description: Strict compile-time checks Default: true Executable server Path: . Install: true CompiledObject: best MainIs: server.ml BuildDepends: bigarray, extunix, unix oasis-0.4.11/test/data/TestOASISParse/bug1239.oasis0000644000175000017500000000073713261073606021005 0ustar gildorgildorOASISFormat: 0.3 OCamlVersion: >= 3.12 Name: foo Version: 1.0 Synopsis: Foo Authors: Philippe Veber License: GPL LicenseFile: LICENCE Plugins: META (0.3), DevFiles (0.3) BuildTools: ocamlbuild Library foo Path: src Modules: M Library bar Path: src/bar Pack: true Modules: A BuildDepends: foo Executable baz Path: src/baz MainIs: baz.ml BuildDepends: bar BuildTools: ocamlbuild Install: false oasis-0.4.11/test/data/TestOASISParse/bug1236.oasis0000644000175000017500000000045413261073606020776 0ustar gildorgildorOASISFormat: 0.3 Name: foo Version: 1.0 Synopsis: test roject Authors: gs License: LGPL Plugins: META (0.3) Executable hello Path: . BuildTools: ocamlbuild MainIs: hello.ml Library lib Path: . Modules: lib FindlibName: lib BuildTools: ocamlbuild oasis-0.4.11/test/data/TestOASISParse/LICENSE0000644000175000017500000000325313261073606017652 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** toto oasis-0.4.11/test/data/TestOASISObject/0000755000175000017500000000000013261073606016776 5ustar gildorgildoroasis-0.4.11/test/data/TestOASISObject/source_patterns/0000755000175000017500000000000013261073606022216 5ustar gildorgildoroasis-0.4.11/test/data/TestOASISObject/source_patterns/_oasis0000644000175000017500000000055513261073606023423 0ustar gildorgildorOASISFormat: 0.4 Name: source_patterns Version: 0.0.1 Authors: Foo Bar License: LGPL with OCaml linking exception Synopsis: Test source_patterns BetaFeatures: section_object AlphaFeatures: source_patterns Object object1 Path: . Modules: O1 InterfacePatterns: ${module}.eliomi ImplementationPatterns: ${module}.eliom Object object2 Path: . Modules: O2 oasis-0.4.11/test/data/TestOASISObject/source_patterns/O2.ml0000644000175000017500000000324613261073606023035 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestOASISObject/source_patterns/O1.eliomi0000644000175000017500000000000013261073606023663 0ustar gildorgildoroasis-0.4.11/test/data/TestOASISObject/source_patterns/O1.eliom0000644000175000017500000000000013261073606023512 0ustar gildorgildoroasis-0.4.11/test/data/TestOASISLibrary/0000755000175000017500000000000013261073606017174 5ustar gildorgildoroasis-0.4.11/test/data/TestOASISLibrary/source_patterns/0000755000175000017500000000000013261073606022414 5ustar gildorgildoroasis-0.4.11/test/data/TestOASISLibrary/source_patterns/_oasis0000644000175000017500000000042513261073606023615 0ustar gildorgildorOASISFormat: 0.4 Name: source_patterns Version: 0.0.1 Authors: Foo Bar License: LGPL with OCaml linking exception Synopsis: Test source_patterns with library AlphaFeatures: source_patterns Library lib Path: . Modules: L1, L2, L3 ImplementationPatterns+: ${module}.mlify oasis-0.4.11/test/data/TestOASISLibrary/source_patterns/L3.mlify0000644000175000017500000000000013261073606023722 0ustar gildorgildoroasis-0.4.11/test/data/TestOASISLibrary/source_patterns/L2.mli0000644000175000017500000000324613261073606023401 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestOASISLibrary/source_patterns/L1.ml0000644000175000017500000000324613261073606023227 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/0000755000175000017500000000000013261073606015673 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/with-cclib/0000755000175000017500000000000013261073606017720 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/with-cclib/src/0000755000175000017500000000000013261073606020507 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/with-cclib/src/test_compile.ml0000644000175000017500000000335313261073606023534 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let s = "test" let _ = Stringprep.caml_stringprep_xmpp_nodeprep s oasis-0.4.11/test/data/TestFull/with-cclib/src/stringprep_stubs.c0000644000175000017500000000414613261073606024275 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include #include #include #include #include #include value caml_stringprep_xmpp_nodeprep( value v_in ) { CAMLparam1( v_in ); char *in; int maxlen; int res; in = String_val(v_in); maxlen = caml_string_length(v_in); res = stringprep_xmpp_nodeprep(in, maxlen); CAMLreturn( Val_int(res) ); } oasis-0.4.11/test/data/TestFull/with-cclib/src/stringprep.ml0000644000175000017500000000340113261073606023234 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) external caml_stringprep_xmpp_nodeprep: string -> int = "caml_stringprep_xmpp_nodeprep" oasis-0.4.11/test/data/TestFull/with-cclib/_oasis0000644000175000017500000000077213261073606021126 0ustar gildorgildorOASISFormat: 0.3 Name: test-oasis-c-dependency Version: 0.1 Synopsis: test oasis with c dependency Authors: test License: LGPL-2.1 with OCaml linking exception Plugins: DevFiles (0.1), Meta (0.1) BuildTools: ocamlbuild Library test_oasis_c_dependency Path: src Modules: Stringprep CSources: stringprep_stubs.c CCLib: -lidn Install: false Executable test_compile Path: src MainIs: test_compile.ml BuildDepends: test_oasis_c_dependency Install: false oasis-0.4.11/test/data/TestFull/ver0.3/0000755000175000017500000000000013261073606016710 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/ver0.3/touch.ml0000644000175000017500000000336413261073606020372 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = Arg.parse [] (fun fn -> close_out (open_out fn)) "foo" oasis-0.4.11/test/data/TestFull/ver0.3/_oasis0000644000175000017500000000047213261073606020113 0ustar gildorgildorOASISFormat: 0.3 Name: dev Version: 0.0.1 Authors: Sylvain Le Gall License: LGPL with OCaml linking exception Synopsis: Minimal project to test v0.3 support. Test main Command: ocaml touch.ml test-done Document api Type: custom (0.3) Title: Manual XCustom: ocaml touch.ml doc-done oasis-0.4.11/test/data/TestFull/recurselib/0000755000175000017500000000000013261073606020032 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/recurselib/src/0000755000175000017500000000000013261073606020621 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/recurselib/src/binary.ml0000644000175000017500000000324613261073606022444 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/recurselib/_oasis0000644000175000017500000000032313261073606021230 0ustar gildorgildorOASISFormat: 0.3 Name: recursivelib Version: 0.1 License: GPL-3 Authors: Sylvain Le Gall Synopsis: recursivelib Library binary Path: src BuildDepends: binary, num BuildTools: ocamlbuild Modules: Binary oasis-0.4.11/test/data/TestFull/no-install-doc/0000755000175000017500000000000013261073606020516 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/no-install-doc/_oasis0000644000175000017500000000036413261073606021721 0ustar gildorgildorOASISFormat: 0.3 Name: no-install-doc Version: 0.1 Synopsis: Test to not install non built doc Authors: Me License: GPL Document toto Type: None (0.1.0) Title: Nothing Install: false Build: false DataFiles: toto.txt oasis-0.4.11/test/data/TestFull/issue107/0000755000175000017500000000000013261073606017253 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/issue107/main.ml0000644000175000017500000000324613261073606020536 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/issue107/_oasis0000644000175000017500000000045013261073606020452 0ustar gildorgildorOASISFormat: 0.4 Name: issue107 Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project in a single directory. Plugins: META BuildTools: ocamlbuild Executable "main" Path: . MainIs: main.ml oasis-0.4.11/test/data/TestFull/flag-ccopt/0000755000175000017500000000000013261073606017712 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/flag-ccopt/_oasis0000644000175000017500000000062513261073606021115 0ustar gildorgildorOASISFormat: 0.3 Name: cryptokit Version: 1.4 Authors: Me License: LGPL-2 with OCaml linking exception BuildTools: ocamlbuild, ocamldoc Synopsis: Cryptographic primitives Flag zlib Description: Enable ZLib Default$: !os_type(Win32) Library cryptokit Path: ./ Modules: A BuildDepends: unix, num Install: false if flag(zlib) CCOpt: -O -DHAVE_ZLIB CCLib: -lz oasis-0.4.11/test/data/TestFull/flag-ccopt/A.ml0000644000175000017500000000324613261073606020431 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/dynrun_for_release/0000755000175000017500000000000013261073606021560 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/dynrun_for_release/foo.ml0000644000175000017500000000330313261073606022674 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = prerr_endline "Foo" oasis-0.4.11/test/data/TestFull/dynrun_for_release/_oasis0000644000175000017500000000050713261073606022762 0ustar gildorgildorOASISFormat: 0.4 AlphaFeatures: dynrun_for_release Name: foo Version: 1.0 Synopsis: Foo Authors: Sylvain License: GPL-3.0 Plugins: StdFiles (0.4) Executable foo Path: . BuildTools: ocamlbuild MainIs: foo.ml BuildDepends: threads Install: false oasis-0.4.11/test/data/TestFull/dynlink/0000755000175000017500000000000013261073606017343 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/dynlink/main.ml0000644000175000017500000000370713261073606020630 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = Arg.parse [ "-load", Arg.String Dynlink.loadfile, "fn load a file" ] ignore "" let () = if !Entry_point.counter <> 2 then failwith (Printf.sprintf "number of loaded modules: got %d, want 2" !Entry_point.counter) oasis-0.4.11/test/data/TestFull/dynlink/entry_point.ml0000644000175000017500000000327213261073606022253 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let counter = ref 0 oasis-0.4.11/test/data/TestFull/dynlink/dyn_loaded_ext.ml0000644000175000017500000000331013261073606022654 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = incr Entry_point.counter oasis-0.4.11/test/data/TestFull/dynlink/dyn_loaded.ml0000644000175000017500000000331013261073606021774 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = incr Entry_point.counter oasis-0.4.11/test/data/TestFull/dynlink/_oasis0000644000175000017500000000132413261073606020543 0ustar gildorgildorOASISFormat: 0.4 Name: dynlink Version: 0 Synopsis: Test dynlink-ing. Authors: Sylvain Le Gall License: LGPL-2.1 with OCaml linking exception Plugins: META (0.4) BuildTools: ocamlbuild Library entry_point Path: . Modules: Entry_point Library dyn_loaded Path: . Modules: Dyn_loaded, Dyn_loaded_ext BuildDepends: entry_point FindlibParent: entry_point Executable "dynlink-test-byte" Path: . MainIs: main.ml CompiledObject: byte BuildDepends: entry_point, dynlink Executable "dynlink-test-native" Path: . MainIs: main.ml CompiledObject: native Build$: flag(native_dynlink) && flag(is_native) BuildDepends: entry_point, dynlink oasis-0.4.11/test/data/TestFull/dev/0000755000175000017500000000000013261073606016451 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/dev/main.ml0000644000175000017500000000324613261073606017734 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/dev/_tags0000644000175000017500000000332513261073606017474 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # OASIS_STOP "A.ml": pkg_oUnit oasis-0.4.11/test/data/TestFull/dev/_oasis.v20000644000175000017500000000051013261073606020173 0ustar gildorgildorOASISFormat: 0.3 Name: dev Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project for dev support. Plugins: META BuildTools: ocamlbuild Library "mylib" Path: . Modules: A Executable "myexec" Path: . MainIs: main.ml oasis-0.4.11/test/data/TestFull/dev/_oasis.v10000644000175000017500000000044013261073606020174 0ustar gildorgildorOASISFormat: 0.3 Name: dev Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project for dev support. Plugins: META BuildTools: ocamlbuild Executable "myexec" Path: . MainIs: main.ml oasis-0.4.11/test/data/TestFull/dev/A.ml0000644000175000017500000000326313261073606017167 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = () oasis-0.4.11/test/data/TestFull/customdoc/0000755000175000017500000000000013261073606017673 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/customdoc/_oasis0000644000175000017500000000070113261073606021071 0ustar gildorgildorOASISFormat: 0.3 Name: with-c Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project in a single directory. Plugins: META BuildTools: ocamlbuild Library "with-a" Path: . Modules: A CompiledObject: byte Document "manual-custom" Type: custom (0.1.0) Title: Manual XCustom: $make doc XCustomClean: $make doc-clean BuildTools: make oasis-0.4.11/test/data/TestFull/customdoc/Makefile0000644000175000017500000000335213261073606021336 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ all: doc: ocamldoc -html A.ml doc-clean: $(RM) *.html style.css oasis-0.4.11/test/data/TestFull/customdoc/A.ml0000644000175000017500000000324613261073606020412 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/create-parent-dir/0000755000175000017500000000000013261073606021201 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/create-parent-dir/_oasis0000644000175000017500000000045513261073606022405 0ustar gildorgildorOASISFormat: 0.3 Name: no-install-doc Version: 0.1 Synopsis: Test to not install non built doc Authors: Me License: GPL Document toto Type: Custom (0.1.0) Title: Nothing XCustom: echo toto > toto.txt XCustomClean: $rm toto.txt DataFiles: toto.txt ($datarootdir/toto/toto/) oasis-0.4.11/test/data/TestFull/cppcc/0000755000175000017500000000000013261073606016763 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/cppcc/testc++.c0000644000175000017500000000354413261073606020405 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #if !__cplusplus #error "Should be processed as C++ file." #endif // #include // // int main() { // std::cout << "Hello World!"; // } oasis-0.4.11/test/data/TestFull/cppcc/myocamlbuild.ml0000644000175000017500000000372513261073606022005 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* OASIS_START *) (* OASIS_STOP *) open Ocamlbuild_plugin let dispatch_add_cc e = match e with | After_rules -> flag ["compile"; "c"] (S[A "-cc"; A "g++"]) | _ -> () ;; Ocamlbuild_plugin.dispatch (MyOCamlbuildBase.dispatch_combine [dispatch_default; dispatch_add_cc]);; oasis-0.4.11/test/data/TestFull/cppcc/cppcc.ml0000644000175000017500000000324613261073606020412 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/cppcc/_oasis0000644000175000017500000000046613261073606020171 0ustar gildorgildorOASISFormat: 0.4 Name: cppcc Version: 0.1 License: LGPL with OCaml linking exception Authors: Sylvain Le Gall Synopsis: Test how to handle C++ compiler. BuildTools: ocamlbuild Plugins: META (0.4) Library cppcc Path: . Modules: Cppcc CSources: testc++.c CCOpt: -Wall oasis-0.4.11/test/data/TestFull/bugClib/0000755000175000017500000000000013261073606017242 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bugClib/src/0000755000175000017500000000000013261073606020031 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bugClib/src/fooC.c0000644000175000017500000000332013261073606021061 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ oasis-0.4.11/test/data/TestFull/bugClib/src/bar.ml0000644000175000017500000000324613261073606021134 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/bugClib/foo.ml0000644000175000017500000000324613261073606020364 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/bugClib/_oasis0000644000175000017500000000076113261073606020446 0ustar gildorgildorOASISFormat: 0.3 Name: bugClib Version: 0.1 Synopsis: Test a bug building C libraries Authors: Sylvain Le Gall License: LGPL-2.1 with OCaml linking exception Plugins: META (0.3) Library mylib Path: . BuildTools: ocamlbuild Modules: Foo, src/Bar CSources: src/fooC.c Pack: true if os_type(Win32) && ccomp_type(msvc) CCLib: ws2_32.lib else if os_type(Win32) CCLib: -lws2_32 else CCLib: -lrt CCOpt: -D_LARGEFILE64_SOURCE oasis-0.4.11/test/data/TestFull/bug982/0000755000175000017500000000000013261073606016713 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug982/test-setup-data.sh0000755000175000017500000000340613261073606022301 0ustar gildorgildor#!/bin/sh ################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ set -e . "./setup.data" set -x test "x$ocamlc" != "x" make -f Makefile.setup-data oasis-0.4.11/test/data/TestFull/bug982/_oasis0000644000175000017500000000037113261073606020114 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0 Synopsis: test Authors: me License: GPL BuildTools: ocamlbuild PostConfCommand: ./test-setup-data.sh Executable test Path: ./ MainIs: A.ml CompiledObject: byte Install: false oasis-0.4.11/test/data/TestFull/bug982/Makefile.setup-data0000644000175000017500000000333113261073606022421 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ include setup.data all: test "x$(ocamlc)" != "x" oasis-0.4.11/test/data/TestFull/bug982/A.ml0000644000175000017500000000330713261073606017430 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = print_endline "coucou" oasis-0.4.11/test/data/TestFull/bug938/0000755000175000017500000000000013261073606016714 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug938/postconf.sh0000755000175000017500000000347313261073606021115 0ustar gildorgildor#!/bin/sh ################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ set -e set -x . ./setup.data echo test foo test "$foo" = "true" echo test bar test "$bar" = "true" echo test over test "$over" = "false" oasis-0.4.11/test/data/TestFull/bug938/_oasis0000644000175000017500000000063313261073606020116 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0 Synopsis: test Authors: me License: GPL BuildTools: ocamlbuild PostConfCommand: ./postconf.sh Flag bar Description: enable support for bar Default$: flag(all) Flag all Description: enable everything Default: false Flag foo Description: enable support for foo Default$: flag(all) Flag over Description: overriden flag Default$: flag(all) oasis-0.4.11/test/data/TestFull/bug823/0000755000175000017500000000000013261073606016705 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug823/preconf.sh0000755000175000017500000000340513261073606020702 0ustar gildorgildor#!/bin/sh ################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ set -e echo 'myvar="true"' >> setup.data echo 'ocamlopt="myocamlopt"' >> setup.data oasis-0.4.11/test/data/TestFull/bug823/postconf.sh0000755000175000017500000000346513261073606021107 0ustar gildorgildor#!/bin/sh ################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ set -e . ./setup.data set -x echo "testing ocamlopt" test "$ocamlopt" = "myocamlopt" echo "testing myvar" test "$myvar" = "true" oasis-0.4.11/test/data/TestFull/bug823/_oasis0000644000175000017500000000027113261073606020105 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0 Synopsis: test Authors: me License: GPL BuildTools: ocamlbuild PreConfCommand: ./preconf.sh PostConfCommand: ./postconf.sh oasis-0.4.11/test/data/TestFull/bug791/0000755000175000017500000000000013261073606016711 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug791/test/0000755000175000017500000000000013261073606017670 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug791/test/C.ml0000644000175000017500000000325513261073606020411 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open B oasis-0.4.11/test/data/TestFull/bug791/src/0000755000175000017500000000000013261073606017500 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug791/src/lib/0000755000175000017500000000000013261073606020246 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug791/src/lib/B.ml0000644000175000017500000000324613261073606020766 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/bug791/src/A.ml0000644000175000017500000000324613261073606020217 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/bug791/_oasis0000644000175000017500000000056513261073606020117 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0 Synopsis: None Authors: Sylvain Le Gall License: LGPL-2.1 with OCaml linking exception Library "testA" Path: src BuildTools: ocamlbuild Modules: A, lib/B Install: false Executable "C" Path: test BuildTools: ocamlbuild BuildDepends: testA MainIs: C.ml Install: false oasis-0.4.11/test/data/TestFull/bug738/0000755000175000017500000000000013261073606016712 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug738/src/0000755000175000017500000000000013261073606017501 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug738/src/foo.bar0000644000175000017500000000003613261073606020751 0ustar gildorgildorprint_endline "Hello, world!" oasis-0.4.11/test/data/TestFull/bug738/myocamlbuild.ml0000644000175000017500000000376213261073606021735 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* OASIS_START *) (* OASIS_STOP *) open Ocamlbuild_plugin let () = dispatch (fun hook -> dispatch_default hook; match hook with | After_rules -> rule ".bar --> .ml" ~dep:"%.bar" ~prod:"%.ml" (fun env _ -> cp (env "%.bar") (env "%.ml")) | _ -> ()) oasis-0.4.11/test/data/TestFull/bug738/_oasis0000644000175000017500000000036413261073606020115 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0.1 License: BSD3 Authors: Jérémie Dimino BuildTools: ocamlbuild Synopsis: test Plugins: META (0.1.0) Library test Path: src Modules: Foo CompiledObject: Byte oasis-0.4.11/test/data/TestFull/bug623/0000755000175000017500000000000013261073606016703 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug623/a.ml0000644000175000017500000000324613261073606017462 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/bug623/_oasis0000644000175000017500000000033013261073606020077 0ustar gildorgildorOASISFormat: 0.3 Name: bug623 Version: 0 Synopsis: Test bug 623 Authors: Me License: GPL BuildTools: ocamlbuild Library empty Path: . Modules: A Test "false" Command: toto Run: true oasis-0.4.11/test/data/TestFull/bug619/0000755000175000017500000000000013261073606016710 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug619/_oasis0000644000175000017500000000026413261073606020112 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0.0.1 Synopsis: test OASIS Authors: Me License: BSD3 Flag "pf-inet6" Description: Test INET6 sockets Default: true oasis-0.4.11/test/data/TestFull/bug588/0000755000175000017500000000000013261073606016715 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug588/test.ml0000644000175000017500000000327713261073606020237 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = Libtest.run () oasis-0.4.11/test/data/TestFull/bug588/libtest.ml0000644000175000017500000000342013261073606020714 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let q = IFDEF HAS_FRENCH THEN "bonjour" ELSE "hello" ENDIF let run () = print_endline q oasis-0.4.11/test/data/TestFull/bug588/_tags_manual0000644000175000017500000000333613261073606021277 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # OASIS_STOP "libtest.ml": syntax_camlp4o oasis-0.4.11/test/data/TestFull/bug588/_oasis0000644000175000017500000000112413261073606020113 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0.0.1 Synopsis: test OASIS Authors: ygrek License: BSD3 BuildTools: ocamlbuild Library libtest Path: . Install: false Modules: Libtest BuildDepends: camlp4.macro Document libtest Title: API reference for libtest Type: ocamlbuild (0.1.0) InstallDir: $htmldir/libtest BuildTools+: ocamldoc Install: false XOCamlbuildPath: . XOCamlbuildLibraries: libtest Executable test Path: . Install: false MainIs: test.ml BuildDepends: libtest oasis-0.4.11/test/data/TestFull/bug571/0000755000175000017500000000000013261073606016705 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug571/_oasis0000644000175000017500000000064613261073606020113 0ustar gildorgildorOASISFormat: 0.3 Name: test Version: 0 Synopsis: test Authors: me License: GPL BuildTools: ocamlbuild Executable test Path: ./ MainIs: A.ml ByteOpt: -package num BuildDepends: oUnit CompiledObject: byte Install: false Executable "test-opt" Path: ./ Build$: flag(is_native) MainIs: A.ml NativeOpt: -package num BuildDepends: oUnit CompiledObject: native Install: false oasis-0.4.11/test/data/TestFull/bug571/A.ml0000644000175000017500000000340613261073606017422 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 open Big_int let () = let _ = Big_int.big_int_of_string "1234" in () oasis-0.4.11/test/data/TestFull/bug1473/0000755000175000017500000000000013261073606016767 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug1473/foo.ml0000644000175000017500000000326213261073606020107 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = () oasis-0.4.11/test/data/TestFull/bug1473/_oasis0000644000175000017500000000037613261073606020175 0ustar gildorgildorOASISFormat: 0.4 Name: foo Version: 1.0 Synopsis: Foo Authors: Me OCamlVersion: >= 3.12 License: GPL-3.0 Executable foo Path: . BuildTools: ocamlbuild MainIs: foo.ml Install: false oasis-0.4.11/test/data/TestFull/bug1358/0000755000175000017500000000000013261073606016771 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug1358/foo.ml0000644000175000017500000000326213261073606020111 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open Thread oasis-0.4.11/test/data/TestFull/bug1358/_oasis0000644000175000017500000000043413261073606020172 0ustar gildorgildorOASISFormat: 0.4 Name: foo Version: 1.0 Synopsis: Foo Authors: Markus OCamlVersion: >= 4.00 License: GPL-3.0 Executable foo Path: . BuildTools: ocamlbuild MainIs: foo.ml BuildDepends: threads Install: false oasis-0.4.11/test/data/TestFull/bug1239/0000755000175000017500000000000013261073606016767 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug1239/src/0000755000175000017500000000000013261073606017556 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug1239/src/m.ml0000644000175000017500000000326013261073606020345 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let a = 1 oasis-0.4.11/test/data/TestFull/bug1239/src/baz/0000755000175000017500000000000013261073606020332 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug1239/src/baz/baz.ml0000644000175000017500000000327413261073606021446 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let a = Bar.A.a + M.a oasis-0.4.11/test/data/TestFull/bug1239/src/bar/0000755000175000017500000000000013261073606020322 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/bug1239/src/bar/a.ml0000644000175000017500000000326213261073606021077 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let a = M.a oasis-0.4.11/test/data/TestFull/bug1239/_oasis0000644000175000017500000000071713261073606020174 0ustar gildorgildorOASISFormat: 0.3 OCamlVersion: >= 3.12 Name: foo Version: 1.0 Synopsis: Foo Authors: Philippe Veber License: GPL LicenseFile: LICENCE Plugins: META (0.3) BuildTools: ocamlbuild Library foo Path: src Modules: M Library bar Path: src/bar Pack: true Modules: A BuildDepends: foo Executable baz Path: src/baz MainIs: baz.ml BuildDepends: bar BuildTools: ocamlbuild Install: false oasis-0.4.11/test/data/TestFull/1level/0000755000175000017500000000000013261073606017063 5ustar gildorgildoroasis-0.4.11/test/data/TestFull/1level/main.ml0000644000175000017500000000324613261073606020346 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/test/data/TestFull/1level/_oasis0000644000175000017500000000116513261073606020266 0ustar gildorgildorOASISFormat: 0.3 Name: with-c Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project in a single directory. Plugins: META BuildTools: ocamlbuild Library "with-a" Path: . Modules: A BuildDepends: oUnit Document "with-a" Title: API reference for with-a Type: ocamlbuild (0.1.0) InstallDir: $htmldir/with-a BuildTools+: ocamldoc XOCamlbuildPath: . XOCamlbuildLibraries: with-a Executable "test-with-a" Path: . MainIs: main.ml BuildDepends: with-a oasis-0.4.11/test/data/TestFull/1level/A.ml0000644000175000017500000000326313261073606017601 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 oasis-0.4.11/test/data/TestFileTemplate/0000755000175000017500000000000013261073606017344 5ustar gildorgildoroasis-0.4.11/test/data/TestFileTemplate/filetemplate5.txt-exp0000644000175000017500000000013613261073606023437 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: 49d02d55ad10973b7b9d0dc9eba7fdf0) tata # OASIS_STOP oasis-0.4.11/test/data/TestFileTemplate/filetemplate4.txt-exp0000644000175000017500000000013113261073606023431 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP oasis-0.4.11/test/data/TestFileTemplate/filetemplate3.txt-exp0000644000175000017500000000014113261073606023431 0ustar gildorgildor toto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP tata oasis-0.4.11/test/data/TestFileTemplate/filetemplate3.txt0000644000175000017500000000005013261073606022636 0ustar gildorgildor toto # OASIS_START # OASIS_STOP tata oasis-0.4.11/test/data/TestFileTemplate/filetemplate2.txt-exp0000644000175000017500000000013213261073606023430 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP oasis-0.4.11/test/data/TestFileTemplate/filetemplate2.txt0000644000175000017500000000002413261073606022636 0ustar gildorgildortoto # OASIS_START oasis-0.4.11/test/data/TestFileTemplate/filetemplate1.txt-exp0000644000175000017500000000001013261073606023422 0ustar gildorgildor toto oasis-0.4.11/test/data/TestFileTemplate/filetemplate1.txt0000644000175000017500000000001013261073606022630 0ustar gildorgildor toto oasis-0.4.11/test/data/TestBasic/0000755000175000017500000000000013261073606016012 5ustar gildorgildoroasis-0.4.11/test/data/TestBasic/dir.data0000644000175000017500000000002013261073606017413 0ustar gildorgildorbindir = "toto" oasis-0.4.11/test/data/TestBaseLog/0000755000175000017500000000000013261073606016305 5ustar gildorgildoroasis-0.4.11/test/data/TestBaseLog/win32/0000755000175000017500000000000013261073606017247 5ustar gildorgildoroasis-0.4.11/test/data/TestBaseLog/win32/setup.log0000644000175000017500000000003013261073606021103 0ustar gildorgildor"foo" "bar" "bar" "baz"oasis-0.4.11/test/data/TestBaseLog/unix/0000755000175000017500000000000013261073606017270 5ustar gildorgildoroasis-0.4.11/test/data/TestBaseLog/unix/setup.log0000644000175000017500000000003113261073606021125 0ustar gildorgildor"foo" "bar" "bar" "baz" oasis-0.4.11/test/data/TestBaseCompat/0000755000175000017500000000000013261073606017007 5ustar gildorgildoroasis-0.4.11/test/data/TestBaseCompat/setup-0.4.ml0000644000175000017500000000407413261073606021005 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* OASIS_START *) (* OASIS_STOP *) let setup_t = {setup_t with BaseSetup.configure = (fun pkg args -> let () = setup_t.BaseSetup.configure pkg args in close_out (open_out "foobar")); BaseSetup.distclean = (fun pkg args -> Sys.remove "foobar") :: setup_t.BaseSetup.distclean} let setup () = BaseSetup.setup setup_t let () = setup ();; oasis-0.4.11/test/data/TestBaseCompat/_oasis-0.40000644000175000017500000000032713261073606020510 0ustar gildorgildorOASISFormat: 0.4 Name: basecompat Version: 0.0.1 Synopsis: Just a test of BaseCompat Authors: Sylvain Le Gall BuildType: None (0.2) License: GPL Executable A Path: . MainIs: A.ml oasis-0.4.11/test/data/TestBaseCompat/_oasis-0.30000644000175000017500000000032713261073606020507 0ustar gildorgildorOASISFormat: 0.3 Name: basecompat Version: 0.0.1 Synopsis: Just a test of BaseCompat Authors: Sylvain Le Gall BuildType: None (0.2) License: GPL Executable A Path: . MainIs: A.ml oasis-0.4.11/test/data/TestBaseCompat/A.ml0000644000175000017500000000324613261073606017526 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/src/0000755000175000017500000000000013261073606013030 5ustar gildorgildoroasis-0.4.11/src/tools/0000755000175000017500000000000013261073606014170 5ustar gildorgildoroasis-0.4.11/src/tools/oasis-dist/0000755000175000017500000000000013261073606016247 5ustar gildorgildoroasis-0.4.11/src/tools/oasis-dist/OASISDist.ml0000644000175000017500000002407513261073606020313 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISMessage open OASISTypes open OASISUtils let run ~ctxt ?f_exit_code prg args = OASISExec.run ~ctxt ?f_exit_code prg args let with_tmpdir f = let res = Filename.temp_file "oasis-dist-" ".dir" in let clean () = FileUtil.rm ~recurse:true [res] in Sys.remove res; FileUtil.mkdir res; try f res; clean () with e -> clean (); raise e let run_oasis_setup_in_tarball ~ctxt fn topdir = with_tmpdir (fun dn -> let () = run ~ctxt "tar" ["-C"; dn; "-xzf"; fn] in let dn_topdir = Filename.concat dn topdir in let pkg = OASISParse.from_file ~ctxt (Filename.concat dn_topdir OASISParse.default_oasis_fn) in let cur_pwd = Sys.getcwd () in let () = try let _chngs: OASISFileTemplate.file_generate_change list = Sys.chdir dn_topdir; BaseGenerate.generate ~ctxt ~setup_fn:BaseSetup.default_filename ~backup:false ~restore:false OASISSetupUpdate.NoUpdate pkg in Sys.chdir cur_pwd with e -> Sys.chdir cur_pwd; raise e in run ~ctxt "tar" ["-C"; dn; "-czf"; fn; topdir]) class virtual vcs = object method virtual check_uncommited_changes: bool method virtual list_tags: string list method virtual dist: string -> host_filename -> unit method virtual tag: string -> unit end class svn ctxt = object inherit vcs val ctxt = ctxt method check_uncommited_changes = match OASISExec.run_read_output ~ctxt "svn" ["status"] with | [] -> true | _ -> false method dist topdir tarball = with_tmpdir (fun dir -> let tgt = Filename.concat dir topdir in let cur_pwd = Sys.getcwd () in run ~ctxt "svn" ["export"; cur_pwd; tgt]; run ~ctxt "tar" ["-C"; dir; "-czf"; tarball; topdir]) method tag _ = warning ~ctxt "No tag method" method list_tags = [] end (* TODO: check file permissions +x for darcs *) class darcs ctxt = object inherit vcs val ctxt = ctxt method check_uncommited_changes = let ok = ref false in (* Check that everything is commited *) run ~ctxt ~f_exit_code: (function | 1 -> ok := true | 0 -> () | n -> failwithf "Unexpected exit code %d" n ) "darcs" ["whatsnew"; "-ls"]; !ok method list_tags = OASISExec.run_read_output ~ctxt "darcs" ["show"; "tags"] method dist topdir tarball = (* Create the tarball *) run ~ctxt "darcs" ["dist"; "--dist-name"; topdir]; Sys.rename (topdir^".tar.gz") tarball method tag ver = run ~ctxt "darcs" ["tag"; ver] end class git ctxt = object inherit vcs val ctxt = ctxt method check_uncommited_changes = match OASISExec.run_read_output ~ctxt "git" ["status"; "--porcelain"] with | [] -> true | _ -> false method list_tags = OASISExec.run_read_output ~ctxt "git" ["tag"] method dist topdir tarball = let tarfn = Filename.chop_extension tarball in run ~ctxt "git" ["archive"; "--prefix"; (Filename.concat topdir ""); "--format"; "tar"; "HEAD"; "-o"; tarfn]; run ~ctxt "gzip" [tarfn] method tag ver = run ~ctxt "git" ["tag"; ver] end class no_vcs ctxt = object inherit vcs val ctxt = ctxt method dist topdir tarball = with_tmpdir (fun dir -> let tgt = Filename.concat dir topdir in let cur_pwd = Sys.getcwd () in OASISFileUtil.cp ~ctxt ~recurse:true cur_pwd tgt; begin try Sys.chdir tgt; run ~ctxt "ocaml" ["setup.ml"; "-distclean"]; Sys.chdir dir; run ~ctxt "tar" ["czf"; tarball; topdir]; Sys.chdir cur_pwd; with e -> Sys.chdir cur_pwd; raise e end) method tag _ = warning ~ctxt "No tag method" method check_uncommited_changes = false method list_tags = [] end let () = let () = OASISBuiltinPlugins.init () in let build = ref true in let tag = ref true in let sign = ref true in let ignore_changes = ref false in let () = Arg.parse [ "-no-build", Arg.Clear build, " Don't try to build the resulting tarball."; "-no-tag", Arg.Clear tag, " Don't tag the result."; "-no-sign", Arg.Clear sign, " Don't sign the result."; "-ignore_changes", Arg.Set ignore_changes, " Ignore local changes."; ] (fun s -> failwith (Printf.sprintf "Don't know what to do with %S" s)) "oasis-dist: build tarball out of oasis enabled sources." in let ctxt = {!OASISContext.default with OASISContext.ignore_plugins = true} in let pkg = OASISParse.from_file ~ctxt OASISParse.default_oasis_fn in let topdir = pkg.name^"-"^(OASISVersion.string_of_version pkg.version) in let tarball = Filename.concat (Sys.getcwd ()) (topdir^".tar.gz") in let vcs = let test_dir dn () = Sys.file_exists dn && Sys.is_directory dn in try snd (List.find (fun (f, _) -> f ()) [ test_dir "_darcs", new darcs ctxt; test_dir ".git", new git ctxt; test_dir ".svn", new svn ctxt; ]) with Not_found -> new no_vcs ctxt in if not !ignore_changes && not vcs#check_uncommited_changes then begin error ~ctxt "Uncommited changes"; exit 1 end; (* Create the tarball *) vcs#dist topdir tarball; (* Run "oasis setup" *) run_oasis_setup_in_tarball ~ctxt tarball topdir; (* Check that the tarball can build *) with_tmpdir (fun dir -> let pwd = Sys.getcwd () in (* Uncompress tarball in tmpdir *) run ~ctxt "tar" ["xz"; "-C"; dir; "-f"; tarball]; Sys.chdir dir; Sys.chdir topdir; try let () = if Sys.file_exists "setup.data" then failwith "Remaining 'setup.data' file."; if Sys.file_exists "configure" && not (FileUtil.test FileUtil.Is_exec "configure") then failwith "'configure' is not executable." in let () = if !build then (* Check that build, test, doc run smoothly *) run ~ctxt "ocaml" ["setup.ml"; "-all"] in let () = let bak_files = (* Check for remaining .bak files *) FileUtil.find (FileUtil.Has_extension "bak") Filename.current_dir_name (fun acc fn -> fn :: acc) [] in if bak_files <> [] then failwithf "Remaining .bak files: %s." (String.concat ", " bak_files) in Sys.chdir pwd with e -> Sys.chdir pwd; raise e); if !tag then begin let tags = List.sort OASISVersion.version_compare (List.rev_map OASISVersion.version_of_string vcs#list_tags) in let ver_str = OASISVersion.string_of_version pkg.version in match tags with | hd :: _ -> begin let cmp = OASISVersion.version_compare hd pkg.version in if List.mem pkg.version tags then begin warning ~ctxt "Version %s already tagged" ver_str end else if cmp > 0 then begin warning ~ctxt "Version %s is smaller than already tagged version %s" ver_str (OASISVersion.string_of_version hd); vcs#tag ver_str end else begin vcs#tag ver_str end end | _ -> vcs#tag ver_str end; if !sign then run ~ctxt ~f_exit_code: (fun i -> if i <> 0 then warning ~ctxt "Cannot sign '%s' with gpg" tarball else ()) "gpg" ["-s"; "-a"; "-b"; tarball] oasis-0.4.11/src/tools/oasis-announce/0000755000175000017500000000000013261073606017112 5ustar gildorgildoroasis-0.4.11/src/tools/oasis-announce/OASISAnnounce.ml0000644000175000017500000001152513261073606022015 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISMessage open OASISTypes let () = let ctxt = {!OASISContext.default with OASISContext.ignore_plugins = true} in let pkg = OASISParse.from_file ~ctxt OASISParse.default_oasis_fn in let version = OASISVersion.string_of_version pkg.version in let from = "Sylvain Le Gall " in let email_to = "caml-list@inria.fr" in let email_bcc = "" in let subject = Printf.sprintf "[ANN] %s v%s: %s" pkg.name version pkg.synopsis in let body = match pkg.description with | Some txt -> OASISText.to_string txt | None -> warning ~ctxt "No description"; "" in let body = match pkg.homepage with | Some url -> body^(Printf.sprintf "\n\nHomepage:\n%s" url) | None -> warning ~ctxt "No homepage"; body in let body = let data = List.fold_left (fun data -> function | SrcRepo (cs, srcrepo) when cs.cs_name = "head" -> Some (cs, srcrepo) | _ -> data) None pkg.sections in match data with | Some (_, src) -> begin let get = match src.src_repo_type with | Darcs -> Printf.sprintf "$ darcs get %s" src.src_repo_location | Svn -> Printf.sprintf "$ svn co %s" src.src_repo_location | _ -> failwith "Unsupported VCS" in body^"\n\nGet source code:\n"^get^ (match src.src_repo_browser with | Some url -> "\n\nBrowse source code:\n"^url | None -> "") end | None -> warning ~ctxt "No source repository"; body in let email = Printf.sprintf "From: %s\n\ To: %s\n\ Bcc: %s\n\ Subject: %s\n\ \n\ %s\n\ \n\ [Generated by 'OASIS announce']" from email_to email_bcc subject body in let editor = try Sys.getenv "EDITOR" with Not_found -> "editor" in let mta = try Sys.getenv "OASIS_MTA" with Not_found -> "/usr/sbin/sendmail" in let fn = Filename.temp_file "oasis-announce-" ".txt" in try let () = let chn_out = open_out fn in output_string chn_out email; close_out chn_out in let edit_exit_code = Sys.command (Printf.sprintf "%s %s" (Filename.quote editor) (Filename.quote fn)) in let send_announcement = print_string "Send the announcement? (y/N) "; match read_line () with | "y" -> true | _ -> false in if send_announcement then begin let mta_exit_code = assert(edit_exit_code = 0); Sys.command (Printf.sprintf "%s -t < %s" (Filename.quote mta) (Filename.quote fn)) in assert(mta_exit_code = 0); print_endline "Announcement sent." end else begin print_endline "No announcement sent." end; Sys.remove fn with e -> Sys.remove fn; raise e oasis-0.4.11/src/tools/guess-cmx/0000755000175000017500000000000013261073606016103 5ustar gildorgildoroasis-0.4.11/src/tools/guess-cmx/GuessCMX.ml0000644000175000017500000001307213261073606020076 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Work in progress, only for testing purpose Try to guess file to install depending on archive (.cma) and published interface (.cmi) *) let warning msg = prerr_endline msg let error msg = prerr_endline msg; exit 1 let find_unit directory unit_name extensions = let unit_base_fn = [ unit_name; (OASISString.uncapitalize_ascii unit_name); ] in let unit_ext_fn = List.flatten (List.rev_map (fun unit_nm -> List.rev_map (fun ext -> unit_nm^"."^ext) extensions ) unit_base_fn ) in let unit_fn = List.rev_map (fun fn -> Filename.concat directory fn ) unit_ext_fn in let () = prerr_endline (String.concat " -> " unit_fn) in let unit_exist_fn = List.filter Sys.file_exists unit_fn in match unit_exist_fn with | fn :: _ -> fn | [] -> raise Not_found let cmx_of_cma cma = let dirname = Filename.dirname cma in let () = if not (Filename.check_suffix cma ".cma") then failwith (cma^" is not an OCaml library") in let unit_name = let reg = Pcre.regexp "Unit name: ([A-Z][A-Za-z0-9]*)" in fun line -> Pcre.get_substring (Pcre.exec ~rex:reg line) 1 in let unit_list = ref [] in let chn = Unix.open_process_in ("ocamlobjinfo "^cma) in let () = try while true do try unit_list := (unit_name (input_line chn)) :: !unit_list with Not_found -> () done with End_of_file -> () in let _ = Unix.close_process_in chn in let add_cmx acc unit_nm = try (find_unit dirname unit_nm ["cmx"]) :: acc with Not_found -> ( warning ("Could not find .cmx file for unit '"^unit_nm^"'"); acc ) in List.fold_left add_cmx [] !unit_list let install_lib ~directory ~archive ~interfaces = let mandatory_file fn = if not (Sys.file_exists fn) then error ("Could not find file '"^fn^"'"); fn in let fn_cma = mandatory_file (Filename.concat directory (archive^".cma")) in let fn_a = mandatory_file (Filename.concat directory (archive^".a")) in let fn_lst_cmi = List.rev_map (fun interf -> try find_unit directory interf ["cmi"] with Not_found -> error ("Could not find interface file for unit '"^interf^"'") ) interfaces in let fn_lst_mli = List.fold_left (fun acc interf -> try (find_unit directory interf ["mli"; "ml"; "mll"; "mly"]) :: acc with Not_found -> ( warning ("Could not find interface source file for unit '"^ interf^"'"); acc ) ) [] interfaces in let fn_lst_stubs = (* TODO *) List.flatten (List.rev_map (fun archive -> let fn_stubs_a = (* FIXME msvc: .lib .dll ? *) mandatory_file (Filename.concat directory ("lib"^archive^"_stubs.a")) in let fn_stubs_so = mandatory_file (Filename.concat directory ("dll"^archive^"_stubs.so")) in [fn_stubs_a; fn_stubs_so] ) [] ) in let fn_lst_native = let fn_cmxa = Filename.concat directory (archive^".cmxa") in if Sys.file_exists fn_cmxa then ( let fn_cmx = cmx_of_cma fn_cma in fn_cmxa :: fn_cmx ) else ( [] ) in List.flatten [ [fn_cma; fn_a]; fn_lst_cmi; fn_lst_mli; fn_lst_native; fn_lst_stubs; ] (* QUID: .o (.obj), .a (.lib), .so (.dll) *) let () = print_endline ("To install: "^ (String.concat ", " (install_lib ~directory:"." ~archive:"stlang" ~interfaces:["STLang"; "STLangTypes"]))) oasis-0.4.11/src/tools/dist/0000755000175000017500000000000013261073606015133 5ustar gildorgildoroasis-0.4.11/src/tools/dist/Dist.ml0000644000175000017500000001377013261073606016400 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2013, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISUtils open OASISTypes let () = let () = OASISBuiltinPlugins.init () in let debug_self = true in let exec nm = try FileUtil.which nm with Not_found -> failwithf "Executable '%s' not found." nm in let distdir = Filename.concat (Sys.getcwd ()) "dist" in let oasis_exec = let fn = FilePath.make_filename [(Sys.getcwd ()); "_build"; "src"; "cli"] in let native = Filename.concat fn "Main.native" in let byte = Filename.concat fn "Main.byte" in if Sys.file_exists native then native else byte in let git_exec = exec "git" in let tar_exec = exec "tar" in let dev = ref false in let () = (* Argument parsing. *) Arg.parse [ "-dev", Arg.Set dev, " Generate a dev tarball."; ] (failwithf "Don't know what to do with %S") "dist.ml: build tarball for oasis." in let ctxt = {!OASISContext.default with OASISContext.ignore_plugins = true} in let run = OASISExec.run ~ctxt in let with_tmpdir f = let res = Filename.temp_file "oasis-dist-" ".dir" in let pwd = Sys.getcwd () in let clean () = Sys.chdir pwd; FileUtil.rm ~recurse:true [res] in Sys.remove res; OASISFileUtil.mkdir ~ctxt res; try f res; clean () with e -> clean (); raise e in let pkg = OASISParse.from_file ~ctxt OASISParse.default_oasis_fn in let uncommited_changes = match OASISExec.run_read_output ~ctxt git_exec ["status"; "--porcelain"] with | [] -> false | _ -> true in let () = if not debug_self && uncommited_changes then failwith "Uncommited changes." in let ver_str = OASISVersion.string_of_version pkg.version in let () = (* Verify that the built oasis match the version in _oasis. *) let exec_ver_str = OASISExec.run_read_one_line ~ctxt oasis_exec ["version"] in if exec_ver_str <> ver_str then failwithf "Version reported by %s (%S) is different from version in _oasis (%S)" oasis_exec exec_ver_str ver_str in let tag = if !dev then "dev" else ver_str in let topdir = pkg.name^"-"^tag in let tarball = Filename.concat distdir (topdir^".tar.gz") in if not !dev then begin let existing_tags = OASISExec.run_read_output ~ctxt git_exec ["tag"] in let most_recent_tag = List.fold_left (fun r e -> if OASISVersion.StringVersion.compare r e < 0 then e else r) tag existing_tags in print_endline ("Most recent tag: "^most_recent_tag); if List.mem tag existing_tags then failwithf "Tag %s already exists." tag; if most_recent_tag <> tag then failwithf "Tag %S is more recent than the tag %S to apply." most_recent_tag tag end; (* Create the tarball. *) run git_exec ["archive"; "--prefix"; (Filename.concat topdir ""); "--format"; "tar.gz"; "HEAD"; "-o"; tarball]; with_tmpdir (fun dn -> (* Uncompress tarball in tmpdir *) run tar_exec ["xz"; "-C"; dn; "-f"; tarball]; (* Run OASIS setup inside the tarball and rebuild it. *) run oasis_exec ["-C"; Filename.concat dn topdir; "setup"]; run tar_exec ["-C"; dn; "-czf"; tarball; topdir]; Sys.chdir (Filename.concat dn topdir); if Sys.file_exists "setup.data" then failwith "Remaining 'setup.data' file."; if Sys.file_exists "configure" && not (FileUtil.test FileUtil.Is_exec "configure") then failwith "'configure' is not executable."; if not !dev then (* Check that build, test, doc run smoothly *) run "ocaml" ["setup.ml"; "-all"]; let bak_files = (* Check for remaining .bak files *) FileUtil.find (FileUtil.Has_extension "bak") Filename.current_dir_name (fun acc fn -> fn :: acc) [] in if bak_files <> [] then failwithf "Remaining .bak files: %s." (String.concat ", " bak_files)); if not !dev then begin run git_exec ["tag"; tag]; run ~f_exit_code: (fun i -> if i <> 0 then OASISMessage.warning ~ctxt "Cannot sign '%s' with gpg" tarball) "gpg" ["-s"; "-a"; "-b"; tarball] end ;; oasis-0.4.11/src/tools/ci/0000755000175000017500000000000013261073606014563 5ustar gildorgildoroasis-0.4.11/src/tools/ci/travis.bash0000644000175000017500000000333213261073606016733 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ OPAMROOT="$HOME/.opam" . $(dirname "$0")/build.bash oasis-0.4.11/src/tools/ci/packages.bash0000644000175000017500000000402113261073606017175 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ OPAM_PKGS=() OPAM_PKGS+=( "base-bytes") OPAM_PKGS+=( "base-unix" ) OPAM_PKGS+=( "ocamlfind>=1.3.1" ) OPAM_PKGS+=( "pcre" ) OPAM_PKGS+=( "expect>=0.0.4" ) OPAM_PKGS+=( "fileutils>=0.4.2" ) OPAM_PKGS+=( "ounit>=2.0.0" ) OPAM_PKGS+=( "ocamlify" ) OPAM_PKGS+=( "ocamlmod" ) OPAM_PKGS+=( "omake.0.9.8.6-0.rc1" ) OPAM_PKGS+=( "benchmark>=1.2" ) OPAM_PKGS+=( "camlp4" ) oasis-0.4.11/src/tools/ci/opam.bash0000644000175000017500000000364313261073606016364 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ export OPAMYES=1 OPAMROOT="${OPAMROOT:="$(pwd)/.opam"}" export OPAMROOT if [ -f "$OPAMROOT/config" ]; then opam update opam upgrade else opam init fi if [ -n "${OPAM_SWITCH}" ]; then opam switch ${OPAM_SWITCH} fi eval `opam config env` oasis-0.4.11/src/tools/ci/opam-build-revdeps.bash0000644000175000017500000000452713261073606021131 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ mkdir dist || true mkdir tmp || true . "$(dirname $0)/opam.bash" || exit 1 if [ "x${OPAM_BUILD_REVDEPS_UNSTABLE}" == "xyes" ] ; then opam pin add opam-build-revdeps \ 'git://github.com/gildor478/opam-build-revdeps.git#opam/unstable' else opam install opam-build-revdeps fi # TODO: un-exclude when upgrading to Debian Stretch # - maxminddb # - brotli # - zstd opam-build-revdeps compare --package oasis ${OPAM_BUILD_REVDEPS_ARGS} \ --exclude qfs \ --exclude maxminddb \ --exclude brotli \ --exclude zstd \ --ocaml_version 4.03.0 \ --version1 latest \ --version2 latest --pin2 "oasis:$(pwd)/sut" \ --html_output "dist/index.html" \ --css_output "dist/index.css" oasis-0.4.11/src/tools/ci/oasis2opam.bash0000644000175000017500000000545213261073606017505 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ if [ -z "$LOCAL" ] ; then . "$(dirname $0)/opam.bash" || exit 1 opam install oasis2opam oasis fi restore_oasis () { if [ -e _oasis.org ] ; then mv _oasis.org _oasis fi } if ! command -v oasis2opam > /dev/null ; then echo "E: oasis2opam must be installed to regenerate opam/* files." >&2 exit 1 fi # Merge with current master branch. restore_oasis cp _oasis _oasis.org VERSION="$(oasis -ignore-plugins query version)-$(date +'%Y-%m-%d')-${BUILD_NUMBER:-0}" NAME="$(oasis -ignore-plugins query name)" # Generate opam files. # TODO: remove when oasis2opam will support BugReports field/plugin feature. # sed -i "s/BugReports:/XBugReports:/" _oasis sed -i "s/AlphaFeatures:/XAlphaFeatures:/" _oasis sed -i "s/ImplementationPatterns+:/XImplementationPatterns+:/" _oasis sed -i "s/^Version:.*/Version: ${VERSION}/" _oasis oasis2opam --local -y # TODO: allow to define a branch for dev-repo directly in oasis2opam. sed -i 's,^\(dev-repo:.*oasis.git\),\1#opam/testing,' opam/opam # Commit changes. restore_oasis if [ -z "$LOCAL" ] ; then git add opam _oasis_remove_.ml "${NAME}.install" git commit -m "Setup OPAM pinning v${VERSION}." fi oasis-0.4.11/src/tools/ci/jenkins.bash0000644000175000017500000000404013261073606017061 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ DISTDIR="$(pwd)/dist" export OUNIT_OUTPUT_HTML_DIR="$DISTDIR/ounit-log-\$(suite_name).html" export OUNIT_OUTPUT_JUNIT_FILE="$DISTDIR/junit-\$(suite_name).xml" export OUNIT_OUTPUT_FILE="$DISTDIR/ounit-log-\$(suite_name)-\$(shard_id).txt" # Build and test. . $(dirname "$0")/build.bash || exit 1 # Create documentation package. make doc-dist # Create dev tarball. make dist-dev oasis-0.4.11/src/tools/ci/build.bash0000644000175000017500000000400013261073606016513 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ . "$(dirname $0)/packages.bash" || exit 1 . "$(dirname $0)/opam.bash" || exit 1 mkdir dist || true opam install "${OPAM_PKGS[@]}" export OCAMLRUNPARAM=b ocaml setup.ml -distclean ocaml setup.ml -configure \ --enable-tests \ --enable-devel \ --enable-omake-tests \ ${CONFIGURE_ARGS} ocaml setup.ml -build ocaml setup.ml -test ${TEST_ARGS} oasis-0.4.11/src/tools/bench/0000755000175000017500000000000013261073606015247 5ustar gildorgildoroasis-0.4.11/src/tools/bench/Bench.ml0000644000175000017500000000375613261073606016633 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = let () = OASISBuiltinPlugins.init () in let bench_one () = let _pkg: OASISTypes.package = OASISParse.from_file ~ctxt:!OASISContext.default OASISParse.default_oasis_fn in () in let l = Benchmark.latency1 2000L ~name:"OASISParse.from_file" bench_one () in Benchmark.tabulate l oasis-0.4.11/src/plugins/0000755000175000017500000000000013261073606014511 5ustar gildorgildoroasis-0.4.11/src/plugins/omake/0000755000175000017500000000000013261073606015605 5ustar gildorgildoroasis-0.4.11/src/plugins/omake/oasis_lib.om0000644000175000017500000011154413261073606020114 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2013, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # Function library for OASIS builds. scratchpad. = data_files = $(Map) ROOT = $(dir .) OASIS_empty_array[] = OASIS_empty_seq = if $(equal $(OSTYPE), Win32) OASIS_linefeed = $(unhexify 0d0a) export else OASIS_linefeed = $(unhexify 0a) export instflags = $(if $(VERBOSE), $(OASIS_empty_array), -s) if $(not $(defined CMXS_ENABLED)) CMXS_ENABLED = false export if $(not $(defined OCAMLMKLIB)) OCAMLMKLIB = ocamlmklib export if $(not $(defined OCAMLMKLIBFLAGS)) OCAMLMKLIBFLAGS = export if $(not $(defined OCAMLDOC)) OCAMLDOC = $(OCAMLFIND) ocamldoc export if $(not $(defined OCAMLDOCFLAGS)) OCAMLDOCFLAGS = export if $(not $(defined OCAMLDOCFLAGS_HTML)) OCAMLDOCFLAGS_HTML = export if $(not $(defined OCAMLDOCFLAGS_LATEX)) OCAMLDOCFLAGS_LATEX = export if $(not $(defined OCAML_LIB_CCLIB)) OCAML_LIB_CCLIB = export if $(not $(defined OCAML_LIB_DLLIB)) OCAML_LIB_DLLIB = export if $(not $(defined OCAML_LIB_DLLPATH)) OCAML_LIB_DLLPATH = export if $(not $(defined OCAML_LIB_MODULE_SUFFIXES)) OCAML_LIB_MODULE_SUFFIXES[] = .cmi export if $(not $(defined OCAML_LIB_MODULE_SUFFIXES_BYTE)) OCAML_LIB_MODULE_SUFFIXES_BYTE[] = export if $(not $(defined OCAML_LIB_MODULE_SUFFIXES_NATIVE)) OCAML_LIB_MODULE_SUFFIXES_NATIVE[] = export if $(not $(defined OCAML_LIB_OPTIONAL_MODULE_SUFFIXES)) OCAML_LIB_OPTIONAL_MODULE_SUFFIXES[] = .mli .cmt .cmti .annot export if $(not $(defined OCAML_LIB_OPTIONAL_MODULE_SUFFIXES_BYTE)) OCAML_LIB_OPTIONAL_MODULE_SUFFIXES_BYTE[] = export if $(not $(defined OCAML_LIB_OPTIONAL_MODULE_SUFFIXES_NATIVE)) OCAML_LIB_OPTIONAL_MODULE_SUFFIXES_NATIVE[] = .cmx export if $(not $(defined OCAML_LIB_LIBRARY_SUFFIXES)) OCAML_LIB_LIBRARY_SUFFIXES[] = export if $(not $(defined OCAML_LIB_LIBRARY_SUFFIXES_BYTE)) OCAML_LIB_LIBRARY_SUFFIXES_BYTE[] = .cma export if $(not $(defined OCAML_LIB_LIBRARY_SUFFIXES_NATIVE)) private.cmxs = $`(if $(CMXS_ENABLED), $(array .cmxs), $(array)) OCAML_LIB_LIBRARY_SUFFIXES_NATIVE[] = .cmxa $(EXT_LIB) $(cmxs) export if $(not $(defined OCAML_LINK_CCLIB)) OCAML_LINK_CCLIB = export if $(not $(defined OCAML_LINK_DLLIB)) OCAML_LINK_DLLIB = export if $(not $(defined OCAML_LINK_DLLPATH)) OCAML_LINK_DLLPATH = export if $(not $(defined OCAMLFINDFLAGS_INSTALL)) OCAMLFINDFLAGS_INSTALL = export if $(not $(defined OCAMLFINDFLAGS_REMOVE)) OCAMLFINDFLAGS_REMOVE = export OASIS_clean_list[] = *.cmi *.cmt *.cmti *.cmo *.cma *.cmx *.annot *$(EXT_OBJ) *.cmxa *$(EXT_LIB) *.so *.cmxs *.libodoc *.odoc OASIS_rec_clean_list[] = *.doc/html *.doc/latex OASIS_dir_clean_list[] = *.doc OASIS_distclean_list[] = $(OASIS_clean_list) *.omc setup.data setup.log setup.log.om _oasis_setup.om OASIS_rec_distclean_list[] = $(OASIS_rec_clean_list) OASIS_dir_distclean_list[] = $(OASIS_dir_clean_list) OASIS_rmdir(dirs) = private.expdirs = $(glob iD, $(dirs)) foreach(dir => ...,$(expdirs)) if $(test -d $(dir)) Shell.rmdir(-f -- $(dir)) OASIS_scratchpad = $(ROOT)/setup.log.om .INCLUDE: $(OASIS_scratchpad) section private.f = $(fopen $(OASIS_scratchpad), wa) close($(f)) OASIS_scratchpad_append_new_data_files(key, files) = private.f = $(fopen $(OASIS_scratchpad), wa) fprintln($(f), $"section") fprintln($(f), $" private.key = $(string-escaped $(key))") fprintln($(f), $' private.files = $(OASIS_empty_array)') fprintln($(f), $' if $(scratchpad.data_files.mem $(key))') fprintln($(f), $' files = $(scratchpad.data_files.find $(key))') fprintln($(f), $' export files') foreach(file => ..., $(files)) fprintln($(f), $" files += $(string-escaped $(file))") fprintln($(f), $' scratchpad.data_files = $(scratchpad.data_files.add $(key), $(files))') fprintln($(f), $' export') close($(f)) Shell.rm(-f $(OASIS_scratchpad)c) OASIS_scratchpad_append_del_data_files(key) = private.f = $(fopen $(OASIS_scratchpad), wa) fprintln($(f), $"section") fprintln($(f), $" private.key = $(string-escaped $(key))") fprintln($(f), $' scratchpad.data_files = $(scratchpad.data_files.remove $(key))') fprintln($(f), $' export') close($(f)) Shell.rm(-f $(OASIS_scratchpad)c) OASIS_destdir(path) = if $(defined DESTDIR) return $(absname $(dir $(DESTDIR)/$(path))) if $(defined oasis_destdir) return $(absname $(dir $(oasis_destdir)/$(path))) else return $(absname $(dir $(path))) # OASIS also interprets the environment variable "destdir" when data files # are installed. IMHO this is really strange, but we simply duplicate the # behavior here. OASIS_data_destdir(path) = if $(defined-env destdir) return $(absname $(dir $(getenv destdir)/$(path))) value $(OASIS_destdir $(path)) # OASIS_getvar(v) gets the contents of the (array) variable named v, or # the empty array if it is not defined. If the variable NAME is defined # in the context where this function is called, it is first looked at # the variable v_$(NAME), and this variable is taken instead. OASIS_getvar(name) = declare private.v if $(and $(defined NAME) $(defined $(name)_$(NAME))) v = $(getvar $(name)_$(NAME)) export v else if $(defined $(name)) v = $(getvar $(name)) export v else v = $(OASIS_empty_array) export v export v value $(apply $(v)) OASIS_getvar_for(NAME, name) = declare private.v if $(defined $(name)_$(NAME)) v = $(getvar $(name)_$(NAME)) export v else if $(defined $(name)) v = $(getvar $(name)) export v else v = $(OASIS_empty_array) export v export v value $(apply $(v)) OASIS_run(list) = run_it(f) = value $(f) foreach($(run_it), $(list)) OASIS_modify_OCAMLINCLUDES(module, flags) = OCAMLINCLUDES += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_OCAMLPACKS(module, flags) = OCAMLPACKS += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_OCAMLFLAGS(module, flags) = OCAMLFLAGS += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_OCAMLCFLAGS(module, flags) = OCAMLCFLAGS += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_OCAMLOPTFLAGS(module, flags) = OCAMLOPTFLAGS += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_OCAMLFINDFLAGS(module, flags) = OCAMLFINDFLAGS += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_OCAMLLEXFLAGS(module, flags) = OCAMLLEXFLAGS += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_OCAMLYACCFLAGS(module, flags) = OCAMLYACCFLAGS += $(flags) $(module).cmi: $(module).cmo: $(module).cmx $(module)$(EXT_OBJ): OASIS_modify_CFLAGS(module, flags) = CFLAGS += $(flags) $(module)$(EXT_OBJ): OASIS_target_OCamlLibrary(name) = value $(array $(if $(NATIVE_ENABLED), $(array $(name).cmxa, $(name)$(EXT_LIB))), $(if $(and $(NATIVE_ENABLED), $(CMXS_ENABLED)), $(name).cmxs), $(if $(BYTE_ENABLED), $(name).cma)) # Extensions compared to OCamlLibrary: # - OCAML_LIBS and OCAML_CLIBS are now dependencies # - creates the cmxs if CMXS_ENABLED # - ignores OCAMLPACKS (no relinking of packages) # - can link in c_objects OASIS_build_OCamlLibrary(name,modules,c_objects) = private.name = $(file $(name)) private.OFILES = $(addsuffix $(EXT_OBJ), $(modules)) private.CMOFILES = $(addsuffix .cmo, $(modules)) private.CMXFILES = $(addsuffix .cmx, $(modules)) private.CLIB = $(file $(name)$(EXT_LIB)) private.BYTELIB = $(file $(name).cma) private.NATIVELIB = $(file $(name).cmxa) private.LIBNAME = $(file $(name)) private.CMXSFILE = $(file $(name).cmxs) private.C_OBJECTS = $(file $(c_objects)) private.STUBS = $(LIBNAME)_stubs private.LIBSTUBS = lib$(LIBNAME)_stubs$(EXT_LIB) private.BYTEDEPS = $(addsuffix .cma, $(OCAML_LIBS)) private.NATIVEDEPS = $(addsuffix .cmxa, $(OCAML_LIBS)) private.CLIBDEPS = $(addsuffix $(EXT_LIB), $(OCAML_LIBS)) private.LIBODOCFILE = $(file $(name).libodoc) private.ODOCFILES = $(addsuffix .odoc, $(modules)) # # Link commands # if $(gt $(length $(C_OBJECTS)), 0) private.flags = private.byteflags = private.natflags = if $(gt $(length $(OCAML_LIB_FLAGS)), 0) flags = -ccopt $(quote $(OCAML_LIB_FLAGS)) export flags if $(gt $(length $(OCAMLCFLAGS)), 0) byteflags = -ccopt $(quote $(OCAMLCFLAGS)) export byteflags if $(gt $(length $(OCAMLOPTFLAGS)), 0) natflags = -ccopt $(quote $(OCAMLOPTFLAGS)) export natflags if $(gt $(length $(OCAML_LIB_DLLIB)), 0) byteflags = -cclib $(quote $(mapprefix -dllib, $(OCAML_LIB_DLLIB))) export byteflags if $(gt $(length $(OCAML_LIB_DLLPATH)), 0) byteflags = -dllpath $(OCAML_LIB_DLLPATH) export byteflags if $(and $(BYTE_ENABLED), $(NATIVE_ENABLED)) $(BYTELIB) $(NATIVELIB) $(CLIB) $(LIBSTUBS): $(CMOFILES) $(CMXFILES) $(OFILES) $(C_OBJECTS) $(BYTEDEPS) $(NATIVEDEPS) $(OCAMLMKLIB) \ $(OCAML_LIB_CCLIB) $(flags) $(byteflags) \ -ocamlc "$(OCAMLC)" \ -o $(LIBNAME) -oc $(STUBS) \ $(OCamlLinkSort $(CMOFILES)) $(C_OBJECTS) $(OCAMLMKLIB) \ $(OCAML_LIB_CCLIB) $(flags) $(natflags) \ -ocamlopt "$(OCAMLOPT)" \ -o $(LIBNAME) -oc $(STUBS) \ $(OCamlLinkSort $(CMXFILES)) $(C_OBJECTS) else $(BYTELIB) $(LIBSTUBS): $(CMOFILES) $(C_OBJECTS) $(BYTEDEPS) $(OCAMLMKLIB) \ $(OCAML_LIB_CCLIB) $(flags) $(byteflags) \ -ocamlc "$(OCAMLC)" \ -o $(LIBNAME) -oc $(STUBS) \ $(OCamlLinkSort $(CMOFILES)) $(C_OBJECTS) $(NATIVELIB) $(CLIB) $(LIBSTUBS): $(CMXFILES) $(OFILES) $(C_OBJECTS) $(NATIVEDEPS) $(CLIBDEPS) $(OCAMLMKLIB) \ $(OCAML_LIB_CCLIB) $(flags) $(natflags) \ -ocamlopt "$(OCAMLOPT)" \ -o $(LIBNAME) -oc $(STUBS) \ $(OCamlLinkSort $(CMXFILES)) $(C_OBJECTS) else private.flags = private.byteflags = if $(gt $(length $(OCAML_LIB_CCLIB)), 0) flags += -cclib $(quote $(OCAML_LIB_CCLIB)) export flags if $(gt $(length $(OCAML_LIB_DLLIB)), 0) byteflags += -dllib $(quote $(OCAML_LIB_DLLIB)) export byteflags if $(gt $(length $(OCAML_LIB_DLLPATH)), 0) byteflags += -dllpath $(quote $(OCAML_LIB_DLLPATH)) export byteflags $(BYTELIB): $(CMOFILES) $(BYTEDEPS) $(OCAMLLINK) -a \ -o $(BYTELIB) $(OCAMLCFLAGS) \ $(flags) $(OCAML_LIB_FLAGS) \ $(OCamlLinkSort $(CMOFILES)) $(NATIVELIB) $(CLIB): $(CMXFILES) $(OFILES) $(NATIVEDEPS) $(CLIBDEPS) $(OCAMLOPTLINK) -a \ -o $(NATIVELIB) $(OCAMLOPTFLAGS) \ $(flags) $(OCAML_LIB_FLAGS) \ $(OCamlLinkSort $(CMXFILES)) $(CMXSFILE): $(NATIVELIB) $(CLIB) $(OCAMLOPTLINK) -shared -cclib -L. -o $(CMXSFILE) $(NATIVELIB) $(LIBODOCFILE): $(ODOCFILES) section f = $(fopen $(LIBODOCFILE), w) foreach(file => ..., $(ODOCFILES)) fprintln($(f), $(file)) close($(f)) return $(array $(if $(NATIVE_ENABLED), $(NATIVELIB)), $(if $(NATIVE_ENABLED), $(CLIB)), $(if $(and $(NATIVE_ENABLED), $(CMXS_ENABLED)), $(CMXSFILE)), $(if $(BYTE_ENABLED), $(BYTELIB))) OASIS_build_OCamlPack(name,modules) = OCamlPackage($(name), $(modules)) %.odoc: %.ml $(OCAMLDOC) $(OCAMLDOCFLAGS) -dump $@ \ $(PREFIXED_OCAMLPACKS) $(PREFIXED_OCAMLINCLUDES) \ $< %.odoc: %.mli $(OCAMLDOC) $(OCAMLDOCFLAGS) -dump $@ \ $(PREFIXED_OCAMLPACKS) $(PREFIXED_OCAMLINCLUDES) \ $< private.lines(filenames) = private.data = $(cat $(filenames)) return $(split $(OASIS_linefeed), $(data)) # WORKAROUND: l1 cannot be private for omake-0.9.8.6 private.rebased_lines(filenames) = l1[] = foreach(n => ..., $(filenames)) private.l2 = $(lines $(n)) l1 += $(addprefix $(dirname $(n))/, $(l2)) export l1 value $(l1) OASIS_target_OCamlDoc(name,format) = switch $(format) case pdf return $"$(name).doc/latex/$(name).pdf" case ps return $"$(name).doc/latex/$(name).ps" case dvi return $"$(name).doc/latex/$(name).dvi" default return $"$(name).doc/$(format)" OASIS_build_OCamlDoc(name,modules,texts) = private.LIBODOCS = $(addsuffix .libodoc, $(OCAML_LIBS)) private.ODOCS = $(addsuffix .odoc, $(modules)) private.odocdeps = $(ODOCS) private.otherdeps = $(addsuffix .txt, $(texts)) private.texexts = .dvi .pdf .ps if $(not $(defined TITLE)) TITLE = $(name) export if $(not $(defined INTRO)) INTRO = $(OASIS_empty_array) export Shell.mkdir(-p $(name).doc/html) Shell.mkdir(-p $(name).doc/latex) .SCANNER: $(name).doc/html/index.html: $(LIBODOCS) section deps = $(rebased_lines $(LIBODOCS)) foreach(dep => ...,$(deps)) println($"$(name).doc/html/index.html: $(dep)") $(name).doc/html $(name).doc/html/index.html: $(odocdeps) $(otherdeps) rm -f $(name).doc/html/* $(OCAMLDOC) $(OCAMLDOCFLAGS) -html $(OCAMLDOCFLAGS_HTML) \ $(mapprefix -load, $(set $(array $(odocdeps), $(rebased_lines $(LIBODOCS))))) \ $(otherdeps) \ -d $(name).doc/html/ \ -t $(TITLE) $(mapprefix -intro, $(addsuffix .txt, $(INTRO))) .SCANNER: $(name).doc/latex/$(name).tex: $(LIBODOCS) section deps = $(rebased_lines $(LIBODOCS)) foreach(dep => ...,$(deps)) println($"$(name).doc/latex/$(name).tex: $(dep)") $(name).doc/latex $(name).doc/latex/$(name).tex: $(odocdeps) $(otherdeps) rm -f $(name).doc/latex/* $(OCAMLDOC) $(OCAMLDOCFLAGS) -latex $(OCAMLDOCFLAGS_LATEX) \ $(mapprefix -load, $(set $(array $(odocdeps), $(rebased_lines $(LIBODOCS))))) \ -o $(name).doc/latex/$(name).tex \ -t $(TITLE) $(mapprefix -intro, $(INTRO)) .SUBDIRS: $(name).doc/latex LaTeXDocument($(name), $(name)) # Inverse of basename/dirname: e.g. # $(OASIS_concat x y z, 1 2 3) yields x/1 y/2 z/3 OASIS_concat2(seq1, seq2) = if $(eq $(seq1.length), 0) return $(OASIS_empty_seq) else private.h1 = $(seq1.nth 0) private.h2 = $(seq2.nth 0) private.r = $(h1)$(DIRSEP)$(h2) return $(r) $(OASIS_concat2 $(seq1.nth-tl 1), $(seq2.nth-tl 1)) # A version of set-diff that ignores the case of the first letter # of the basename OASIS_set_diff(set1, set2) = private.dir2 = $(dirname $(set2)) private.base2 = $(basename $(set2)) private.base2_lc = $(uncapitalize $(base2)) private.base2_uc = $(capitalize $(base2)) private.set2_lc = $(OASIS_concat2 $(dir2), $(base2_lc)) private.set2_uc = $(OASIS_concat2 $(dir2), $(base2_uc)) private.set2_all = $(set2) $(set2_lc) $(set2_uc) return $(set-diff $(set1), $(set2_all)) OASIS_target_OCamlExecutable(name) = value $(name) # The difference to OCamlProgram is that OASIS_build_OCamlExecutable figures # the modules of the program automatically out. You just need to pass in the # name of the main module. # Also: # - can link in c_objects OASIS_build_OCamlExecutable(name,mainmodule,c_objects) = private.get_byte_deps(cmofile, cmafiles) = private.all_cmodeps = $(dependencies-all $(cmofile)) private.cmi_cmodeps = $(filter %.cmi, $(all_cmodeps)) private.cmo_cmodeps = $(replacesuffixes .cmi, .cmo, $(cmi_cmodeps)) private.all_cmadeps = $(dependencies-all $(cmafiles)) private.cmo_cmadeps = $(filter %.cmo, $(all_cmadeps)) value $(set $(OASIS_set_diff $(cmo_cmodeps), $(cmo_cmadeps))) private.get_native_deps(cmxfile, cmxafiles) = private.all_cmxdeps = $(dependencies-all $(cmxfile)) private.cmi_cmxdeps = $(filter %.cmi, $(all_cmxdeps)) private.cmx_cmxdeps = $(replacesuffixes .cmi, .cmx, $(cmi_cmxdeps)) private.all_cmxadeps = $(dependencies-all $(cmxafiles)) private.cmx_cmxadeps = $(filter %.cmx, $(all_cmxadeps)) value $(set $(OASIS_set_diff $(cmx_cmxdeps), $(cmx_cmxadeps))) private.CMOFILE = $(addsuffix .cmo, $(mainmodule)) private.CMXFILE = $(addsuffix .cmx, $(mainmodule)) private.OFILE = $(addsuffix $(EXT_OBJ), $(mainmodule)) private.CMAFILES = $(addsuffix .cma, $(OCAML_LIBS)) private.CMXAFILES = $(addsuffix .cmxa, $(OCAML_LIBS)) private.ARFILES = $(addsuffix $(EXT_LIB), $(OCAML_LIBS)) private.CMA_OTHER_FILES = $(addsuffix .cma, $(OCAML_OTHER_LIBS)) private.CMXA_OTHER_FILES = $(addsuffix .cmxa, $(OCAML_OTHER_LIBS)) private.CLIBS = $(addsuffix $(EXT_LIB), $(OCAML_CLIBS)) private.C_OBJECTS = $(file $(c_objects)) private.name = $(file $(name)) private.PROG = $(file $(name)$(EXE)) private.BYTEPROG = $(file $(name).run) private.OPTPROG = $(file $(name).opt) private.flags = private.byteflags = if $(gt $(length $(OCAML_LINK_CCLIB)), 0) flags += -cclib $(OCAML_LINK_CCLIB) export flags if $(gt $(length $(OCAML_LINK_DLLIB)), 0) byteflags += -dllib $(OCAML_LINK_DLLIB) export byteflags if $(gt $(length $(OCAML_LINK_DLLPATH)), 0) byteflags += -dllpath $(OCAML_LINK_DLLPATH) export byteflags # # Rules to build byte-code and native targets # $(BYTEPROG): $(CMAFILES) $(CMOFILE) $(CLIBS) $(C_OBJECTS) $(OCAMLFIND) $(OCAMLLINK) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) $(OCAMLCFLAGS)\ $(PREFIXED_OCAMLINCLUDES) $(OCAML_BYTE_LINK_FLAGS) \ $(byteflags) $(flags) \ -o $@ $(CMA_OTHER_FILES) $(CMAFILES) \ $(OCamlLinkSort $(get_byte_deps $(CMOFILE), $(CMAFILES)) $(CMOFILE)) \ $(C_OBJECTS) $(CLIBS) $(OCAML_LINK_FLAGS) $(OPTPROG): $(CMXAFILES) $(ARFILES) $(CMXFILE) $(OFILE) $(CLIBS) $(C_OBJECTS) $(OCAMLFIND) $(OCAMLOPTLINK) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) $(OCAMLOPTFLAGS)\ $(PREFIXED_OCAMLINCLUDES) $(OCAML_NATIVE_LINK_FLAGS)\ $(flags) \ -o $@ $(CMXA_OTHER_FILES) $(CMXAFILES) \ $(OCamlLinkSort $(get_native_deps $(CMXFILE), $(CMXAFILES)) $(CMXFILE)) \ $(C_OBJECTS) $(CLIBS) $(OCAML_LINK_FLAGS) # # Link the actual executables. # Always prefer native executables. # if $(NATIVE_ENABLED) $(PROG): $(OPTPROG) ln-or-cp $< $@ elseif $(BYTE_ENABLED) $(PROG): $(BYTEPROG) ln-or-cp $< $@ else err. = extends $(UnbuildableException) message = $(string $"Cannot build $(PROG) because neither bytecode nor native code is enabled") raise($(err)) return $(array $(PROG), $(if $(NATIVE_ENABLED), $(OPTPROG)), $(if $(BYTE_ENABLED), $(BYTEPROG))) # install things OASIS_installtarget_OCamlLibrary(name) = value $".PHONY/install-lib-$(name)" OASIS_uninstalltarget_OCamlLibrary(name) = value $".PHONY/uninstall-lib-$(name)" OASIS_reinstalltarget_OCamlLibrary(name) = value $".PHONY/reinstall-lib-$(name)" OASIS_installtarget_Executable(name) = value $".PHONY/install-exec-$(name)" OASIS_uninstalltarget_Executable(name) = value $".PHONY/uninstall-exec-$(name)" OASIS_reinstalltarget_Executable(name) = value $".PHONY/reinstall-exec-$(name)" OASIS_installtarget_Document(name) = value $".PHONY/install-doc-$(name)" OASIS_uninstalltarget_Document(name) = value $".PHONY/uninstall-doc-$(name)" OASIS_reinstalltarget_Document(name) = value $".PHONY/reinstall-doc-$(name)" OASIS_expand_module_files_OCamlLibrary(modules) = value $(array \ $(addsuffixes $(OCAML_LIB_MODULE_SUFFIXES), $(modules)), \ $(if $(BYTE_ENABLED), $(addsuffixes $(OCAML_LIB_MODULE_SUFFIXES_BYTE), $(modules))), \ $(if $(NATIVE_ENABLED), $(addsuffixes $(OCAML_LIB_MODULE_SUFFIXES_NATIVE), $(modules)))) OASIS_expand_optional_module_files_OCamlLibrary(modules) = value $(array \ $(addsuffixes $(OCAML_LIB_OPTIONAL_MODULE_SUFFIXES), $(modules)), \ $(if $(BYTE_ENABLED), $(addsuffixes $(OCAML_LIB_OPTIONAL_MODULE_SUFFIXES_BYTE), $(modules))), \ $(if $(NATIVE_ENABLED), $(addsuffixes $(OCAML_LIB_OPTIONAL_MODULE_SUFFIXES_NATIVE), $(modules)))) OASIS_expand_library_files_OCamlLibrary(name) = value $(array \ $(addsuffixes $(OCAML_LIB_LIBRARY_SUFFIXES), $(name)), \ $(if $(BYTE_ENABLED), $(addsuffixes $(OCAML_LIB_LIBRARY_SUFFIXES_BYTE), $(name))), \ $(if $(NATIVE_ENABLED), $(addsuffixes $(OCAML_LIB_LIBRARY_SUFFIXES_NATIVE), $(name)))) OASIS_expand_optional_library_files_OCamlLibrary(name) = private.files[] = lib$(name)_stubs$(EXT_LIB) dll$(name)_stubs$(EXT_DLL) value $(files) private.install_OCamlLibrary(flname, add_to, files, opt_files) = private.args = $(if $(equal $(flname), $(add_to)), $(OASIS_empty_array), -add) private.destdir = $(shell $(OCAMLFIND) printconf destdir) if $(not $(defined OCAMLFIND_DESTDIR)) destdir = $(OASIS_destdir $(destdir)) Shell.mkdir(-p $(destdir)) export destdir $(OCAMLFIND) \ install -destdir $(destdir) $(OCAMLFINDFLAGS_INSTALL) \ $(add_to) $(args) $(files) -optional $(opt_files) private.uninstall_OCamlLibrary(flname) = private.destdir = $(shell $(OCAMLFIND) printconf destdir) if $(not $(defined OCAMLFIND_DESTDIR)) destdir = $(OASIS_destdir $(destdir)) export destdir $(OCAMLFIND) \ remove -destdir $(destdir) $(OCAMLFINDFLAGS_REMOVE) $(flname) # note that add_to may be prefixed by a path! e.g. ../../dir/findlibname.subpkg OASIS_install_OCamlLibrary(name, flname, add_to, files, opt_files) = OMakeFlags($(instflags)) private.dep = $(if $(equal $(flname), $(add_to)), $(OASIS_empty_array), .PHONY/$(dirname $(add_to))/install-findlib-$(basename $(add_to))) .PHONY/install-lib-$(name): .PHONY/install-findlib-$(flname) .PHONY/install-findlib-$(flname): $(dep) pre-install-here install_OCamlLibrary($(flname), $(basename $(add_to)), $(files), $(opt_files)) private.install_data(tag, src, dest) = private.d = $(OASIS_data_destdir $(dest)) Shell.mkdir(-p $(d)) private.files = $(glob iF, $(src)) foreach (file => ..., $(files)) Shell.cp($(file) $(d)/.) println($"Installed $(d)/$(basename $(file))") OASIS_scratchpad_append_new_data_files($(tag), $(addprefix $(d)/, $(basename $(files)))) private.uninstall_data(tag) = private.files = $(OASIS_empty_array) if $(scratchpad.data_files.mem $(tag)) files = $(scratchpad.data_files.find $(tag)) export files foreach(file => ..., $(files)) Shell.rm(-f $(file)) println($"Removed $(file)") OASIS_scratchpad_append_del_data_files($(tag)) OASIS_uninstall_OCamlLibrary(name, flname, add_to) = OMakeFlags($(instflags)) .PHONY/uninstall-lib-$(name): .PHONY/uninstall-findlib-$(flname) if $(equal $(flname), $(add_to)) .PHONY/uninstall-findlib-$(flname): uninstall_OCamlLibrary($(flname)) else .PHONY/uninstall-findlib-$(flname): .PHONY/$(dirname $(add_to))/uninstall-findlib-$(basename $(add_to)) OASIS_reinstall_OCamlLibrary(name, flname, add_to, files, opt_files) = OMakeFlags($(instflags)) .PHONY/reinstall-lib-$(name): .PHONY/reinstall-findlib-$(flname) if $(equal $(flname), $(add_to)) .PHONY/reinstall-findlib-$(flname): .PHONY/uninstall-lib-$(name) install_OCamlLibrary($(flname), $(add_to), $(files), $(opt_files)) else .PHONY/reinstall-findlib-$(flname): .PHONY/$(dirname $(add_to))/reinstall-findlib-$(basename $(add_to)) install_OCamlLibrary($(flname), $(basename $(add_to)), $(files), $(opt_files)) OASIS_install_data_OCamlLibrary(name, src, dest) = OMakeFlags($(instflags)) .PHONY/install-lib-$(name): install_data($"lib-$(name)", $(src), $(dest)) OASIS_uninstall_data_OCamlLibrary(name) = OMakeFlags($(instflags)) .PHONY/uninstall-lib-$(name): uninstall_data($"lib-$(name)") OASIS_reinstall_data_OCamlLibrary(name, src, dest) = OMakeFlags($(instflags)) .PHONY/reinstall-lib-$(name): install_data($"lib-$(name)", $(src), $(dest)) OASIS_expand_file_Executable(name) = if $(NATIVE_ENABLED) return $(name).opt elseif $(BYTE_ENABLED) return $(name).run else return $(name) private.install_Executable(name,src) = private.d = $(OASIS_data_destdir $(oasis_bindir)) private.f = $(d)/$(basename $(name)) Shell.mkdir(-p $(d)) if $(test -d $(f)) err. = extends $(Exception) message = $"Is a directory: $(f)" raise($(err)) Shell.cp($(src) $(f)) println($"Installed $(f)") private.uninstall_Executable(name) = private.d = $(OASIS_data_destdir $(oasis_bindir)) if $(file-exists $(d)/$(basename $(name))) Shell.rm(-f $(d)/$(basename $(name))) println($"Removed $(d)/$(basename $(name))") OASIS_install_Executable(name,src) = OMakeFlags($(instflags)) .PHONY/install-exec-$(name): pre-install-here install_Executable($(name), $(src)) OASIS_uninstall_Executable(name) = OMakeFlags($(instflags)) .PHONY/uninstall-exec-$(name): uninstall_Executable($(name)) OASIS_reinstall_Executable(name,src) = OMakeFlags($(instflags)) .PHONY/reinstall-exec-$(name): .PHONY/uninstall-exec-$(name) install_Executable($(name), $(src)) OASIS_install_data_Executable(name, src, dest) = OMakeFlags($(instflags)) .PHONY/install-exec-$(name): install_data($"exec-$(name)", $(src), $(dest)) OASIS_uninstall_data_Executable(name) = OMakeFlags($(instflags)) .PHONY/uninstall-exec-$(name): uninstall_data($"exec-$(name)") OASIS_reinstall_data_Executable(name, src, dest) = OMakeFlags($(instflags)) .PHONY/reinstall-exec-$(name): install_data($"exec-$(name)", $(src), $(dest)) OASIS_expand_files_Document(name, format) = switch $(format) case dvi return $"$(name).doc/latex/$(name).dvi" case pdf return $"$(name).doc/latex/$(name).pdf" case ps return $"$(name).doc/latex/$(name).ps" default return $(glob iF, $(name).doc/$(format)/*) private.install_Document(name, src, dest) = install_data($"doc-$(name)", $(src), $(dest)) private.uninstall_Document(name) = uninstall_data($"doc-$(name)") OASIS_install_Document(name, src, dest) = OMakeFlags($(instflags)) .PHONY/install-doc-$(name): pre-install-here install_Document($(name), $(src), $(dest)) OASIS_uninstall_Document(name) = OMakeFlags($(instflags)) .PHONY/uninstall-doc-$(name): uninstall_Document($(name)) OASIS_reinstall_Document(name, src, dest) = OMakeFlags($(instflags)) .PHONY/reinstall-doc-$(name): .PHONY/uninstall-doc-$(name) install_Document($(name), $(src), $(dest)) OASIS_install_data_Document(name, src, dest) = OMakeFlags($(instflags)) .PHONY/install-doc-$(name): install_data($"doc-$(name)", $(src), $(dest)) OASIS_uninstall_data_Document(name) = # no action needed OASIS_reinstall_data_Document(name, src, dest) = OMakeFlags($(instflags)) .PHONY/reinstall-doc-$(name): install_data($"doc-$(name)", $(src), $(dest)) # Reading in setup.data private.to_hex_digit(n) = if $(eq $(n), 10) return a elseif $(eq $(n), 11) return b elseif $(eq $(n), 12) return c elseif $(eq $(n), 13) return d elseif $(eq $(n), 14) return e elseif $(eq $(n), 15) return f else return $(string $(n)) private.char(code) = d1 = $(div $(code) 16) d2 = $(mod $(code) 16) return $(unhexify $(string $(to_hex_digit $(d1))$(to_hex_digit $(d2)))) private.string_lexer() = lexer. = extends $(Lexer) declare lex declare rule buffer[] = other: . buffer[] += $0 lex() eof: $"\'" err. = extends $(Exception) message = $"Unterminated string, location: $(string-of-location $(parse-loc))" raise $(err) chars: $'[^\\"]+' buffer[] += $0 lex() string-end: $'"' Token.pair(string, $(concat $(string), $(buffer))) esc1: $'\\\\' buffer[] += \\ lex() esc2: $"\\'" buffer[] += \' lex() esc3: $'\\"' buffer[] += \" lex() esc4: $'\\n' buffer[] += $(unhexify 0a) lex() esc5: $'\\t' buffer[] += $(unhexify 09) lex() esc6: $'\\b' buffer[] += $(unhexify 07) lex() esc7: $'\\r' buffer[] += $(unhexify 0d) lex() esc8: $'\\ ' buffer[] += \ lex() esc9: $'\\\([0-7]\)\([0-7]\)\([0-7]\)' # Work around an omake-0.9.8.6 bug if $(defined 4) d1 = $2 d2 = $3 d3 = $4 export d1 d2 d3 else d1 = $1 d2 = $2 d3 = $3 export d1 d2 d3 code = $(add $(add $(mul $(int $(d1)) 64) $(mul $(int $(d2)) 8)) $(int $(d3))) buffer[] += $(char $(code)) lex() esc10: $'\\x\([0-9a-fA-F][0-9a-fA-F]\)' buffer[] += $(unhexify $1) lex() newline: $'(\n|\r\n)' buffer[] += $(unhexify 0a) lex() return $(lexer) private.main_lexer() = lexer. = extends $(Lexer) declare lex declare rule other: . err. = extends $(Exception) message = $"Lexing error, location: $(string-of-location $(parse-loc))" raise $(err) white: $'[ \r\n\t]+' lex() ident: $"[a-zA-Z0-9_']+" Token.pair(ident, $0) equal: = Token.unit(equal) string: $'"' slexer = $(string_lexer) slexer.lex-channel($(channel)) eof: $"\'" Token.unit(eof) return $(lexer) param_lexer() = private.dollar = \$ lexer. = extends $(Lexer) declare lex declare rule buffer[] = other: . err. = extends $(Exception) message = $"Lexing error, location: $(string-of-location $(parse-loc))" raise $(err) dollar1: $"\$(dollar)\([a-zA-Z0-9_]+\)" declare private.ident declare private.varname # omake-0.9.8.6 bug if $(defined 4) ident = $4 export ident else ident = $1 export ident varname = $"oasis_$(ident)" buffer += $"$(dollar)(apply $(dollar)(getvar $(string-escaped $(varname))))" lex() dollar2: $"\$(dollar)[(]\([^)]+\)[)]" declare private.ident declare private.varname # omake-0.9.8.6 bug if $(defined 3) ident = $3 export ident else ident = $1 export ident varname = $"oasis_$(ident)" buffer += $"$(dollar)(apply $(dollar)(getvar $(string-escaped $(varname))))" lex() dollar3: $"\$(dollar)[{]\([^)]+\)[}]" declare private.ident declare private.varname # omake-0.9.8.6 bug if $(defined 2) ident = $2 export ident else ident = $1 export ident varname = $"oasis_$(ident)" buffer += $"$(dollar)(apply $(dollar)(getvar $(string-escaped $(varname))))" lex() esc: $"\\\(.\)" declare private.data data = $1 buffer += $(string-escaped $(data)) lex() regular: $"[^\\$(dollar)]+" declare private.data data = $0 buffer += $(string-escaped $(data)) lex() eof: $"\'" value $(concat $(string), $(buffer)) private.parse_error(loc) = err. = extends $(Exception) message = $"Parse error, location: $(string-of-location $(loc))" value $(err) OASIS_convert_env(inchannel,outchannel) = private.lexer = $(main_lexer) # omake-0.9.8.6 bug: "while" condition is not evaluated at all while true private.tok = $(lexer.lex-channel $(inchannel)) if $(equal $(tok.name), eof) value $(break) elseif $(equal $(tok.name), ident) private.ident = $(tok.val) tok = $(lexer.lex-channel $(inchannel)) if $(not $(equal $(tok.name), equal)) raise $(parse_error $(tok.loc)) tok = $(lexer.lex-channel $(inchannel)) if $(not $(equal $(tok.name), string)) raise $(parse_error $(tok.loc)) private.val = $(tok.val) private.plexer = $(param_lexer) private.omakecode = $(plexer.lex-channel $(open-in-string $(val))) fprintln($(outchannel), $"oasis_$(string-escaped $(ident))() =") fprintln($(outchannel), $" value $(omakecode)") else raise $(parse_error $(tok.loc)) OASIS_generate_setup() = private.inch = $(fopen setup.data, r) private.outch = $(fopen _oasis_setup.om, w) OASIS_convert_env($(inch), $(outch)) fprintln($(outch), $'USE_OCAMLFIND = true') fprintln($(outch), $'BYTE_ENABLED = true') fprintln($(outch), $'NATIVE_ENABLED = $(OCAMLOPT_EXISTS)') fprintln($(outch), $'OCAMLDEP_MODULES_ENABLED = true') fprintln($(outch), $'CMXS_ENABLED = $(oasis_native_dynlink)') fprintln($(outch), $'OCAMLFLAGS = -g') fprintln($(outch), $'INCLUDES = $(oasis_standard_library)') fprintln($(outch), $'CC = $(nth-hd 1, $(split $(oasis_bytecomp_c_compiler)))') fprintln($(outch), $'CFLAGS = $(nth-tl 1, $(split $(oasis_bytecomp_c_compiler)))') close($(inch)) flush($(outch)) close($(outch)) oasis-0.4.11/src/plugins/omake/README.md0000644000175000017500000001732613261073606017075 0ustar gildorgildor# The OMake plugin Author: Gerd Stolpmann, gerd@gerd-stolpmann.de The OMake plugin is meant as a powerful alternative to the ocamlbuild plugin. Its special feature is that the user can modify the generated OMakefiles, and add further build rules that are beyond the scope of OASIS. The OMake plugin uses a scheme that is largely compatible with the way ocamlbuild works. However, there are a few differences you should be aware of (see below in this doc). That means it is normally sufficient to change the plugin type in your _oasis file to "omake". At this point, generate the OMakefiles with `oasis setup`, modify them by your needs, and enjoy the new scripting capabilities. What is included: * A new build plugin * A new doc plugin * A new install plugin There is no new configuration plugin. The standard one coming with OASIS is good enough, and if you need to run some custom configuration script, you can still do with a PostConfCommand. The new install plugin is optional. You can also use the standard install plugin of OASIS. The new install plugin is easier to extend, though, because it also runs OMake. ## Switching to OMake Just change: * In all sections for libraries and executables (or just globally): ``` BuildType: OMake ``` * If you want to use the install plugin: ``` InstallType: OMake ``` * In documents, change: ``` Type: OMake ``` Also, use `XOMakePath` and `XOMakeLibraries` instead of `XOCamlbuildPath` and `XOCamlbuildLibraries` After that, don't forget to run `oasis setup`. This generates a bunch of files. After that, you are ready to go, and e.g. ``` ocaml setup.ml -build ``` will invoke OMake. Note that you can also run OMake directly: ``` omake build omake doc omake install ``` When distributing your project, you should also pack up the generated files (`OMakeroot`, `OMakefile`, `_oasis_*.om` except `_oasis_setup.om`). ## Generated files After `oasis setup`, the following files are generated: * OMakeroot: This file marks the root of the directory hierarchy, and contains global OMake configurations. This file is constant, and never changed by `oasis setup` again once put into place. * OMakefile: This file exists in every directory of the hierarchy, and is starting point for the definition of rules for the directory. This file is constant, and never changed by `oasis setup` again once put into place. The idea is that this file can be freely modified by your needs. * _oasis_lib.om: This is the library with additional OMake functionality. It is overwritten with every `oasis setup`. * _oasis_hier.om: This file defines a variable with the subdirectories. It is overwritten with every `oasis setup`. * _oasis_build.om: This file defines the build rules derived from _oasis. It is overwritten with every `oasis setup`. * _oasis_install.om: This file defines the install rules derived from _oasis. It is overwritten with every `oasis setup`. Note that OMake stores a binary version of the *.om files with suffix .omc. ## Configure OMake is able to read setup.data (the file where the result of `ocaml setup.ml -configure` is written to). There is a converted file _oasis_setup.om: * All OASIS variables are prefixed with "oasis_". E.g. "bindir" is available as "oasis_bindir". * A couple of extra configurations are appended to _oasis_setup.om, e.g. the C compiler to use (CC) is extracted from OASIS variables. The file _oasis_setup.om is included into the OMakefile in the root directory. If you need to adjust variables, you can do that after the "include _oasis_setup.om" line. Note that _oasis_setup.om is automatically rebuilt once setup.data is changed. ## Build OMake doesn't use a separate build directory. Object files are put into the source hierarchy side by side with the source. (Note: there is a vmount() function, but it is still marked as experimental feature. See the OMake manual.) There is one thing that is fundamentally different. First, there is no _tags file. OMake only gets the build flags from the OMakefile. Second, OMake takes the build flags from the OMakefile in the same directory as the module/library/executable. The build flags are derived from a number of variables defined in the OMakefiles. The exact set is documented in the OMake manual, but the most important variables are: Variable | Meaning -------------------|--------------------------------------------- OCAMLPACKS: | the findlib packages OCAMLINCLUDES: | other project directories to include OCAMLFLAGS: | flags for both ocamlc and ocamlopt OCAMLCFLAGS: | flags for ocamlc OCAMLOPTFLAGS: | flags for ocamlopt OCAMLFINDFLAGS: | flags for ocamlfind The generated _oasis_build.om files already initialize these variables in a meaningful way. Nevertheless, you should know: * For compiling modules, the value of of these variable at the end of the OMakefile in the same directory counts. * If you want good control over the flags for a certain library or executable, build the library or executable in a directory of its own. This way, you can be sure that it is isolated from the settings of any other library or executable, as these are built in different directories. * It is a bad idea to put modules into subdirectories unless you want to achieve a special effect. For example, you could have in _oasis: ``` Modules: P Q subdir/R subdir/S ``` The point here is now that R and S are now built in the subdirectory, and the flags are taken from the OMakefile in this subdirectory. The generator does not take care of anything in this situation, and probably does not generate the right flags. So, don't do this even if you only have something innocent in mind like grouping your files logically. * It is possible to set deviating flags for a module. There are a number of helper functions to do so. E.g. if a module X needs camlp4 syntax, the way to enable this only for this module is: ``` OASIS_modify_OCAMLFINDFLAGS(X, -syntax camlp4) ``` Put that into the OMakefile of the directory where X exists. There is some documentation in the top-most OMakefile explaining further ways to set flags. ## Doc The doc plugin understands a couple of additional options in _oasis: * OMakePath: where to build the document * OMakeLibraries: libraries to include into the document * OMakeModules: modules to include into the document * OMakeTexts: texts to include (the files must have suffix .txt but omit the extension, e.g. "OMakeTexts: foo" would take foo.txt) * OMakeIntro: introductory text (also without extension) * OMakeFlags: additional flags for ocamldoc You can set Format to either HTML, PDF, PostScript, or DVI. ## Install The new install plugin should just do the same as the internal plugin, only that the installation is done via OMake rules. If you e.g. want to run some additional commands, you can modify the install-here rule in the OMakefile in the directory where you want to install something. It normally reads: ``` install-here: $(INSTALL_TARGETS) ``` without commands, and you can simply add some commands, e.g. ``` install-here: $(INSTALL_TARGETS) cp myfile /dest/dir/ ``` In order to comply with the configuration, you should copy the files into the right directories, e.g. ``` install-here: $(INSTALL_TARGETS) cp myconfig $(OASIS_destdir $(oasis_sysconfdir)) ``` Here, the variable oasis_sysconfdir is the configured directory for configurations, and the function OASIS_destdir prepends, if configured, the destination prefix (-destdir). (NB. OASIS_destdir is defined in _oasis_lib.om.) ## Uninstalling This works also the same as for the internal plugin. Note that OMake keeps track of the installed files in setup.log.om. oasis-0.4.11/src/plugins/omake/OMakeroot.om0000644000175000017500000000020013261073606020032 0ustar gildorgildor# include the standard installed configuration file. include $(STDROOT) # include the OMakefile in this directory. .SUBDIRS: . oasis-0.4.11/src/plugins/omake/OMakefile_top.om0000644000175000017500000002043213261073606020661 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2013, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # This file was created by "oasis setup". You may modify this file freely. # It is not overwritten once it exists. The same holds for OMakeroot and # all OMakefiles in the subdirectories. The files following the naming # pattern _oasis_*.om are overwritten by the next "oasis setup". # Include OASIS library: if $(not $(file-exists _oasis_lib.om)) err. = extends $(Exception) message = $'Not set up. Run first: oasis setup' raise $(err) if $(not $(file-exists setup.data)) err. = extends $(Exception) message = $'Not configured. Run first: ocaml setup.ml -configure' raise $(err) include _oasis_lib.om # Include the configuration, i.e. the output of "ocaml setup.ml -configure". # The settings are written to a file setup.data. We need it in a different # format, and convert the setup here. Note that the variables from setup.data # are prefixed with "oasis_", e.g. "prefix" is made available as # $(oasis_prefix). At this point we also initialize a number of build-related # variables like BYTE_ENANBLED or OCAMLFLAGS. .INCLUDE: _oasis_setup.om: setup.data OASIS_generate_setup() # At this point you may fine-tune the configuration, and modify defaults: # # OCAML_LIB_MODULE_SUFFIXES += .ml (install also .ml files with libs) # OCAMLFINDFLAGS += -verbose (be verbose) # OCAMLFLAGS += -bin-annot (create .cmt/.cmti files) OCAMLFLAGS_ANNOT = -annot -bin-annot OCAMLFLAGS += $(OCAMLFLAGS_ANNOT) # Until this point we allow to override variables via the command-line. # That means all initializations from above can be changed by omake arguments # here. E.g. invoke with "omake BYTE_ENABLED=false" to disable bytecode # builds. DefineCommandVars() # Global phonies: This declaration is visible in the whole build tree. .PHONY: build doc install uninstall reinstall clean distclean .DEFAULT: build # Define hierarchy (sets OASIS_SUBDIRS to the sub directories that are part # of the build): include _oasis_hier.om # Include these subdirectories into the build. Normally, you only name # direct subdirectories here. Also note that all definitions up to this # point are automatically passed down to the OMakefiles in the subdirectories. .SUBDIRS: $(OASIS_SUBDIRS) # Local phonies: This declaration is only visible in this directory. .PHONY: build-here doc-here install-here uninstall-here reinstall-here pre-install-here clean-here distclean-here # At this point you may set any of the EXTRA variables used in the .om files: # # -- build -- # EXTRA_OCAMLPACKS (findlib packages) # EXTRA_OCAMLINCLUDES (include directories) # EXTRA_MODULES (OCaml modules w/o extension) # EXTRA_C_OBJECTS (C object files) # EXTRA_OCAML_LIBS (internal OCaml libraries w/o extension) # EXTRA_OCAML_LIB_CCLIB (-L and -l switches to embed into libs) # EXTRA_OCAML_LIB_DLLIB (-L and -l switches to embed into bytecode libs) # EXTRA_OCAML_LIB_DLLPATH (runtime path to embed into libs) # EXTRA_OCAML_LIB_FLAGS (flags for creating libs) # EXTRA_OCAML_LINK_CCLIB (-L and -l switches for linking executables) # EXTRA_OCAML_LINK_DLLIB (-L and -l switches for dynamic bytecode executables) # EXTRA_OCAML_LINK_DLLPATH (runtime path for bytecode executables) # EXTRA_OCAML_LINK_FLAGS (flags for creating executables) # EXTRA_OCAMLFINDFLAGS (flags for ocamlfind call) # # -- install -- # EXTRA_INSTALL_MODULES (OCaml modules w/o extension) # EXTRA_INSTALL_FILES (files to install with the library) # EXTRA_INSTALL_OPTIONAL_FILES (optional files to install with the library) # # In order to restrict such a variable to only a single library, executable, or # object, append its name separated with an underscore, e.g. # # EXTRA_MODULES_mylibrary[] = # module7 # Include definitions generated by OASIS. These files contain the definitions # derived from the _oasis file. include _oasis_build.om include _oasis_install.om # These calls define the rules needed for "build", "install", etc. DefineBuildRules() DefineInstallRules() # You may define additional build rules here, e.g. # # file.ml: file.mlp # ./mypreprocessor file.mlp # If you set here one of the following variables, the setting will be # taken for compiling modules and C sources in this directory, unless # more specific settings exist. Note that _oasis_build.om ensures # that these variables are already filled with something reasonable # derived from _oasis, but you might want to adjust this here. You can # also append to variables with "+=". If you move the setting before the # .SUBDIRS line it is applied to all subdirectories, too. # # OCAMLPACKS = # OCAMLINCLUDES = # OCAMLFINDFLAGS = # OCAMLFLAGS = # OCAMLCFLAGS = # OCAMLOPTFLAGS = # OCAMLLEXFLAGS = # OCAMLYACCFLAGS = # It is also possible to specify variables for a single source file. Use # the OASIS_modify_* functions to append flags for a single source only. # Do not add file extensions like .ml or .c here. These functions must be # called from the OMakefile in the directory of the module to modify. # # OASIS_modify_OCAMLPACKS(module, unix) # OASIS_modify_OCAMLINCLUDES(module, /some/path) # OASIS_modify_OCAMLFINDFLAGS(module, -syntax camlp4o) # OASIS_modify_OCAMLFLAGS(module, -warn-error +a) # OASIS_modify_OCAMLOPTFLAGS(module, -p) # OASIS_modify_OCAMLCFLAGS(module, -vmthread) # OASIS_modify_OCAMLLEXFLAGS(module, -ml) # OASIS_modify_OCAMLYACCFLAGS(module, -q) # OASIS_modify_CFLAGS(module, -q) # Entry points: # # omake build: Build the configured targets here and in subdirectories # omake build-here: Build the configured targets only in this directory # omake install: Install here and in subdirectories # omake install-here: Install only in this directory # omake clean: Clean here and in subdirectories # omake clean-here: Clean only in this directory # omake distclean: dist-clean here and in subdirectories # omake distclean-here: dist-clean only in this directory # # You can also request to build explicit files, e.g. omake mylib.cma build-here: $(BUILD_TARGETS) doc-here: $(BUILD_DOC_TARGETS) install-here: $(INSTALL_TARGETS) uninstall-here: $(UNINSTALL_TARGETS) reinstall-here: $(REINSTALL_TARGETS) pre-install-here: clean-here: rm -f $(OASIS_clean_list) rm -rf $(OASIS_rec_clean_list) section OASIS_rmdir($(OASIS_dir_clean_list)) distclean-here: rm -f $(OASIS_distclean_list) rm -rf $(OASIS_rec_distclean_list) section OASIS_rmdir($(OASIS_dir_distclean_list)) build: build-here doc: doc-here install: install-here uninstall: uninstall-here reinstall: reinstall-here clean: clean-here distclean: distclean-here oasis-0.4.11/src/plugins/omake/OMakefile_nontop.om0000644000175000017500000000206213261073606021373 0ustar gildorgildor# You may modify this file freely. It is not overwritten by oasis # setup once it exists. See the OMakefile in the topmost directory # for more documentation. include _oasis_hier.om # subdirectories .SUBDIRS: $(OASIS_SUBDIRS) # local phonies .PHONY: build-here doc-here install-here uninstall-here reinstall-here pre-install-here clean-here distclean-here include _oasis_build.om include _oasis_install.om DefineBuildRules() DefineInstallRules() build-here: $(BUILD_TARGETS) doc-here: $(BUILD_DOC_TARGETS) install-here: $(INSTALL_TARGETS) uninstall-here: $(UNINSTALL_TARGETS) reinstall-here: $(REINSTALL_TARGETS) pre-install-here: clean-here: rm -f $(OASIS_clean_list) rm -rf $(OASIS_rec_clean_list) section OASIS_rmdir($(OASIS_dir_clean_list)) distclean-here: rm -f $(OASIS_distclean_list) rm -rf $(OASIS_rec_distclean_list) section OASIS_rmdir($(OASIS_dir_distclean_list)) build: build-here doc: doc-here install: install-here uninstall: uninstall-here reinstall: reinstall-here clean: clean-here distclean: distclean-here oasis-0.4.11/src/plugins/omake/OMakeSys.mod0000644000175000017500000000003613261073606020000 0ustar gildorgildorOMakeFields.ml OMakePlugin.ml oasis-0.4.11/src/plugins/omake/OMakePlugin.ml0000644000175000017500000002234613261073606020321 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Generate omake configure/build/doc/test/install system @author Gerd Stolpmann *) open BaseEnv open OASISTypes let run_command = BaseCustom.run module BuildRuntime = struct let main ~ctxt run pkg extra_args = run_command "omake" ( ["build"] @ OMakeFields.(run.extra_args)) extra_args; (* Register generated files in the log files. *) List.iter (fun sct -> let evs = match sct with | Library (cs, bs, lib) when var_choose bs.bs_build -> begin let evs, _ = BaseBuilt.of_library OASISHostPath.of_unix (cs, bs, lib) in evs end | Executable (cs, bs, exec) when var_choose bs.bs_build -> begin let evs, _, _ = BaseBuilt.of_executable OASISHostPath.of_unix (cs, bs, exec) in evs end | _ -> [] in List.iter (fun (bt, bnm, lst) -> BaseBuilt.register ~ctxt bt bnm lst) evs) pkg.sections let clean ~ctxt run pkg extra_args = run_command "omake" (["clean"] @ OMakeFields.(run.extra_args)) extra_args; List.iter (function | Library (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister ~ctxt BaseBuilt.BExecLib cs.cs_name | Doc(cs, _) -> (* "omake clean" also cleans docs *) BaseBuilt.unregister ~ctxt BaseBuilt.BDoc cs.cs_name | _ -> ()) pkg.sections let distclean ~ctxt:_ run _ extra_args = run_command "omake" (["distclean"] @ OMakeFields.(run.extra_args)) extra_args; List.iter (fun fn -> if Sys.file_exists fn then Sys.remove fn) [".omakedb"; ".omakedb.lock"] end module InstallRuntime = struct let install ~ctxt:_ run _ extra_args = run_command "omake" (["install"] @ OMakeFields.(run.extra_args)) extra_args let uninstall ~ctxt:_ run _ extra_args = run_command "omake" (["uninstall"] @ OMakeFields.(run.extra_args)) extra_args end module DocRuntime = struct open OMakeFields let main ~ctxt run pkg (cs,doc) extra_args = let target = OASISUnixPath.make [ run.run_path; cs.cs_name ^ ".doc"; string_of_format doc.doc_format; ] in run_command "omake" ([target] @ run.OMakeFields.extra_args) extra_args; (* The following exists only to make the internal install plugin happy: *) List.iter (fun sct -> match sct with | Doc(cs,doc) when var_choose doc.doc_build -> let files = Array.to_list (Sys.readdir (OASISHostPath.of_unix target)) in let files = List.filter (fun n -> n.[0] <> '.') files in let full_files = List.map (fun n -> OASISHostPath.of_unix (OASISUnixPath.concat target n)) files in BaseBuilt.register ~ctxt BaseBuilt.BDoc cs.cs_name [full_files] | _ -> () ) pkg.sections end (* END EXPORT *) open OASISGettext open OASISPlugin open OMakeFields let odn_of_run_t v = OASISDataNotation.REC ("OMakeFields", [ ("run_path", (odn_of_unix_dirname v.run_path)); ("extra_args", ((fun x -> OASISDataNotation.of_list OASISDataNotation.of_string x) v.extra_args)) ]) let need_ocaml_401 ctxt pkg = let open OASISVersion.StringVersion in set_error (not (comparator_ge "4.01" pkg.ocaml_version)) "omake plugin is only available for OCaml >= 4.01. \ Please restrict your requirements with 'OCamlVersion: >= 4.01'." ctxt (* Build plugin *) let build_init () = let generator data = { OMakeFields.run_path = ""; OMakeFields.extra_args = OMakeFields.BuildFields.extra_args data; } in let doit ctxt pkg = let ctxt = need_ocaml_401 ctxt pkg in let run = generator pkg.schema_data in let equip() = OMakeEquip.equip_project ctxt pkg in { ctxt with other_actions = equip :: ctxt.other_actions }, { OASISPlugin.chng_moduls = [OMakeData.omakesys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt BuildRuntime.main ("OMakePlugin.BuildRuntime.main") run odn_of_run_t; chng_clean = Some (OASISDataNotation.func_with_arg_ctxt BuildRuntime.clean ("OMakePlugin.BuildRuntime.clean") run odn_of_run_t); chng_distclean = Some (OASISDataNotation.func_with_arg_ctxt BuildRuntime.distclean ("OMakePlugin.BuildRuntime.distclean") run odn_of_run_t); } in Build.register_act BuildFields.self_id doit; register_generator_package BuildFields.id BuildFields.build_data generator (* Install plugin *) let install_init () = let generator_inst _ = { OMakeFields.run_path = ""; OMakeFields.extra_args = [] } in let generator_uninst _ = { OMakeFields.run_path = ""; OMakeFields.extra_args = [] } in let doit_install plugin_ctxt pkg = let plugin_ctxt = need_ocaml_401 plugin_ctxt pkg in let run = generator_inst pkg.schema_data in let equip() = OMakeEquip.equip_project plugin_ctxt pkg in { plugin_ctxt with other_actions = equip :: plugin_ctxt.other_actions }, { chng_moduls = [OMakeData.omakesys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt InstallRuntime.install "OMakePlugin.InstallRuntime.install" run odn_of_run_t; chng_clean = None; chng_distclean = None } in let doit_uninstall plugin_ctxt pkg = let plugin_ctxt = need_ocaml_401 plugin_ctxt pkg in let run = generator_uninst pkg.schema_data in let equip() = OMakeEquip.equip_project plugin_ctxt pkg in { plugin_ctxt with other_actions = equip :: plugin_ctxt.other_actions }, { chng_moduls = [OMakeData.omakesys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt InstallRuntime.uninstall "OMakePlugin.InstallRuntime.uninstall" run odn_of_run_t; chng_clean = None; chng_distclean = None } in Install.register_act InstallFields.self_id (doit_install, doit_uninstall); register_generator_package InstallFields.id InstallFields.install_data generator_inst; register_generator_package InstallFields.id InstallFields.uninstall_data generator_uninst (* Doc plugin *) let doc_init () = let generator data = (* bug in OASIS? DocFields.path gives here always PropList.Not_set exn *) { OMakeFields.run_path = DocFields.path data; OMakeFields.extra_args = BuildFields.extra_args data; } in let doit ctxt pkg (cs, _) = let run = generator cs.cs_data in let equip() = OMakeEquip.equip_project ctxt pkg in { ctxt with other_actions = equip :: ctxt.other_actions }, { OASISPlugin.chng_moduls = [OMakeData.omakesys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt DocRuntime.main "OMakePlugin.DocRuntime.main" run odn_of_run_t; chng_clean = None; chng_distclean = None; } in Doc.register_act DocFields.self_id doit; register_generator_section `Doc DocFields.id DocFields.doc_data generator let init () = register_help BuildFields.build_plugin (help_default OMakeData.readme_template_mkd); build_init (); install_init (); doc_init() oasis-0.4.11/src/plugins/omake/OMakeFormat.ml0000644000175000017500000001334713261073606020314 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Write omake files @author Gerd Stolpmann *) (* END EXPORT *) open Printf type om_entry = | Section of om_entry list | Set_string of om_append * string * om_value | Set_array of om_append * string * om_value list | Export of string list | Lines of string list | Cond of (om_condition * om_entry list) list * om_entry list | Nop and om_append = bool and om_value = | Literal of string | Variable of string | Choices of (om_condition * om_value) list * om_value | Expression of string | Concat of om_value list and om_condition = | OMBool of bool | OMNot of om_condition | OMAnd of om_condition * om_condition | OMOr of om_condition * om_condition | OMIsTrue of om_value | OMEq of om_value * om_value let write_const_file ?(skip_existing=false) upath data = let hpath = OASISHostPath.of_unix upath in if not skip_existing || not (Sys.file_exists hpath) then ( let f = open_out hpath in output_string f data; close_out f ) let rec string_of_value = function | Literal "" -> "$(string)" | Literal s -> let b = Buffer.create 80 in Buffer.add_string b "$\""; String.iter (function | '"' -> Buffer.add_string b "$(string $'\"')" | '$' -> Buffer.add_string b "$(string $'$')" | c -> Buffer.add_char b c ) s; Buffer.add_string b "\""; Buffer.contents b | Variable v -> sprintf "$(%s)" v | Choices(switch,default) -> List.fold_right (fun (c,v) acc -> sprintf "$(if %s, %s, %s)" (string_of_condition c) (string_of_value v) acc ) switch (string_of_value default) | Expression s -> s | Concat l -> String.concat "" (List.map string_of_value l) and string_of_condition = function | OMBool b -> string_of_bool b | OMNot c1 -> sprintf "$(not %s)" (string_of_condition c1) | OMAnd(c1,c2) -> sprintf "$(and %s, %s)" (string_of_condition c1) (string_of_condition c2) | OMOr(c1,c2) -> sprintf "$(or %s, %s)" (string_of_condition c1) (string_of_condition c2) | OMIsTrue v -> string_of_value v | OMEq(v1,v2) -> sprintf "$(equal %s, %s)" (string_of_value v1) (string_of_value v2) let write_omake_file ?(skip_existing=false) upath entries = let write_indent f indent = output_string f (String.make indent ' ') in let rec write f indent entry = match entry with | Section l -> write_indent f indent; fprintf f "section\n"; List.iter (write f (indent+4)) l; fprintf f "\n"; | Set_string(append,name,value) -> write_indent f indent; fprintf f "%s %s= %s\n" name (if append then "+" else "") (string_of_value value) | Set_array(append,name,values) -> write_indent f indent; fprintf f "%s[] %s=\n" name (if append then "+" else ""); List.iter (fun value -> write_indent f (indent+4); fprintf f "%s\n" (string_of_value value)) values | Export names -> write_indent f indent; if names <> [] then begin fprintf f "export %s\n" (String.concat " " names) end else begin fprintf f "export\n" end | Lines lines -> List.iter (fun line -> write_indent f indent; fprintf f "%s\n" line) lines | Cond(ll1,l2) -> let s = ref "if" in List.iter (fun (c,l1) -> write_indent f indent; fprintf f "%s %s\n" !s (string_of_condition c); List.iter (write f (indent+4)) l1; s := "elseif") ll1; if l2 <> [] then begin write_indent f indent; fprintf f "else\n"; List.iter (write f (indent+4)) l2; end | Nop -> () in let hpath = OASISHostPath.of_unix upath in if not skip_existing || not (Sys.file_exists hpath) then ( let f = open_out hpath in List.iter (write f 0) entries; close_out f ) oasis-0.4.11/src/plugins/omake/OMakeFields.ml0000644000175000017500000001172613261073606020271 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Describe fields of OMake plugins @author Gerd Stolpmann *) open BaseEnv open OASISGettext open OASISTypes type run_t = { run_path : unix_dirname; (* "doc" only *) extra_args: string list; } let string_of_format = function | HTML _ -> "html" | DocText -> "txt" | PDF -> "pdf" | PostScript -> "ps" | Info _ -> "texi" | DVI -> "dvi" | OtherDoc -> "html" (* END EXPORT *) open OASISTypes open OASISValues open OASISPlugin open OASISGettext open OASISSchema let nm, ver = "OMake", Some OASISConf.version_short module CommonFields = struct let common_fields schm id pivot_data = let extra_args = new_field schm id "ExtraArgs" ~default:[] command_line_options (fun () -> s_ "Gives extra arguments to omake") pivot_data (fun _ t -> t.extra_args) in extra_args end module BuildFields = struct let build_plugin = `Build, nm, ver let build_data = (data_new_property build_plugin : run_t OASISPlugin.prop) let self_id, id = Build.create build_plugin let extra_args = CommonFields.common_fields OASISPackage.schema id build_data end module DocFields = struct type t = { path: unix_dirname; modules: string list; texts: string list; libraries: findlib_full list; intro: unix_filename option; flags: string list; } let doc_plugin = `Doc, nm, ver let doc_data = (data_new_property doc_plugin : run_t OASISPlugin.prop) let doc_generator_data = data_new_property doc_plugin let self_id, id = Doc.create doc_plugin let new_field nm ?default vl hlp sync = new_field OASISDocument.schema id nm ?default vl (fun () -> s_ hlp) doc_generator_data sync let path = new_field "Path" ~default:OASISUnixPath.current_dir_name file (ns_ "Top level directory for building ocamldoc documentation") (fun _ t -> t.path) let modules = new_field "Modules" ~default:[] modules (ns_ "List of OCaml modules used to generate ocamldoc documentation") (fun _ t -> t.modules) let texts = new_field "Texts" ~default:[] files (ns_ "List of text modules used to generate ocamldoc documentation") (fun _ t -> t.texts) let libraries = new_field "Libraries" ~default:[] (comma_separated findlib_full) (ns_ "Findlib names of internal libraries used to generate the ocamldoc \ documentation") (fun _ t -> t.libraries) let intro = new_field ~default:None "Intro" (opt file) (ns_ "OCamldoc formatted file used to generate index.html of the ocamldoc \ documentation") (fun _ t -> t.intro) let flags = new_field ~default:[] "Flags" space_separated (ns_ "OCamldoc flags") (fun _ t -> t.flags) let extra_args = CommonFields.common_fields OASISDocument.schema id doc_data end module InstallFields = struct let install_plugin = `Install, nm, ver let install_data = (data_new_property install_plugin:run_t OASISPlugin.prop) let uninstall_data = (data_new_property ~purpose:`Uninstall install_plugin:run_t OASISPlugin.prop) let self_id, id = Install.create install_plugin end oasis-0.4.11/src/plugins/omake/OMakeEquip.ml0000644000175000017500000012025613261073606020145 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Put OMakeroot, OMakefile etc. in place. @author Gerd Stolpmann *) (* TODO: support for objects *) open OASISPlugin open OASISTypes open OMakeFields open OMakeFormat open Printf type dir = { dir_path : string; dir_top : bool; dir_sub : string list; dir_build : om_entry list; dir_install : om_entry list; dir_accu : om_entry list; dir_pack : bool option; } module StrMap = Map.Make(String) module StrSet = Set.Make(String) type dir_map = dir StrMap.t let fixup_path path = if path = "/" then (* CHECK: can we really run into this? *) failwith "Absolute paths not supported here"; let l = OASISString.nsplit path '/' in let l = List.filter (fun n -> n <> "") l in OASISUnixPath.reduce (String.concat "/" l) let new_dir path = { dir_path = fixup_path path; dir_top = false; dir_sub = []; dir_build = []; dir_install = []; dir_accu = []; dir_pack = None; } let new_dir_map() = let top_dir = new_dir OASISUnixPath.current_dir_name in let top_dir = { top_dir with dir_top = true } in StrMap.add top_dir.dir_path top_dir StrMap.empty let rec establish map dir = if StrMap.mem dir.dir_path map then map else let container = OASISUnixPath.dirname dir.dir_path in let cont_dir = new_dir container in let map1 = establish map cont_dir in let cont_dir1 = StrMap.find cont_dir.dir_path map1 in let cont_dir2 = { cont_dir1 with dir_sub = dir.dir_path :: cont_dir1.dir_sub } in let map2 = StrMap.add cont_dir.dir_path cont_dir2 map1 in StrMap.add dir.dir_path dir map2 let establish_in map path module_includes = (* Also create OMakefile in all directories storing the module files: *) StrSet.fold (fun include_dir acc -> establish map (new_dir (OASISUnixPath.concat path include_dir)) ) module_includes map let rec om_cond_of_expr = function | OASISExpr.EBool b -> OMBool b | OASISExpr.ENot c1 -> OMNot(om_cond_of_expr c1) | OASISExpr.EAnd(c1,c2) -> OMAnd(om_cond_of_expr c1, om_cond_of_expr c2) | OASISExpr.EOr(c1,c2) -> OMOr(om_cond_of_expr c1, om_cond_of_expr c2) | OASISExpr.EFlag name -> OMIsTrue(Variable ("oasis_" ^ name)) | OASISExpr.ETest(name, value) -> OMEq(Variable ("oasis_" ^ OASISExpr.string_of_test name), Literal value) let om_cond_of_flag flag = let rec translate = function | (e, true) :: rest -> OMOr(om_cond_of_expr e, translate rest) | (e, false) :: rest -> OMAnd(OMNot(om_cond_of_expr e), translate rest) | [] -> OMBool false in match flag with | [ OASISExpr.EBool true, b ] -> OMBool b | [ OASISExpr.EBool false, _ ] -> OMBool false | _ -> translate flag let set_array_cond append name args_choices = Cond(List.map (fun (e,args) -> (om_cond_of_expr e, [ Set_array(append, name, List.map (fun s -> Literal s) args); Export [name] ]) ) (List.rev args_choices), []) let gen_getvar name = Expression (sprintf "$(OASIS_getvar %s)" name) let gen_getvar_for libname name = Expression (sprintf "$(OASIS_getvar_for %s, %s)" libname name) exception Ident of string let get_data_destination ?(default_dest = "$datadir/$pkg_name") dir_opt = (* cannot use Buffer.add_substitute because we want to get an omake expression as result *) let dir = match dir_opt with | None -> default_dest | Some dir -> dir in let lim = String.length dir in let get_lit acc = if acc = [] then [] else [Literal (String.concat "" (List.rev acc))] in let rec subst acc prev i = if i < lim then ( match dir.[i] with | '$' when prev = '\\' -> subst ("$"::acc) ' ' (i+1) | '$' -> (* a gross hack... *) ( try let b = Buffer.create 1 in Buffer.add_substitute b (fun ident -> raise(Ident ident)) (String.sub dir i (lim-i)); assert false with Ident ident -> let len = if i+1 < lim && (dir.[i+1] = '(' || dir.[i+1] = '{') then String.length ident + 3 else String.length ident + 1 in get_lit acc @ [Variable ("oasis_" ^ ident)] @ subst [] ' ' (i+len) ) | cur when prev = '\\' -> let acc = ("\\" ^ String.make 1 cur) :: acc in subst acc ' ' (i+1) | '\\' -> subst acc '\\' (i+1) | cur -> subst (String.make 1 cur :: acc) cur (i+1) ) else let acc = if prev = '\\' then String.make 1 prev :: acc else acc in get_lit acc in subst [] ' ' 0 let fixup_module_case dir name = let name_cap = OASISUnixPath.capitalize_file name in let name_uncap = OASISUnixPath.uncapitalize_file name in try let (name_fixed,_) = List.find (fun (name,ext) -> let file = OASISUnixPath.concat dir (name ^ ext) in Sys.file_exists (OASISHostPath.of_unix file) ) [ name_cap, ".ml"; name_cap, ".mli"; name_cap, ".mly"; name_cap, ".mll"; name_uncap, ".ml"; name_uncap, ".mli"; name_uncap, ".mly"; name_uncap, ".mll"; ] in name_fixed with | Not_found -> name let strset_flatten l = List.fold_left StrSet.union StrSet.empty l let get_lib_flname cs lib = String.concat "." ( (match lib.lib_findlib_parent with | None -> [] | Some p -> [p] ) @ lib.lib_findlib_containers @ match lib.lib_findlib_name with | None -> [cs.cs_name] | Some n -> [n] ) let rebase_lib_dir pkg cur_path lib_sect_name = let sect2 = try OASISSection.section_find (`Library,lib_sect_name) pkg.sections with Not_found -> failwith (sprintf "Cannot find section: %s" lib_sect_name) in ( match sect2 with | Library(_,sect_bs,_) -> OASISUnixPath.make_relative cur_path sect_bs.bs_path | _ -> assert false ) let rebase_lib pkg cur_path lib_sect_name = let p = rebase_lib_dir pkg cur_path lib_sect_name in OASISUnixPath.concat p lib_sect_name let get_lib_includes_1 pkg cur_path libs = (* only the direct includes, not the indirect ones *) strset_flatten (List.map (fun sect_name -> let p = rebase_lib_dir pkg cur_path sect_name in StrSet.singleton p ) libs ) let get_lib_includes ?subdir pkg bs = let libs = List.flatten (List.map (function | FindlibPackage _ -> [] | InternalLibrary sect_name -> [sect_name] ) bs.bs_build_depends ) in let path = match subdir with | None -> bs.bs_path | Some d -> OASISUnixPath.concat bs.bs_path d in get_lib_includes_1 pkg path libs let get_lib_deps ?(transitive=false) ?(filter = fun _ -> true) pkg bs = (* transitive=false: only the direct dependencies, not the indirect ones. transitive=true: the indirect ones too *) let trans_map = if transitive then OASISBuildSection.transitive_build_depends pkg else OASISSection.MapSection.empty in strset_flatten (List.map (function | FindlibPackage _ -> StrSet.empty | InternalLibrary sect_name -> let sect = try OASISSection.section_find (`Library,sect_name) pkg.sections with Not_found -> failwith (sprintf "Cannot find section: %s" sect_name) in let deps = if transitive then [InternalLibrary sect_name] @ OASISSection.MapSection.find sect trans_map else [InternalLibrary sect_name] in strset_flatten (List.map (function | FindlibPackage _ -> StrSet.empty | InternalLibrary sect_name2 -> if filter sect_name2 then let p = rebase_lib pkg bs.bs_path sect_name2 in StrSet.singleton p else StrSet.empty ) deps ) ) bs.bs_build_depends ) let get_sorted_trans_lib_deps pkg section bs = let m = OASISBuildSection.transitive_build_depends pkg in let deps = OASISSection.MapSection.find section m in let sections = OASISBuildSection.build_order pkg in List.flatten (List.map (function | Library(cs,_,_) -> if List.mem (InternalLibrary cs.cs_name) deps then [rebase_lib pkg bs.bs_path cs.cs_name] else [] | _ -> [] ) sections ) let lib_has_c_sources pkg sect_name = let sect = try OASISSection.section_find (`Library,sect_name) pkg.sections with Not_found -> failwith (sprintf "Cannot find section: %s" sect_name) in match sect with | Library(cs,bs,lib) -> bs.bs_c_sources <> [] | _ -> false let get_ocamlpacks ?(transitive=false) pkg bs = let trans_map = if transitive then OASISBuildSection.transitive_build_depends pkg else OASISSection.MapSection.empty in List.flatten (List.map (function | FindlibPackage(flib,_) -> [flib] | InternalLibrary sect_name when transitive -> let sect = try OASISSection.section_find (`Library,sect_name) pkg.sections with Not_found -> failwith (sprintf "Cannot find section: %s" sect_name) in let deps = OASISSection.MapSection.find sect trans_map in List.flatten (List.map (function | FindlibPackage(flib,_) -> [flib] | InternalLibrary _ -> [] ) deps ) | InternalLibrary _ -> [] ) bs.bs_build_depends ) let get_c_object name = OASISUnixPath.chop_extension name ^ ".o" let well_known_syntax = [ "camlp4.quotations.o"; "camlp4.quotations.r"; "camlp4.exceptiontracer"; "camlp4.extend"; "camlp4.foldgenerator"; "camlp4.listcomprehension"; "camlp4.locationstripper"; "camlp4.macro"; "camlp4.mapgenerator"; "camlp4.metagenerator"; "camlp4.profiler"; "camlp4.tracer" ] let have_syntax_camlp4o ocamlpacks = List.exists (fun pack -> Filename.check_suffix pack "syntax" || List.mem pack well_known_syntax ) ocamlpacks let skippable prefix name l = let skip = prefix ^ "_" ^ name in [ Lines [ "if $(not $(defined " ^ skip ^ "))"; " " ^ skip ^ " = false"; " export " ^ skip; ]; Cond( [ OMNot(OMIsTrue(Variable skip)), l ], []); Export []; ] let set_byte_or_native bs = (* the default settings correspond to "best" *) match bs.bs_compiled_object with | Best -> Nop | Byte -> Set_string(false, "NATIVE_ENABLED", Literal "false") | Native -> Set_string(false, "BYTE_ENABLED", Literal "false") let add_sources map path module_includes ocamlpacks pkg cs bs pack_flag = let cname = OASISString.capitalize_ascii cs.cs_name in let uniq_includes = StrSet.fold (fun include_dir acc -> let p = fixup_path(OASISUnixPath.concat path include_dir) in StrSet.add p acc ) module_includes StrSet.empty in StrSet.fold (fun include_dir acc -> let map = establish acc (new_dir include_dir) in let dir = StrMap.find include_dir map in let pack_complain = match dir.dir_pack with | Some true -> true | Some false -> pack_flag | None -> false in if pack_complain then failwith ("It is not supported to build a second library or \ executable in a \ directory where already a packed library is built: " ^ include_dir); let subdir = OASISUnixPath.make_relative path include_dir in let lib_includes = get_lib_includes ~subdir pkg bs in let accu = [ set_array_cond true "CFLAGS" bs.bs_ccopt; set_array_cond true "OCAMLCFLAGS" bs.bs_byteopt; set_array_cond true "OCAMLOPTFLAGS" bs.bs_nativeopt; Set_array(true, "OCAMLINCLUDES", ( List.map (fun n -> Literal n) (StrSet.elements lib_includes) @ [gen_getvar_for cs.cs_name "EXTRA_OCAMLINCLUDES"] )); Set_array(true, "OCAMLPACKS", ( List.map (fun n -> Literal n) ocamlpacks @ [gen_getvar_for cs.cs_name "EXTRA_OCAMLPACKS"] )); if have_syntax_camlp4o ocamlpacks then Set_string(false, "ENABLE_SYNTAX_CAMLP4O", Literal "true") else Nop; ] @ (if pack_flag then [ Set_array(true, "OCAMLOPTFLAGS", [ Expression "-for-pack"; Literal cname ]) ] else [] ) @ dir.dir_accu in let dir' = { dir with dir_pack = Some pack_flag; dir_accu = dir.dir_accu @ accu; } in StrMap.add include_dir dir' map ) uniq_includes map let add_library ctx pkg map cs bs lib = (* CHECK: what if bs.bs_path contains .. path elements? What if module names do so? *) let lib_dir = new_dir bs.bs_path in let map = establish map lib_dir in let lib_deps = get_lib_deps pkg bs in let self_include = if lib.lib_pack then (* for the case that there is a pack-level mli *) [ OASISUnixPath.current_dir_name ] else [] in let module_includes = List.fold_left (fun acc m -> let d = OASISUnixPath.dirname m in StrSet.add d acc ) StrSet.empty (lib.lib_modules @ lib.lib_internal_modules @ self_include) in let lib_includes = get_lib_includes pkg bs in let ocamlpacks = get_ocamlpacks pkg bs in let module_impls = (* TODO: at this point we'd like to filter out modules that only consist of a mli file. We cannot know that, though, because there may be a rule to generate the ml file. *) List.flatten (List.map (fun m -> let m = fixup_module_case bs.bs_path m in [ Literal m ] ) (lib.lib_modules @ lib.lib_internal_modules) ) in let priv_modules = "MODULES_" ^ cs.cs_name in let priv_c_sources = "C_SOURCES_" ^ cs.cs_name in let section = [ Set_string(false, "NAME", Literal cs.cs_name); Set_string(false, "CNAME", Literal (OASISString.capitalize_ascii cs.cs_name)); set_byte_or_native bs; Set_array(false, "MODULES", module_impls @ [gen_getvar "EXTRA_MODULES"] ); Set_array(false, priv_modules, [ Variable "MODULES" ]); Set_array(false, "OCAML_LIBS", ( List.map (fun n -> Literal n) (StrSet.elements lib_deps) @ [gen_getvar "EXTRA_OCAML_LIBS"] )); Set_array(false, "C_SOURCES", ( List.map (fun n -> Literal (get_c_object n)) (List.filter (fun n -> OASISUnixPath.check_extension n "c") bs.bs_c_sources ) )); Lines [ "C_OBJECTS = $(replacesuffixes .c, $(EXT_OBJ), $(C_SOURCES))"; "C_OBJECTS += $(OASIS_getvar EXTRA_C_OBJECTS)"; ]; Set_array(false, priv_c_sources, [ Variable "C_SOURCES" ]); set_array_cond false "OCAML_LIB_CCLIB" bs.bs_cclib; Set_array(true, "OCAML_LIB_CCLIB", [gen_getvar "EXTRA_OCAML_LIB_CCLIB"]); set_array_cond false "OCAML_LIB_DLLIB" bs.bs_dlllib; Set_array(true, "OCAML_LIB_DLLIB", [gen_getvar "EXTRA_OCAML_LIB_DLLIB"]); set_array_cond false "OCAML_LIB_DLLPATH" bs.bs_dllpath; Set_array(true, "OCAML_LIB_DLLPATH", [gen_getvar "EXTRA_OCAML_LIB_DLLPATH"]); Set_array(false, "OCAML_LIB_FLAGS", [gen_getvar "EXTRA_OCAML_LIB_FLAGS"]); Set_array(false, "OCAMLFINDFLAGS", [ gen_getvar "EXTRA_OCAMLFINDFLAGS" ]); set_array_cond false "cflags" bs.bs_ccopt; set_array_cond false "ocamlcflags" bs.bs_byteopt; set_array_cond false "ocamloptflags" bs.bs_nativeopt; Lines [ "OCAMLCFLAGS += $(ocamlcflags)"; "OCAMLOPTFLAGS += $(ocamloptflags)"; ]; (* OCAMLINCLUDES and OCAMPACKS may play a role for OCamlPack, namely for the .cmi:.mli dependency. *) Set_array(true, "OCAMLINCLUDES", ( List.map (fun n -> Literal n) (StrSet.elements lib_includes) @ [gen_getvar_for cs.cs_name "EXTRA_OCAMLINCLUDES"] )); Set_array(true, "OCAMLPACKS", ( List.map (fun n -> Literal n) ocamlpacks @ [gen_getvar_for cs.cs_name "EXTRA_OCAMLPACKS"] )); Lines [ "DefineRules() =" ]; if lib.lib_pack then Lines [ " OASIS_build_OCamlPack($(NAME), $(MODULES))"; " OASIS_build_OCamlLibrary($(NAME), $(NAME), $(C_OBJECTS))" ] else Lines [ " OASIS_build_OCamlLibrary($(NAME), $(MODULES), $(C_OBJECTS))" ]; Cond([ om_cond_of_flag bs.bs_build, [ Set_array(true, "BUILD_TARGETS", [Expression "$(OASIS_target_OCamlLibrary $(NAME))"]); Export ["BUILD_TARGETS"]; ] ], []); Set_array(true, "DEFINE_RULES", [Expression "$(DefineRules)"]); Export [ "BUILD_TARGETS"; "DEFINE_RULES"; priv_modules; priv_c_sources; ]; ] in let section = skippable "SKIP_BUILD" cs.cs_name section in let dir = StrMap.find lib_dir.dir_path map in let dir = { dir with dir_build = Section section :: dir.dir_build; } in let map = StrMap.add lib_dir.dir_path dir map in add_sources map bs.bs_path module_includes ocamlpacks pkg cs bs lib.lib_pack let inst_data ?(typ="OCamlLibrary") ?default_dest data_files = let lines1 = [ sprintf " OASIS_uninstall_data_%s($(NAME))" typ; ] in let lines2 = List.flatten (List.map (fun (src, dest) -> let dest_val = get_data_destination ?default_dest dest in [ sprintf " OASIS_install_data_%s($(NAME), %s, %s)" typ src (string_of_value (Concat dest_val)); sprintf " OASIS_reinstall_data_%s($(NAME), %s, %s)" typ src (string_of_value (Concat dest_val)); ] ) data_files ) in Lines (lines1 @ lines2) let inst_library ctx pkg map cs bs lib = let lib_dir = new_dir bs.bs_path in let findlib_parent_section = match lib.lib_findlib_parent with | None -> None | Some p -> ( try Some (List.find (fun sect -> match sect with | Library(cs,bs,lib) -> get_lib_flname cs lib = p | _ -> false ) pkg.sections ) with | Not_found -> failwith ("No section with this findlib name: " ^ p) ) in let findlib_parent_relpath = match findlib_parent_section with | None -> None | Some(Library(_,pbs,_)) -> Some(OASISUnixPath.make_relative bs.bs_path pbs.bs_path) | Some _ -> assert false in let modules = if lib.lib_pack then [ Expression "$(NAME)" ] else List.map (fun m0 -> let m = fixup_module_case bs.bs_path m0 in Literal m ) lib.lib_modules in let maybe_meta = if lib.lib_findlib_parent = None then [Literal "META"] else [] in let section = [ Set_string(false, "NAME", Literal cs.cs_name); Set_string(false, "FINDLIB_NAME", Literal (get_lib_flname cs lib)); Set_string(false, "FINDLIB_PARENT", match lib.lib_findlib_parent, findlib_parent_relpath with | None, None -> Variable "FINDLIB_NAME" | Some p, Some path -> Literal(OASISUnixPath.concat path p) | _ -> assert false); set_byte_or_native bs; Set_array(false, "INSTALL_MODULES", modules @ [ gen_getvar "EXTRA_INSTALL_MODULES" ]); Set_array(false, "INSTALL_FILES", maybe_meta @ [ Expression "$(OASIS_expand_module_files_OCamlLibrary $(INSTALL_MODULES))"; Expression "$(OASIS_expand_library_files_OCamlLibrary $(NAME))"; gen_getvar "EXTRA_INSTALL_FILES" ]); Set_array(false, "INSTALL_OPTIONAL_FILES", [ Expression "$(OASIS_expand_optional_module_files_OCamlLibrary $(INSTALL_MODULES))"; Expression "$(OASIS_expand_optional_library_files_OCamlLibrary $(NAME))"; gen_getvar "EXTRA_INSTALL_OPTIONAL_FILES" ]); Lines [ "DefineRules() ="; " OASIS_install_OCamlLibrary($(NAME), $(FINDLIB_NAME), $(FINDLIB_PARENT), $(INSTALL_FILES), $(INSTALL_OPTIONAL_FILES))"; " OASIS_uninstall_OCamlLibrary($(NAME), $(FINDLIB_NAME), $(FINDLIB_PARENT))"; " OASIS_reinstall_OCamlLibrary($(NAME), $(FINDLIB_NAME), $(FINDLIB_PARENT), $(INSTALL_FILES), $(INSTALL_OPTIONAL_FILES))"; ]; inst_data bs.bs_data_files; Cond([ om_cond_of_flag bs.bs_install, [ Set_array(true, "INSTALL_TARGETS", [Expression "$(OASIS_installtarget_OCamlLibrary $(NAME))"]); Set_array(true, "UNINSTALL_TARGETS", [Expression "$(OASIS_uninstalltarget_OCamlLibrary $(NAME))"]); Set_array(true, "REINSTALL_TARGETS", [Expression "$(OASIS_reinstalltarget_OCamlLibrary $(NAME))"]); Export [ "INSTALL_TARGETS"; "UNINSTALL_TARGETS"; "REINSTALL_TARGETS"; ]; ] ], []); Set_array(true, "DEFINE_RULES", [Expression "$(DefineRules)"]); Export [ "INSTALL_TARGETS"; "UNINSTALL_TARGETS"; "REINSTALL_TARGETS"; "DEFINE_RULES"; ]; ] in let section = skippable "SKIP_INSTALL" cs.cs_name section in let dir = StrMap.find lib_dir.dir_path map in let dir = { dir with dir_install = Section section :: dir.dir_install } in StrMap.add lib_dir.dir_path dir map let add_document ctx pkg map cs doc = let path = DocFields.path cs.cs_data in let libs_findlib = DocFields.libraries cs.cs_data in let intro = DocFields.intro cs.cs_data in let modules = DocFields.modules cs.cs_data in let texts = DocFields.texts cs.cs_data in let doc_dir = new_dir path in let map = establish map doc_dir in let _, _, library_name_of_findlib_name = OASISFindlib.findlib_mapping pkg in let libs = List.map library_name_of_findlib_name libs_findlib in let libs = List.map (rebase_lib pkg path) libs in (* let lib_includes = get_lib_includes_1 pkg path libs in *) let module_includes = List.fold_left (fun acc m -> let d = OASISUnixPath.dirname m in if OASISUnixPath.is_current_dir d then acc else StrSet.add d acc ) StrSet.empty modules in (* let ocaml_includes = StrSet.union lib_includes module_includes in *) let module_impls = List.flatten (List.map (fun m -> let m = fixup_module_case path m in [ Literal m ] ) modules ) in let text_lits = List.map (fun s -> Literal s) texts in let intro_lits = match intro with | None -> [] | Some intr -> [Literal intr] in let format = string_of_format doc.doc_format in let section = [ Set_string(false, "NAME", Literal cs.cs_name); Set_string(false, "FORMAT", Literal format); Set_array(false, "MODULES", module_impls @ [gen_getvar "EXTRA_MODULES"] ); Set_array(false, "TEXTS", text_lits @ [gen_getvar "EXTRA_TEXTS"] ); Set_array(false, "INTRO", intro_lits); Set_string(false, "TITLE", Literal doc.doc_title); Set_array(false, "OCAML_LIBS", ( List.map (fun n -> Literal n) libs @ [gen_getvar "EXTRA_OCAML_LIBS"] )); Set_array(false, "OCAMLDOCFLAGS", [ gen_getvar "EXTRA_OCAMLDOCFLAGS" ]); Set_array(false, "OCAMLDOCFLAGS_HTML", [ gen_getvar "EXTRA_OCAMLDOCFLAGS_HTML" ]); Set_array(false, "OCAMLDOCFLAGS_LATEX", [ gen_getvar "EXTRA_OCAMLDOCFLAGS_LATEX" ]); Set_array(false, "OCAMLFINDFLAGS", [ gen_getvar "EXTRA_OCAMLFINDFLAGS" ]); Set_array(true, "TEXINPUTS", [Expression "$(NAME).doc/latex"]); Lines [ "DefineRules() ="; " OASIS_build_OCamlDoc($(NAME), $(MODULES), $(TEXTS))"; ]; Cond([ om_cond_of_flag doc.doc_build, [ Set_array(true, "BUILD_DOC_TARGETS", [Expression "$(OASIS_target_OCamlDoc $(NAME), $(FORMAT))"]); Export ["BUILD_DOC_TARGETS"]; ] ], []); Set_array(true, "DEFINE_RULES", [Expression "$(DefineRules)"]); Export [ "BUILD_DOC_TARGETS"; "DEFINE_RULES"; ]; ] in let section = skippable "SKIP_DOC" cs.cs_name section in let dir = StrMap.find doc_dir.dir_path map in let dir = { dir with dir_build = Section section :: dir.dir_build } in let map = StrMap.add doc_dir.dir_path dir map in establish_in map path module_includes let inst_document ctx pkg map cs doc = let path = DocFields.path cs.cs_data in let doc_dir = new_dir path in let format = string_of_format doc.doc_format in let dest = get_data_destination (Some doc.doc_install_dir) in let data_files = doc.doc_data_files in let section = [ Set_string(false, "NAME", Literal cs.cs_name); Set_string(false, "FORMAT", Literal format); Set_string(false, "DEST", Concat dest); Set_array(false, "INSTALL_FILES", [ Expression "$(OASIS_expand_files_Document $(NAME), $(FORMAT))"; gen_getvar "EXTRA_INSTALL_FILES" ]); Lines [ "DefineRules() ="; " OASIS_install_Document($(NAME), $(INSTALL_FILES), $(DEST))"; " OASIS_uninstall_Document($(NAME))"; " OASIS_reinstall_Document($(NAME), $(INSTALL_FILES), $(DEST))"; ]; inst_data ~typ:"Document" ~default_dest:doc.doc_install_dir data_files; Cond([ om_cond_of_flag doc.doc_install, [ Set_array(true, "INSTALL_TARGETS", [Expression "$(OASIS_installtarget_Document $(NAME))"]); Set_array(true, "UNINSTALL_TARGETS", [Expression "$(OASIS_uninstalltarget_Document $(NAME))"]); Set_array(true, "REINSTALL_TARGETS", [Expression "$(OASIS_reinstalltarget_Document $(NAME))"]); Export [ "INSTALL_TARGETS"; "UNINSTALL_TARGETS"; "REINSTALL_TARGETS"; ]; ] ], []); Set_array(true, "DEFINE_RULES", [Expression "$(DefineRules)"]); Export [ "INSTALL_TARGETS"; "UNINSTALL_TARGETS"; "REINSTALL_TARGETS"; "DEFINE_RULES"; ]; ] in let section = skippable "SKIP_DOC_INSTALL" cs.cs_name section in let dir = StrMap.find doc_dir.dir_path map in let dir = { dir with dir_install = Section section :: dir.dir_install } in StrMap.add doc_dir.dir_path dir map let add_executable ctx pkg map cs bs exec = (* CHECK: what if bs.bs_path contains .. path elements? What if module names do so? *) let exec_dir = new_dir bs.bs_path in let map = establish map exec_dir in let sect = Executable(cs,bs,exec) in let trans_lib_deps = get_sorted_trans_lib_deps pkg sect bs in let clib_deps = get_lib_deps ~transitive:true ~filter:(lib_has_c_sources pkg) pkg bs in let auto_cclib = List.map (fun p -> Literal ("-L" ^ OASISUnixPath.dirname p)) (StrSet.elements clib_deps) in let auto_dllpath = List.map (fun p -> Literal (OASISUnixPath.dirname p)) (StrSet.elements clib_deps) in let module_includes = let d = OASISUnixPath.dirname exec.exec_main_is in StrSet.singleton d in let ocamlpacks = get_ocamlpacks ~transitive:false pkg bs in let trans_ocamlpacks = get_ocamlpacks ~transitive:true pkg bs in let main_module = OASISUnixPath.chop_extension exec.exec_main_is in let section = [ Set_string(false, "NAME", Literal cs.cs_name); set_byte_or_native bs; Set_string(false, "MAIN_MODULE", Literal(fixup_module_case bs.bs_path main_module)); Set_array(false, "OCAMLPACKS", ( List.map (fun n -> Literal n) trans_ocamlpacks @ [gen_getvar "EXTRA_OCAMLPACKS"] )); Set_array(false, "OCAML_LIBS", ( List.map (fun n -> Literal n) trans_lib_deps @ [gen_getvar "EXTRA_OCAML_LIBS"] )); Set_array(false, "C_SOURCES", ( List.map (fun n -> Literal (get_c_object n)) (List.filter (fun n -> OASISUnixPath.check_extension n "c") bs.bs_c_sources ) )); Lines [ "C_OBJECTS = $(replacesuffixes .c, $(EXT_OBJ), $(C_SOURCES))"; "C_OBJECTS += $(OASIS_getvar EXTRA_C_OBJECTS)"; ]; set_array_cond false "OCAML_LINK_CCLIB" bs.bs_cclib; Set_array(true, "OCAML_LINK_CCLIB", auto_cclib @ [gen_getvar "EXTRA_OCAML_LINK_CCLIB"]); set_array_cond false "OCAML_LINK_DLLIB" bs.bs_dlllib; Set_array(true, "OCAML_LINK_DLLIB", [gen_getvar "EXTRA_OCAML_LINK_DLLIB"]); set_array_cond false "OCAML_LINK_DLLPATH" bs.bs_dllpath; Set_array(true, "OCAML_LINK_DLLPATH", auto_dllpath @ [gen_getvar "EXTRA_OCAML_LINK_DLLPATH"]); Set_array(false, "OCAML_LINK_FLAGS", [ Literal "-linkpkg"; gen_getvar "EXTRA_OCAML_LINK_FLAGS" ]); Set_array(false, "OCAMLFINDFLAGS", [ gen_getvar "EXTRA_OCAMLFINDFLAGS" ]); set_array_cond false "cflags" bs.bs_ccopt; set_array_cond false "ocamlcflags" bs.bs_byteopt; set_array_cond false "ocamloptflags" bs.bs_nativeopt; Lines [ "OCAMLCFLAGS += $(ocamlcflags)"; "OCAMLOPTFLAGS += $(ocamloptflags)"; ]; Lines [ "DefineRules() ="; " OASIS_build_OCamlExecutable($(NAME), $(MAIN_MODULE), $(C_OBJECTS))"; ]; Cond([ om_cond_of_flag bs.bs_build, [ Set_array(true, "BUILD_TARGETS", [Expression "$(OASIS_target_OCamlExecutable $(NAME))"]); Export ["BUILD_TARGETS"]; ] ], []); Set_array(true, "DEFINE_RULES", [Expression "$(DefineRules)"]); Set_array(true, "OASIS_clean_list", [ Expression "$(NAME)"; Expression "$(NAME).run"; Expression "$(NAME).opt"; ]); Export [ "BUILD_TARGETS"; "DEFINE_RULES"; "OASIS_clean_list"; ]; ] in let section = skippable "SKIP_BUILD" cs.cs_name section in let dir = StrMap.find exec_dir.dir_path map in let dir = { dir with dir_build = Section section :: dir.dir_build } in let map = StrMap.add exec_dir.dir_path dir map in add_sources map bs.bs_path module_includes ocamlpacks pkg cs bs false let inst_executable ctx pkg map cs bs exec = let exec_dir = new_dir bs.bs_path in let section = [ Set_string(false, "NAME", Literal cs.cs_name); set_byte_or_native bs; Set_string(false, "INSTALL_FILE", Expression "$(OASIS_expand_file_Executable $(NAME))"); Lines [ "DefineRules() ="; " OASIS_install_Executable($(NAME), $(INSTALL_FILE))"; " OASIS_uninstall_Executable($(NAME))"; " OASIS_reinstall_Executable($(NAME), $(INSTALL_FILE))"; ]; inst_data ~typ:"Executable" bs.bs_data_files; Cond([ om_cond_of_flag bs.bs_install, [ Set_array(true, "INSTALL_TARGETS", [Expression "$(OASIS_installtarget_Executable $(NAME))"]); Set_array(true, "UNINSTALL_TARGETS", [Expression "$(OASIS_uninstalltarget_Executable $(NAME))"]); Set_array(true, "REINSTALL_TARGETS", [Expression "$(OASIS_reinstalltarget_Executable $(NAME))"]); Export [ "INSTALL_TARGETS"; "UNINSTALL_TARGETS"; "REINSTALL_TARGETS"; ]; ] ], []); Set_array(true, "DEFINE_RULES", [Expression "$(DefineRules)"]); Export [ "INSTALL_TARGETS"; "UNINSTALL_TARGETS"; "REINSTALL_TARGETS"; "DEFINE_RULES"; ]; ] in let section = skippable "SKIP_INSTALL" cs.cs_name section in let dir = StrMap.find exec_dir.dir_path map in let dir = { dir with dir_install = Section section :: dir.dir_install } in StrMap.add exec_dir.dir_path dir map let define_build_rules = Lines [ "DefineBuildRules() ="; " OASIS_run($(DEFINE_RULES))"; ] let define_build_rules_empty = Lines [ "DefineBuildRules() ="; ] let define_install_rules = Lines [ "DefineInstallRules() ="; " OASIS_run($(DEFINE_RULES))"; ] let define_install_rules_empty = Lines [ "DefineInstallRules() ="; ] let finish_definitions map = (* add headers and footers *) StrMap.map (fun dir -> let build = if dir.dir_build = [] then [ Set_array(false, "BUILD_TARGETS", []); Set_array(false, "BUILD_DOC_TARGETS", []); Set_string(false, "ENABLE_SYNTAX_CAMLP4O", Literal "false"); define_build_rules_empty; Lines [ "" ]; ] else let header = [ Set_array(false, "BUILD_TARGETS", []); Set_array(false, "BUILD_DOC_TARGETS", []); Set_string(false, "ENABLE_SYNTAX_CAMLP4O", Literal "false"); Set_array(false, "DEFINE_RULES", []); Lines [ "" ]; ] in let footer = [ Lines [ "" ]; define_build_rules; Set_string(false, "OCAMLINCLUDES", Expression "."); (* "." is required for OCAMLDEP_MODULES_ENABLED! *) ] in header @ dir.dir_build @ footer in let build_accu = dir.dir_accu @ [ Lines [ "if $(ENABLE_SYNTAX_CAMLP4O)"; " OCAMLFINDFLAGS += -syntax camlp4o"; " export OCAMLFINDFLAGS"; "" ] ] in let install = if dir.dir_install = [] then [ Set_array(false, "INSTALL_TARGETS", []); Set_array(false, "UNINSTALL_TARGETS", []); Set_array(false, "REINSTALL_TARGETS", []); define_install_rules_empty; Lines [ "" ]; ] else let header = [ Set_array(false, "INSTALL_TARGETS", []); Set_array(false, "UNINSTALL_TARGETS", []); Set_array(false, "REINSTALL_TARGETS", []); Set_array(false, "DEFINE_RULES", []); Lines [ "" ]; ] in let footer = [ Lines [ "" ]; define_install_rules; ] in header @ dir.dir_install @ footer in { dir with dir_build = build @ build_accu; dir_install = install; } ) map let delete_setup() = let p = OASISUnixPath.concat OASISUnixPath.current_dir_name "_oasis_setup.om" in let hp = OASISHostPath.of_unix p in if Sys.file_exists hp then Sys.remove hp let write_files map = delete_setup(); write_const_file ~skip_existing:true (OASISUnixPath.concat OASISUnixPath.current_dir_name "OMakeroot") OMakeData.omakeroot; write_const_file (OASISUnixPath.concat OASISUnixPath.current_dir_name "_oasis_lib.om") OMakeData.oasis_lib_om; StrMap.iter (fun _ dir -> let omf_path = (OASISUnixPath.concat dir.dir_path "OMakefile") in let omf = if dir.dir_top then OMakeData.omakefile_top else OMakeData.omakefile_nontop in write_const_file ~skip_existing:true omf_path omf; let hier_path = (OASISUnixPath.concat dir.dir_path "_oasis_hier.om") in let hier = [ Set_array(false, "OASIS_SUBDIRS", List.map (fun s -> Literal (OASISUnixPath.make_relative dir.dir_path s ) ) dir.dir_sub) ] in write_omake_file hier_path hier; let build_path = (OASISUnixPath.concat dir.dir_path "_oasis_build.om") in let install_path = (OASISUnixPath.concat dir.dir_path "_oasis_install.om") in write_omake_file build_path dir.dir_build; write_omake_file install_path dir.dir_install; ) map let equip_project ctxt pkg = Printexc.record_backtrace true; try let map = List.fold_left (fun acc -> function | Library (cs, bs, lib) -> let acc1 = add_library ctxt pkg acc cs bs lib in inst_library ctxt pkg acc1 cs bs lib | Executable (cs, bs, exec) -> let acc1 = add_executable ctxt pkg acc cs bs exec in inst_executable ctxt pkg acc1 cs bs exec | Object (cs, bs, lib) -> (* TODO *) establish acc (new_dir bs.bs_path) | Doc(cs,doc) -> let acc1 = add_document ctxt pkg acc cs doc in inst_document ctxt pkg acc1 cs doc | _ -> acc ) (new_dir_map()) pkg.sections in let map = finish_definitions map in write_files map with | err -> let bt = Printexc.get_backtrace() in eprintf "Backtrace: %s\n%!" bt; raise err oasis-0.4.11/src/plugins/omake/OMakeData.mlify0000644000175000017500000000046213261073606020437 0ustar gildorgildorVarString omakesys_ml "OMakeSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" VarString oasis_lib_om "oasis_lib.om" VarString omakeroot "OMakeroot.om" VarString omakefile_top "OMakefile_top.om" VarString omakefile_nontop "OMakefile_nontop.om" oasis-0.4.11/src/plugins/omake/MANUAL-template.mkd0000644000175000017500000000042613261073606021072 0ustar gildorgildorThis plugin uses OMake to generate a build system. You need to specify `OMake` for the `BuildType`. It is also possible to use this plugin for `Document.Type` and as a `InstallType`. Package fields: $ListOMakeBuildPackageFields Document fields: $ListOMakeDocDocumentFields oasis-0.4.11/src/plugins/ocamlbuild/0000755000175000017500000000000013261073606016624 5ustar gildorgildoroasis-0.4.11/src/plugins/ocamlbuild/OCamlbuildSys.mod0000644000175000017500000000007713261073606022043 0ustar gildorgildorOCamlbuildCommon.ml OCamlbuildPlugin.ml OCamlbuildDocPlugin.ml oasis-0.4.11/src/plugins/ocamlbuild/OCamlbuildPlugin.ml0000644000175000017500000010645513261073606022363 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Build using ocamlbuild @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OASISUtils open OASISString open BaseEnv open OCamlbuildCommon open BaseStandardVar let cond_targets_hook = ref (fun lst -> lst) let build ~ctxt args pkg argv = (* Return the filename in build directory *) let in_build_dir fn = Filename.concat (build_dir argv) fn in (* Return the unix filename in host build directory *) let in_build_dir_of_unix fn = in_build_dir (OASISHostPath.of_unix fn) in let cond_targets = List.fold_left (fun acc -> function | Library (cs, bs, lib) when var_choose bs.bs_build -> begin let evs, unix_files = BaseBuilt.of_library in_build_dir_of_unix (cs, bs, lib) in let tgts = List.flatten (List.filter (fun l -> l <> []) (List.map (List.filter (fun fn -> ends_with ~what:".cma" fn || ends_with ~what:".cmxs" fn || ends_with ~what:".cmxa" fn || ends_with ~what:(ext_lib ()) fn || ends_with ~what:(ext_dll ()) fn)) unix_files)) in match tgts with | _ :: _ -> (evs, tgts) :: acc | [] -> failwithf (f_ "No possible ocamlbuild targets for library %s") cs.cs_name end | Object (cs, bs, obj) when var_choose bs.bs_build -> begin let evs, unix_files = BaseBuilt.of_object in_build_dir_of_unix (cs, bs, obj) in let tgts = List.flatten (List.filter (fun l -> l <> []) (List.map (List.filter (fun fn -> ends_with ~what:".cmo" fn || ends_with ~what:".cmx" fn)) unix_files)) in match tgts with | _ :: _ -> (evs, tgts) :: acc | [] -> failwithf (f_ "No possible ocamlbuild targets for object %s") cs.cs_name end | Executable (cs, bs, exec) when var_choose bs.bs_build -> begin let evs, _, _ = BaseBuilt.of_executable in_build_dir_of_unix (cs, bs, exec) in let target ext = let unix_tgt = (OASISUnixPath.concat bs.bs_path (OASISUnixPath.chop_extension exec.exec_main_is))^ext in let evs = (* Fix evs, we want to use the unix_tgt, without copying *) List.map (function | BaseBuilt.BExec, nm, _ when nm = cs.cs_name -> BaseBuilt.BExec, nm, [[in_build_dir_of_unix unix_tgt]] | ev -> ev) evs in evs, [unix_tgt] in (* Add executable *) let acc = match bs.bs_compiled_object with | Native -> (target ".native") :: acc | Best when bool_of_string (is_native ()) -> (target ".native") :: acc | Byte | Best -> (target ".byte") :: acc in acc end | Library _ | Object _ | Executable _ | Test _ | SrcRepo _ | Flag _ | Doc _ -> acc) [] (* Keep the pkg.sections ordered *) (List.rev pkg.sections); in (* Check and register built files *) let check_and_register (bt, bnm, lst) = List.iter (fun fns -> if not (List.exists OASISFileUtil.file_exists_case fns) then failwithf (fn_ "Expected built file %s doesn't exist." "None of expected built files %s exists." (List.length fns)) (String.concat (s_ " or ") (List.map (Printf.sprintf "'%s'") fns))) lst; (BaseBuilt.register ~ctxt bt bnm lst) in (* Run the hook *) let cond_targets = !cond_targets_hook cond_targets in (* Run a list of target... *) run_ocamlbuild ~ctxt {args with extra = List.flatten (List.map snd cond_targets) @ args.extra} argv; (* ... and register events *) List.iter check_and_register (List.flatten (List.map fst cond_targets)) let clean ~ctxt pkg args = run_clean ~ctxt args; List.iter (function | Library (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister ~ctxt BaseBuilt.BExecLib cs.cs_name | _ -> ()) pkg.sections (* END EXPORT *) open OASISFileTemplate open OASISUtils open OASISMessage open OASISGettext open OASISPlugin open OASISTypes open MyOCamlbuildBase open Ocamlbuild_plugin open OCamlbuildId let plugin = `Build, name, Some version let self_id, all_id = Build.create plugin let pure_interface_test = OASISFeatures.package_test (OASISFeatures.create "pure_interface" ~plugin OASISFeatures.alpha (fun () -> s_ "Allow to have module with only .mli file.")) let pivot_data = data_new_property plugin let only_h_files lst = List.filter (fun fn -> OASISUnixPath.check_extension fn "h") lst let only_c_files lst = List.filter (fun fn -> OASISUnixPath.check_extension fn "c") lst let add_tags tag_t tgts tags = let quote_target fn = let test_char = String.contains fn in if test_char '*' || test_char '?' || test_char '{' || test_char '[' then "<"^fn^">" else "\""^fn^"\"" in List.fold_left (fun tag_t tgt -> List.fold_left (fun tag_t tag -> ((quote_target tgt)^": "^tag) :: tag_t) tag_t tags) tag_t tgts let prepend_bs_path bs fn = Tag.filename_concat bs.bs_path fn let bs_paths bs files = let subdirs = List.rev_map OASISUnixPath.dirname (List.rev_map (prepend_bs_path bs) files) in (* Unique elements *) SetString.elements (SetString.of_list (List.rev_map OASISUnixPath.reduce (bs.bs_path :: subdirs))) let bs_tags pkg sct cs bs src_dirs src_internal_dirs link_tgt ctxt tag_t myocamlbuild_t = let link_pkg = (* Only link findlib package with executable *) match sct with | Executable _ -> true | Library _ | Object _ | Flag _ | Test _ | SrcRepo _ | Doc _ -> false in let src_tgts = List.rev_append (* .ml files *) (List.rev_map (fun dn -> Tag.filename_concat dn "*.ml{,i,y}") (src_dirs @ src_internal_dirs)) (* .c files *) (List.map (prepend_bs_path bs) (only_c_files bs.bs_c_sources)) in let clib_tgts = if bs.bs_c_sources <> [] then (List.rev_map (fun fmt -> (prepend_bs_path bs) (Printf.sprintf fmt cs.cs_name)) [ (* Unix *) "dll%s_stubs.so"; "lib%s_stubs.a"; (* Win32 *) "dll%s_stubs.dll"; "lib%s_stubs.lib"; ]) else [] in (* Manipulate ocamlbuild's spec *) let atom s = A s in let path s = P s in let mkspec pre_arg tr_arg lst = S (List.fold_left (fun acc arg -> match pre_arg with | Some s -> s :: arg :: acc | None -> arg :: acc) [] (List.rev_map tr_arg lst)) in (* Create flag for extra command line option *) let ctxt, tag_t, myocamlbuild_t = List.fold_left (fun ((ctxt, tag_t, myocamlbuild_t) as acc) (basename, tgts, tags, pre_arg, tr_arg, args_cond) -> if args_cond <> [OASISExpr.EBool true, []] then begin let tag_name = (* e.g. oasis_library_foo_ccopt *) varname_concat "oasis_" (varname_concat (varname_of_string (OASISSection.string_of_section sct)) basename) in let all_tags = tag_name :: tags in let cond_specs = List.map (fun (cond, lst) -> cond, mkspec pre_arg tr_arg lst) args_cond in let flags = (all_tags, cond_specs) :: myocamlbuild_t.flags in let tag_t = add_tags tag_t tgts [tag_name] in ctxt, tag_t, {myocamlbuild_t with flags = flags} end else begin acc end) (ctxt, tag_t, myocamlbuild_t) ([ "ccopt", src_tgts, ["compile"], Some (A"-ccopt"), atom, bs.bs_ccopt; "cclib", [link_tgt], ["link"], Some (A"-cclib"), atom, bs.bs_cclib; "cclib", clib_tgts, ["ocamlmklib"; "c"], None, atom, bs.bs_cclib; "dlllib", [link_tgt], ["link"; "byte"], Some (A"-dllib"), path, bs.bs_dlllib; "dllpath", [link_tgt], ["link"; "byte"], Some (A"-dllpath"), path, bs.bs_dllpath; "dllpath", clib_tgts, ["ocamlmklib"; "c"], Some(A"-dllpath"), path, bs.bs_dllpath; ] @ (List.fold_left (fun acc flg -> ("byte", link_tgt :: src_tgts, ["ocaml"; flg; "byte"], None, atom, bs.bs_byteopt) :: ("native", link_tgt :: src_tgts, ["ocaml"; flg; "native"], None, atom, bs.bs_nativeopt) :: acc) [] ["compile"; "ocamldep"; "link"])) in (* Add tag for dependency on C part of the library *) let ctxt, tag_t, myocamlbuild_t = if bs.bs_c_sources <> [] then begin (* Generate .clib files *) let fn_clib = OASISHostPath.add_extension (prepend_bs_path bs ("lib"^(nm_libstubs cs.cs_name))) "clib" in add_file (template_make fn_clib comment_ocamlbuild [] (List.map (fun fn -> (Filename.chop_extension fn)^".o") (only_c_files bs.bs_c_sources)) []) ctxt, add_tags tag_t [link_tgt] [tag_libstubs cs.cs_name], {myocamlbuild_t with lib_c = ((cs.cs_name, bs.bs_path, List.map (fun fn -> prepend_bs_path bs fn) (only_h_files bs.bs_c_sources)) :: myocamlbuild_t.lib_c)} end else ctxt, tag_t, myocamlbuild_t in (* Add build depends tags *) let tag_t = let mp = OASISBuildSection.transitive_build_depends pkg in let supports_ocamlfind = ocamlbuild_supports_ocamlfind pkg in add_tags tag_t (if link_pkg then link_tgt :: src_tgts else src_tgts) (List.sort String.compare (List.fold_left (fun acc -> function | FindlibPackage (findlib_pkg, _) -> (if supports_ocamlfind then ("package("^findlib_pkg^")") else ("pkg_"^findlib_pkg) ) :: acc | InternalLibrary nm -> ("use_"^nm) :: acc) [] (OASISSection.MapSection.find sct mp))) in let ctxt = (* TODO: merge with qstr_cmplt *) set_error (not (List.mem (ExternalTool "ocamlbuild") bs.bs_build_tools)) (Printf.sprintf (f_ "ocamlbuild in field BuildTools of %s is mandatory") (OASISSection.string_of_section sct)) ctxt in ctxt, tag_t, myocamlbuild_t module MapDirs = Map.Make (struct type t = [`Library of string | `Object of string | `Executable of string] let compare t1 t2 = match t1, t2 with | `Library _, `Executable _ | `Library _, `Object _ | `Object _, `Executable _ -> -1 | `Object _, `Library _ | `Executable _, `Library _ | `Executable _, `Object _ -> 1 | `Library s1, `Library s2 | `Object s1, `Object s2 | `Executable s1, `Executable s2 -> String.compare s1 s2 end) let compute_map_dirs pkg = let add k dirs internal_dirs mp = let src_dirs, src_internal_dirs = try MapDirs.find k mp with Not_found -> SetString.empty, SetString.empty in let add_dirs st dirs = SetString.add_list st dirs in MapDirs.add k (add_dirs src_dirs dirs, add_dirs src_internal_dirs internal_dirs) mp in let map_dirs = List.fold_left (fun mp -> function | Library (cs, bs, lib) -> add (`Library cs.cs_name) (* All paths accessed from within the library *) (bs_paths bs lib.lib_modules) (* All paths accessed only by the library *) (bs_paths bs lib.lib_internal_modules) mp | Object (cs, bs, obj) -> add (`Object cs.cs_name) (* All paths accessed from within the (potentially packed) object *) (bs_paths bs obj.obj_modules) [] (* No internal paths *) mp | Executable (cs, bs, exec) -> add (`Executable cs.cs_name) (bs_paths bs [exec.exec_main_is]) [] (* No internal paths *) mp | Flag _ | SrcRepo _ | Test _ | Doc _ -> mp) MapDirs.empty pkg.sections in (* Now get rid of internal paths that are also non internal. *) MapDirs.map (fun (src_dirs, src_internal_dirs) -> SetString.elements src_dirs, SetString.elements (SetString.diff src_internal_dirs src_dirs)) map_dirs let compute_includes map_dirs pkg = let add_includes dir set_dirs includes = (* Not self-dependent *) let set_dirs = SetString.diff set_dirs (SetString.singleton dir) in let pre_dirs = try MapString.find dir includes with Not_found -> SetString.empty in MapString.add dir (SetString.union set_dirs pre_dirs) includes in let add_map_dirs k bs includes = let dep_dirs = (* Source dirs of dependent libraries *) List.fold_left (fun set -> function | InternalLibrary nm -> let src_dirs, _ = try MapDirs.find (`Library nm) map_dirs with Not_found -> MapDirs.find (`Object nm) map_dirs in SetString.add_list set src_dirs | FindlibPackage _ -> set) SetString.empty bs.bs_build_depends in let self_dirs = (* Source dirs *) let src_dirs, src_internal_dirs = MapDirs.find k map_dirs in SetString.add_list (SetString.of_list src_dirs) src_internal_dirs in let all_dirs = SetString.union dep_dirs self_dirs in let all_dirs = (* No need to include the current dir. *) SetString.filter (fun dn -> not (OASISUnixPath.is_current_dir dn)) all_dirs in (* All self_dirs depends on all_dirs *) SetString.fold (fun dir includes -> add_includes dir all_dirs includes) self_dirs includes in let includes = List.fold_left (fun includes -> function | Library (cs, bs, _) -> add_map_dirs (`Library cs.cs_name) bs includes | Object (cs, bs, _) -> add_map_dirs (`Object cs.cs_name) bs includes | Executable (cs, bs, _) -> add_map_dirs (`Executable cs.cs_name) bs includes | Flag _ | SrcRepo _ | Test _ | Doc _ -> includes) MapString.empty pkg.sections in MapString.fold (fun dir include_dirs acc -> if SetString.empty <> include_dirs then (dir, SetString.elements include_dirs) :: acc else acc) includes [] (* Check if the given files list only contains .mli. *) let is_pure_interface (base_fn, fn_lst) = let rec is_pure_interface_aux = (* TODO: this needs to be refine because sometime we don't have the .ml file * because it is generated (BaseData.ml) but we have the .mli. *) function | [fn] -> OASISString.ends_with ~what:".mli" fn | fn :: tl -> OASISString.ends_with ~what:".mli" fn && is_pure_interface_aux tl | [] -> false in is_pure_interface_aux fn_lst let add_ocamlbuild_files ctxt pkg = let map_dirs = compute_map_dirs pkg in let ctxt, tag_t, myocamlbuild_t = List.fold_left (fun (ctxt, tag_t, myocamlbuild_t) -> function | Library (cs, bs, lib) as sct -> begin (* Extract content for libraries *) (* All paths of the library *) let src_dirs, src_internal_dirs = MapDirs.find (`Library cs.cs_name) map_dirs in (* Generated library *) let target_lib = let ext = match bs.bs_compiled_object with | Best -> "{cma,cmxa}" | Byte -> "cma" | Native -> "cmxa" in prepend_bs_path bs (OASISUnixPath.add_extension cs.cs_name ext) in (* Start comment *) let tag_t = (Printf.sprintf "# Library %s" cs.cs_name) :: tag_t in (* Sources of the library. *) let sources = OASISLibrary.source_unix_files ~ctxt:ctxt.ctxt (cs, bs, lib) (fun ufn -> OASISFileUtil.file_exists_case (OASISHostPath.of_unix ufn)) in let intf_module_list, impl_module_list = let to_module (base_fn, _) = OASISString.capitalize_ascii (Filename.basename base_fn) in let intf_module_list = if pure_interface_test pkg then List.map to_module (List.filter is_pure_interface sources) else [] in List.partition (fun modul -> List.mem modul intf_module_list) (lib.lib_modules @ lib.lib_internal_modules) in (* Add dependency of cmxs to their own library: used at link time when there is C code *) let tag_t = add_tags tag_t [prepend_bs_path bs (OASISUnixPath.add_extension cs.cs_name "cmxs")] ["use_"^cs.cs_name] in let tag_t = if lib.lib_pack then add_tags tag_t (List.rev_map (fun (base_fn, _) -> OASISUnixPath.add_extension base_fn "cmx") sources) ["for-pack("^OASISString.capitalize_ascii cs.cs_name^")"] else tag_t in let ctxt, tag_t, myocamlbuild_t = bs_tags pkg sct cs bs src_dirs src_internal_dirs target_lib ctxt tag_t myocamlbuild_t in let myocamlbuild_t = {myocamlbuild_t with lib_ocaml = (cs.cs_name, List.filter (fun fn -> not (OASISUnixPath.is_current fn)) src_dirs, intf_module_list) :: myocamlbuild_t.lib_ocaml} in let () = if lib.lib_modules = [] then warning ~ctxt:ctxt.ctxt (f_ "No exported module defined for library %s") cs.cs_name; in let ctxt = (* Generate .mllib *) let fn_base = prepend_bs_path bs cs.cs_name in let mllib = OASISHostPath.add_extension fn_base "mllib" in let mldylib = OASISHostPath.add_extension fn_base "mldylib" in let mlpack = OASISHostPath.add_extension fn_base "mlpack" in let mllib_template_lines = (* mllib contains either the name of the pack or the list * of modules. *) if lib.lib_pack then [ OASISString.capitalize_ascii cs.cs_name ] else impl_module_list in let ctxt = add_file (template_make mllib comment_ocamlbuild [] mllib_template_lines []) ctxt in let ctxt = add_file (template_make mldylib comment_ocamlbuild [] mllib_template_lines []) ctxt in if lib.lib_pack then begin (* generate .mlpack for packed libraries *) add_file (template_make mlpack comment_ocamlbuild [] impl_module_list []) ctxt end else begin (* make sure there is no conflicting mlpack file *) {ctxt with other_actions = (fun ()-> if OASISFileUtil.file_exists_case mlpack then OASISMessage.error ~ctxt:ctxt.ctxt (f_ "Conflicting file '%s' and '%s' \ exists, remove '%s'.") mllib mlpack mlpack) :: ctxt.other_actions} end in ctxt, tag_t, myocamlbuild_t end | Object (cs, bs, obj) as sct -> begin (* Extract content for objects *) (* All paths of the library *) let src_dirs, src_internal_dirs = MapDirs.find (`Object cs.cs_name) map_dirs in (* Generated library *) let target_lib = let ext = match bs.bs_compiled_object with | Best -> "{cmo,cmx}" | Byte -> "cmo" | Native -> "cmx" in prepend_bs_path bs (OASISUnixPath.add_extension cs.cs_name ext) in (* Start comment *) let tag_t = (Printf.sprintf "# Object %s" cs.cs_name) :: tag_t in let tag_t = if List.length obj.obj_modules <> 1 then let base_sources = OASISObject.source_unix_files ~ctxt:ctxt.ctxt (cs, bs, obj) (fun ufn -> OASISFileUtil.file_exists_case (OASISHostPath.of_unix ufn)) in add_tags tag_t (List.rev_map (fun (base_fn, _) -> OASISUnixPath.add_extension base_fn "cmx") base_sources) ["for-pack("^OASISString.capitalize_ascii cs.cs_name^")"] else tag_t in let ctxt, tag_t, myocamlbuild_t = bs_tags pkg sct cs bs src_dirs src_internal_dirs target_lib ctxt tag_t myocamlbuild_t in let myocamlbuild_t = {myocamlbuild_t with lib_ocaml = (cs.cs_name, List.filter (fun fn -> not (OASISUnixPath.is_current fn)) src_dirs, []) :: myocamlbuild_t.lib_ocaml} in let () = if obj.obj_modules = [] then warning ~ctxt:ctxt.ctxt (f_ "No exported module defined for object %s") cs.cs_name; in let ctxt = match obj.obj_modules with | [ _ ] -> ctxt | _ -> (* generate mlpack file *) let fn_base = prepend_bs_path bs cs.cs_name in let fn = OASISHostPath.add_extension fn_base "mlpack" and not_fn = OASISHostPath.add_extension fn_base "ml" in let ctxt = add_file (template_make fn comment_ocamlbuild [] obj.obj_modules []) ctxt in {ctxt with other_actions = (fun () -> if OASISFileUtil.file_exists_case not_fn then OASISMessage.error ~ctxt:ctxt.ctxt (f_ "Conflicting file '%s' and '%s' \ exists, remove '%s'.") fn not_fn not_fn) :: ctxt.other_actions} in ctxt, tag_t, myocamlbuild_t end | Executable (cs, bs, exec) as sct -> begin (* Extract content for executables *) let src_dirs, src_internal_dirs = MapDirs.find (`Executable cs.cs_name) map_dirs in let target_exec = let ext = match bs.bs_compiled_object with | Best -> "{native,byte}" | Byte -> "byte" | Native -> "native" in prepend_bs_path bs (OASISUnixPath.replace_extension (exec.exec_main_is) ext) in let tag_t = (Printf.sprintf "# Executable %s" cs.cs_name) :: tag_t in let ctxt, tag_t, myocamlbuild_t = bs_tags pkg sct cs bs src_dirs src_internal_dirs target_exec ctxt tag_t myocamlbuild_t in let tag_t = if exec.exec_custom then add_tags tag_t [target_exec] ["custom"] else tag_t in ctxt, tag_t, myocamlbuild_t end | Flag _ | SrcRepo _ | Test _ | Doc _ -> ctxt, tag_t, myocamlbuild_t) (ctxt, [], {lib_ocaml = []; lib_c = []; flags = []; includes = []}) pkg.sections in (* Filter duplicate and reverse content in tag_t. *) let tag_t = snd (List.fold_left (fun (prev_tag, acc) tag -> (* Don't remove comment but remove already seen tag. *) if (String.length tag > 0 && tag.[0] = '#') || not (SetString.mem tag prev_tag) then ( SetString.add tag prev_tag, tag :: acc ) else (prev_tag, acc)) (SetString.empty, []) tag_t) in let myocamlbuild_t = (* Fix section order *) { lib_ocaml = List.rev myocamlbuild_t.lib_ocaml; lib_c = List.rev myocamlbuild_t.lib_c; flags = List.rev myocamlbuild_t.flags; includes = compute_includes map_dirs pkg; } in let tag_t = "# 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" :: "true: annot, bin_annot" :: add_tags tag_t ["_darcs"; ".git"; ".hg"; ".bzr"; "**/.svn"] ["not_hygienic"; "-traverse"] in let ctxt = List.fold_left (fun ctxt tmpl -> add_file tmpl ctxt) ctxt [ (* Generate _tags *) template_make "_tags" comment_ocamlbuild [] tag_t []; (* Generate myocamlbuild.ml *) template_of_mlfile "myocamlbuild.ml" [] [ OASISData.oasissyslight_ml; BaseData.basesysenvironment_ml; OCamlbuildData.myocamlbuild_ml; "open Ocamlbuild_plugin;;"; ( Format.fprintf Format.str_formatter "@[let package_default =@ %a@,@];;" (OASISDataNotation.pp_odn ~opened_modules:["Ocamlbuild_plugin"]) (MyOCamlbuildBase.odn_of_t myocamlbuild_t); Format.flush_str_formatter () ); ""; Printf.sprintf "let conf = {MyOCamlbuildFindlib.no_automatic_syntax = %b}" (OASISFeatures.package_test OASISFeatures.no_automatic_syntax pkg); ""; "let dispatch_default = \ MyOCamlbuildBase.dispatch_default conf package_default;;"; ""; ] ["Ocamlbuild_plugin.dispatch dispatch_default;;"]; ] in ctxt let generator = ocamlbuild_common_generator pivot_data OASISPackage.schema all_id let doit ctxt pkg = let args, ctxt = args_ocamlbuild_common ctxt pkg (generator pkg.schema_data) in let ctxt = add_ocamlbuild_files ctxt pkg in ctxt, { chng_moduls = [OCamlbuildData.ocamlbuildsys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt build "OCamlbuildPlugin.build" args (OCamlbuildCommon.odn_of_args); chng_clean = Some (OASISDataNotation.func clean "OCamlbuildPlugin.clean"); chng_distclean = None; } let qstrt_completion pkg = fix_build_tools (ExternalTool "ocamlbuild") pkg let init () = OCamlbuildId.init (); Build.register_act self_id doit; register_quickstart_completion all_id qstrt_completion; register_generator_package all_id pivot_data generator oasis-0.4.11/src/plugins/ocamlbuild/OCamlbuildId.ml0000644000175000017500000000374013261073606021452 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Identity of OCamlbuild plugin @author Sylvain Le Gall *) let name = "OCamlbuild" let version = OASISConf.version_short (* END EXPORT *) open OASISPlugin let init () = register_help (`All, name, Some version) {(help_default OCamlbuildData.readme_template_mkd) with help_order = 20} oasis-0.4.11/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml0000644000175000017500000002027613261073606023005 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Create documentation using ocamlbuild .odocl files @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OCamlbuildCommon type run_t = { args: args; run_path: unix_filename; } let doc_build ~ctxt run _ (cs, _) argv = let index_html = OASISUnixPath.make [ run.run_path; cs.cs_name^".docdir"; "index.html"; ] in let tgt_dir = OASISHostPath.make [ build_dir argv; OASISHostPath.of_unix run.run_path; cs.cs_name^".docdir"; ] in run_ocamlbuild ~ctxt {run.args with extra = index_html :: run.args.extra} argv; List.iter (fun glb -> match OASISFileUtil.glob ~ctxt (Filename.concat tgt_dir glb) with | (_ :: _) as filenames -> BaseBuilt.register ~ctxt BaseBuilt.BDoc cs.cs_name [filenames] | [] -> ()) ["*.html"; "*.css"] let doc_clean ~ctxt _ _ (cs, _) argv = run_clean ~ctxt argv; BaseBuilt.unregister ~ctxt BaseBuilt.BDoc cs.cs_name (* END EXPORT *) open OASISFileTemplate open OASISValues open OASISUtils open OASISPlugin open OASISSchema open OCamlbuildId let plugin = `Doc, name, Some version type t = { path: unix_dirname; modules: string list; libraries: findlib_full list; intro: unix_filename option; flags: string list; ocamlbuild_common_args: args; } let pivot_data = data_new_property plugin let pivot_sub_data = data_new_property plugin let self_id, all_id = Doc.create plugin let new_field nm ?default vl hlp sync = new_field OASISDocument.schema all_id nm ?default vl (fun () -> s_ hlp) pivot_data sync let path = new_field "Path" directory (ns_ "Top level directory for building ocamldoc documentation") (fun _ t -> t.path) let modules = new_field "Modules" ~default:[] modules (ns_ "List of OCaml modules used to generate ocamldoc documentation") (fun _ t -> t.modules) let libraries = new_field "Libraries" ~default:[] (comma_separated findlib_full) (ns_ "Findlib names of internal libraries used to generate the ocamldoc \ documentation") (fun _ t -> t.libraries) (* TODO: the following 2 options require to edit _tags after OCamlbuildDoc *) (* let intro = new_field ~default:None "Intro" (opt file) (ns_ "OCamldoc formatted file used to generate index.html of the ocamldoc \ documentation") (fun _ t -> t.intro) let flags = new_field ~default:[] "Flags" space_separated (ns_ "OCamldoc flags") (fun _ t -> t.flags) *) (* TODO: use -t for title *) let generator = let generator_common = (* Register fields. *) ocamlbuild_common_generator pivot_sub_data OASISDocument.schema all_id in fun data pkg -> let path = path data in let modules_from_libraries = (* Convert findlib name to internal library and compute * the module they shipped. *) let lib_of_findlib = let _, _, library_name_of_findlib_name = OASISFindlib.findlib_mapping pkg in let lib_of_name = List.fold_left (fun mp -> function | Library ({cs_name = name; _}, bs, lib) -> MapString.add name (bs, lib) mp | _ -> mp) MapString.empty pkg.sections in fun fndlb_nm -> let nm = library_name_of_findlib_name fndlb_nm in MapString.find nm lib_of_name in (* Fetch modules from internal libraries *) List.flatten (List.map (fun fndlb_nm -> let bs, lib = lib_of_findlib fndlb_nm in (* Rebase modules in the doc path *) List.map (fun modul -> OASISUnixPath.make_relative path (OASISUnixPath.concat bs.bs_path modul)) lib.lib_modules) (libraries data)) in let modules_from_doc = (* Fetch modules defined directly *) modules data in let modules = modules_from_libraries @ modules_from_doc in { path = path; modules = modules; libraries = libraries data; intro = None; flags = []; ocamlbuild_common_args = generator_common data; } let doit ctxt pkg (cs, doc) = let t = generator cs.cs_data pkg in let ctxt = (* Create .odocl file *) add_file (template_make (OASISHostPath.add_extension (Filename.concat t.path cs.cs_name) "odocl") comment_ocamlbuild [] t.modules []) ctxt in let ctxt = (* Checks consistency of options *) (* TODO: merge with qstrt_completion *) List.fold_left (fun ctxt f -> f ctxt) ctxt [ set_error (not (List.mem (ExternalTool "ocamldoc") doc.doc_build_tools)) (Printf.sprintf (f_ "ocamldoc in field BuildTools of document %s is mandatory.") cs.cs_name); set_error (not (List.mem (ExternalTool "ocamlbuild") doc.doc_build_tools)) (Printf.sprintf (f_ "ocamlbuild in field BuildTools of document %s is mandatory.") cs.cs_name); set_error (t.modules = []) (Printf.sprintf (f_ "No module defined for document %s.") cs.cs_name); ] in let args, ctxt = args_ocamlbuild_common ctxt pkg t.ocamlbuild_common_args in let run = {run_path = t.path; args = args} in let odn_of_run_t (v: run_t) = OASISDataNotation.REC ("OCamlbuildDocPlugin", [ ("args", OCamlbuildCommon.odn_of_args v.args); ("run_path", (odn_of_unix_filename v.run_path)) ]) in ctxt, { chng_moduls = [OCamlbuildData.ocamlbuildsys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt doc_build "OCamlbuildDocPlugin.doc_build" run odn_of_run_t; chng_clean = Some (OASISDataNotation.func_with_arg_ctxt doc_clean "OCamlbuildDocPlugin.doc_clean" run odn_of_run_t); chng_distclean = None; } let qstrt_completion pkg = List.fold_left (fun pkg tool -> fix_build_tools tool pkg) pkg [ExternalTool "ocamlbuild"; ExternalTool "ocamldoc"] let init () = OCamlbuildId.init (); Doc.register_act self_id doit; register_quickstart_completion all_id qstrt_completion oasis-0.4.11/src/plugins/ocamlbuild/OCamlbuildData.mlify0000644000175000017500000000024413261073606022473 0ustar gildorgildorVarString myocamlbuild_ml "MyOCamlbuildSys.ml" VarString ocamlbuildsys_ml "OCamlbuildSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/plugins/ocamlbuild/OCamlbuildCommon.ml0000644000175000017500000001760313261073606022351 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Functions common to OCamlbuild build and doc plugin *) open OASISGettext open BaseEnv open BaseStandardVar open OASISTypes type args = { plugin_tags: string option; extra: string list; } let ocamlbuild_clean_ev = "ocamlbuild-clean" let ocamlbuildflags = var_define ~short_desc:(fun () -> "OCamlbuild additional flags") "ocamlbuildflags" (fun () -> "") (** Fix special arguments depending on environment *) let fix_args args extra_argv = List.flatten [ if (os_type ()) = "Win32" then [ "-classic-display"; "-no-log"; "-no-links"; ] else []; if OASISVersion.comparator_apply (OASISVersion.version_of_string (ocaml_version ())) (OASISVersion.VLesser (OASISVersion.version_of_string "3.11.1")) then [ "-install-lib-dir"; (Filename.concat (standard_library ()) "ocamlbuild") ] else []; if not (bool_of_string (is_native ())) || (os_type ()) = "Win32" then [ "-byte-plugin" ] else []; args.extra; begin match args.plugin_tags with | Some t -> ["-plugin-tag"; Filename.quote t] | None -> [] end; if bool_of_string (debug ()) then ["-tag"; "debug"] else []; if bool_of_string (tests ()) then ["-tag"; "tests"] else []; if bool_of_string (profile ()) then ["-tag"; "profile"] else []; OASISString.nsplit (ocamlbuildflags ()) ' '; Array.to_list extra_argv; ] (** Run 'ocamlbuild -clean' if not already done *) let run_clean ~ctxt extra_argv = let extra_cli = String.concat " " (Array.to_list extra_argv) in (* Run if never called with these args *) if not (BaseLog.exists ~ctxt ocamlbuild_clean_ev extra_cli) then begin OASISExec.run ~ctxt (ocamlbuild ()) (fix_args {extra = ["-clean"]; plugin_tags = None} extra_argv); BaseLog.register ~ctxt ocamlbuild_clean_ev extra_cli; at_exit (fun () -> try BaseLog.unregister ~ctxt ocamlbuild_clean_ev extra_cli with _ -> ()) end (** Run ocamlbuild, unregister all clean events *) let run_ocamlbuild ~ctxt args extra_argv = (* TODO: enforce that target in args must be UNIX encoded i.e. toto/index.html *) OASISExec.run ~ctxt (ocamlbuild ()) (fix_args args extra_argv); (* Remove any clean event, we must run it again *) List.iter (fun (e, d) -> BaseLog.unregister ~ctxt e d) (BaseLog.filter ~ctxt [ocamlbuild_clean_ev]) (** Determine real build directory *) let build_dir extra_argv = let rec search_args dir = function | "-build-dir" :: dir :: tl -> search_args dir tl | _ :: tl -> search_args dir tl | [] -> dir in search_args "_build" (fix_args {extra = []; plugin_tags = None} extra_argv) (* END EXPORT *) open OASISValues let fix_build_tools tool pkg = let fix_build_tools' _ bs = if not (List.mem tool bs.bs_build_tools) then {bs with bs_build_tools = tool :: bs.bs_build_tools} else bs in let sections = List.fold_left (fun acc sct -> let sct = match sct with | Executable (cs, bs, exec) -> let bs = fix_build_tools' sct bs in Executable (cs, bs, exec) | Library (cs, bs, lib) -> let bs = fix_build_tools' sct bs in Library (cs, bs, lib) | Object (cs, bs, obj) -> let bs = fix_build_tools' sct bs in Object (cs, bs, obj) | Flag _ | SrcRepo _ | Test _ | Doc _ as sct -> sct in sct :: acc) [] pkg.sections in {pkg with sections = List.rev sections} module Tag = struct (** [filename_concat fn1 fn2] Concat filename, using semantic of _tags [fn1] must be a real filename whereas fn2 can contains wildcards. *) let filename_concat fn1 fn2 = OASISUnixPath.concat (OASISUnixPath.reduce fn1) fn2 end (** Check OCaml version constraint defined in _oasis. *) let check_ocaml_version version pkg = OASISVersion.StringVersion.comparator_ge version pkg.ocaml_version let ocamlbuild_more_args = OASISFeatures.create "ocamlbuild_more_args" OASISFeatures.alpha (fun () -> s_ "Allow to pass arguments to ocamlbuild.") let ocamlbuild_supports_ocamlfind = check_ocaml_version "3.12.1" let ocamlbuild_supports_plugin_tags = check_ocaml_version "4.01" let ocamlbuild_common_generator pivot_data schm id = let new_field nm = OASISSchema.new_field schm id nm in let plugin_tags = new_field "PluginTags" ~default:None ~feature:ocamlbuild_more_args (opt string_not_empty) (fun () -> s_ "Gives the plugin tags to ocambuild through \ '-plugin-tags' (OCaml >= 4.01 only)") pivot_data (fun _ args -> args.plugin_tags) in let extra_args = new_field "ExtraArgs" ~default:[] ~feature:ocamlbuild_more_args command_line_options (fun () -> s_ "Gives extra arguments to ocamlbuild") pivot_data (fun _ args -> args.extra) in fun data -> { extra = extra_args data; plugin_tags = plugin_tags data; } let args_ocamlbuild_common ctxt pkg args = let supports_plugins = ocamlbuild_supports_plugin_tags pkg in let plugin_tags, ctxt = if args.plugin_tags <> None && (not supports_plugins) then begin None, OASISPlugin.set_error (not supports_plugins) (s_ "'XOCamlbuildPluginTags' in only available for OCaml >= 4.01. \ Please restrict your requirements with 'OCamlVersion: >= 4.01'") ctxt end else begin args.plugin_tags, ctxt end in let extra = if ocamlbuild_supports_ocamlfind pkg then "-use-ocamlfind" :: args.extra else args.extra in {plugin_tags; extra}, ctxt let odn_of_args (args:args) = OASISDataNotation.REC ("OCamlbuildCommon", [ "plugin_tags", (OASISDataNotation.of_option OASISDataNotation.of_string) (args:args).plugin_tags; "extra", (OASISDataNotation.of_list OASISDataNotation.of_string) args.extra ]) oasis-0.4.11/src/plugins/ocamlbuild/MyOCamlbuildSys.mod0000644000175000017500000000005313261073606022343 0ustar gildorgildorMyOCamlbuildFindlib.ml MyOCamlbuildBase.ml oasis-0.4.11/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml0000644000175000017500000001721313261073606022773 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** OCamlbuild extension, copied from * https://ocaml.org/learn/tutorials/ocamlbuild/Using_ocamlfind_with_ocamlbuild.html * by N. Pouillard and others * * Updated on 2016-06-02 * * Modified by Sylvain Le Gall *) open Ocamlbuild_plugin type conf = {no_automatic_syntax: bool} let run_and_read = Ocamlbuild_pack.My_unix.run_and_read let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings let exec_from_conf exec = let exec = let env = BaseEnvLight.load ~allow_empty:true () in try BaseEnvLight.var_get exec env with Not_found -> Printf.eprintf "W: Cannot get variable %s\n" exec; exec in let fix_win32 str = if Sys.os_type = "Win32" then begin let buff = Buffer.create (String.length str) in (* Adapt for windowsi, ocamlbuild + win32 has a hard time to handle '\\'. *) String.iter (fun c -> Buffer.add_char buff (if c = '\\' then '/' else c)) str; Buffer.contents buff end else begin str end in fix_win32 exec let split s ch = let buf = Buffer.create 13 in let x = ref [] in let flush () = x := (Buffer.contents buf) :: !x; Buffer.clear buf in 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 (* ocamlfind command *) let ocamlfind x = S[Sh (exec_from_conf "ocamlfind"); x] (* This lists all supported packages. *) let find_packages () = List.map before_space (split_nl & run_and_read (exec_from_conf "ocamlfind" ^ " list")) (* Mock to list available syntaxes. *) let find_syntaxes () = ["camlp4o"; "camlp4r"] let well_known_syntax = [ "camlp4.quotations.o"; "camlp4.quotations.r"; "camlp4.exceptiontracer"; "camlp4.extend"; "camlp4.foldgenerator"; "camlp4.listcomprehension"; "camlp4.locationstripper"; "camlp4.macro"; "camlp4.mapgenerator"; "camlp4.metagenerator"; "camlp4.profiler"; "camlp4.tracer" ] let dispatch conf = function | After_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 *) 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.ocamlmklib := ocamlfind & A"ocamlmklib" | After_rules -> (* Avoid warnings for unused tag *) flag ["tests"] N; (* 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 begin fun pkg -> let base_args = [A"-package"; A pkg] in (* TODO: consider how to really choose camlp4o or camlp4r. *) let syn_args = [A"-syntax"; A "camlp4o"] in let (args, pargs) = (* Heuristic to identify syntax extensions: whether they end in ".syntax"; some might not. *) if not (conf.no_automatic_syntax) && (Filename.check_suffix pkg "syntax" || List.mem pkg well_known_syntax) then (syn_args @ base_args, syn_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; (* TODO: Check if this is allowed for OCaml < 3.12.1 *) flag ["ocaml"; "compile"; "package("^pkg^")"] & S pargs; flag ["ocaml"; "ocamldep"; "package("^pkg^")"] & S pargs; flag ["ocaml"; "doc"; "package("^pkg^")"] & S pargs; flag ["ocaml"; "infer_interface"; "package("^pkg^")"] & S pargs; end (find_packages ()); (* Like -package but for extensions syntax. Morover -syntax is useless * when linking. *) List.iter begin fun syntax -> 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]; 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 ["c"; "pkg_threads"; "compile"] (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"]); flag ["c"; "package(threads)"; "compile"] (S[A "-thread"]); | _ -> () oasis-0.4.11/src/plugins/ocamlbuild/MyOCamlbuildBase.ml0000644000175000017500000002022413261073606022272 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** 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 type t = { 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; } (* END EXPORT *) let odn_of_t v = let open OASISDataNotation in let rec odn_of_spec = let vrt nm lst = VRT ("Ocamlbuild_plugin."^nm, lst) in let vrt_str nm str = vrt nm [STR str] in function | N -> vrt "N" [] | S lst -> vrt "S" [of_list odn_of_spec lst] | A s -> vrt_str "A" s | P s -> vrt_str "P" s | Px s -> vrt_str "Px" s | Sh s -> vrt_str "Sh" s | V s -> vrt_str "V" s | Quote spc -> vrt "Quote" [odn_of_spec spc] | T _ -> assert false in REC ("MyOCamlbuildBase", [ ("lib_ocaml", ((fun x -> of_list (fun (v2, v1, v0) -> TPL [ of_string v2; of_list of_string v1; of_list of_string v0 ]) x) v.lib_ocaml)); ("lib_c", ((fun x -> of_list (fun (v2, v1, v0) -> TPL [ of_string v2; of_string v1; of_list of_string v0 ]) x) v.lib_c)); ("flags", ((fun x -> of_list (fun (v1, v0) -> TPL [ of_list of_string v1; OASISExpr.odn_of_choices odn_of_spec v0 ]) x) v.flags)); ("includes", ((fun x -> of_list (fun (v1, v0) -> TPL [ of_string v1; of_list of_string v0 ]) x) v.includes)) ]) (* START EXPORT *) 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 ~allow_empty:true () in match e with | Before_options -> let no_trailing_dot s = if String.length s >= 1 && s.[0] = '.' then String.sub s 1 ((String.length s) - 1) else s in List.iter (fun (opt, var) -> try opt := no_trailing_dot (BaseEnvLight.var_get var env) with Not_found -> Printf.eprintf "W: Cannot get variable %s\n" var) [ Options.ext_obj, "ext_obj"; Options.ext_lib, "ext_lib"; Options.ext_dll, "ext_dll"; ] | After_rules -> (* Declare OCaml libraries *) List.iter (function | nm, [], intf_modules -> ocaml_lib nm; let cmis = List.map (fun m -> (OASISString.uncapitalize_ascii 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 str -> flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir])) ["compile"; "infer_interface"; "doc"]) tl; let cmis = List.map (fun m -> dir^"/"^(OASISString.uncapitalize_ascii 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 (fun (dir, include_dirs) -> Pathname.define_context dir include_dirs) t.includes; (* Declare C libraries *) List.iter (fun (lib, dir, headers) -> (* Handle C part of library *) 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))]); if bool_of_string (BaseEnvLight.var_get "native_dynlink" env) then 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. This holds both for programs and for libraries. *) dep ["link"; "ocaml"; tag_libstubs lib] [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; dep ["compile"; "ocaml"; 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) -> let spec = BaseEnvLight.var_choose cond_specs env in let rec eval_specs = function | S lst -> S (List.map eval_specs lst) | A str -> A (BaseEnvLight.var_expand str env) | spec -> spec in flag tags & (eval_specs spec)) t.flags | _ -> () let dispatch_default conf t = dispatch_combine [ dispatch t; MyOCamlbuildFindlib.dispatch conf; ] (* END EXPORT *) oasis-0.4.11/src/plugins/ocamlbuild/MANUAL-template.mkd0000644000175000017500000000056713261073606022117 0ustar gildorgildorThis plugin uses OCamlbuild to generate a build system. It is the default value for `BuildType`. It is also possible to use this plugin for `Document.Type` which is the default. In this case, OCamlbuild will also be involved in the generation of a particular document. Package fields: $ListOCamlbuildBuildPackageFields Document fields: $ListOCamlbuildDocDocumentFields oasis-0.4.11/src/plugins/none/0000755000175000017500000000000013261073606015450 5ustar gildorgildoroasis-0.4.11/src/plugins/none/NoneSys.mod0000644000175000017500000000001613261073606017544 0ustar gildorgildorNonePlugin.ml oasis-0.4.11/src/plugins/none/NonePlugin.ml0000644000175000017500000000662613261073606020072 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Plugin to handle "none" generation @author Sylvain Le Gall *) open OASISGettext open OASISUtils let not_implemented ~ctxt:_ str _ _ = failwithf (f_ "No implementation for %s") str let section_not_implemented ~ctxt:_ str pkg _ _ extra_args = not_implemented str pkg extra_args (* END EXPORT *) open OASISTypes open OASISPlugin let std_no_generate str ctxt _ = ctxt, { chng_moduls = [NoneData.nonesys_ml]; chng_clean = None; chng_distclean = None; chng_main = (OASISDataNotation.func_with_arg_ctxt not_implemented "NonePlugin.not_implemented" str OASISDataNotation.of_string); } let section_no_generate str plugin_ctxt pkg (cs, _) = std_no_generate (str^" of section "^cs.cs_name) plugin_ctxt pkg let init () = let nm, ver = "None", Some OASISConf.version_short in let () = register_help (`All, nm, ver) {(help_default NoneData.readme_template_mkd) with help_order = 10} in let plugin = `Configure, nm, ver in let self_id, _ = Configure.create plugin in let () = Configure.register_act self_id (std_no_generate "configure") in let plugin = `Build, nm, ver in let self_id, _ = Build.create plugin in let () = Build.register_act self_id (std_no_generate "build") in let plugin = `Install, nm, ver in let self_id, _ = Install.create plugin in let () = Install.register_act self_id ((std_no_generate "install"), (std_no_generate "uninstall")) in let plugin = `Test, nm, ver in let self_id, _ = Test.create plugin in let () = Test.register_act self_id (section_no_generate "test") in let plugin = `Doc, nm, ver in let self_id, _ = Doc.create plugin in let () = Doc.register_act self_id (section_no_generate "doc") in () oasis-0.4.11/src/plugins/none/NoneData.mlify0000644000175000017500000000015113261073606020200 0ustar gildorgildorVarString nonesys_ml "NoneSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/plugins/none/MANUAL-template.mkd0000644000175000017500000000012313261073606020727 0ustar gildorgildorThis plugin basically does nothing. It helps to replace mandatory step by nothing. oasis-0.4.11/src/plugins/internal/0000755000175000017500000000000013261073606016325 5ustar gildorgildoroasis-0.4.11/src/plugins/internal/MANUAL-template.mkd0000644000175000017500000000065613261073606021617 0ustar gildorgildorThis plugin is the default value for the `ConfType` and `InstallType`. It represents a default behavior for configuring and installing OCaml project. The configure part take care of checking: * Tools availability (ocamlfind, ocamlc et al) * OCaml version * Findlib packages The install part take care of installing executables, libraries and data files using standard environment variable (`\$bindir`, `\$datadir` et al). oasis-0.4.11/src/plugins/internal/InternalSys.mod0000644000175000017500000000006413261073606021301 0ustar gildorgildorInternalConfigurePlugin.ml InternalInstallPlugin.ml oasis-0.4.11/src/plugins/internal/InternalInstallPlugin.ml0000644000175000017500000004626013261073606023151 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Install using internal scheme @author Sylvain Le Gall *) (* TODO: rewrite this module with OASISFileSystem. *) open BaseEnv open BaseStandardVar open BaseMessage open OASISTypes open OASISFindlib open OASISGettext open OASISUtils let exec_hook = ref (fun (cs, bs, exec) -> cs, bs, exec) let lib_hook = ref (fun (cs, bs, dn, lib) -> cs, bs, dn, lib, []) let obj_hook = ref (fun (cs, bs, dn, obj) -> cs, bs, dn, obj, []) let doc_hook = ref (fun (cs, doc) -> cs, doc) let install_file_ev = "install-file" let install_dir_ev = "install-dir" let install_findlib_ev = "install-findlib" (* TODO: this can be more generic and used elsewhere. *) let win32_max_command_line_length = 8000 let split_install_command ocamlfind findlib_name meta files = if Sys.os_type = "Win32" then (* Arguments for the first command: *) let first_args = ["install"; findlib_name; meta] in (* Arguments for remaining commands: *) let other_args = ["install"; findlib_name; "-add"] in (* Extract as much files as possible from [files], [len] is the current command line length: *) let rec get_files len acc files = match files with | [] -> (List.rev acc, []) | file :: rest -> let len = len + 1 + String.length file in if len > win32_max_command_line_length then (List.rev acc, files) else get_files len (file :: acc) rest in (* Split the command into several commands. *) let rec split args files = match files with | [] -> [] | _ -> (* Length of "ocamlfind install [META|-add]" *) let len = List.fold_left (fun len arg -> len + 1 (* for the space *) + String.length arg) (String.length ocamlfind) args in match get_files len [] files with | ([], _) -> failwith (s_ "Command line too long.") | (firsts, others) -> let cmd = args @ firsts in (* Use -add for remaining commands: *) let () = let findlib_ge_132 = OASISVersion.comparator_apply (OASISVersion.version_of_string (BaseStandardVar.findlib_version ())) (OASISVersion.VGreaterEqual (OASISVersion.version_of_string "1.3.2")) in if not findlib_ge_132 then failwithf (f_ "Installing the library %s require to use the \ flag '-add' of ocamlfind because the command \ line is too long. This flag is only available \ for findlib 1.3.2. Please upgrade findlib from \ %s to 1.3.2") findlib_name (BaseStandardVar.findlib_version ()) in let cmds = split other_args others in cmd :: cmds in (* The first command does not use -add: *) split first_args files else ["install" :: findlib_name :: meta :: files] let install = let in_destdir fn = try (* Practically speaking destdir is prepended at the beginning of the target filename *) (destdir ())^fn with PropList.Not_set _ -> fn in let install_file ~ctxt ?(prepend_destdir=true) ?tgt_fn src_file envdir = let tgt_dir = if prepend_destdir then in_destdir (envdir ()) else envdir () in let tgt_file = Filename.concat tgt_dir (match tgt_fn with | Some fn -> fn | None -> Filename.basename src_file) in (* Create target directory if needed *) OASISFileUtil.mkdir_parent ~ctxt (fun dn -> info (f_ "Creating directory '%s'") dn; BaseLog.register ~ctxt install_dir_ev dn) (Filename.dirname tgt_file); (* Really install files *) info (f_ "Copying file '%s' to '%s'") src_file tgt_file; OASISFileUtil.cp ~ctxt src_file tgt_file; BaseLog.register ~ctxt install_file_ev tgt_file in (* Install the files for a library. *) let install_lib_files ~ctxt findlib_name files = let findlib_dir = let dn = let findlib_destdir = OASISExec.run_read_one_line ~ctxt (ocamlfind ()) ["printconf" ; "destdir"] in Filename.concat findlib_destdir findlib_name in fun () -> dn in let () = if not (OASISFileUtil.file_exists_case (findlib_dir ())) then failwithf (f_ "Directory '%s' doesn't exist for findlib library %s") (findlib_dir ()) findlib_name in let f dir file = let basename = Filename.basename file in let tgt_fn = Filename.concat dir basename in (* Destdir is already include in printconf. *) install_file ~ctxt ~prepend_destdir:false ~tgt_fn file findlib_dir in List.iter (fun (dir, files) -> List.iter (f dir) files) files ; in (* Install data into defined directory *) let install_data ~ctxt srcdir lst tgtdir = let tgtdir = OASISHostPath.of_unix (var_expand tgtdir) in List.iter (fun (src, tgt_opt) -> let real_srcs = OASISFileUtil.glob ~ctxt:!BaseContext.default (Filename.concat srcdir src) in if real_srcs = [] then failwithf (f_ "Wildcard '%s' doesn't match any files") src; List.iter (fun fn -> install_file ~ctxt fn (fun () -> match tgt_opt with | Some s -> OASISHostPath.of_unix (var_expand s) | None -> tgtdir)) real_srcs) lst in let make_fnames modul sufx = List.fold_right begin fun sufx accu -> (OASISString.capitalize_ascii modul ^ sufx) :: (OASISString.uncapitalize_ascii modul ^ sufx) :: accu end sufx [] in (** Install all libraries *) let install_libs ~ctxt pkg = let find_first_existing_files_in_path bs lst = let path = OASISHostPath.of_unix bs.bs_path in List.find OASISFileUtil.file_exists_case (List.map (Filename.concat path) lst) in let files_of_modules new_files typ cs bs modules = List.fold_left (fun acc modul -> begin try (* Add uncompiled header from the source tree *) [find_first_existing_files_in_path bs (make_fnames modul [".mli"; ".ml"])] with Not_found -> warning (f_ "Cannot find source header for module %s \ in %s %s") typ modul cs.cs_name; [] end @ List.fold_left (fun acc fn -> try find_first_existing_files_in_path bs [fn] :: acc with Not_found -> acc) acc (make_fnames modul [".annot";".cmti";".cmt"])) new_files modules in let files_of_build_section (f_data, new_files) typ cs bs = let extra_files = List.map (fun fn -> try find_first_existing_files_in_path bs [fn] with Not_found -> failwithf (f_ "Cannot find extra findlib file %S in %s %s ") fn typ cs.cs_name) bs.bs_findlib_extra_files in let f_data () = (* Install data associated with the library *) install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name); f_data () in f_data, new_files @ extra_files in let files_of_library (f_data, acc) data_lib = let cs, bs, lib, dn, lib_extra = !lib_hook data_lib in if var_choose bs.bs_install && BaseBuilt.is_built ~ctxt BaseBuilt.BLib cs.cs_name then begin (* Start with lib_extra *) let new_files = lib_extra in let new_files = files_of_modules new_files "library" cs bs lib.lib_modules in let f_data, new_files = files_of_build_section (f_data, new_files) "library" cs bs in let new_files = (* Get generated files *) BaseBuilt.fold ~ctxt BaseBuilt.BLib cs.cs_name (fun acc fn -> fn :: acc) new_files in let acc = (dn, new_files) :: acc in let f_data () = (* Install data associated with the library *) install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name); f_data () in (f_data, acc) end else begin (f_data, acc) end and files_of_object (f_data, acc) data_obj = let cs, bs, obj, dn, obj_extra = !obj_hook data_obj in if var_choose bs.bs_install && BaseBuilt.is_built ~ctxt BaseBuilt.BObj cs.cs_name then begin (* Start with obj_extra *) let new_files = obj_extra in let new_files = files_of_modules new_files "object" cs bs obj.obj_modules in let f_data, new_files = files_of_build_section (f_data, new_files) "object" cs bs in let new_files = (* Get generated files *) BaseBuilt.fold ~ctxt BaseBuilt.BObj cs.cs_name (fun acc fn -> fn :: acc) new_files in let acc = (dn, new_files) :: acc in let f_data () = (* Install data associated with the object *) install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name); f_data () in (f_data, acc) end else begin (f_data, acc) end in (* Install one group of library *) let install_group_lib grp = (* Iterate through all group nodes *) let rec install_group_lib_aux data_and_files grp = let data_and_files, children = match grp with | Container (_, children) -> data_and_files, children | Package (_, cs, bs, `Library lib, dn, children) -> files_of_library data_and_files (cs, bs, lib, dn), children | Package (_, cs, bs, `Object obj, dn, children) -> files_of_object data_and_files (cs, bs, obj, dn), children in List.fold_left install_group_lib_aux data_and_files children in (* Findlib name of the root library *) let findlib_name = findlib_of_group grp in (* Determine root library *) let root_lib = root_of_group grp in (* All files to install for this library *) let f_data, files = install_group_lib_aux (ignore, []) grp in (* Really install, if there is something to install *) if files = [] then begin warning (f_ "Nothing to install for findlib library '%s'") findlib_name end else begin let meta = (* Search META file *) let _, bs, _ = root_lib in let res = Filename.concat bs.bs_path "META" in if not (OASISFileUtil.file_exists_case res) then failwithf (f_ "Cannot find file '%s' for findlib library %s") res findlib_name; res in let files = (* Make filename shorter to avoid hitting command max line length * too early, esp. on Windows. *) (* TODO: move to OASISHostPath as make_relative. *) let remove_prefix p n = let plen = String.length p in let nlen = String.length n in if plen <= nlen && String.sub n 0 plen = p then begin let fn_sep = if Sys.os_type = "Win32" then '\\' else '/' in let cutpoint = plen + (if plen < nlen && n.[plen] = fn_sep then 1 else 0) in String.sub n cutpoint (nlen - cutpoint) end else begin n end in List.map (fun (dir, fn) -> (dir, List.map (remove_prefix (Sys.getcwd ())) fn)) files in let ocamlfind = ocamlfind () in let nodir_files, dir_files = List.fold_left (fun (nodir, dir) (dn, lst) -> match dn with | Some dn -> nodir, (dn, lst) :: dir | None -> lst @ nodir, dir) ([], []) (List.rev files) in info (f_ "Installing findlib library '%s'") findlib_name; List.iter (OASISExec.run ~ctxt ocamlfind) (split_install_command ocamlfind findlib_name meta nodir_files); install_lib_files ~ctxt findlib_name dir_files; BaseLog.register ~ctxt install_findlib_ev findlib_name end; (* Install data files *) f_data (); in let group_libs, _, _ = findlib_mapping pkg in (* We install libraries in groups *) List.iter install_group_lib group_libs in let install_execs ~ctxt pkg = let install_exec data_exec = let cs, bs, _ = !exec_hook data_exec in if var_choose bs.bs_install && BaseBuilt.is_built ~ctxt BaseBuilt.BExec cs.cs_name then begin let exec_libdir () = Filename.concat (libdir ()) pkg.name in BaseBuilt.fold ~ctxt BaseBuilt.BExec cs.cs_name (fun () fn -> install_file ~ctxt ~tgt_fn:(cs.cs_name ^ ext_program ()) fn bindir) (); BaseBuilt.fold ~ctxt BaseBuilt.BExecLib cs.cs_name (fun () fn -> install_file ~ctxt fn exec_libdir) (); install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name) end in List.iter (function | Executable (cs, bs, exec)-> install_exec (cs, bs, exec) | _ -> ()) pkg.sections in let install_docs ~ctxt pkg = let install_doc data = let cs, doc = !doc_hook data in if var_choose doc.doc_install && BaseBuilt.is_built ~ctxt BaseBuilt.BDoc cs.cs_name then begin let tgt_dir = OASISHostPath.of_unix (var_expand doc.doc_install_dir) in BaseBuilt.fold ~ctxt BaseBuilt.BDoc cs.cs_name (fun () fn -> install_file ~ctxt fn (fun () -> tgt_dir)) (); install_data ~ctxt Filename.current_dir_name doc.doc_data_files doc.doc_install_dir end in List.iter (function | Doc (cs, doc) -> install_doc (cs, doc) | _ -> ()) pkg.sections in fun ~ctxt pkg _ -> install_libs ~ctxt pkg; install_execs ~ctxt pkg; install_docs ~ctxt pkg (* Uninstall already installed data *) let uninstall ~ctxt _ _ = let uninstall_aux (ev, data) = if ev = install_file_ev then begin if OASISFileUtil.file_exists_case data then begin info (f_ "Removing file '%s'") data; Sys.remove data end else begin warning (f_ "File '%s' doesn't exist anymore") data end end else if ev = install_dir_ev then begin if Sys.file_exists data && Sys.is_directory data then begin if Sys.readdir data = [||] then begin info (f_ "Removing directory '%s'") data; OASISFileUtil.rmdir ~ctxt data end else begin warning (f_ "Directory '%s' is not empty (%s)") data (String.concat ", " (Array.to_list (Sys.readdir data))) end end else begin warning (f_ "Directory '%s' doesn't exist anymore") data end end else if ev = install_findlib_ev then begin info (f_ "Removing findlib library '%s'") data; OASISExec.run ~ctxt (ocamlfind ()) ["remove"; data] end else begin failwithf (f_ "Unknown log event '%s'") ev; end; BaseLog.unregister ~ctxt ev data in (* We process event in reverse order *) List.iter uninstall_aux (List.rev (BaseLog.filter ~ctxt [install_file_ev; install_dir_ev])); List.iter uninstall_aux (List.rev (BaseLog.filter ~ctxt [install_findlib_ev])) (* END EXPORT *) open OASISPlugin open InternalId let plugin = `Install, name, Some version let init () = let self_id, _ = Install.create plugin in (* Installation *) let doit_install plugin_ctxt _ = plugin_ctxt, { chng_moduls = [InternalData.internalsys_ml]; chng_main = OASISDataNotation.func install "InternalInstallPlugin.install"; chng_clean = None; chng_distclean = None; } in (* Uninstall *) let doit_uninstall plugin_ctxt _ = plugin_ctxt, { chng_moduls = [InternalData.internalsys_ml]; chng_main = OASISDataNotation.func uninstall "InternalInstallPlugin.uninstall"; chng_clean = None; chng_distclean = None; } in InternalId.init (); Install.register_act self_id (doit_install, doit_uninstall) oasis-0.4.11/src/plugins/internal/InternalId.ml0000644000175000017500000000373413261073606020717 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Internal plugin identification @author Sylvain Le Gall *) let name = "Internal" let version = OASISConf.version_short (* END EXPORT *) open OASISPlugin let init () = register_help (`All, name, Some version) {(help_default InternalData.readme_template_mkd) with help_order = 30} oasis-0.4.11/src/plugins/internal/InternalData.mlify0000644000175000017500000000015513261073606021736 0ustar gildorgildorVarString internalsys_ml "InternalSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/plugins/internal/InternalConfigurePlugin.ml0000644000175000017500000002165313261073606023463 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Configure using internal scheme @author Sylvain Le Gall *) open BaseEnv open OASISTypes open OASISUtils open OASISGettext open BaseMessage (** Configure build using provided series of check to be done and then output corresponding file. *) let configure ~ctxt:_ pkg argv = let var_ignore_eval var = let _s: string = var () in () in let errors = ref SetString.empty in let buff = Buffer.create 13 in let add_errors fmt = Printf.kbprintf (fun b -> errors := SetString.add (Buffer.contents b) !errors; Buffer.clear b) buff fmt in let warn_exception e = warning "%s" (Printexc.to_string e) in (* Check tools *) let check_tools lst = List.iter (function | ExternalTool tool -> begin try var_ignore_eval (BaseCheck.prog tool) with e -> warn_exception e; add_errors (f_ "Cannot find external tool '%s'") tool end | InternalExecutable nm1 -> (* Check that matching tool is built *) List.iter (function | Executable ({cs_name = nm2; _}, {bs_build = build; _}, _) when nm1 = nm2 -> if not (var_choose build) then add_errors (f_ "Cannot find buildable internal executable \ '%s' when checking build depends") nm1 | _ -> ()) pkg.sections) lst in let build_checks sct bs = if var_choose bs.bs_build then begin if bs.bs_compiled_object = Native then begin try var_ignore_eval BaseStandardVar.ocamlopt with e -> warn_exception e; add_errors (f_ "Section %s requires native compilation") (OASISSection.string_of_section sct) end; (* Check tools *) check_tools bs.bs_build_tools; (* Check depends *) List.iter (function | FindlibPackage (findlib_pkg, version_comparator) -> begin try var_ignore_eval (BaseCheck.package ?version_comparator findlib_pkg) with e -> warn_exception e; match version_comparator with | None -> add_errors (f_ "Cannot find findlib package %s") findlib_pkg | Some ver_cmp -> add_errors (f_ "Cannot find findlib package %s (%s)") findlib_pkg (OASISVersion.string_of_comparator ver_cmp) end | InternalLibrary nm1 -> (* Check that matching library is built *) List.iter (function | Library ({cs_name = nm2; _}, {bs_build = build; _}, _) when nm1 = nm2 -> if not (var_choose build) then add_errors (f_ "Cannot find buildable internal library \ '%s' when checking build depends") nm1 | _ -> ()) pkg.sections) bs.bs_build_depends end in (* Parse command line *) BaseArgExt.parse argv (BaseEnv.args ()); (* OCaml version *) begin match pkg.ocaml_version with | Some ver_cmp -> begin try var_ignore_eval (BaseCheck.version "ocaml" ver_cmp BaseStandardVar.ocaml_version) with e -> warn_exception e; add_errors (f_ "OCaml version %s doesn't match version constraint %s") (BaseStandardVar.ocaml_version ()) (OASISVersion.string_of_comparator ver_cmp) end | None -> () end; (* Findlib version *) begin match pkg.findlib_version with | Some ver_cmp -> begin try var_ignore_eval (BaseCheck.version "findlib" ver_cmp BaseStandardVar.findlib_version) with e -> warn_exception e; add_errors (f_ "Findlib version %s doesn't match version constraint %s") (BaseStandardVar.findlib_version ()) (OASISVersion.string_of_comparator ver_cmp) end | None -> () end; (* Make sure the findlib version is fine for the OCaml compiler. *) begin let ocaml_ge4 = OASISVersion.version_compare (OASISVersion.version_of_string (BaseStandardVar.ocaml_version ())) (OASISVersion.version_of_string "4.0.0") >= 0 in if ocaml_ge4 then let findlib_lt132 = OASISVersion.version_compare (OASISVersion.version_of_string (BaseStandardVar.findlib_version())) (OASISVersion.version_of_string "1.3.2") < 0 in if findlib_lt132 then add_errors "OCaml >= 4.0.0 requires Findlib version >= 1.3.2" end; (* FlexDLL *) if BaseStandardVar.os_type () = "Win32" || BaseStandardVar.os_type () = "Cygwin" then begin try var_ignore_eval BaseStandardVar.flexlink with e -> warn_exception e; add_errors (f_ "Cannot find 'flexlink'") end; (* Check build depends *) List.iter (function | Executable (_, bs, _) | Library (_, bs, _) as sct -> build_checks sct bs | Doc (_, doc) -> if var_choose doc.doc_build then check_tools doc.doc_build_tools | Test (_, test) -> if var_choose test.test_run then check_tools test.test_tools | _ -> ()) pkg.sections; (* Check if we need native dynlink (presence of libraries that compile to native) *) begin let has_cmxa = List.exists (function | Library (_, bs, _) -> var_choose bs.bs_build && (bs.bs_compiled_object = Native || (bs.bs_compiled_object = Best && bool_of_string (BaseStandardVar.is_native ()))) | _ -> false) pkg.sections in if has_cmxa then var_ignore_eval BaseStandardVar.native_dynlink end; (* Check errors *) if SetString.empty != !errors then begin List.iter (fun e -> error "%s" e) (SetString.elements !errors); failwithf (fn_ "%d configuration error" "%d configuration errors" (SetString.cardinal !errors)) (SetString.cardinal !errors) end (* END EXPORT *) open OASISPlugin open InternalId let plugin = `Configure, name, Some version let init () = let self_id, _ = Configure.create plugin in let doit plugin_ctxt _ = plugin_ctxt, { chng_moduls = [InternalData.internalsys_ml]; chng_clean = None; chng_distclean = None; chng_main = (OASISDataNotation.func configure "InternalConfigurePlugin.configure"); } in InternalId.init (); Configure.register_act self_id doit oasis-0.4.11/src/plugins/extra/0000755000175000017500000000000013261073606015634 5ustar gildorgildoroasis-0.4.11/src/plugins/extra/stdfiles/0000755000175000017500000000000013261073606017451 5ustar gildorgildoroasis-0.4.11/src/plugins/extra/stdfiles/StdFilesPlugin.ml0000644000175000017500000004245713261073606022713 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Generate standard text files: INSTALL.txt, README.txt @author Sylvain Le Gall *) open OASISFileTemplate open OASISTypes open OASISUtils open OASISValues open OASISGettext open OASISVersion open OASISPlugin open OASISSchema open Format open FormatExt let plugin = `Extra, "StdFiles", Some OASISConf.version_short let self_id, all_id = Extra.create plugin let markdown = OASISFeatures.create "stdfiles_markdown" ~plugin OASISFeatures.alpha (fun () -> s_ "Use markdown comment and replace .txt extensions of standard files by .md.") type package = (* Standalone executable *) | LTool of prog (* Findlib package *) | LFindlibPackage of name * (OASISVersion.comparator option) let facts = [ LFindlibPackage ("ocaml", None), [ (* Tools shipped with OCaml *) "camlp4"; "camlp4boot"; "camlp4o"; "camlp4of"; "camlp4of.opt"; "camlp4oof"; "camlp4oof.opt"; "camlp4o.opt"; "camlp4orf"; "camlp4orf.opt"; "camlp4prof"; "camlp4r"; "camlp4rf"; "camlp4rf.opt"; "camlp4r.opt"; "mkcamlp4"; "ocaml"; "ocamlbuild"; "ocamlbuild.byte"; "ocamlbuild.native"; "ocamlc"; "ocamlc.opt"; "ocamlcp"; "ocamldebug"; "ocamldep"; "ocamldep.opt"; "ocamldoc"; "ocamldoc.opt"; "ocamllex"; "ocamllex.opt"; "ocamlmklib"; "ocamlmktop"; "ocamlopt"; "ocamlopt.opt"; "ocamlprof"; "ocamlrun"; "ocamlyacc"; ], [ (* Libraries shipped with OCaml *) "bigarray"; "camlp4"; "dbm"; "dynlink"; "graphics"; "labltk"; "num"; "stdlib"; "str"; "threads"; "unix"; ]; LFindlibPackage ("findlib", None), ["ocamlfind"], ["findlib"]; ] (** Merge 2 versions constraint *) let merge_version_opt ver_opt1 ver_opt2 = match ver_opt1, ver_opt2 with | Some v1, Some v2 -> Some (VAnd (v1, v2)) | None, v | v, None -> v (** Associate a tool to a findlib package or a tool *) let package_of_tool = let mp = MapString.of_list (List.fold_left (fun acc (pkg, tools, _) -> List.fold_left (fun acc tool -> (tool, pkg) :: acc) acc tools) [] facts) in fun tool -> try MapString.find tool mp with Not_found -> LTool tool (** Associate a library to a findlib package raw data *) let package_of_library = let mp = MapString.of_list (List.fold_left (fun acc (pkg, _, libs) -> List.fold_left (fun acc lib -> (lib, pkg) :: acc) acc libs) [] facts) in fun lib ver_opt -> try MapString.find lib mp with Not_found -> LFindlibPackage (lib, ver_opt) type t = { readme: unix_filename option; install: unix_filename option; authors: unix_filename option; } let pivot_data = data_new_property plugin let default_filenames = let mp = MapString.of_list(["README", "README.txt"; "INSTALL", "INSTALL.txt"; "AUTHORS", "AUTHORS.txt"]) in fun fn -> try MapString.find fn mp with Not_found -> failwithf (f_ "No default filename for file %s.") fn let generator = let fn_enable fn sync = let enable = new_field OASISPackage.schema all_id fn ~default:true boolean (fun () -> Printf.sprintf (f_ "Enable %s file generation.") fn) pivot_data (fun t t' -> (sync t t') <> None) in let fn = new_field OASISPackage.schema all_id (fn^"Filename") ~default:(default_filenames fn) string_not_empty (fun () -> Printf.sprintf (f_ "Real filename to use for file %s.") fn) pivot_data (fun t t' -> match sync t t' with | Some fn -> fn | None -> raise Not_printable) in fun data -> if enable data then Some (fn data) else None in let readme = fn_enable "README" (fun _ t -> t.readme) in let install = fn_enable "INSTALL" (fun _ t -> t.install) in let authors = fn_enable "AUTHORS" (fun _ t -> t.authors) in fun data -> { readme = readme data; install = install data; authors = authors data; } module SetSection = Set.Make (struct type t = section let compare = compare end) let main ctxt pkg = let data = pkg.schema_data in (** All sections that contains a build_section *) let all_build_sections_set = let all_build_sections = List.rev (List.fold_left (fun acc -> function | Library (_, bs, _) | Object (_, bs, _) | Executable (_, bs, _) as sct -> (sct, bs) :: acc | SrcRepo _ | Flag _ | Test _ | Doc _ -> acc) [] pkg.sections) in List.fold_left (fun acc e -> SetSection.add e acc) SetSection.empty (List.rev_map fst all_build_sections) in let pp_print_sections = (* If a tool/library applies to all sections that can handle a build_depends or build_tools we can say it is a general depends. In this case, return is None, otherwise "Some sections". *) fun fmt sections -> let is_all_build_sections, sections = if SetSection.subset all_build_sections_set sections then true, SetSection.diff sections all_build_sections_set else false, sections in if SetSection.is_empty sections then () else fprintf fmt " for %t%a" (fun fmt -> if is_all_build_sections then fprintf fmt "all,@ ") (pp_print_list (fun fmt sct -> fprintf fmt "%s" (OASISSection.string_of_section sct)) ",@ ") (SetSection.elements sections) in let pp_print_ver_opt fmt = may (fun ver_cmp -> fprintf fmt " (%a)" pp_print_string (OASISVersion.string_of_comparator (OASISVersion.comparator_reduce ver_cmp))) in let depends = let merge_package_section lst (new_pkg, new_sections) = try let old_pkg, new_pkg, old_sections = match new_pkg with | LTool _ as tool -> tool, tool, List.assoc tool lst | LFindlibPackage (nm1, ver_opt1) -> begin let res_opt = List.fold_left (fun acc pkg -> match acc, pkg with | None, ((LFindlibPackage (nm2, ver_opt2)) as old_pkg, sections) -> if nm1 = nm2 then Some (old_pkg, LFindlibPackage (nm1, merge_version_opt ver_opt1 ver_opt2), sections) else acc | _, _ -> acc) None lst in match res_opt with | Some res -> res | None -> raise Not_found end in let lst = try List.remove_assoc old_pkg lst with Not_found -> lst in (new_pkg, SetSection.union new_sections old_sections) :: lst with Not_found -> (new_pkg, new_sections) :: lst in let add_build_tools ssection = List.fold_left (fun lst -> function | ExternalTool tool -> (package_of_tool tool, ssection) :: lst | InternalExecutable _ -> lst) in let split_package_section = List.fold_left (fun lst -> function | Library (_, bs, _) | Object (_, bs, _) | Executable (_, bs, _) as section -> begin let ssection = SetSection.singleton section in let lst = (* Add build_depends *) List.fold_left (fun lst -> function | FindlibPackage (fndlb_nm, ver_opt) -> let fndlb_root = match (OASISString.nsplit fndlb_nm '.') with | hd :: _ -> hd | _ -> fndlb_nm in (package_of_library fndlb_root ver_opt, ssection) :: lst | InternalLibrary _ -> lst) lst bs.bs_build_depends in (* Add build_tools *) add_build_tools ssection lst bs.bs_build_tools end | Test (_, {test_tools = build_tools}) | Doc (_, {doc_build_tools = build_tools}) as section -> add_build_tools (SetSection.singleton section) lst build_tools | Flag _ | SrcRepo _ -> lst) (* Basic dependencies *) ([ LFindlibPackage ("findlib", pkg.findlib_version), all_build_sections_set; LFindlibPackage ("ocaml", pkg.ocaml_version), all_build_sections_set] @ (if OASISFeatures.package_test OASISFeatures.dynrun_for_release pkg then [ LFindlibPackage ("oasis", Some (OASISVersion.VGreaterEqual pkg.oasis_version)), all_build_sections_set ] else [])) (* Go through all sections *) pkg.sections in (* Merge everything *) List.fold_left merge_package_section [] split_package_section in let add_file ctxt (fn_opt, important, ppf) = match fn_opt with | Some unix_fn -> begin let rec remove_eol_eof str = List.fold_left (fun str eol -> try remove_eol_eof (OASISString.strip_ends_with ~what:eol str) with Not_found -> str) str ["\n"; "\r"] in let content = ppf str_formatter; (* Trim problematic 2x newline at end of last para, because we * don't know if there will a following para. *) remove_eol_eof (flush_str_formatter ()) in let comment = if OASISFeatures.package_test markdown pkg then comment_markdown else comment_ml in add_file {(template_make unix_fn comment [] [ (* One line before, one line after to avoid mixing content * with comment formatting (it causes e.g. pandoc to think * this is a paragraph. *) "\n"^content^"\n" ] []) with important = important} ctxt end | None -> ctxt in let t = generator data in let fix_ext fn real_fn_opt = match real_fn_opt with | Some real_fn -> if OASISFeatures.package_test markdown pkg && real_fn = default_filenames fn then Some (fn^".md") else Some real_fn | None -> None in let t = { readme = fix_ext "README" t.readme; install = fix_ext "INSTALL" t.install; authors = fix_ext "AUTHORS" t.authors; } in List.fold_left add_file ctxt [ (* Generate README.txt *) t.readme, false, (fun fmt -> pp_open_vbox fmt 0; pp_print_titlef fmt 1 "%s - %s" pkg.name pkg.synopsis; may (fun descr -> OASISText.pp_print fmt descr; pp_print_newline fmt (); pp_print_newline fmt ()) pkg.description; may (fun fn -> pp_print_paraf fmt "See the file [%s](%s) for building and installation \ instructions." fn fn) t.install; may (pp_print_paraf fmt "[Home page](%s)") pkg.homepage; may (pp_print_paraf fmt "[Bug reports](%s)") pkg.bugreports; pp_print_title fmt 2 "Copyright and license"; List.iter (fun str -> pp_print_string fmt str; pp_print_newline fmt ()) pkg.copyrights; if pkg.copyrights <> [] then pp_print_newline fmt (); pp_print_para fmt (OASISLicense.legal_disclaimer pkg.name pkg.license); may (fun fn -> pp_print_paraf fmt "See [%s](%s) for more information." fn fn) pkg.license_file; pp_close_box fmt (); ); (* Generate INSTALL.txt *) t.install, (OASISFeatures.package_test OASISFeatures.dynrun_for_release pkg), (fun fmt -> pp_open_vbox fmt 0; fprintf fmt "@[This is the INSTALL file for the %s distribution.@]@,@," pkg.name; pp_print_para fmt "This package uses OASIS to generate its build system. \ See section OASIS for full information."; pp_print_title fmt 1 "Dependencies"; fprintf fmt "@[In order to compile this package, you will need:@]@,"; pp_open_vbox fmt 0; pp_print_cut fmt (); pp_print_list (fun fmt (pkg, sections) -> fprintf fmt "* @[%a%a@]" (fun fmt -> function | LTool s -> pp_print_string fmt s | LFindlibPackage (nm, ver_opt) -> fprintf fmt "%s%a" nm pp_print_ver_opt ver_opt) pkg pp_print_sections sections) "@," fmt depends; pp_close_box fmt (); pp_print_cut fmt (); pp_print_string fmt StdFilesData.install; pp_close_box fmt ()); (* Generate AUTHORS.txt *) t.authors, false, (fun fmt -> pp_open_vbox fmt 0; fprintf fmt "@[Authors of %s:@]@," pkg.name; pp_print_cut fmt (); pp_print_list (fun fmt str -> pp_print_string fmt ("* "^str)) "@," fmt pkg.OASISTypes.authors; if pkg.maintainers <> [] then begin pp_print_cut2 fmt (); fprintf fmt "@[Current maintainers of %s:@]@," pkg.name; pp_print_cut fmt (); pp_print_list (fun fmt str -> pp_print_string fmt ("* "^str)) "@," fmt pkg.maintainers end; pp_close_box fmt ()); ] let init () = register_help plugin {(help_default StdFilesData.readme_template_mkd) with help_order = 50}; Extra.register_act self_id main; register_generator_package all_id pivot_data generator oasis-0.4.11/src/plugins/extra/stdfiles/StdFilesData.mlify0000644000175000017500000000015213261073606023020 0ustar gildorgildorVarString install "INSTALL.txt" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/plugins/extra/stdfiles/MANUAL-template.mkd0000644000175000017500000000052313261073606022734 0ustar gildorgildorThis plugin generates standard files like `README.txt`, `INSTALL.txt` and `AUTHORS.txt`. These files will summarize data contains in `_oasis`. The `.txt` extension has been added to allow easy editing/viewing under Windows and other system that look for extension to determine file type. Package fields: $ListStdFilesExtraPackageFields oasis-0.4.11/src/plugins/extra/stdfiles/INSTALL.txt0000644000175000017500000000076213261073606021325 0ustar gildorgildor Installing ========== 1. Uncompress the source archive and go to the root of the package 2. Run 'ocaml setup.ml -configure' 3. Run 'ocaml setup.ml -build' 4. Run 'ocaml setup.ml -install' Uninstalling ============ 1. Go to the root of the package 2. Run 'ocaml setup.ml -uninstall' OASIS ===== OASIS is a program that generates a setup.ml file using a simple '_oasis' configuration file. The generated setup only depends on the standard OCaml installation: no additional library is required. oasis-0.4.11/src/plugins/extra/docbook.ml0000644000175000017500000000355713261073606017620 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Docbook package *) module Docbook = struct module Env = Environment module Chk = Check module Msg = Message let xsltproc = Chk.prog "xsltproc" let xmllint = Chk.prog "xmllint" end oasis-0.4.11/src/plugins/extra/devfiles/0000755000175000017500000000000013261073606017435 5ustar gildorgildoroasis-0.4.11/src/plugins/extra/devfiles/configure0000755000175000017500000000040513261073606021343 0ustar gildorgildor#!/bin/sh # OASIS_START set -e FST=true for i in "$@"; do if $FST; then set -- FST=false fi case $i in --*=*) ARG=${i%%=*} VAL=${i##*=} set -- "$@" "$ARG" "$VAL" ;; *) set -- "$@" "$i" ;; esac done oasis-0.4.11/src/plugins/extra/devfiles/MANUAL-template.mkd0000644000175000017500000000027313261073606022722 0ustar gildorgildorIt helps to generate a toplevel `Makefile` and `configure` files which only invoke `setup.ml`. It aims to provide good old entry points. Package fields: $ListDevFilesExtraPackageFields oasis-0.4.11/src/plugins/extra/devfiles/DevFilesPlugin.ml0000644000175000017500000002020013261073606022641 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Generate standard development files @author Sylvain Le Gall *) open OASISFileTemplate open OASISGettext open OASISTypes open OASISPlugin open OASISSchema let plugin = `Extra, "DevFiles", Some OASISConf.version_short let self_id, all_id = Extra.create plugin let all_targets = [ "build"; "doc"; "test"; "all"; "install"; "uninstall"; "reinstall"; "clean"; "distclean"; "configure"; ] type t = { makefile_notargets: string list; enable_makefile: bool; enable_configure: bool; } let pivot_data = data_new_property plugin let generator = let makefile_notargets = new_field OASISPackage.schema all_id "MakefileNoTargets" ~default:[] (OASISValues.comma_separated (OASISValues.choices (fun _ -> s_ "target") (List.rev_map (fun s -> s, s) all_targets))) (fun () -> s_ "Targets to disable when generating Makefile") pivot_data (fun _ t -> t.makefile_notargets) in let enable_makefile = new_field OASISPackage.schema all_id "EnableMakefile" ~default:true OASISValues.boolean (fun () -> s_ "Generate Makefile") pivot_data (fun _ t -> t.enable_makefile) in let enable_configure = new_field OASISPackage.schema all_id "EnableConfigure" ~default:true OASISValues.boolean (fun () -> s_ "Generate configure script") pivot_data (fun _ t -> t.enable_configure) in (fun data -> { makefile_notargets = makefile_notargets data; enable_makefile = enable_makefile data; enable_configure = enable_configure data; }) let main ctxt pkg = let t = generator pkg.schema_data in let (makefile_setup_deps, packages) = match ctxt.update with | OASISSetupUpdate.Dynamic -> (" _oasis", " -linkpkg -package oasis.dynrun") | OASISSetupUpdate.Weak -> (" _oasis", "") | OASISSetupUpdate.NoUpdate -> ("", "") in let compiled_setup_ml = OASISFeatures.package_test OASISFeatures.compiled_setup_ml pkg in if compiled_setup_ml && not t.enable_makefile then OASISMessage.error ~ctxt:ctxt.ctxt "The alpha feature compiled_setup_ml doesn't work without a Makefile if \ DevFiles in enabled"; let ctxt = (* Generate Makefile (for standard dev. env.) *) if t.enable_makefile then begin let buff = Buffer.create 13 in let targets = let excludes = OASISUtils.SetString.of_list t.makefile_notargets in List.filter (fun t -> not (OASISUtils.SetString.mem t excludes)) all_targets in let add_one_target ?(need_configure=true) ?(other_depends=[]) nm = let setup_deps l = if compiled_setup_ml then "$(SETUP)" :: l else l in let deps = String.concat " " ((if need_configure then (fun l -> "setup.data" :: setup_deps l) else (fun l -> setup_deps l)) other_depends) in let deps = if deps <> "" then " " ^ deps else deps in Printf.bprintf buff "%s:%s\n\ \t$(SETUP) -%s $(%sFLAGS)\n\n" nm deps nm (OASISString.uppercase_ascii nm) in Buffer.add_string buff (if compiled_setup_ml then "\nSETUP = ./setup.exe\n\n" else "\nSETUP = ocaml setup.ml\n\n" ); List.iter (function | "distclean" when compiled_setup_ml -> Printf.bprintf buff "distclean: $(SETUP)\n\ \t$(SETUP) -distclean $(DISTCLEANFLAGS)\n\ \t$(RM) $(SETUP)\n\n"; | "all" | "clean" | "distclean" as nm -> add_one_target ~need_configure:false nm | "test" | "doc" as nm -> add_one_target ~other_depends:["build"] nm | "configure" -> let add_configure_target nm = Printf.bprintf buff "%s:%s\n\ \t$(SETUP) -configure $(CONFIGUREFLAGS)\n\n" nm (if compiled_setup_ml then " $(SETUP)" else ""); in add_configure_target "setup.data"; add_configure_target "configure"; | nm -> add_one_target nm) targets; if compiled_setup_ml then begin Printf.bprintf buff "setup.exe: setup.ml%s\n\ \tocamlfind ocamlopt -o $@%s setup.ml || ocamlfind ocamlc -o $@%s setup.ml || true\n\ \t$(RM) setup.cmi setup.cmo setup.cmx setup.o setup.cmt\n\n" makefile_setup_deps packages packages; end; Buffer.add_string buff (".PHONY: "^(String.concat " " targets)^"\n"); OASISPlugin.add_file {(template_make "Makefile" comment_sh [] (OASISString.split_newline ~do_trim:false (Buffer.contents buff)) []) with important = true} ctxt end else ctxt in let ctxt = (* Generate configure (for standard dev. env.) *) if t.enable_configure then let ocaml_setup_configure = let cmd = if compiled_setup_ml then Printf.sprintf "if [ ! -e setup.exe ] || [ _oasis -nt setup.exe ] || [ setup.ml -nt setup.exe ] || [ configure -nt setup.exe ]; then\n \ ocamlfind ocamlopt -o setup.exe%s setup.ml || ocamlfind ocamlc -o setup.exe%s setup.ml || exit 1\n \ rm -f setup.cmi setup.cmo setup.cmx setup.o setup.cmt\n\ fi\n\ ./setup.exe -configure \"$@\"" packages packages else "ocaml setup.ml -configure \"$@\"" in [""; cmd; "# OASIS_STOP"] in begin let tmpl = template_of_string_list ~ctxt:ctxt.OASISPlugin.ctxt ~template:true "configure" comment_sh (DevFilesData.configure @ ocaml_setup_configure) in OASISPlugin.add_file {tmpl with perm = 0o755; important = true} ctxt end else ctxt in ctxt let init () = Extra.register_act self_id main; register_help plugin {(help_default DevFilesData.readme_template_mkd) with help_order = 60}; register_generator_package all_id pivot_data generator oasis-0.4.11/src/plugins/extra/devfiles/DevFilesData.mlify0000644000175000017500000000015013261073606022766 0ustar gildorgildorVarStringList configure "configure" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/plugins/extra/camlidl.ml0000644000175000017500000000351013261073606017572 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Camlidl package *) module Camlidl = struct module Env = Environment module Chk = Check module Msg = Message let camlidl = Chk.prog "camlidl" end oasis-0.4.11/src/plugins/extra/META/0000755000175000017500000000000013261073606016362 5ustar gildorgildoroasis-0.4.11/src/plugins/extra/META/METAPlugin.ml0000644000175000017500000002542713261073606020633 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** META generator @author Sylvain Le Gall *) open OASISGettext open OASISTypes open OASISValues open OASISFindlib open OASISFileTemplate open OASISPlugin open OASISSchema open Format type meta_type = | METALibrary | METASyntax type t = { enable: bool; description: string option; meta_type: meta_type; requires: (string list) option; extra_lines: string list; } let plugin = `Extra, "META", Some OASISConf.version_short let self_id, all_id = Extra.create plugin let feature_extra_lines = OASISFeatures.create "extra_lines" ~plugin (OASISFeatures.since_version "0.3") (fun () -> s_ "Allow to add extra lines to the generated META.") let pivot_data = data_new_property plugin let generator = let new_field nm = new_field OASISLibrary.schema all_id nm in let enable = new_field "Enable" ~default:true boolean (fun () -> s_ "Enable META generation") pivot_data (fun _ t -> t.enable) in let description = new_field "Description" ~default:None (opt string_not_empty) (fun () -> s_ "META package description") pivot_data (fun _ t -> t.description) in let meta_type = new_field "Type" ~default:METALibrary (choices (fun () -> s_ "META type") [ "library", METALibrary; "syntax", METASyntax; ]) (fun () -> s_ "Type of META package, set default predicates for archive") pivot_data (fun _ t -> t.meta_type) in let extra_lines = new_field "ExtraLines" ~default:[] ~feature:feature_extra_lines (newline_separated string_not_empty) (fun () -> s_ "Extra lines to add to the META") pivot_data (fun _ t -> t.extra_lines) in let requires = new_field "Requires" ~default:None (opt (comma_separated string)) (fun () -> s_ "Requires field for META package") pivot_data (fun _ t -> t.requires) in fun data -> { enable = enable data; description = description data; meta_type = meta_type data; requires = requires data; extra_lines = extra_lines data; } let pp_print_meta pkg root_t findlib_name_of_library_name fmt grp = let may f = function | Some x -> f x | None -> () in let replace_chars s = OASISString.replace_chars (fun c -> if OASISString.is_whitespace c then ' ' else c) s in let pp_print_field fmt (var, preds, vl) = fprintf fmt "@,@[%s(%s) =@ %S@]" var (String.concat ", " preds) (replace_chars vl) in let pp_print_sfield fmt (var, vl) = fprintf fmt "@,@[%s =@ %S@]" var (replace_chars vl) in let default_synopsis = match root_t.description with | Some txt -> txt | None -> pkg.synopsis in let rec pp_print_library fmt (cs, bs, contents, children) = let name = cs.cs_name in let archive_byte, archive_byte_plugin, archive_native, archive_native_plugin = match contents with | `Library _ -> name^".cma", Some (name^".cma"), name^".cmxa", Some (name^".cmxs") | `Object { obj_modules = [ m ] } -> let dir = OASISHostPath.of_unix bs.bs_path in let exists fn ext = let path = Filename.concat dir (fn ^ ext) in OASISFileUtil.file_exists_case path in let m = List.find (fun m -> exists m ".mli" || exists m ".ml") [ OASISString.uncapitalize_ascii m; OASISString.capitalize_ascii m ] in m^".cmo", None, m^".cmx", None | `Object _ -> name^".cmo", None, name^".cmx", None in let t = generator cs.cs_data in pp_print_sfield fmt ("version", (OASISVersion.string_of_version pkg.version)); begin let txt = match t.description with | Some txt -> txt | None -> default_synopsis in pp_print_sfield fmt ("description", txt) end; begin let directory = match contents with | `Library l -> l.lib_findlib_directory | `Object o -> o.obj_findlib_directory in match directory with | Some dir -> pp_print_sfield fmt ("directory", dir) | None -> () end; begin let requires = match t.requires with | Some lst -> lst | None -> List.map (function | InternalLibrary nm -> findlib_name_of_library_name nm | FindlibPackage (fndlb_nm, _) -> fndlb_nm) bs.bs_build_depends in if requires <> [] then pp_print_sfield fmt ("requires", String.concat " " requires) end; begin match t.meta_type with | METALibrary -> pp_print_field fmt ("archive", ["byte"], archive_byte); may (fun x -> pp_print_field fmt ("archive", ["byte"; "plugin"], x)) archive_byte_plugin; begin match bs.bs_compiled_object with | Best | Native -> pp_print_field fmt ("archive", ["native"], archive_native); may (fun x -> pp_print_field fmt ("archive", ["native"; "plugin"], x)) archive_native_plugin; | Byte -> () end | METASyntax -> pp_print_field fmt ("archive", ["syntax"; "preprocessor"], archive_byte); pp_print_field fmt ("archive", ["syntax"; "toploop"], archive_byte); begin match bs.bs_compiled_object with | Best | Native -> pp_print_field fmt ("archive", ["syntax"; "preprocessor"; "native"], archive_native); may (fun x -> pp_print_field fmt ("archive", ["syntax"; "preprocessor"; "native"; "plugin"], x)) archive_native_plugin; | Byte -> () end end; List.iter (fprintf fmt "@,%s") t.extra_lines; pp_print_sfield fmt ("exists_if", if bs.bs_compiled_object = Native then archive_native else archive_byte); FormatExt.pp_print_list pp_print_group "@," fmt children and pp_print_group fmt = function | Container (fndlb_nm, children) -> fprintf fmt "@,@[@[package %S (@]%a%a@]@,)" fndlb_nm pp_print_sfield ("description", "Virtual container") (FormatExt.pp_print_list pp_print_group "") children | Package (fndlb_nm, lib_cs, lib_bs, lib, _, children) -> let t = generator lib_cs.cs_data in if t.enable then fprintf fmt "@,@[@[package %S (@]%a@]@,)" fndlb_nm pp_print_library (lib_cs, lib_bs, lib, children) in assert(root_t.enable); pp_open_vbox fmt 0; fprintf fmt "# OASIS_START"; begin match grp with | Container (_, children) -> FormatExt.pp_print_list pp_print_group "" fmt children | Package (_, lib_cs, lib_bs, lib, _, children) -> pp_print_library fmt (lib_cs, lib_bs, lib, children) end; fprintf fmt "@,# OASIS_STOP@,"; pp_close_box fmt (); pp_print_flush fmt () let main ctxt pkg = let group_libs, findlib_name_of_library_name, _ = findlib_mapping pkg in let meta_created = Hashtbl.create 3 in List.fold_left (fun ctxt grp -> let root_cs, root_bs, _ = root_of_group grp in let root_t = generator root_cs.cs_data in if root_t.enable then begin let meta_fn = OASISUnixPath.concat root_bs.bs_path "META" in let buff = Buffer.create 13 in if Hashtbl.mem meta_created meta_fn then OASISUtils.failwithf (f_ "The file '%s' generated for the library '%s' is \ already used for the library '%s'. You can make \ one a child of the other to solve this \ (field `FindlibParent:`).") meta_fn root_cs.cs_name (Hashtbl.find meta_created meta_fn); Hashtbl.add meta_created meta_fn root_cs.cs_name; pp_print_meta pkg root_t findlib_name_of_library_name (Format.formatter_of_buffer buff) grp; OASISPlugin.add_file (template_of_string_list ~ctxt:ctxt.OASISPlugin.ctxt ~template:true meta_fn comment_meta (OASISString.split_newline ~do_trim:false (Buffer.contents buff))) ctxt end else ctxt) ctxt group_libs let init () = register_help plugin {(help_default METAData.readme_template_mkd) with help_order = 40}; Extra.register_act self_id main; register_generator_section `Library all_id pivot_data generator oasis-0.4.11/src/plugins/extra/META/METAData.mlify0000644000175000017500000000007013261073606020741 0ustar gildorgildorVarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/plugins/extra/META/MANUAL-template.mkd0000644000175000017500000000036513261073606021651 0ustar gildorgildorThis plugin is a helper to generate a `META` files that can be distributed and install with a library. It uses library name, version, synopsis and dependencies to generate matching fields in `META`. Library fields: $ListMETAExtraLibraryFields oasis-0.4.11/src/plugins/custom/0000755000175000017500000000000013261073606016023 5ustar gildorgildoroasis-0.4.11/src/plugins/custom/MANUAL-template.mkd0000644000175000017500000000151413261073606021307 0ustar gildorgildorThis plugin allow to define a set of three commands to perform each steps, associated with the following fields: * `XCustomXXX`: main action to run. * `XCustomXXXClean`: action to run when clean is invoked. * `XCustomXXXDistclean`: action to run when distclean is invoked. `XXX` stands for `Conf`, `Build`, `Doc`, `Test`, `Install` or `Uninstall`. Action to run is a simple shell command. It can contain substitution variables as defined in [this section][#substitution]. Package fields: $ListCustomConfPackageFields $ListCustomBuildPackageFields $ListCustomInstallPackageFields Document fields: $ListCustomDocDocumentFields Test fields: $ListCustomTestTestFields The file `setup.data` remains __mandatory__, even when using the custom plugin. You must create it. A simple `touch setup.data; ./configure` should be enough, though. oasis-0.4.11/src/plugins/custom/CustomSys.mod0000644000175000017500000000002013261073606020465 0ustar gildorgildorCustomPlugin.ml oasis-0.4.11/src/plugins/custom/CustomPlugin.ml0000644000175000017500000003127213261073606021013 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Generate custom configure/build/doc/test/install system @author *) open BaseEnv open OASISGettext open OASISTypes type t = { cmd_main: command_line conditional; cmd_clean: (command_line option) conditional; cmd_distclean: (command_line option) conditional; } let run = BaseCustom.run let main ~ctxt:_ t _ extra_args = let cmd, args = var_choose ~name:(s_ "main command") t.cmd_main in run cmd args extra_args let clean ~ctxt:_ t _ extra_args = match var_choose t.cmd_clean with | Some (cmd, args) -> run cmd args extra_args | _ -> () let distclean ~ctxt:_ t _ extra_args = match var_choose t.cmd_distclean with | Some (cmd, args) -> run cmd args extra_args | _ -> () module Build = struct let main ~ctxt t pkg extra_args = main ~ctxt t pkg extra_args; List.iter (fun sct -> let evs = match sct with | Library (cs, bs, lib) when var_choose bs.bs_build -> begin let evs, _ = BaseBuilt.of_library OASISHostPath.of_unix (cs, bs, lib) in evs end | Executable (cs, bs, exec) when var_choose bs.bs_build -> begin let evs, _, _ = BaseBuilt.of_executable OASISHostPath.of_unix (cs, bs, exec) in evs end | _ -> [] in List.iter (fun (bt, bnm, lst) -> BaseBuilt.register ~ctxt bt bnm lst) evs) pkg.sections let clean ~ctxt t pkg extra_args = clean ~ctxt t pkg extra_args; (* TODO: this seems to be pretty generic (at least wrt to ocamlbuild * considering moving this to BaseSetup? *) List.iter (function | Library (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister ~ctxt BaseBuilt.BExecLib cs.cs_name | _ -> ()) pkg.sections let distclean ~ctxt t pkg extra_args = distclean ~ctxt t pkg extra_args end module Test = struct let main ~ctxt t pkg (cs, _) extra_args = try main ~ctxt t pkg extra_args; 0.0 with Failure s -> BaseMessage.warning (f_ "Test '%s' fails: %s") cs.cs_name s; 1.0 let clean ~ctxt t pkg _ extra_args = clean ~ctxt t pkg extra_args let distclean ~ctxt t pkg _ extra_args = distclean ~ctxt t pkg extra_args end module Doc = struct let main ~ctxt t pkg (cs, _) extra_args = main ~ctxt t pkg extra_args; BaseBuilt.register ~ctxt BaseBuilt.BDoc cs.cs_name [] let clean ~ctxt t pkg (cs, _) extra_args = clean ~ctxt t pkg extra_args; BaseBuilt.unregister ~ctxt BaseBuilt.BDoc cs.cs_name let distclean ~ctxt t pkg _ extra_args = distclean ~ctxt t pkg extra_args end (* END EXPORT *) module BuildRuntime = Build module TestRuntime = Test module DocRuntime = Doc open OASISGettext open OASISTypes open OASISValues open OASISPlugin open OASISSchema let nm, ver = "Custom", Some OASISConf.version_short let conf_plugin = `Configure, nm, ver let conf_data = data_new_property conf_plugin let build_plugin = `Build, nm, ver let build_data = data_new_property build_plugin let install_plugin = `Install, nm, ver let install_data = data_new_property install_plugin let uninstall_data = data_new_property ~purpose:`Uninstall install_plugin let test_plugin = `Test, nm, ver let test_data = data_new_property test_plugin let doc_plugin = `Doc, nm, ver let doc_data = data_new_property doc_plugin (** Add standard fields *) let add_fields ~schema id data nm hlp hlp_clean hlp_distclean = let cmd_main = new_field_conditional schema id nm command_line (* TODO: remove when fun () -> s_ be replaced *) (fun () -> s_ hlp) data (fun _ t -> t.cmd_main) in let cmd_clean = new_field_conditional schema id (nm^"Clean") ~default:None (opt command_line) (* TODO: remove when fun () -> s_ be replaced *) (fun () -> s_ hlp_clean) data (fun _ t -> t.cmd_clean) in let cmd_distclean = new_field_conditional schema id (nm^"Distclean") ~default:None (opt command_line) (* TODO: remove when fun () -> s_ be replaced *) (fun () -> s_ hlp_distclean) data (fun _ t -> t.cmd_distclean) in let generator data = { cmd_main = cmd_main data; cmd_clean = cmd_clean data; cmd_distclean = cmd_distclean data; } in cmd_main, cmd_clean, cmd_distclean, generator let odn_of_t v = let open OASISDataNotation in REC ("CustomPlugin", [ ("cmd_main", (odn_of_conditional odn_of_command_line v.cmd_main)); ("cmd_clean", (odn_of_conditional (of_option odn_of_command_line) v.cmd_clean)); ("cmd_distclean", (odn_of_conditional (of_option odn_of_command_line) v.cmd_distclean))]) (** Standard custom handling. *) let std id data nm hlp hlp_clean hlp_distclean = let _, _, _, generator = add_fields ~schema:OASISPackage.schema id data nm hlp hlp_clean hlp_distclean in generator, fun plugin_ctxt pkg -> let t = generator pkg.schema_data in plugin_ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt main ("CustomPlugin.main") t odn_of_t; chng_clean = Some (OASISDataNotation.func_with_arg_ctxt clean ("CustomPlugin.clean") t odn_of_t); chng_distclean = Some (OASISDataNotation.func_with_arg_ctxt distclean ("CustomPlugin.distclean") t odn_of_t); } (* Configure plugin *) let conf_init () = let self_id, id = Configure.create conf_plugin in let generator, doit = std id (* TODO: test if replacing conf_data -> build_data generates an error *) conf_data "Conf" (ns_ "Run command to configure.") (ns_ "Run command to clean configure step.") (ns_ "Run command to distclean configure step.") in Configure.register_act self_id doit; register_generator_package id conf_data generator (* Build plugin *) let build_init () = let self_id, id = Build.create build_plugin in let _, _, _, generator = add_fields id build_data ~schema:OASISPackage.schema "Build" (ns_ "Run command to build.") (ns_ "Run command to clean build step.") (ns_ "Run command to distclean build step.") in let doit plugin_ctxt pkg = let t = generator pkg.schema_data in plugin_ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt BuildRuntime.main ("CustomPlugin.Build.main") t odn_of_t; chng_clean = Some (OASISDataNotation.func_with_arg_ctxt BuildRuntime.clean ("CustomPlugin.Build.clean") t odn_of_t); chng_distclean = Some (OASISDataNotation.func_with_arg_ctxt BuildRuntime.distclean ("CustomPlugin.Build.distclean") t odn_of_t); } in Build.register_act self_id doit; register_generator_package id build_data generator (* Install plugin *) let install_init () = let self_id, id = Install.create install_plugin in let generate_install, doit_install = std id install_data "Install" (ns_ "Run command to install.") (ns_ "Run command to clean install step.") (ns_ "Run command to distclean install step.") in let generate_uninstall, doit_uninstall = std id uninstall_data "Uninstall" (ns_ "Run command to uninstall.") (ns_ "Run command to clean uninstall step.") (ns_ "Run command to distclean uninstall step.") in Install.register_act self_id (doit_install, doit_uninstall); register_generator_package id install_data generate_install; register_generator_package id uninstall_data generate_uninstall (* Document plugin *) let doc_init () = let self_id, id = Doc.create doc_plugin in let _, _, _, generator = add_fields ~schema:OASISDocument.schema id build_data "" (ns_ "Run command to build documentation.") (ns_ "Run command to clean build documentation step.") (ns_ "Run command to distclean build documentation step.") in let doit plugin_ctxt _ (cs, _) = let t = generator cs.cs_data in plugin_ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt DocRuntime.main ("CustomPlugin.Doc.main") t odn_of_t; chng_clean = Some (OASISDataNotation.func_with_arg_ctxt DocRuntime.clean ("CustomPlugin.Doc.clean") t odn_of_t); chng_distclean = Some (OASISDataNotation.func_with_arg_ctxt DocRuntime.distclean ("CustomPlugin.Doc.distclean") t odn_of_t); } in Doc.register_act self_id doit; register_generator_package id doc_data generator (* Test plugin *) let test_init () = let self_id, id = Test.create test_plugin in let test_clean = new_field_conditional OASISTest.schema id "Clean" ~default:None (opt command_line) (fun () -> s_ "Run command to clean test step.") test_data (fun _ t -> t.cmd_clean) in let test_distclean = new_field_conditional OASISTest.schema id "Distclean" ~default:None (opt command_line) (fun () -> s_ "Run command to distclean test step.") test_data (fun _ t -> t.cmd_distclean) in let generator data = { cmd_main = [OASISExpr.EBool true, ("false", [])]; cmd_clean = test_clean data; cmd_distclean = test_distclean data; } in let doit plugin_ctxt _ (cs, test) = let t = {(generator cs.cs_data) with cmd_main = test.test_command} in plugin_ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = OASISDataNotation.func_with_arg_ctxt TestRuntime.main ("CustomPlugin.Test.main") t odn_of_t; chng_clean = Some (OASISDataNotation.func_with_arg_ctxt TestRuntime.clean ("CustomPlugin.Test.clean") t odn_of_t); chng_distclean = Some (OASISDataNotation.func_with_arg_ctxt TestRuntime.distclean ("CustomPlugin.Test.distclean") t odn_of_t); } in Test.register_act self_id doit; register_generator_package id test_data generator let init () = register_help conf_plugin (help_default CustomData.readme_template_mkd); conf_init (); build_init (); install_init (); doc_init (); test_init () oasis-0.4.11/src/plugins/custom/CustomData.mlify0000644000175000017500000000015113261073606021126 0ustar gildorgildorVarString customsys_ml "CustomSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/oasis/0000755000175000017500000000000013261073606014146 5ustar gildorgildoroasis-0.4.11/src/oasis/oasis.mllib0000644000175000017500000000540313261073606016307 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 81a38ee789d9dee511957cf7b53700aa) FormatExt PropList OASISUtils OASISUnixPath OASISFileSystem OASISContext OASISSourcePatterns OASISGettext OASISMessage OASISText OASISTypes OASISParse OASISValues OASISExpr OASISVersion OASISLicense OASISFileTemplate OASISBuildSection OASISDocument OASISExecutable OASISFlag OASISSetupUpdate OASISLibrary OASISObject OASISPackage OASISSourceRepository OASISTest OASISPlugin OASISFindlib OASISSchema OASISSection OASISData OASISString OASISExec OASISFileUtil OASISHostPath OASISGraph OASISFeatures OASISDataNotation OASISMutex OASISVersion_types OASISVersion_lexer OASISVersion_parser OASISLicense_types OASISLicense_lexer OASISLicense_parser OASISValues_lexer OASISConf OASISAst_types OASISAst_lexer OASISAst_parser OASISAst OASISCheck OASISCustom OASISQuickstart OASISHelp OASISFormat OASISSection_intern OASISBuildSection_intern OASISDocument_intern OASISExecutable_intern OASISFlag_intern OASISLibrary_intern OASISObject_intern OASISPackage_intern OASISSourceRepository_intern OASISTest_intern OASISSchema_intern OASISPath_intern # OASIS_STOP oasis-0.4.11/src/oasis/oasis.mldylib0000644000175000017500000000540313261073606016644 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 81a38ee789d9dee511957cf7b53700aa) FormatExt PropList OASISUtils OASISUnixPath OASISFileSystem OASISContext OASISSourcePatterns OASISGettext OASISMessage OASISText OASISTypes OASISParse OASISValues OASISExpr OASISVersion OASISLicense OASISFileTemplate OASISBuildSection OASISDocument OASISExecutable OASISFlag OASISSetupUpdate OASISLibrary OASISObject OASISPackage OASISSourceRepository OASISTest OASISPlugin OASISFindlib OASISSchema OASISSection OASISData OASISString OASISExec OASISFileUtil OASISHostPath OASISGraph OASISFeatures OASISDataNotation OASISMutex OASISVersion_types OASISVersion_lexer OASISVersion_parser OASISLicense_types OASISLicense_lexer OASISLicense_parser OASISValues_lexer OASISConf OASISAst_types OASISAst_lexer OASISAst_parser OASISAst OASISCheck OASISCustom OASISQuickstart OASISHelp OASISFormat OASISSection_intern OASISBuildSection_intern OASISDocument_intern OASISExecutable_intern OASISFlag_intern OASISLibrary_intern OASISObject_intern OASISPackage_intern OASISSourceRepository_intern OASISTest_intern OASISSchema_intern OASISPath_intern # OASIS_STOP oasis-0.4.11/src/oasis/PropList.mli0000644000175000017500000001222313261073606016425 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Property list @author Sylvain Le Gall *) (** {2 Types and exceptions} *) type name = string (** The field of [name] is not set with optional explanation. *) exception Not_set of name * string option (** Can retrieve the field value, but no printer can convert. it to string. *) exception No_printer of name (** [Unknown_field (fld, schm)] Unknown field [fld] in schema [schm]. *) exception Unknown_field of name * name (** {2 Modules} *) (** This module stores heterogeneous data defined in Schema and Field. *) module Data: sig type t (** Create a data storage. *) val create: unit -> t (** Clear a data storage. *) val clear: t -> unit (** List field set, not exported *) val elements: t -> string list end (** This module is a set of fields (Field.t and FieldRO.t) that can be addressed by their name (as string). Value can be set and retrieved as string only. However, the value itself is stored in its native type. *) module Schema: sig (** A value. *) type ('a, 'b) value (** A schema. *) type ('a, 'b) t (** Create a schema. *) val create: ?case_insensitive:bool -> name -> ('a, 'b) t (** Check that the given field name exists. *) val mem: ('a, 'b) t -> name -> bool (** [get t data nm] Retrieve the string value of field [nm] from schema [t] stores in [data]. *) val get: ('a, 'b) t -> Data.t -> name -> string (** [set t data nm ~context str] Parse string value [str] in [~context] and stores it in [data] for field [nm] of schema [t]. *) val set: ('a, 'b) t -> Data.t -> name -> ?context:'a -> string -> unit (** [fold f acc t] Apply [f acc field_name field_extra field_help] in turn to all fields of schema [t]. *) val fold: ('a -> name -> 'b -> (unit -> string) option -> 'a) -> 'a -> ('c, 'b) t -> 'a (** Same as {!Schema.fold} except no accumulator are involved. *) val iter: (name -> 'a -> (unit -> string) option -> unit) -> ('b, 'a) t -> unit (** Get the name of the schema. *) val name: ('a, 'b) t -> name end (** This module defines a field that hold a value. A field can be set and retrieve. It is stored in {!Data.t}. *) module Field: sig (** A field. *) type ('a, 'b, 'c) t (** Create a field, and optionally attached it to a schema. *) val create: ?schema:('a, 'b) Schema.t -> ?name:name -> ?parse:(?context:'a -> string -> 'c) -> ?print:('c -> string) -> ?default:'c -> ?update:(?context:'a -> 'c -> 'c -> 'c) -> ?help:(unit -> string) -> 'b -> ('a, 'c, 'b) t (** Store a field in a {!Data.t}. *) val fset: Data.t -> ('a, 'b, 'c) t -> ?context:'a -> 'b -> unit (** Retrieve a field from a {!Data.t}. *) val fget: Data.t -> ('a, 'b, 'c) t -> 'b (** Same as {!Field.fset} but parses a string to get the value. *) val fsets: Data.t -> ('a, 'b, 'c) t -> ?context:'a -> string -> unit (** Same as {!Field.fget} but applies a printer to the value returned. *) val fgets: Data.t -> ('a, 'b, 'c) t -> string end (** This module defines a read-only field. However, it can only be set through {!Schema.set} if the field is attached to a schema. *) module FieldRO: sig (** Create a read-only field. The returned function can be used to retrieve the value of the field. *) val create: ?schema:('a, 'b) Schema.t -> ?name:name -> ?parse:(?context:'a -> string -> 'c) -> ?print:('c -> string) -> ?default:'c -> ?update:(?context:'a -> 'c -> 'c -> 'c) -> ?help:(unit -> string) -> 'b -> Data.t -> 'c end oasis-0.4.11/src/oasis/PropList.ml0000644000175000017500000001622413261073606016261 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext type name = string exception Not_set of name * string option exception No_printer of name exception Unknown_field of name * name let () = Printexc.register_printer (function | Not_set (nm, Some rsn) -> Some (Printf.sprintf (f_ "Field '%s' is not set: %s") nm rsn) | Not_set (nm, None) -> Some (Printf.sprintf (f_ "Field '%s' is not set") nm) | No_printer nm -> Some (Printf.sprintf (f_ "No default printer for value %s") nm) | Unknown_field (nm, schm) -> Some (Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm) | _ -> None) module Data = struct type t = (name, unit -> unit) Hashtbl.t let create () = Hashtbl.create 13 let clear t = Hashtbl.clear t (* END EXPORT *) let elements t = let rlst = ref [] in Hashtbl.iter (fun nm _ -> rlst := nm :: !rlst) t; !rlst (* START EXPORT *) end module Schema = struct type ('ctxt, 'extra) value = { get: Data.t -> string; set: Data.t -> ?context:'ctxt -> string -> unit; help: (unit -> string) option; extra: 'extra; } type ('ctxt, 'extra) t = { name: name; fields: (name, ('ctxt, 'extra) value) Hashtbl.t; order: name Queue.t; name_norm: string -> string; } let create ?(case_insensitive=false) nm = { name = nm; fields = Hashtbl.create 13; order = Queue.create (); name_norm = (if case_insensitive then OASISString.lowercase_ascii else fun s -> s); } let add t nm set get extra help = let key = t.name_norm nm in if Hashtbl.mem t.fields key then failwith (Printf.sprintf (f_ "Field '%s' is already defined in schema '%s'") nm t.name); Hashtbl.add t.fields key { set = set; get = get; help = help; extra = extra; }; Queue.add nm t.order let mem t nm = Hashtbl.mem t.fields nm let find t nm = try Hashtbl.find t.fields (t.name_norm nm) with Not_found -> raise (Unknown_field (nm, t.name)) let get t data nm = (find t nm).get data let set t data nm ?context x = (find t nm).set data ?context x let fold f acc t = Queue.fold (fun acc k -> let v = find t k in f acc k v.extra v.help) acc t.order let iter f t = fold (fun () -> f) () t let name t = t.name end module Field = struct type ('ctxt, 'value, 'extra) t = { set: Data.t -> ?context:'ctxt -> 'value -> unit; get: Data.t -> 'value; sets: Data.t -> ?context:'ctxt -> string -> unit; gets: Data.t -> string; help: (unit -> string) option; extra: 'extra; } let new_id = let last_id = ref 0 in fun () -> incr last_id; !last_id let create ?schema ?name ?parse ?print ?default ?update ?help extra = (* Default value container *) let v = ref None in (* If name is not given, create unique one *) let nm = match name with | Some s -> s | None -> Printf.sprintf "_anon_%d" (new_id ()) in (* Last chance to get a value: the default *) let default () = match default with | Some d -> d | None -> raise (Not_set (nm, Some (s_ "no default value"))) in (* Get data *) let get data = (* Get value *) try (Hashtbl.find data nm) (); match !v with | Some x -> x | None -> default () with Not_found -> default () in (* Set data *) let set data ?context x = let x = match update with | Some f -> begin try f ?context (get data) x with Not_set _ -> x end | None -> x in Hashtbl.replace data nm (fun () -> v := Some x) in (* Parse string value, if possible *) let parse = match parse with | Some f -> f | None -> fun ?context s -> failwith (Printf.sprintf (f_ "Cannot parse field '%s' when setting value %S") nm s) in (* Set data, from string *) let sets data ?context s = set ?context data (parse ?context s) in (* Output value as string, if possible *) let print = match print with | Some f -> f | None -> fun _ -> raise (No_printer nm) in (* Get data, as a string *) let gets data = print (get data) in begin match schema with | Some t -> Schema.add t nm sets gets extra help | None -> () end; { set = set; get = get; sets = sets; gets = gets; help = help; extra = extra; } let fset data t ?context x = t.set data ?context x let fget data t = t.get data let fsets data t ?context s = t.sets data ?context s let fgets data t = t.gets data end module FieldRO = struct let create ?schema ?name ?parse ?print ?default ?update ?help extra = let fld = Field.create ?schema ?name ?parse ?print ?default ?update ?help extra in fun data -> Field.fget data fld end oasis-0.4.11/src/oasis/OASISVersion_types.ml0000644000175000017500000000357713261073606020164 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Common types for OASISVersion parser @author Sylvain Le Gall *) type t = | VCGt of string | VCGe of string | VCEq of string | VCLt of string | VCLe of string | VCOr of t * t | VCAnd of t * t oasis-0.4.11/src/oasis/OASISVersion_parser.mly0000644000175000017500000000440613261073606020475 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ %{ open OASISVersion_types %} %token VER %token GT GE EQ LT LE OR AND %token LPAREN RPAREN %token EOF %left OR /* lowest precedence */ %left AND /* highest precedence */ %start main %type main %% main: cmp EOF { $1 } ; cmp: | LPAREN cmp RPAREN { $2 } | cmp AND cmp { VCAnd ($1, $3) } | cmp OR cmp { VCOr ($1, $3) } | GT VER { VCGt $2 } | GE VER { VCGe $2 } | EQ VER { VCEq $2 } | LT VER { VCLt $2 } | LE VER { VCLe $2 } ; oasis-0.4.11/src/oasis/OASISVersion_lexer.mll0000644000175000017500000000410313261073606020275 0ustar gildorgildor(********************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (********************************************************************************) { open OASISVersion_parser } rule token = parse [' ''\t''\n'] { token lexbuf } | '>' { GT } | ">=" { GE } | '=' { EQ } | '<' { LT } | "<=" { LE } | "&&" { AND } | "||" { OR } | '(' { LPAREN } | ')' { RPAREN } | eof { EOF } | [^' ''\t''\n']+ as lxm { VER lxm } oasis-0.4.11/src/oasis/OASISVersion.mli0000644000175000017500000001014613261073606017077 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Version comparisons This module handles versions and version comparators. A version is a string of the form "1.0.0". We compare integer and non-integer parts between to version to order them. Version comparators defined relations to a set of version. E.g. ">= 1.0.0" is a version comparator and defines all version above "1.0.0", including "1.0.0". The version comparison is done using {{:http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version}Debian policy for version}. @author Sylvain Le Gall *) (** {2 Version} *) type t (** Compare versions. *) val version_compare: t -> t -> int (** Convert a string to version. *) val version_of_string: string -> t (** Convert a version to string. *) val string_of_version: t -> string (** Version number value. {b Not exported}. *) val value: t OASISValues.t (** Dump [OASISDataNotation.t]. {b Not exported}. *) val odn_of_t: t -> OASISDataNotation.t (** Remove the last part of a version, after the last '.'. I.e. 0.2.0~alpha1 -> 0.2. *) val chop: t -> t (** {2 Version comparator} *) type comparator = | VGreater of t | VGreaterEqual of t | VEqual of t | VLesser of t | VLesserEqual of t | VOr of comparator * comparator | VAnd of comparator * comparator (** Apply version comparator expression. *) val comparator_apply: t -> comparator -> bool (** Convert a comparator to string. Example of output [">= 3.12.1"]. *) val string_of_comparator: comparator -> string (** Convert a comparator to variable name. *) val varname_of_comparator: comparator -> string (** Convert a string to comparator. {b Not exported}. *) val comparator_of_string: string -> comparator (** Simplify comparator, if possible. {b Not exported}. *) val comparator_reduce: comparator -> comparator (** Check that we have a version constraint. {b Not exported}. *) val comparator_value: comparator OASISValues.t (** Dump [OASISDataNotation.t]. {b Not exported}. *) val odn_of_comparator: comparator -> OASISDataNotation.t (** The module [OASISVersion.StringVersion] uses [string] for version. *) module StringVersion: sig type t = string (** Compare version strings. *) val compare: t -> t -> int (** [comparator_ge version comparator_opt] Check if [comparator] is compatible with all versions >= than [version]. Return [false] if comparator is [None]. {b Not exported} *) val comparator_ge: string -> comparator option -> bool end oasis-0.4.11/src/oasis/OASISVersion.ml0000644000175000017500000003230013261073606016722 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext type t = string type comparator = | VGreater of t | VGreaterEqual of t | VEqual of t | VLesser of t | VLesserEqual of t | VOr of comparator * comparator | VAnd of comparator * comparator (* Range of allowed characters *) let is_digit c = '0' <= c && c <= '9' let is_alpha c = ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') let is_special = function | '.' | '+' | '-' | '~' -> true | _ -> false let rec version_compare v1 v2 = if v1 <> "" || v2 <> "" then begin (* Compare ascii string, using special meaning for version * related char *) let val_ascii c = if c = '~' then -1 else if is_digit c then 0 else if c = '\000' then 0 else if is_alpha c then Char.code c else (Char.code c) + 256 in let len1 = String.length v1 in let len2 = String.length v2 in let p = ref 0 in (** Compare ascii part *) let compare_vascii () = let cmp = ref 0 in while !cmp = 0 && !p < len1 && !p < len2 && not (is_digit v1.[!p] && is_digit v2.[!p]) do cmp := (val_ascii v1.[!p]) - (val_ascii v2.[!p]); incr p done; if !cmp = 0 && !p < len1 && !p = len2 then val_ascii v1.[!p] else if !cmp = 0 && !p = len1 && !p < len2 then - (val_ascii v2.[!p]) else !cmp in (** Compare digit part *) let compare_digit () = let extract_int v p = let start_p = !p in while !p < String.length v && is_digit v.[!p] do incr p done; let substr = String.sub v !p ((String.length v) - !p) in let res = match String.sub v start_p (!p - start_p) with | "" -> 0 | s -> int_of_string s in res, substr in let i1, tl1 = extract_int v1 (ref !p) in let i2, tl2 = extract_int v2 (ref !p) in i1 - i2, tl1, tl2 in match compare_vascii () with | 0 -> begin match compare_digit () with | 0, tl1, tl2 -> if tl1 <> "" && is_digit tl1.[0] then 1 else if tl2 <> "" && is_digit tl2.[0] then -1 else version_compare tl1 tl2 | n, _, _ -> n end | n -> n end else begin 0 end let version_of_string str = str let string_of_version t = t let chop t = try let pos = String.rindex t '.' in String.sub t 0 pos with Not_found -> t let rec comparator_apply v op = match op with | VGreater cv -> (version_compare v cv) > 0 | VGreaterEqual cv -> (version_compare v cv) >= 0 | VLesser cv -> (version_compare v cv) < 0 | VLesserEqual cv -> (version_compare v cv) <= 0 | VEqual cv -> (version_compare v cv) = 0 | VOr (op1, op2) -> (comparator_apply v op1) || (comparator_apply v op2) | VAnd (op1, op2) -> (comparator_apply v op1) && (comparator_apply v op2) let rec string_of_comparator = function | VGreater v -> "> "^(string_of_version v) | VEqual v -> "= "^(string_of_version v) | VLesser v -> "< "^(string_of_version v) | VGreaterEqual v -> ">= "^(string_of_version v) | VLesserEqual v -> "<= "^(string_of_version v) | VOr (c1, c2) -> (string_of_comparator c1)^" || "^(string_of_comparator c2) | VAnd (c1, c2) -> (string_of_comparator c1)^" && "^(string_of_comparator c2) let rec varname_of_comparator = let concat p v = OASISUtils.varname_concat p (OASISUtils.varname_of_string (string_of_version v)) in function | VGreater v -> concat "gt" v | VLesser v -> concat "lt" v | VEqual v -> concat "eq" v | VGreaterEqual v -> concat "ge" v | VLesserEqual v -> concat "le" v | VOr (c1, c2) -> (varname_of_comparator c1)^"_or_"^(varname_of_comparator c2) | VAnd (c1, c2) -> (varname_of_comparator c1)^"_and_"^(varname_of_comparator c2) (* END EXPORT *) open OASISUtils open OASISVersion_types module StringVersion = struct type t = string let to_version = version_of_string let compare s1 s2 = version_compare (to_version s1) (to_version s2) let comparator_ge s c_opt = let rec comparator_ge' v' = let cmp v = version_compare v v' >= 0 in function | VEqual v | VGreaterEqual v | VGreater v -> cmp v | VLesserEqual _ | VLesser _ -> false | VOr (c1, c2) -> comparator_ge' v' c1 || comparator_ge' v' c2 | VAnd (c1, c2) -> comparator_ge' v' c1 && comparator_ge' v' c2 in match c_opt with | Some c -> comparator_ge' (to_version s) c | None -> false end let comparator_of_string str = let lexbuf = Lexing.from_string str in let rec parse_aux = function | VCAnd (c1, c2) -> VAnd (parse_aux c1, parse_aux c2) | VCOr (c1, c2) -> VOr (parse_aux c1, parse_aux c2) | VCGt s -> VGreater (version_of_string s) | VCGe s -> VGreaterEqual (version_of_string s) | VCEq s -> VEqual (version_of_string s) | VCLt s -> VLesser (version_of_string s) | VCLe s -> VLesserEqual (version_of_string s) in try parse_aux (OASISVersion_parser.main OASISVersion_lexer.token lexbuf) with e -> failwithf (f_ "Error while parsing '%s': %s") str (Printexc.to_string e) (* The comparator_reduce function transforms the given comparator into its * disjunctive normal form considering, with all version in ascending order. It * uses intervals of version to combine the terms of the comparator. *) let comparator_reduce = (* Compare endpoints *) let cmp_norm e1 e2 = match e1, e2 with | `BeforeFirst, `BeforeFirst | `AfterLast, `AfterLast -> `EQ | `BeforeFirst, _ | _, `AfterLast -> `AB | _, `BeforeFirst | `AfterLast, _ -> `BA | `Version v1, `Version v2 -> let d = version_compare v1 v2 in if d = 0 then `EQ else if d < 0 then `AB else `BA in let split e1 e2 e3 tl = match e2 with | `Version v2 -> `Interval(e1, e2) :: `Point v2 :: `Interval(e2, e3) :: tl | _ -> assert false in let pushif op acc b1 b2 e = if op b1 b2 then e :: acc else acc in (* Combine heads of intervals and continue processing. *) let rec combine op acc hd1 tl1 hd2 tl2 = let id, cons, pacc = (fun i -> i), (fun i j -> i :: j), pushif op acc in let m ?(acc=acc) ?(f1=id) ?(f2=id) () = merge op acc (f1 tl1) (f2 tl2) in match hd1, hd2 with | `Interval(e1, e2), `Interval (e3, e4) -> begin match cmp_norm e3 e1, cmp_norm e1 e4, cmp_norm e2 e4 with | `BA, _, _ -> combine op acc hd2 tl2 hd1 tl1 | `EQ, _, `EQ -> m ~acc:(pacc true true hd1) () | `AB, `EQ, _ -> m ~acc:(pacc false true hd2) ~f1:(cons hd1) () | `AB, `BA, _ -> m ~acc:(pacc false true hd2) ~f1:(cons hd1) () | `AB, `AB, `BA -> m ~f1:(split e1 e4 e2) ~f2:(split e3 e1 e4) () | `AB, `AB, `EQ -> m ~f1:(cons hd1) ~f2:(split e3 e1 e4) () | `AB, `AB, `AB -> m ~f1:(cons hd1) ~f2:(split e3 e1 e4) () | `EQ, _, `BA -> m ~f1:(split e1 e4 e2) ~f2:(cons hd2) () | `EQ, _, `AB -> m ~f1:(cons hd1) ~f2:(split e3 e2 e4) () end | `Interval(e1, e2), `Point v3 -> begin let e3 = `Version v3 in match cmp_norm e3 e1, cmp_norm e2 e3 with | `BA, `BA -> m ~f1:(split e1 e3 e2) ~f2:(cons hd2) () | (`EQ | `AB), _ -> m ~acc:(pacc false true hd2) ~f1:(cons hd1) () | _, (`EQ | `AB) -> m ~acc:(pacc true false hd1) ~f2:(cons hd2) () end | `Point v1, `Point v2 -> begin match cmp_norm (`Version v1) (`Version v2) with | `EQ -> m ~acc:(pacc true true hd1) () | `AB -> m ~acc:(pacc true false hd1) ~f2:(cons hd2) () | `BA -> m ~acc:(pacc false true hd2) ~f1:(cons hd1) () end | `Point _, `Interval _ -> combine op acc hd2 tl2 hd1 tl1 (* Reduce a list of segment when we can find some patterns. *) and reduce acc i = match i with | `Interval(e1, `Version v2) :: `Point v3 :: `Interval(`Version v4, e5) :: tl when v2 = v3 && v3 = v4 -> reduce [] (List.rev_append acc (`Interval(e1, e5) :: tl)) | hd :: tl -> reduce (hd :: acc) tl | [] -> List.rev acc and merge op acc i1 i2 = match i1, i2 with | hd1 :: tl1, hd2 :: tl2 -> combine op acc hd1 tl1 hd2 tl2 | hd :: tl, [] -> merge op (pushif op acc true false hd) tl [] | [], hd :: tl -> merge op (pushif op acc false true hd) [] tl | [], [] -> reduce [] (List.rev acc) in let rec of_comparator = function | VGreater v -> [`Interval(`Version v, `AfterLast)] | VLesser v -> [`Interval(`BeforeFirst, `Version v)] | VEqual v -> [`Point v] | VGreaterEqual v -> [`Point v; `Interval(`Version v, `AfterLast)] | VLesserEqual v -> [`Interval(`BeforeFirst, `Version v); `Point v] | VOr (c1, c2) -> merge ( || ) [] (of_comparator c1) (of_comparator c2) | VAnd (c1, c2) -> merge ( && ) [] (of_comparator c1) (of_comparator c2) in let to_comparator i = let cmp_true = VOr(VLesserEqual "0", VGreaterEqual "0") in let rec close_interval acc i c e = match e, i with | `Version v1, `Point v2 :: tl when v1 = v2 -> combine_intervals acc tl c (VLesserEqual v1) | `Version v, _ -> combine_intervals acc i c (VLesser v) | `AfterLast, _ -> combine_intervals acc i c cmp_true | `BeforeFirst, _ -> assert false and combine_intervals acc i c1 c2 = let vor c1 c2 = if c1 = cmp_true then c2 else VOr(c1, c2) in match c1 = cmp_true, c2 = cmp_true with | true, true -> map_intervals cmp_true i | true, false -> map_intervals (vor acc c2) i | false, true -> map_intervals (vor acc c1) i | false, false -> map_intervals (vor acc (VAnd(c1, c2))) i and map_intervals acc i = match i with | `Point v1 :: `Interval(`Version v2, e3) :: tl when v1 = v2 -> close_interval acc tl (VGreaterEqual v2) e3 | `Interval(`BeforeFirst, e) :: tl -> close_interval acc tl cmp_true e | `Interval(`Version v, e) :: tl -> close_interval acc tl (VGreater v) e | `Interval(`AfterLast, _) :: _ -> assert false | `Point v :: tl -> combine_intervals acc tl (VEqual v) cmp_true | [] -> assert (acc <> cmp_true); acc in map_intervals cmp_true i in fun v -> to_comparator (of_comparator v) open OASISValues let value = { parse = (fun ~ctxt:_ s -> version_of_string s); update = update_fail; print = string_of_version; } let comparator_value = { parse = (fun ~ctxt:_ s -> comparator_of_string s); update = update_fail; print = string_of_comparator; } let odn_of_t = OASISDataNotation.of_string let rec odn_of_comparator = let open OASISDataNotation in function | VGreater v0 -> VRT ("OASISVersion.VGreater", [ odn_of_t v0 ]) | VGreaterEqual v0 -> VRT ("OASISVersion.VGreaterEqual", [ odn_of_t v0 ]) | VEqual v0 -> VRT ("OASISVersion.VEqual", [ odn_of_t v0 ]) | VLesser v0 -> VRT ("OASISVersion.VLesser", [ odn_of_t v0 ]) | VLesserEqual v0 -> VRT ("OASISVersion.VLesserEqual", [ odn_of_t v0 ]) | VOr ((v1, v0)) -> VRT ("OASISVersion.VOr", [ odn_of_comparator v1; odn_of_comparator v0 ]) | VAnd ((v1, v0)) -> VRT ("OASISVersion.VAnd", [ odn_of_comparator v1; odn_of_comparator v0 ]) oasis-0.4.11/src/oasis/OASISValues_lexer.mll0000644000175000017500000000431413261073606020113 0ustar gildorgildor(********************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (********************************************************************************) let w = ['0'-'9' 'a'-'z' 'A'-'Z' '_'] let s = ['\t' '\r' '\n' ' '] let notS = _ # s let d = ['0'-'9'] let url_scheme = ['A'-'Z' 'a'-'z'] ['A'-'Z' 'a'-'z' '0'-'9' '+' '-' '.']* let url_path = ( w + ':'? w* '@')? (notS+) (':' d+)? ('/'|'/'((w|['#' '!' ':' '.' '?' '+' '=' '&' '%' '@' '!' '-' '/'])))? rule url = parse (url_scheme "://" url_path) as lxm { lxm } and copyright = parse ('(' ['c' 'C'] ')' ' '* (d+)('-' d+)? ','? ' ' _*) as lxm { lxm } and modul = parse (['A'-'Z'] w*) as lxm { lxm } oasis-0.4.11/src/oasis/OASISValues.mli0000644000175000017500000001211513261073606016707 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Parse, print and check values This module allows to parse values that should match a particular content (URL, list). The whole module is {b not exported}. @author Sylvain Le Gall *) (** {2 Types and exception} *) (** Definition of a value. *) type 'a t = { parse: ctxt:OASISContext.t -> string -> 'a; (** Parse a string into value *) update: 'a -> 'a -> 'a; (** Merge two values into one *) print: 'a -> string; (** Convert a value to string *) } (** The value exist but there is no easy way to represent it. *) exception Not_printable (** It is not possible to combine values. *) exception Not_combinable (** Always raise {!Not_combinable}. *) val update_fail: 'a -> 'b -> 'c (** {2 Basic values and combinators} *) (** Hidden value to build phantom data storage, cannot set/get it using string. *) val blackbox: 'a t (** String value. *) val string: string t (** String value, must not be "". *) val string_not_empty: string t (** Boolean value, use [bool_of_string] to parse. *) val boolean: bool t (** Extra check to see if the string value, can be expanded using [Buffer.add_substitute] rules. *) val expandable: string t -> string t (** [dot_separated v] When parsing split the input string using '.' separator and apply [v.parse]. Merge by concatenate two values, and print by joining [v.print] generated strings using a '.' separator. Don't strip whitespaces. *) val dot_separated: 'a t -> 'a list t (** Same as {!dot_separated} using ',' as separator. Strip whitespaces before and after the input string. *) val comma_separated: 'a t -> 'a list t (** Same {!dot_separated} using '\n' as separator. Strip whitespaces before and after the input string. *) val newline_separated: 'a t -> 'a list t (** Same as {!dot_separated} using blanks as separator. *) val space_separated: string list t (** [with_optional_parentheses v_main v_opt] Combine two values. The input string ["abcd (defg)"] is split between the part not between parentheses and the one between. [v_main] is applied to the first one and [v_opt] to the latter. If no parentheses is found, only apply [v_main]. *) val with_optional_parentheses: 'a t -> 'b t -> ('a * 'b option) t (** Optional value. *) val opt: 'a t -> 'a option t (** [choices nm lst] Value that must be in a list of predefined choices. Find the right association in [lst], comparison is case insensitive. If something failed output a message using [nm] as the name of the value represented. *) val choices: (unit -> string) -> (string * 'a) list -> 'a t (** {2 Standard values} *) (** URL value. *) val url: string t (** Copyright value. *) val copyright: string t (** File value. *) val file: string t (** File list value. *) val files: string list t (** File with glob value. *) val file_glob: string t (** Directory value. *) val directory: string t (** Module list value. *) val modules: string list t (** Category list value. *) val categories: string list t (** Findlib package name value, without its path. *) val findlib_name: string t (** Findlib package name with path value, e.g. oasis.base. *) val findlib_full: string t (** Internal library. *) val internal_library: string t (** Command line. *) val command_line: (string * string list) t (** Arguments of command line programs. See {!OASISUtils.POSIX.split} for more information. *) val command_line_options: string list t oasis-0.4.11/src/oasis/OASISValues.ml0000644000175000017500000003017213261073606016541 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext open OASISUtils exception Not_printable exception Not_combinable type 'a t = { parse: ctxt:OASISContext.t -> string -> 'a; update: 'a -> 'a -> 'a; print: 'a -> string; } let update_fail _ _ = raise Not_combinable let blackbox = { parse = (fun ~ctxt:_ s -> failwithf (f_ "Blackbox type cannot be set to the value '%s'") s); update = update_fail; print = (fun _ -> raise Not_printable); } module StdLexer = struct let url = OASISValues_lexer.url let copyright = OASISValues_lexer.copyright let modul = OASISValues_lexer.modul end let lexer ?(fail=(fun ~ctxt:_ _ _ -> ())) lxr nm = { parse = (fun ~ctxt str -> try let lexbuf = Lexing.from_string str in let str_matched = lxr lexbuf in if str_matched = str then str else failwithf (f_ "Only substring '%s' of '%s' is a %s") str_matched str (nm ()) with e -> fail ~ctxt str e; (* Catch all if the previous ignore error. *) failwithf (f_ "String '%s' is not a %s: %s.") str (nm ()) (Printexc.to_string e)); update = update_fail; print = (fun s -> s); } let url = lexer StdLexer.url (fun () -> s_ "URL") let copyright = let base_value = lexer StdLexer.copyright (fun () -> s_ "copyright") in {base_value with parse = (fun ~ctxt str -> try base_value.parse ~ctxt str with _ -> failwithf (f_ "Copyright must follow the convention \ '(C) 2008-2009 J.R. Hacker', here it is '%s'") str)} let string = { parse = (fun ~ctxt:_ s -> s); update = (fun s1 s2 -> s1^" "^s2); print = (fun s -> s); } let string_not_empty = { parse = (fun ~ctxt:_ str -> if str <> "" then str else failwith (s_ "Expecting not empty string")); update = (fun s1 s2 ->s1^" "^s2); print = (fun s -> s); } let file = {string_not_empty with update = update_fail} let file_glob = {string_not_empty with update = update_fail} let file_pattern = { parse = (fun ~ctxt:_ str -> match OASISString.nsplit str '%' with | [pfx; sfx] -> (pfx, sfx) | _ -> failwith (s_ "Expecting a file pattern, containing one %.")); update = update_fail; print = (fun (pfx, sfx) -> pfx ^ "%" ^ sfx); } let directory = {string_not_empty with update = update_fail} let expandable value = (* TODO: check expandable value and return a list rather * than a single value. Use split_expandable defined above. *) value let dot_separated value = { parse = (fun ~ctxt s -> List.map (value.parse ~ctxt) (OASISString.nsplit s '.')); update = List.append; print = (fun lst -> String.concat "." (List.map value.print lst)); } let comma_separated value = { parse = (fun ~ctxt s -> List.map (fun s -> value.parse ~ctxt s) (OASISString.split_comma s)); update = List.append; print = (fun lst -> String.concat ", " (List.map value.print lst)); } let newline_separated value = { parse = (fun ~ctxt s -> List.map (fun s -> value.parse ~ctxt s) (OASISString.split_newline s)); update = List.append; print = (fun lst -> String.concat "\n" (List.map value.print lst)); } let space_separated = { parse = (fun ~ctxt:_ s -> List.filter (fun s -> s <> "") (OASISString.nsplit s ' ')); update = List.append; print = (fun lst -> String.concat " " lst); } let with_optional_parentheses main_value optional_value = { parse = (fun ~ctxt str -> match OASISString.split_optional_parentheses str with | e1, Some e2 -> main_value.parse ~ctxt e1, Some (optional_value.parse ~ctxt e2) | e1, None -> main_value.parse ~ctxt e1, None); update = update_fail; print = (function | v, None -> main_value.print v | v, Some opt -> Printf.sprintf "%s (%s)" (main_value.print v) (optional_value.print opt)); } let opt value = { parse = (fun ~ctxt str -> Some (value.parse ~ctxt str)); update = update_fail; print = (function | Some v -> value.print v | None -> raise Not_printable); } let modules = let base_value = lexer StdLexer.modul ~fail:(fun ~ctxt:_ str _ -> if OASISString.capitalize_ascii str <> str then failwithf (f_ "Module name '%s', must be capitalized ('%s').") str (OASISString.capitalize_ascii str)) (fun () -> s_ "module") in comma_separated { parse = (fun ~ctxt s -> let path = OASISUnixPath.dirname s in let modul = OASISUnixPath.basename s in if String.contains path ' ' then failwithf (f_ "Module path '%s' must not contain a ' '") s; OASISUnixPath.concat path (base_value.parse ~ctxt modul)); update = update_fail; print = (fun s -> s); } let files = comma_separated file let categories = comma_separated url let choices nm lst = { parse = (fun ~ctxt:_ str -> try List.assoc (OASISString.lowercase_ascii str) (List.map (fun (k, v) -> OASISString.lowercase_ascii k, v) lst) with Not_found -> failwithf (f_ "Unknown %s %S (possible: %s)") (nm ()) str (String.concat ", " (List.map fst lst))); update = update_fail; print = (fun v -> try List.assoc v (List.map (fun (s, v) -> v, s) lst) with Not_found -> failwithf (f_ "Unexpected abstract choice value for %s") (nm ())); } let boolean = choices (fun () -> s_ "boolean") ["true", true; "false", false] let findlib_name = { parse = (fun ~ctxt:_ s -> if s = "" then failwith (s_ "Empty string is not a valid findlib package") else if String.contains s '"' || String.contains s '.' then failwith (s_ "Findlib package name cannot contain '.' or '\"'") else s); update = update_fail; print = (fun s -> s); } let findlib_full = { parse = (fun ~ctxt s -> let cpnts = OASISString.nsplit s '.' in if cpnts = [] then failwith (s_ "Empty string is not a valid findlib package"); List.iter (fun cpnt -> let _s: string = findlib_name.parse ~ctxt cpnt in ()) cpnts; s); update = update_fail; print = (fun s -> s); } let internal_library = (* TODO: check that the library really exists *) {string with update = update_fail} let command_line = let split_expandable str = (* Add a single char to accumulator *) let rec addchr c = function | Some b, _ as acc -> Buffer.add_char b c; acc | None, l -> let b = Buffer.create 13 in addchr c (Some b, l) in (* Add a separator that will end the previous * token or do nothing if already separated *) let addsep = function | Some b, l -> None, (Buffer.contents b) :: l | None, l -> None, l in (* Split the list of char into a list of token * taking care of matching $( ... ) and ${ ... } *) let rec lookup_closing oc cc acc = function | c :: tl -> let acc = addchr c acc in if c = oc then begin let acc, tl = lookup_closing oc cc acc tl in lookup_closing oc cc acc tl end else if c = cc then begin acc, tl end else begin lookup_closing oc cc acc tl end | [] -> failwithf (f_ "'%s' contains unbalanced curly braces") str in let rec lookup_dollar acc = function | '$' :: ('(' as c) :: tl | '$' :: ('{' as c) :: tl -> begin let acc, tl = lookup_closing c (if c = '(' then ')' else '}') (addchr c (addchr '$' acc)) tl in lookup_dollar acc tl end | ' ' :: tl -> lookup_dollar (addsep acc) tl | c :: tl -> lookup_dollar (addchr c acc) tl | [] -> begin let l = match acc with | Some b, l -> Buffer.contents b :: l | None, l -> l in List.rev l end in (* Transform string into list *) let lst = let rl = ref [] in String.iter (fun c -> rl := c :: !rl) str; List.rev !rl in lookup_dollar (None, []) lst in { parse = (fun ~ctxt:_ s -> match split_expandable s with | cmd :: args -> cmd, args | [] -> failwithf (f_ "Command line '%s' is invalid") s); update = (fun (cmd, args1) (arg2, args3) -> (cmd, args1 @ (arg2 :: args3))); print = (fun (cmd, args) -> space_separated.print (cmd :: args)) } let command_line_options = { parse = (fun ~ctxt:_ s -> POSIXShell.split s); update = List.append; print = (fun lst -> String.concat " " (List.map POSIXShell.escape lst)); } oasis-0.4.11/src/oasis/OASISUtils.mli0000644000175000017500000001307613261073606016557 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Various utilities @author Sylvain Le Gall *) (** {2 Map} *) module MapExt: sig module type S = sig include Map.S (** Extends a map with an association list. *) val add_list: 'a t -> (key * 'a) list -> 'a t (** Convert an association list to a map. *) val of_list: (key * 'a) list -> 'a t (** Convert a map to an association list. *) val to_list: 'a t -> (key * 'a) list end module Make: functor (Ord: Map.OrderedType) -> S with type key = Ord.t end module MapString: MapExt.S with type key = String.t (** {2 Set} *) module SetExt: sig module type S = sig include Set.S (** Extends a set with a list. *) val add_list: t -> elt list -> t (** Convert a list to a set. *) val of_list: elt list -> t (** Shortcut for [Set.elements]. *) val to_list: t -> elt list end module Make: functor (Ord: Set.OrderedType) -> S with type elt = Ord.t end (** Set for String. *) module SetString: SetExt.S with type elt = String.t (** Set for String. *) module SetStringCsl: SetExt.S with type elt = String.t (** {2 Hashtable} *) (** Caseless string hashtable *) module HashStringCsl: Hashtbl.S with type key = String.t (** {2 Variable name} *) (** [varname_of_string ~hyphen:c s] Transform a string [s] into a variable name, following this convention: no digit at the beginning, lowercase, only a-z and 0-9 chars. Whenever there is a problem, use an hyphen. *) val varname_of_string: ?hyphen:char -> string -> string (** [varname_concat ~hyphen p s] Concat variable name, removing hyphen at end of [p] and at beginning of [s]. *) val varname_concat: ?hyphen:char -> string -> string -> string (** [is_varname str] Check that the string [str] is a valid varname. See {!varname_of_string} for definition. *) val is_varname: string -> bool (** {2 Fail with Printf.sprintf} *) (** This function raises the [Failure] exception just as [failwith] except that one specifies the string raised through a format string. Example: [failwithf "Cannot do %s because of %d" str i] *) val failwithf: ('a, unit, string, 'b) format4 -> 'a (** This function returns a string describing a position in a file, to locate an error. The format of the string is compatible with OCaml compilation location format. *) val file_location: ?pos1:Lexing.position -> ?pos2:Lexing.position -> ?lexbuf:Lexing.lexbuf -> unit -> string (** This function raises the [Failure] exception just as [failwith] except that one specifies the string raised through a format string and locate the error using [lexbuf] in the source file. Example: [failwithpf lexbuf "Cannot do %s because of %d" str i] *) val failwithpf: ?pos1:Lexing.position -> ?pos2:Lexing.position -> ?lexbuf:Lexing.lexbuf -> ('a, unit, string, 'b) format4 -> 'a (** {2 String} *) (** Caseless compare function *) val compare_csl: string -> string -> int (** {2 Options} *) (** [may f (Some x)] calls [f x] or do nothing. *) val may: ('a -> unit) -> 'a option -> unit module POSIXShell: sig (** [split s]: the string [s] is interpreted as command line arguments and splitted into its components (un-escaped). For example [split "a \"b c\" d" = ["a"; "b c"; "d"]]. Note that [split "" = []]. It is possible that substitutions such as "$a" (resp. "$(a b)") may be transformed into "$\{a\}" (resp. "$\{a b\}"). *) val split: string -> string list (** [escape s] quote [s] if needed to protect spaces, '"' and '\'' so it reads as a single argument in a POSIX shell command, the content of which is identical to [s] (interpreted with OCaml conventions). If quoted, the returned string will start and end with '"'. The original string [s] is returned if no quoting is necessary. *) val escape: string -> string (** [unescape s] returns a string [s'] removing all backslashes preceding a char. *) val unescape: string -> string end oasis-0.4.11/src/oasis/OASISUtils.ml0000644000175000017500000002515213261073606016404 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext module MapExt = struct module type S = sig include Map.S val add_list: 'a t -> (key * 'a) list -> 'a t val of_list: (key * 'a) list -> 'a t val to_list: 'a t -> (key * 'a) list end module Make (Ord: Map.OrderedType) = struct include Map.Make(Ord) let rec add_list t = function | (k, v) :: tl -> add_list (add k v t) tl | [] -> t let of_list lst = add_list empty lst let to_list t = fold (fun k v acc -> (k, v) :: acc) t [] end end module MapString = MapExt.Make(String) module SetExt = struct module type S = sig include Set.S val add_list: t -> elt list -> t val of_list: elt list -> t val to_list: t -> elt list end module Make (Ord: Set.OrderedType) = struct include Set.Make(Ord) let rec add_list t = function | e :: tl -> add_list (add e t) tl | [] -> t let of_list lst = add_list empty lst let to_list = elements end end module SetString = SetExt.Make(String) let compare_csl s1 s2 = String.compare (OASISString.lowercase_ascii s1) (OASISString.lowercase_ascii s2) module HashStringCsl = Hashtbl.Make (struct type t = string let equal s1 s2 = (compare_csl s1 s2) = 0 let hash s = Hashtbl.hash (OASISString.lowercase_ascii s) end) module SetStringCsl = SetExt.Make (struct type t = string let compare = compare_csl end) let varname_of_string ?(hyphen='_') s = if String.length s = 0 then begin invalid_arg "varname_of_string" end else begin let buf = OASISString.replace_chars (fun c -> if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') then c else hyphen) s; in let buf = (* Start with a _ if digit *) if '0' <= s.[0] && s.[0] <= '9' then "_"^buf else buf in OASISString.lowercase_ascii buf end let varname_concat ?(hyphen='_') p s = let what = String.make 1 hyphen in let p = try OASISString.strip_ends_with ~what p with Not_found -> p in let s = try OASISString.strip_starts_with ~what s with Not_found -> s in p^what^s let is_varname str = str = varname_of_string str let failwithf fmt = Printf.ksprintf failwith fmt let rec file_location ?pos1 ?pos2 ?lexbuf () = match pos1, pos2, lexbuf with | Some p, None, _ | None, Some p, _ -> file_location ~pos1:p ~pos2:p ?lexbuf () | Some p1, Some p2, _ -> let open Lexing in let fn, lineno = p1.pos_fname, p1.pos_lnum in let c1 = p1.pos_cnum - p1.pos_bol in let c2 = c1 + (p2.pos_cnum - p1.pos_cnum) in Printf.sprintf (f_ "file %S, line %d, characters %d-%d") fn lineno c1 c2 | _, _, Some lexbuf -> file_location ~pos1:(Lexing.lexeme_start_p lexbuf) ~pos2:(Lexing.lexeme_end_p lexbuf) () | None, None, None -> s_ "" let failwithpf ?pos1 ?pos2 ?lexbuf fmt = let loc = file_location ?pos1 ?pos2 ?lexbuf () in Printf.ksprintf (fun s -> failwith (Printf.sprintf "%s: %s" loc s)) fmt (* END EXPORT *) let may f = function | Some x -> f x | None -> () module POSIXShell = struct let unescape s = let buf = Buffer.create (String.length s) in let _b: bool = OASISString.fold_left (fun escaped_char -> function | '\\' when not escaped_char -> true (* Next char should be added anyway *) | c -> Buffer.add_char buf c; false) false s in Buffer.contents buf (* [escape s] escapes [s] in such a way that [unescape] recovers the original string. *) let escape s = let buf = Buffer.create (String.length s + 8) in let need_to_quote = Buffer.add_char buf '"'; OASISString.fold_left (fun need_to_quote -> function | '"' -> Buffer.add_string buf "\\\""; true | '\\' -> Buffer.add_string buf "\\\\"; true | c -> Buffer.add_char buf c; need_to_quote || OASISString.is_whitespace c || c = '\'') (s = "") (* empty strings must be quoted *) s in if need_to_quote then (Buffer.add_char buf '"'; Buffer.contents buf) else s (* FIXME: Not handled (does it make sense in this context?) • $'string' *) let rec split str = (* Buffer holding the current arg being parsed. *) let buf = Buffer.create (String.length str) in (* Shorthands to access the buffer *) let buf_add c = Buffer.add_char buf c in let buf_flush () = let res = Buffer.contents buf in Buffer.clear buf; res in (* Protect Buffer.add_substitute substitution inside a string, the $... will * be transformed into $X0, $X1... *) let substr_data = Hashtbl.create 13 in let str = let idx = ref 0 in try Buffer.add_substitute buf (fun var -> let nvar = Printf.sprintf "X%d" !idx in incr idx; Hashtbl.add substr_data nvar var; "${" ^ nvar ^ "}") str; buf_flush () with Not_found -> failwithf (f_ "Unterminated substitution $(...) or ${...} in the string %S") str in (* Function to unprotect a string protected above. *) let unprotect_subst str = let add_end_dollar, str = let len = String.length str in if len > 0 && str.[len - 1] = '$' then true, String.sub str 0 (len - 1) else false, str in Buffer.add_substitute buf (fun nvar -> let var = try Hashtbl.find substr_data nvar with Not_found -> nvar in (* The protection, using [Buffer.add_substitute], ensures that if [var] contains '}' then it was delimited with '(', ')'. *) if String.contains var '}' then "$("^var^")" else "${"^var^"}" ) str; if add_end_dollar then buf_add '$'; buf_flush () in let rec skip_blank strm = match Stream.peek strm with | Some c -> if OASISString.is_whitespace c then begin Stream.junk strm; skip_blank strm end | None -> () in let rec get_simply_quoted_string strm = try match Stream.next strm with | '\'' -> (* End of simply quoted string *) () | c -> buf_add c; get_simply_quoted_string strm with Stream.Failure -> failwithf (f_ "Unterminated simply quoted string in %S") (unprotect_subst (buf_flush ())) in let is_doubly_quoted_escapable = function | Some c -> c = '$' || c = '`' || c = '"' || c = '\\' | None -> false in let get_escape_char strm = match Stream.peek strm with | Some c -> buf_add c; Stream.junk strm | None -> (* Final backslash, ignore it *) () in let rec get_doubly_quoted_string strm = try match Stream.next strm with | '"' -> (* End of doubly quoted string *) () | '\\' when is_doubly_quoted_escapable (Stream.peek strm) -> get_escape_char strm; get_doubly_quoted_string strm | c -> buf_add c; get_doubly_quoted_string strm with Stream.Failure -> failwithf (f_ "Unterminated doubly quoted string in %S") (unprotect_subst (buf_flush ())) in (* The char stream used for parsing *) let strm = Stream.of_string str in let rargs = ref [] in let () = (* Skip blanks at the beginning *) skip_blank strm; while Stream.peek strm <> None do match Stream.next strm with | '\\' -> (* Escape a char, since it is possible that get_escape_char * decide to ignore the '\\', we let this function choose to * add or not '\\'. *) get_escape_char strm | '\'' -> get_simply_quoted_string strm | '"' -> get_doubly_quoted_string strm | c -> if OASISString.is_whitespace c then begin (* We reach the end of an arg *) rargs := buf_flush () :: !rargs; skip_blank strm end else begin buf_add c end done; let last = buf_flush () in if last <> "" then rargs := last :: !rargs in List.rev_map unprotect_subst !rargs end oasis-0.4.11/src/oasis/OASISUnixPath.mli0000644000175000017500000001016113261073606017207 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Unix path manipulation The filename and dirname used in '_oasis' file and {!OASISTypes.package} are always encoded as Unix path. They are changed when using it on the target system. @author Sylvain Le Gall *) type unix_filename = string type unix_dirname = unix_filename type host_filename = string type host_dirname = host_filename (** '.' on Unix. *) val current_dir_name: unix_filename (** Test if the filename is current dir (either '.' or '') on Unix. *) val is_current_dir: unix_filename -> bool (** '..' on Unix. *) val parent_dir_name: unix_filename (** [concat fn1 fn2] Concatenate fn1 and fn2, i.e. [fn1^'/'^fn2]. *) val concat: unix_filename -> unix_filename -> unix_filename (** [make lst] Concatenate all filename components of [lst]. *) val make: unix_filename list -> unix_filename (** [dirname fn] Return directory name of [fn] or [current_dir_name] if no directory name is defined. *) val dirname: unix_filename -> unix_filename (** [basename fn] Return filename without its directory name. *) val basename: unix_filename -> unix_filename (** [chop_extension fn] Remove the last part of the filename, after a '.', return [fn] if there is no extension. *) val chop_extension: unix_filename -> unix_filename (** [check_extension fn ext] Check that the filen [fn] has the extension [ext]. {b Not exported} *) val check_extension: unix_filename -> string -> bool (** [add_extension fn ext] Add the extension [ext] to the filename [fn]. {b Not exported} *) val add_extension: unix_filename -> string -> unix_filename (** [replace_extension fn ext] Add the extension [ext] to the filename [fn]. {b Not exported} *) val replace_extension: unix_filename -> string -> unix_filename (** [capitalize_file fn] Return filename capitalized. *) val capitalize_file: unix_filename -> unix_filename (** [uncapitalize_file fn] Return filename uncapitalized. *) val uncapitalize_file: unix_filename -> unix_filename (** Try to compress the filename by removing '.' and collapsing '..'. {b Not exported} *) val reduce: unix_filename -> unix_filename (** [make_relative fn_root fn] Make [fn] relative to [fn_root]. {b Not exported} *) val make_relative: unix_filename -> unix_filename -> unix_filename (** Test if the filename is the current directory. {b Not exported} *) val is_current: unix_filename -> bool (** Set for Unix path. {b Not exported} *) module Set: OASISUtils.SetExt.S with type elt = unix_filename oasis-0.4.11/src/oasis/OASISUnixPath.ml0000644000175000017500000001431213261073606017040 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type unix_filename = string type unix_dirname = string type host_filename = string type host_dirname = string let current_dir_name = "." let parent_dir_name = ".." let is_current_dir fn = fn = current_dir_name || fn = "" let concat f1 f2 = if is_current_dir f1 then f2 else let f1' = try OASISString.strip_ends_with ~what:"/" f1 with Not_found -> f1 in f1'^"/"^f2 let make = function | hd :: tl -> List.fold_left (fun f p -> concat f p) hd tl | [] -> invalid_arg "OASISUnixPath.make" let dirname f = try String.sub f 0 (String.rindex f '/') with Not_found -> current_dir_name let basename f = try let pos_start = (String.rindex f '/') + 1 in String.sub f pos_start ((String.length f) - pos_start) with Not_found -> f let chop_extension f = try let last_dot = String.rindex f '.' in let sub = String.sub f 0 last_dot in try let last_slash = String.rindex f '/' in if last_slash < last_dot then sub else f with Not_found -> sub with Not_found -> f let capitalize_file f = let dir = dirname f in let base = basename f in concat dir (OASISString.capitalize_ascii base) let uncapitalize_file f = let dir = dirname f in let base = basename f in concat dir (OASISString.uncapitalize_ascii base) (* END EXPORT *) let check_extension fn ext = OASISString.ends_with ~what:("."^ext) fn let add_extension fn ext = fn^"."^ext let replace_extension fn ext = add_extension (Filename.chop_extension fn) ext open OASISPath_intern open OASISUtils let filename_of_list lst = let buf = Buffer.create 34 in List.iter (function | `Root _ | `RootRelative _ -> Buffer.add_char buf '/' | `Component str -> if Buffer.length buf > 0 then Buffer.add_char buf '/'; Buffer.add_string buf str | `CurrentDir -> if Buffer.length buf > 0 then begin Buffer.add_char buf '/'; Buffer.add_string buf current_dir_name end | `ParentDir -> if Buffer.length buf > 0 then Buffer.add_char buf '/'; Buffer.add_string buf parent_dir_name) lst; Buffer.contents buf let fn_norm fn = fn_reduce [] (fn_reader ~os_type:"Unix" fn) let reduce fn = filename_of_list (fn_norm fn) let make_relative fn_root fn = (* Basic analysis of fn_root and fn. *) let lst_root = fn_norm fn_root in let lst = fn_norm fn in let existing_component = List.fold_left (fun acc -> function | `Component str -> SetString.add str acc | _ -> acc) SetString.empty (List.rev_append lst_root lst) in (* Create a fake absolute path that will can be used to make * fn_root and fn absolute. * It covers pathological case like "../../../../" as a filename. *) let fake_root = let abs_len = max (List.length lst_root) (List.length lst) + 1 in let idx = ref 0 in let rec cpt_uniq i = let cpt = Printf.sprintf "c%d" !idx in incr idx; if SetString.mem cpt existing_component then cpt_uniq i else `Component cpt in filename_of_list (`Root "" :: Array.to_list (Array.init abs_len cpt_uniq)) in (* Use the created fake root to make fn and fn_root absolute. *) let make_absolute lst fn = match lst with | `Root _ :: _ -> lst | _ -> fn_norm (concat fake_root fn) in let abs_lst_root = make_absolute lst_root fn_root in let abs_lst = make_absolute lst fn in (* Compute relative path. *) let rec make_relative' = function | hd_root :: tl_root, hd :: tl when hd_root = hd -> make_relative' (tl_root, tl) | lst_root, lst -> let back_to_base = List.rev_map (fun _ -> `ParentDir) lst_root in back_to_base @ lst in let res = filename_of_list (fn_reduce [] (make_relative' (abs_lst_root, abs_lst))) in (* Check result. *) List.iter (function | `Component str -> if not (SetString.mem str existing_component) then OASISUtils.failwithf "When trying to 'make_relative %S %S' create a \ non-existent path component %S" fn_root fn str | _ -> ()) (fn_norm res); res let is_current fn = if fn = current_dir_name || fn = "" then true else (fn_norm fn) = [`CurrentDir] module Set = SetExt.Make( struct type t = unix_filename let compare t1 t2 = String.compare (reduce t1) (reduce t2) end) oasis-0.4.11/src/oasis/OASISTypes.mli0000644000175000017500000003764013261073606016566 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Package definition This module contains all the types used to build an OASIS package. A package is described by an '_oasis' file. @author Sylvain Le Gall *) (** {2 Aliases} *) type name = string (** Standard name. *) type package_name = string (** Name of a package, see {!package}. *) type url = string (** Standard URL. *) (* TODO: use OASIS{Host,Unix}Path. *) type unix_dirname = string (** UNIX directory name. *) type unix_filename = string (** UNIX file name. *) type host_dirname = string (** Host directory name. *) type host_filename = string (** Host file name. *) type prog = string (** Program. *) type arg = string (** Command line argument. *) type args = arg list (** Command line arguments. *) type command_line = (prog * args) (** Command line. *) (** Package name for findlib, doesn't contain '.'. *) type findlib_name = string (** Package name + path for findlib, made of several findlib name concatenated with '.'. *) type findlib_full = string (** {2 OASIS package definition} *) (** Compilation type. *) type compiled_object = | Byte (** Always use byte code. *) | Native (** Always use native code. *) | Best (** Use either byte or native, depending ocamlopt availability. *) (** Package dependency. *) type dependency = | FindlibPackage of findlib_full * OASISVersion.comparator option (** External findlib package. *) | InternalLibrary of name (** Section library of the given name. *) (** Tool dependency. *) type tool = | ExternalTool of name (** External tool. *) | InternalExecutable of name (** Section executable of the given name. *) (** Possible VCS. *) type vcs = | Darcs (** Darcs *) | Git (** Git *) | Svn (** Subversion *) | Cvs (** CVS *) | Hg (** Mercurial *) | Bzr (** Bazaar *) | Arch (** GNU arch *) | Monotone (** Monotone *) | OtherVCS of url (** Anything else, follow URL for description. *) (** Conditional value, last expression that evaluate to true define the value. *) type 'a conditional = 'a OASISExpr.choices (** Plugin kind. *) type plugin_kind = [`Configure | `Build | `Doc | `Test | `Install | `Extra] (** Additional data to allow registration of more than one data property per plugin. See {!OASISPlugin.data_new_property} *) type plugin_data_purpose = [ `Configure | `Build | `Install | `Clean | `Distclean | `Install | `Uninstall | `Test | `Doc | `Extra | `Other of string ] (** Plugin definition, plugin type depends on which fields this types is used for. *) type 'a plugin = 'a * name * OASISVersion.t option type all_plugin = plugin_kind plugin (** Property list storage for plugin data *) type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list (** Set of command lines to run before and after a step. *) type custom = { pre_command: (command_line option) conditional; (** Run before. *) post_command: (command_line option) conditional; (** Run after. *) } (** Common attributes for sections. *) type common_section = { cs_name: name; (** Name of the section. *) (* TODO: get rid of schema_data and cs_data *) cs_data: PropList.Data.t; cs_plugin_data: plugin_data; (** Property list attached to the section. *) } (** Common attributes for Executable and Library sections. *) type build_section = { bs_build: bool conditional; (** Build this section. *) bs_install: bool conditional; (** Install this section. *) bs_path: unix_dirname; (** Top level location of the sources. *) bs_compiled_object: compiled_object; (** What kind of compilation. *) bs_build_depends: dependency list; (** List of dependencies. *) bs_build_tools: tool list; (** List of build tools. *) bs_interface_patterns: OASISSourcePatterns.t list; (** Patterns used to locate interface source filesi (.mli). *) bs_implementation_patterns: OASISSourcePatterns.t list; (** Patterns used to locate implementation source files (.ml). *) bs_c_sources: unix_filename list; (** C sources, relative to [bs_path]. *) bs_data_files: (unix_filename * unix_filename option) list; (** Data files and their install location, relative to [bs_path]. *) bs_findlib_extra_files: unix_filename list; (** Extra files to install with findlib. *) bs_ccopt: args conditional; (** Options for -ccopt. *) bs_cclib: args conditional; (** Options for -cclib. *) bs_dlllib: args conditional; (** Options for -dllib. *) bs_dllpath: args conditional; (** Options for -dllpath. *) bs_byteopt: args conditional; (** Option to pass to ocamlc. *) bs_nativeopt: args conditional; (** Option to pass to ocamlopt. *) } (** Library definition. *) type library = { lib_modules: string list; (** List of modules exported by the library. *) lib_pack: bool; (** Are we building a packed library? *) lib_internal_modules: string list; (** List of modules not-exported by the library, but compiled along. *) lib_findlib_parent: findlib_name option; (** Name of the findlib parent, if any. *) lib_findlib_name: findlib_name option; (** Findlib name of this library, this name is used to refer to this library in build dependencies. *) lib_findlib_directory: unix_dirname option; (** Findlib sub-directory where the library will be installed. This directory is actually relative to the directory of the findlib parent. *) lib_findlib_containers: findlib_name list; (** Name of virtual containers (empty findlib package) between findlib parent and findlib name *) } (** Object definition. *) type object_ = { obj_modules: string list; obj_findlib_fullname: findlib_name list option; (** Findlib name of this library, this name is used to refer to this library in build dependencies. *) obj_findlib_directory: unix_dirname option; (** See {!library.lib_findlib_directory}. *) } (** Executable definition. *) type executable = { exec_custom: bool; (** Use -custom ocamlc option. *) exec_main_is: unix_filename; (** Main file to compile, dependencies should be guessed by build system. *) } (** Command line flag definition. *) type flag = { flag_description: string option; (** Short description. *) flag_default: bool conditional; (** Default value. *) } (** Source repository definition. *) type source_repository = { src_repo_type: vcs; (** Repository type. *) src_repo_location: url; (** Where to fetch the source, using appropriate VCS tool. *) src_repo_browser: url option; (** Where to browse the source, using web browser. *) src_repo_module: string option; (** Depending on VCS, which module (e.g. CVS). *) src_repo_branch: string option; (** Depending on VCS, which branch (e.g. git). *) src_repo_tag: string option; (** Depending on VCS, which tag (e.g. tag for darcs, git or svn). *) src_repo_subdir: unix_filename option; (** Depending on VCS, which sub directory (e.g. svn). *) } (** Test definition. *) type test = { test_type: [`Test] plugin; (** Plugin to run the test, default custom. *) test_command: command_line conditional; (** Command to run the test, may depend on the plugin meaning. *) test_custom: custom; (** Custom command lines to run before and after. *) test_working_directory: unix_filename option; (** Which working directorty to chdir in. *) test_run: bool conditional; (** Should we run the test. *) test_tools: tool list; (** Tools required for this test. *) } (** Document formats. *) type doc_format = | HTML of unix_filename (** HTML files and their main entry point (e.g. [HTML "index.html"]) *) | DocText (** Plain text. *) | PDF (** Portable document format. *) | PostScript | Info of unix_filename (** Info files and their main entry point. *) | DVI | OtherDoc (** Anything else. *) (** Document definition. *) type doc = { doc_type: [`Doc] plugin; (** Plugin to build this document, default none. *) doc_custom: custom; (** Custom command lines ommand to before and after. *) doc_build: bool conditional; (** Build this document. *) doc_install: bool conditional; (** Install this document. *) doc_install_dir: unix_filename; (** Where to install this document. *) doc_title: string; (** What is the title of this document. *) doc_authors: string list; (** Who are the authors of this document. *) doc_abstract: string option; (** Abstract of this document. *) doc_format: doc_format; (** Format of this document. *) doc_data_files: (unix_filename * unix_filename option) list; (** All data files and where they should be install, by default to doc_install_dir *) doc_build_tools: tool list; (** Tools required to generate this document. *) } (** All sections and their attributes. *) type section = | Library of common_section * build_section * library | Object of common_section * build_section * object_ | Executable of common_section * build_section * executable | Flag of common_section * flag | SrcRepo of common_section * source_repository | Test of common_section * test | Doc of common_section * doc type section_kind = [ `Library | `Object | `Executable | `Flag | `SrcRepo | `Test | `Doc ] (** OASIS package, what an '_oasis' file contains. *) type package = { oasis_version: OASISVersion.t; (** OASIS version used to write this package. *) ocaml_version: OASISVersion.comparator option; (** OCaml version required for this package. *) findlib_version: OASISVersion.comparator option; (** Findlib version required for this package. *) alpha_features: string list; (** Alpha features enabled for this package. *) beta_features: string list; (** Beta features enabled for this package. *) name: package_name; (** Name of this package. *) version: OASISVersion.t; (** Version of this package. *) license: OASISLicense.t; (** License of this package. *) license_file: unix_filename option; (** File containing the license of this package. *) copyrights: string list; (** Copyright holders (e.g. companies or people). *) maintainers: string list; (** People actually taking care of this package (e.g. subset of copyright holders) *) authors: string list; (** Real people who wrote this package, not their companies. *) homepage: url option; (** Location of the package homepage. *) bugreports: url option; (** Location of the page to report bugs. *) synopsis: string; (** Short description of the package. *) description: OASISText.t option; (** Long description of the package. *) tags: string list; (** List of tags. *) categories: url list; (** List of categories that the package belong to. *) conf_type: [`Configure] plugin; (** Plugin to configure, default internal. *) conf_custom: custom; (** Actions around configure step. *) build_type: [`Build] plugin; (** Plugin to build, default ocamlbuild. *) build_custom: custom; (** Actions around build step. *) install_type: [`Install] plugin; (** Plugin to install/uninstall, default internal. *) install_custom: custom; (** Actions around install step. *) uninstall_custom: custom; (** Actions around uninstall step. *) clean_custom: custom; (** Actions around clean step. *) distclean_custom: custom; (** Actions aroudn distclean step. *) files_ab: unix_filename list; (** Files to generate by replacing token in it after configure step. *) sections: section list; (** All sections (libraries, executables, tests...). *) plugins: [`Extra] plugin list; (** Extra plugins applied. *) disable_oasis_section: unix_filename list; (** Files which should not have OASIS Section comments and digests *) (* TODO: get rid of schema_data and cs_data *) schema_data: PropList.Data.t; plugin_data: plugin_data; (** Property list attached to this package. *) } (** {2 Quickstart questions } *) (** Quickstart level. {b Not exported}. *) type 'a quickstart_level = | NoChoice of 'a (** Don't ask question, use provided value. *) | Beginner (** Ask the question to a beginner and above. *) | Intermediate (** Ask the question to an intermediate user and above. *) | Expert (** Ask the question to an expert. *) (** Howto ask questions in quickstart. {b Not exported}. *) type 'a quickstart_question = | Field (** Short text. *) | Text (** Long text, may use editor for it. *) | Choices of 'a list (** Multiple choices in a list. *) | ExclusiveChoices of 'a list (** Pick a single choice in the list. *) (** {2 ODN functions} TODO: rewrite. These functions allow to generate setup.ml standalone code, by serializing OCaml data using OCaml notation. They are {b not exported}. See {{:http://forge.ocamlcore.org/projects/odn} the OCaml data notation project} *) val odn_of_unix_dirname: unix_dirname -> OASISDataNotation.t val odn_of_unix_filename: unix_filename -> OASISDataNotation.t val odn_of_command_line: prog * args -> OASISDataNotation.t val odn_of_conditional: ('a -> OASISDataNotation.t) -> 'a OASISExpr.choices -> OASISDataNotation.t val odn_of_package: package -> OASISDataNotation.t oasis-0.4.11/src/oasis/OASISTypes.ml0000644000175000017500000004613013261073606016407 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type name = string type package_name = string type url = string type unix_dirname = string type unix_filename = string (* TODO: replace everywhere. *) type host_dirname = string (* TODO: replace everywhere. *) type host_filename = string (* TODO: replace everywhere. *) type prog = string type arg = string type args = string list type command_line = (prog * arg list) type findlib_name = string type findlib_full = string type compiled_object = | Byte | Native | Best type dependency = | FindlibPackage of findlib_full * OASISVersion.comparator option | InternalLibrary of name type tool = | ExternalTool of name | InternalExecutable of name type vcs = | Darcs | Git | Svn | Cvs | Hg | Bzr | Arch | Monotone | OtherVCS of url type plugin_kind = [ `Configure | `Build | `Doc | `Test | `Install | `Extra ] type plugin_data_purpose = [ `Configure | `Build | `Install | `Clean | `Distclean | `Install | `Uninstall | `Test | `Doc | `Extra | `Other of string ] type 'a plugin = 'a * name * OASISVersion.t option type all_plugin = plugin_kind plugin type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list type 'a conditional = 'a OASISExpr.choices type custom = { pre_command: (command_line option) conditional; post_command: (command_line option) conditional; } type common_section = { cs_name: name; cs_data: PropList.Data.t; cs_plugin_data: plugin_data; } type build_section = { bs_build: bool conditional; bs_install: bool conditional; bs_path: unix_dirname; bs_compiled_object: compiled_object; bs_build_depends: dependency list; bs_build_tools: tool list; bs_interface_patterns: OASISSourcePatterns.t list; bs_implementation_patterns: OASISSourcePatterns.t list; bs_c_sources: unix_filename list; bs_data_files: (unix_filename * unix_filename option) list; bs_findlib_extra_files: unix_filename list; bs_ccopt: args conditional; bs_cclib: args conditional; bs_dlllib: args conditional; bs_dllpath: args conditional; bs_byteopt: args conditional; bs_nativeopt: args conditional; } type library = { lib_modules: string list; lib_pack: bool; lib_internal_modules: string list; lib_findlib_parent: findlib_name option; lib_findlib_name: findlib_name option; lib_findlib_directory: unix_dirname option; lib_findlib_containers: findlib_name list; } type object_ = { obj_modules: string list; obj_findlib_fullname: findlib_name list option; obj_findlib_directory: unix_dirname option; } type executable = { exec_custom: bool; exec_main_is: unix_filename; } type flag = { flag_description: string option; flag_default: bool conditional; } type source_repository = { src_repo_type: vcs; src_repo_location: url; src_repo_browser: url option; src_repo_module: string option; src_repo_branch: string option; src_repo_tag: string option; src_repo_subdir: unix_filename option; } type test = { test_type: [`Test] plugin; test_command: command_line conditional; test_custom: custom; test_working_directory: unix_filename option; test_run: bool conditional; test_tools: tool list; } type doc_format = | HTML of unix_filename (* TODO: source filename. *) | DocText | PDF | PostScript | Info of unix_filename (* TODO: source filename. *) | DVI | OtherDoc type doc = { doc_type: [`Doc] plugin; doc_custom: custom; doc_build: bool conditional; doc_install: bool conditional; doc_install_dir: unix_filename; (* TODO: dest filename ?. *) doc_title: string; doc_authors: string list; doc_abstract: string option; doc_format: doc_format; (* TODO: src filename. *) doc_data_files: (unix_filename * unix_filename option) list; doc_build_tools: tool list; } type section = | Library of common_section * build_section * library | Object of common_section * build_section * object_ | Executable of common_section * build_section * executable | Flag of common_section * flag | SrcRepo of common_section * source_repository | Test of common_section * test | Doc of common_section * doc type section_kind = [ `Library | `Object | `Executable | `Flag | `SrcRepo | `Test | `Doc ] type package = { oasis_version: OASISVersion.t; ocaml_version: OASISVersion.comparator option; findlib_version: OASISVersion.comparator option; alpha_features: string list; beta_features: string list; name: package_name; version: OASISVersion.t; license: OASISLicense.t; license_file: unix_filename option; (* TODO: source filename. *) copyrights: string list; maintainers: string list; authors: string list; homepage: url option; bugreports: url option; synopsis: string; description: OASISText.t option; tags: string list; categories: url list; conf_type: [`Configure] plugin; conf_custom: custom; build_type: [`Build] plugin; build_custom: custom; install_type: [`Install] plugin; install_custom: custom; uninstall_custom: custom; clean_custom: custom; distclean_custom: custom; files_ab: unix_filename list; (* TODO: source filename. *) sections: section list; plugins: [`Extra] plugin list; disable_oasis_section: unix_filename list; (* TODO: source filename. *) schema_data: PropList.Data.t; plugin_data: plugin_data; } (* END EXPORT *) type 'a quickstart_level = | NoChoice of 'a (* Don't ask question, use provided value *) | Beginner | Intermediate | Expert type 'a quickstart_question = | Field | Text | Choices of 'a list | ExclusiveChoices of 'a list let odn_of_unix_dirname = OASISDataNotation.of_string let odn_of_unix_filename = OASISDataNotation.of_string let odn_of_conditional = OASISExpr.odn_of_choices let odn_of_command_line (prog, args) = OASISDataNotation.TPL [OASISDataNotation.STR prog; OASISDataNotation.of_list OASISDataNotation.of_string args] let odn_of_package pkg = let open OASISDataNotation in let proplist_data = APP ("PropList.Data.create", [], [UNT]) in let odn_of_args = of_list of_string in let odn_of_plugin odn_of_a (v2, v1, v0) = TPL [ odn_of_a v2; of_string v1; of_option OASISVersion.odn_of_t v0] in let odn_of_custom v = REC ("OASISTypes", ["pre_command", odn_of_conditional (of_option odn_of_command_line) v.pre_command; "post_command", odn_of_conditional (of_option odn_of_command_line) v.post_command]) in let odn_of_tool = function | ExternalTool v0 -> VRT ("OASISTypes.ExternalTool", [ STR v0 ]) | InternalExecutable v0 -> VRT ("OASISTypes.InternalExecutable", [ STR v0 ]) in let odn_of_dependency = function | FindlibPackage ((v1, v0)) -> VRT ("OASISTypes.FindlibPackage", [ of_string v1; of_option OASISVersion.odn_of_comparator v0 ]) | InternalLibrary v0 -> VRT ("OASISTypes.InternalLibrary", [ STR v0 ]) in let odn_of_compiled_object = function | Byte -> VRT ("OASISTypes.Byte", []) | Native -> VRT ("OASISTypes.Native", []) | Best -> VRT ("OASISTypes.Best", []) in let odn_of_common_section v = REC ("OASISTypes", [ ("cs_name", (STR v.cs_name)); ("cs_data", proplist_data); ("cs_plugin_data", LST []) ]) in let odn_of_build_section v = REC ("OASISTypes", [ ("bs_build", (odn_of_conditional of_bool v.bs_build)); ("bs_install", (odn_of_conditional of_bool v.bs_install)); ("bs_path", (odn_of_unix_dirname v.bs_path)); ("bs_compiled_object", (odn_of_compiled_object v.bs_compiled_object)); ("bs_build_depends", (of_list odn_of_dependency v.bs_build_depends)); ("bs_build_tools", (of_list odn_of_tool v.bs_build_tools)); ("bs_interface_patterns", (of_list OASISSourcePatterns.odn_of_t v.bs_interface_patterns)); ("bs_implementation_patterns", (of_list OASISSourcePatterns.odn_of_t v.bs_implementation_patterns)); ("bs_c_sources", (of_list odn_of_unix_filename v.bs_c_sources)); ("bs_data_files", (of_list (fun (v1, v0) -> TPL [ odn_of_unix_filename v1; of_option odn_of_unix_filename v0 ]) v.bs_data_files)); ("bs_findlib_extra_files", (of_list odn_of_unix_filename v.bs_findlib_extra_files)); ("bs_ccopt", (odn_of_conditional odn_of_args v.bs_ccopt)); ("bs_cclib", (odn_of_conditional odn_of_args v.bs_cclib)); ("bs_dlllib", (odn_of_conditional odn_of_args v.bs_dlllib)); ("bs_dllpath", (odn_of_conditional odn_of_args v.bs_dllpath)); ("bs_byteopt", (odn_of_conditional odn_of_args v.bs_byteopt)); ("bs_nativeopt", (odn_of_conditional odn_of_args v.bs_nativeopt)) ]) in let odn_of_library v = REC ("OASISTypes", [ ("lib_modules", of_list of_string v.lib_modules); ("lib_pack", of_bool v.lib_pack); ("lib_internal_modules", of_list of_string v.lib_internal_modules); ("lib_findlib_parent", of_option of_string v.lib_findlib_parent); ("lib_findlib_name", of_option of_string v.lib_findlib_name); ("lib_findlib_directory", of_option odn_of_unix_filename v.lib_findlib_directory); ("lib_findlib_containers", of_list of_string v.lib_findlib_containers); ]) in let odn_of_object_ v = REC ("OASISTypes", [ ("obj_modules", of_list of_string v.obj_modules); ("obj_findlib_fullname", of_option (of_list of_string) v.obj_findlib_fullname); ("obj_findlib_directory", of_option odn_of_unix_filename v.obj_findlib_directory); ]) in let odn_of_executable v = REC ("OASISTypes", [ ("exec_custom", (of_bool v.exec_custom)); ("exec_main_is", (odn_of_unix_filename v.exec_main_is)) ]) in let odn_of_flag v = REC ("OASISTypes", [ ("flag_description", (of_option of_string v.flag_description)); ("flag_default", (odn_of_conditional of_bool v.flag_default)) ]) in let odn_of_vcs = function | Darcs -> VRT ("OASISTypes.Darcs", []) | Git -> VRT ("OASISTypes.Git", []) | Svn -> VRT ("OASISTypes.Svn", []) | Cvs -> VRT ("OASISTypes.Cvs", []) | Hg -> VRT ("OASISTypes.Hg", []) | Bzr -> VRT ("OASISTypes.Bzr", []) | Arch -> VRT ("OASISTypes.Arch", []) | Monotone -> VRT ("OASISTypes.Monotone", []) | OtherVCS v0 -> VRT ("OASISTypes.OtherVCS", [ STR v0 ]) in let odn_of_source_repository v = REC ("OASISTypes", [ ("src_repo_type", (odn_of_vcs v.src_repo_type)); ("src_repo_location", (STR v.src_repo_location)); ("src_repo_browser", (of_option of_string v.src_repo_browser)); ("src_repo_module", (of_option of_string v.src_repo_module)); ("src_repo_branch", (of_option of_string v.src_repo_branch)); ("src_repo_tag", (of_option of_string v.src_repo_tag)); ("src_repo_subdir", (of_option odn_of_unix_filename v.src_repo_subdir)) ]) in let odn_of_test v = REC ("OASISTypes", [ ("test_type", (odn_of_plugin (function | `Test -> PVR ("Test", None)) v.test_type)); ("test_command", (odn_of_conditional odn_of_command_line v.test_command)); ("test_custom", (odn_of_custom v.test_custom)); ("test_working_directory", (of_option odn_of_unix_filename v.test_working_directory)); ("test_run", (odn_of_conditional of_bool v.test_run)); ("test_tools", (of_list odn_of_tool v.test_tools)) ]) in let odn_of_doc_format = function | HTML v0 -> VRT ("OASISTypes.HTML", [ odn_of_unix_filename v0 ]) | DocText -> VRT ("OASISTypes.DocText", []) | PDF -> VRT ("OASISTypes.PDF", []) | PostScript -> VRT ("OASISTypes.PostScript", []) | Info v0 -> VRT ("OASISTypes.Info", [ odn_of_unix_filename v0 ]) | DVI -> VRT ("OASISTypes.DVI", []) | OtherDoc -> VRT ("OASISTypes.OtherDoc", []) in let odn_of_doc v = REC ("OASISTypes", [ ("doc_type", (odn_of_plugin (function | `Doc -> PVR ("Doc", None)) v.doc_type)); ("doc_custom", (odn_of_custom v.doc_custom)); ("doc_build", (odn_of_conditional of_bool v.doc_build)); ("doc_install", (odn_of_conditional of_bool v.doc_install)); ("doc_install_dir", (odn_of_unix_filename v.doc_install_dir)); ("doc_title", (of_string v.doc_title)); ("doc_authors", (of_list of_string v.doc_authors)); ("doc_abstract", (of_option of_string v.doc_abstract)); ("doc_format", (odn_of_doc_format v.doc_format)); ("doc_data_files", (of_list (fun (v1, v0) -> TPL [ odn_of_unix_filename v1; of_option odn_of_unix_filename v0 ]) v.doc_data_files)); ("doc_build_tools", (of_list odn_of_tool v.doc_build_tools)) ]) in let odn_of_section = function | Library ((v2, v1, v0)) -> VRT ("OASISTypes.Library", [ odn_of_common_section v2; odn_of_build_section v1; odn_of_library v0 ]) | Object ((v2, v1, v0)) -> VRT ("OASISTypes.Object", [ odn_of_common_section v2; odn_of_build_section v1; odn_of_object_ v0 ]) | Executable ((v2, v1, v0)) -> VRT ("OASISTypes.Executable", [ odn_of_common_section v2; odn_of_build_section v1; odn_of_executable v0 ]) | Flag ((v1, v0)) -> VRT ("OASISTypes.Flag", [ odn_of_common_section v1; odn_of_flag v0 ]) | SrcRepo ((v1, v0)) -> VRT ("OASISTypes.SrcRepo", [ odn_of_common_section v1; odn_of_source_repository v0 ]) | Test ((v1, v0)) -> VRT ("OASISTypes.Test", [ odn_of_common_section v1; odn_of_test v0 ]) | Doc ((v1, v0)) -> VRT ("OASISTypes.Doc", [ odn_of_common_section v1; odn_of_doc v0 ]) in let odn_of_text = let odn_of_elt = function | OASISText.Para v0 -> VRT ("OASISText.Para", [ of_string v0 ]) | OASISText.Verbatim v0 -> VRT ("OASISText.Verbatim", [ of_string v0 ]) | OASISText.BlankLine -> VRT ("OASISText.BlankLine", []) in of_list odn_of_elt in REC ("OASISTypes", [ ("oasis_version", (OASISVersion.odn_of_t pkg.oasis_version)); ("ocaml_version", (of_option OASISVersion.odn_of_comparator) pkg.ocaml_version); ("version", (OASISVersion.odn_of_t pkg.version)); ("license", (OASISLicense.odn_of_t pkg.license)); ("findlib_version", (of_option OASISVersion.odn_of_comparator pkg.findlib_version)); ("alpha_features", (of_list of_string pkg.alpha_features)); ("beta_features", (of_list of_string pkg.beta_features)); ("name", (STR pkg.name)); ("license_file", (of_option odn_of_unix_filename pkg.license_file)); ("copyrights", (of_list of_string pkg.copyrights)); ("maintainers", (of_list of_string pkg.maintainers)); ("authors", (of_list of_string pkg.authors)); ("homepage", (of_option of_string pkg.homepage)); ("bugreports", (of_option of_string pkg.bugreports)); ("synopsis", (of_string pkg.synopsis)); ("description", (of_option odn_of_text pkg.description)); ("tags", (of_list of_string pkg.tags)); ("categories", (of_list of_string pkg.categories)); ("files_ab", (of_list odn_of_unix_filename pkg.files_ab)); ("sections", (of_list odn_of_section pkg.sections)); ("disable_oasis_section", (of_list odn_of_unix_filename pkg.disable_oasis_section)); ("conf_type", (odn_of_plugin (function | `Configure -> PVR ("Configure", None)) pkg.conf_type)); ("conf_custom", (odn_of_custom pkg.conf_custom)); ("build_type", (odn_of_plugin (function | `Build -> PVR ("Build", None)) pkg.build_type)); ("build_custom", (odn_of_custom pkg.build_custom)); ("install_type", (odn_of_plugin (function | `Install -> PVR ("Install", None)) pkg.install_type)); ("install_custom", (odn_of_custom pkg.install_custom)); ("uninstall_custom", (odn_of_custom pkg.uninstall_custom)); ("clean_custom", (odn_of_custom pkg.clean_custom)); ("distclean_custom", (odn_of_custom pkg.distclean_custom)); ("plugins", ((fun x -> of_list (odn_of_plugin (function | `Extra -> PVR ("Extra", None))) x) pkg.plugins)); ("schema_data", proplist_data); ("plugin_data", LST []); ]) oasis-0.4.11/src/oasis/OASISText.ml0000644000175000017500000001074213261073606016227 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type elt = | Para of string | Verbatim of string | BlankLine type t = elt list (* END EXPORT *) open Format open FormatExt open OASISValues let of_string str = let lst = OASISString.split_newline ~do_trim:false str in let is_verbatim = OASISString.starts_with ~what:" " in let rec parse = function (* End of string special cases. *) | [""; ""] -> [`BlankLine] | [str; ""] -> if is_verbatim str then [`Verbatim str; `BlankLine] else [`ContPara str; `BlankLine] | "" :: "" :: tl -> `BlankLine :: (parse tl) | str1 :: "" :: str2 :: tl when is_verbatim str2 -> `ContPara str1 :: `BlankLine :: `Verbatim str2 :: (parse tl) | str :: "" :: tl -> if is_verbatim str then (`Verbatim str) :: `BlankLine :: (parse tl) else (`ContPara str) :: `EndPara :: (parse tl) | str :: tl -> if is_verbatim str then (`Verbatim str) :: (parse tl) else (`ContPara str) :: (parse tl) | [] -> [] in let rec join_para = function | `ContPara str1 :: `ContPara str2 :: tl -> join_para ((`ContPara (str1 ^ " " ^ str2)) :: tl) | `EndPara :: tl -> join_para tl | (`Verbatim _ | `ContPara _ | `BlankLine) as e :: tl -> e :: join_para tl | [] -> [] in List.map (function | `ContPara str -> Para str | `Verbatim str -> Verbatim (String.sub str 1 ((String.length str) - 1)) | `BlankLine -> BlankLine) (join_para (parse lst)) let pp_print_verbatim fmt str = pp_print_char fmt ' '; pp_print_string fmt str let rec pp_print fmt = function | [Para str] -> pp_print_para fmt ~end_para:false str | [Verbatim str] -> pp_print_verbatim fmt str | [Para str; BlankLine] -> pp_print_para fmt ~end_para:false str; pp_print_newline fmt () | [Verbatim str; BlankLine] -> pp_print_verbatim fmt str; pp_print_newline fmt () | Para str :: BlankLine :: ((Verbatim _ :: _) as tl) -> pp_print_para fmt str; pp_print fmt tl | Para str :: ((Verbatim _ :: _) as tl) -> pp_print_para ~end_para:false fmt str; pp_print_newline fmt (); pp_print fmt tl | Para str :: tl -> pp_print_para fmt str; pp_print fmt tl | Verbatim str :: tl -> pp_print_verbatim fmt str; pp_print_newline fmt (); pp_print fmt tl | BlankLine :: tl -> pp_print_newline fmt (); pp_print fmt tl | [] -> () let to_string t = let buff = Buffer.create 13 in let fmt = Format. formatter_of_buffer buff in pp_print fmt t; pp_print_flush fmt (); Buffer.contents buff let value = { parse = (fun ~ctxt:_ s -> of_string s); update = update_fail; print = to_string; } oasis-0.4.11/src/oasis/OASISTest_intern.ml0000644000175000017500000001064213261073606017600 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test schema and generator @author Sylvain Le Gall *) (* END EXPORT *) open OASISTypes open OASISSchema_intern open OASISValues open OASISUtils open OASISGettext let schema, generator = let schm = schema "Test" (fun (cs, _) -> cs.cs_plugin_data) in let cmn_section_gen = OASISSection_intern.section_fields (fun () -> (s_ "test")) schm (fun (cs, _) -> cs) in let typ = new_field_plugin schm "Type" ~default:(OASISPlugin.builtin `Test "custom") `Test OASISPlugin.Test.value (fun () -> s_ "Plugin to use to run test.") (fun (_, test) -> test.test_type) in let tools = new_field schm "TestTools" ~default:[] OASISBuildSection_intern.build_tools_value (fun () -> s_ "Tools required to run the test, including internal executables.") (fun (_, test) -> test.test_tools) in let command = new_field_conditional schm "Command" command_line (fun () -> s_ "Command to run for the test.") (fun (_, test) -> test.test_command) in let working_directory = new_field schm "WorkingDirectory" ~default:None (opt string_not_empty) (fun () -> s_ "Directory to run the test.") (fun (_, test) -> test.test_working_directory) in let custom = OASISCustom.add_fields schm "" (fun () -> s_ "Command to run before the test") (fun () -> s_ "Command to run after the test") (fun (_, test) -> test.test_custom) in let run = new_field_conditional schm "Run" ~default:true boolean (fun () -> s_ "Enable this test.") (fun (_, test) -> test.test_run) in schm, (fun features_data nm data -> let cs = cmn_section_gen features_data nm data in (* Set data specific to plugin used for this test *) let typ = typ data in let rplugin_data = ref cs.cs_plugin_data in let cs = OASISPlugin.generator_section `Test (typ :> plugin_kind plugin) rplugin_data cs.cs_data; {cs with cs_plugin_data = !rplugin_data} in let run = if OASISFeatures.data_test OASISFeatures.flag_tests features_data then (* TODO: establish a formal link between here and BaseStandardVars *) OASISExpr.if_then_else (OASISExpr.EFlag "tests") (run data) [OASISExpr.EBool true, false] else run data in Test (cs, { test_type = typ; test_command = command data; test_working_directory = working_directory data; test_custom = custom data; test_run = run; test_tools = tools data; })) oasis-0.4.11/src/oasis/OASISTest.mli0000644000175000017500000000351613261073606016374 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test section @author Sylvain Le Gall *) open OASISTypes (** Schema for the section. {b Not exported}. *) val schema: (common_section * test) OASISSchema.t oasis-0.4.11/src/oasis/OASISTest.ml0000644000175000017500000000333713261073606016224 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* END EXPORT *) let schema = OASISTest_intern.schema oasis-0.4.11/src/oasis/OASISSysLight.mod0000644000175000017500000000007213261073606017213 0ustar gildorgildorOASISGettext.ml OASISString.ml OASISUtils.ml OASISExpr.ml oasis-0.4.11/src/oasis/OASISSysBundle.mod0000644000175000017500000000031113261073606017351 0ustar gildorgildorOASISGettext.ml OASISString.ml OASISUtils.ml OASISUnixPath.ml OASISHostPath.ml OASISFileSystem.ml OASISContext.ml PropList.ml OASISMessage.ml OASISVersion.ml OASISExpr.ml OASISExec.ml OASISFileUtil.ml oasis-0.4.11/src/oasis/OASISSys.mod0000644000175000017500000000072713261073606016232 0ustar gildorgildorOASISGettext.ml OASISString.ml OASISUtils.ml OASISUnixPath.ml OASISHostPath.ml OASISFileSystem.ml OASISContext.ml PropList.ml OASISMessage.ml OASISVersion.ml OASISLicense.ml OASISExpr.ml OASISText.ml OASISSourcePatterns.ml OASISTypes.ml OASISFeatures.ml OASISSection.ml OASISBuildSection.ml OASISExecutable.ml OASISLibrary.ml OASISObject.ml OASISFindlib.ml OASISFlag.ml OASISPackage.ml OASISSourceRepository.ml OASISTest.ml OASISDocument.ml OASISExec.ml OASISFileUtil.ml oasis-0.4.11/src/oasis/OASISString.ml0000644000175000017500000001746313261073606016560 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Various string utilities. Mostly inspired by extlib and batteries ExtString and BatString libraries. @author Sylvain Le Gall *) let nsplitf str f = if str = "" then [] else let buf = Buffer.create 13 in let lst = ref [] in let push () = lst := Buffer.contents buf :: !lst; Buffer.clear buf in let str_len = String.length str in for i = 0 to str_len - 1 do if f str.[i] then push () else Buffer.add_char buf str.[i] done; push (); List.rev !lst (** [nsplit c s] Split the string [s] at char [c]. It doesn't include the separator. *) let nsplit str c = nsplitf str ((=) c) let find ~what ?(offset=0) str = let what_idx = ref 0 in let str_idx = ref offset in while !str_idx < String.length str && !what_idx < String.length what do if str.[!str_idx] = what.[!what_idx] then incr what_idx else what_idx := 0; incr str_idx done; if !what_idx <> String.length what then raise Not_found else !str_idx - !what_idx let sub_start str len = let str_len = String.length str in if len >= str_len then "" else String.sub str len (str_len - len) let sub_end ?(offset=0) str len = let str_len = String.length str in if len >= str_len then "" else String.sub str 0 (str_len - len) let starts_with ~what ?(offset=0) str = let what_idx = ref 0 in let str_idx = ref offset in let ok = ref true in while !ok && !str_idx < String.length str && !what_idx < String.length what do if str.[!str_idx] = what.[!what_idx] then incr what_idx else ok := false; incr str_idx done; !what_idx = String.length what let strip_starts_with ~what str = if starts_with ~what str then sub_start str (String.length what) else raise Not_found let ends_with ~what ?(offset=0) str = let what_idx = ref ((String.length what) - 1) in let str_idx = ref ((String.length str) - 1) in let ok = ref true in while !ok && offset <= !str_idx && 0 <= !what_idx do if str.[!str_idx] = what.[!what_idx] then decr what_idx else ok := false; decr str_idx done; !what_idx = -1 let strip_ends_with ~what str = if ends_with ~what str then sub_end str (String.length what) else raise Not_found let replace_chars f s = let buf = Buffer.create (String.length s) in String.iter (fun c -> Buffer.add_char buf (f c)) s; Buffer.contents buf let lowercase_ascii = replace_chars (fun c -> if (c >= 'A' && c <= 'Z') then Char.chr (Char.code c + 32) else c) let uncapitalize_ascii s = if s <> "" then (lowercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1)) else s let uppercase_ascii = replace_chars (fun c -> if (c >= 'a' && c <= 'z') then Char.chr (Char.code c - 32) else c) let capitalize_ascii s = if s <> "" then (uppercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1)) else s (* END EXPORT *) (* TODO: replace lowercase_ascii, capitalize_ascii and uncapitalize_ascii functions by String.*_ascii function when OCaml minimal version will be 4.03.0. *) let is_whitespace = function | ' ' | '\r' | '\n' | '\t' -> true | _ -> false let tokenize ?(is_whitespace=is_whitespace) ?(tokens=[]) str = let lst = ref [] in let buf = Buffer.create 13 in let idx = ref 0 in let push () = (* Push the content of the buffer on the list. *) if Buffer.length buf > 0 then begin lst := Buffer.contents buf :: !lst; Buffer.clear buf end in let match_token () = List.exists (fun tok -> if starts_with ~what:tok ~offset:!idx str then begin push (); lst := tok :: !lst; idx := !idx + (String.length tok); true end else false) tokens in while !idx < String.length str do let c = str.[!idx] in if is_whitespace c then begin push (); incr idx end else if match_token () then begin () end else begin Buffer.add_char buf c; incr idx end done; push (); List.rev !lst let tokenize_genlex ?(tokens=[]) str = let strm = Genlex.make_lexer tokens (Stream.of_string str) in let lst = ref [] in Stream.iter (fun tok -> lst := tok :: !lst) strm; List.rev !lst let split str c = let idx = String.index str c in String.sub str 0 idx, String.sub str (idx + 1) (String.length str - idx - 1) let trim str = let start_non_blank = ref 0 in let stop_non_blank = ref ((String.length str) - 1) in while !start_non_blank < String.length str && is_whitespace (str.[!start_non_blank]) do incr start_non_blank done; while !start_non_blank <= !stop_non_blank && is_whitespace (str.[!stop_non_blank]) do decr stop_non_blank done; String.sub str !start_non_blank (!stop_non_blank - !start_non_blank + 1) let fold_left f acc str = let racc = ref acc in for i = 0 to String.length str - 1 do racc := f !racc str.[i] done; !racc let contains ~what str = (* Implementation is naive. *) let len_what = String.length what in let len_str = String.length str in let rec check idx_what idx_str = if idx_what >= len_what then true else if idx_str >= len_str then false else if str.[idx_str] = what.[idx_what] then check (idx_what + 1) (idx_str + 1) else check 0 (idx_str + 1) in check 0 0 (** Split a list using ',' as separator. {b Not exported} *) let split_comma str = List.map trim (nsplit str ',') (** Split a list using '\n' as separator. {b Not exported} *) let split_newline ?(do_trim=true) str = let lst = nsplit str '\n' in if do_trim then List.map trim lst else lst (** Split a string containing '(...)' optionally. {b Not exported} *) let split_optional_parentheses str = try let beg_str, end_str = split (trim str) '(' in let content_str = strip_ends_with ~what:")" end_str in trim beg_str, Some (trim content_str) with Not_found -> trim str, None oasis-0.4.11/src/oasis/OASISSourceRepository_intern.ml0000644000175000017500000001107713261073606022224 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** SourceRepository schema and generator (internal) @author Sylvain Le Gall *) open OASISSchema_intern open OASISValues open OASISUtils open OASISGettext open PropList.Field open OASISTypes let schema, generator = let schm = schema "SourceRepository" (fun (cs, _) -> cs.cs_plugin_data) in let cmn_section_gen = OASISSection_intern.section_fields (fun () -> (s_ "source repository")) schm (fun (cs, _) -> cs) in let typ = new_field schm "Type" (choices (fun () -> s_ "source repository type") ["darcs", Darcs; "git", Git; "svn", Svn; "cvs", Cvs; "hg", Hg; "bzr", Bzr; "arch", Arch; "monotone", Monotone]) (fun () -> s_ "VCS type.") (fun (_, src_repo) -> src_repo.src_repo_type) in let location = new_field schm "Location" url (fun () -> s_ "URL of the repository. The exact form of this field depends on \ the repository type.") (fun (_, src_repo) -> src_repo.src_repo_location) in let browser = new_field schm "Browser" ~default:None (opt url) (fun () -> s_ "URL where the repository can be navigated using a web browser.") (fun (_, src_repo) -> src_repo.src_repo_browser) in let new_field_opt nm hlp = new_field schm nm ~default:None (opt string_not_empty) hlp in let modul = new_field_opt "Module" (fun () -> s_ "CVS requires a named module, as each CVS server can host \ multiple named repositories. (__mandatory__ for CVS)") (fun (_, src_repo) -> src_repo.src_repo_module) in let branch = new_field_opt "Branch" (fun () -> s_ "Define a meaningful branch for this repository.") (fun (_, src_repo) -> src_repo.src_repo_branch) in let tag = new_field_opt "Tag" (fun () -> s_ "Identify a state corresponding to this particular package \ version.") (fun (_, src_repo) -> src_repo.src_repo_tag) in let subdir = new_field_opt "Subdir" (fun () -> s_ "Define the relative path from the root of the repository to the \ top directory for the package, i.e. the directory containing the \ package's `_oasis` file.") (fun (_, src_repo) -> src_repo.src_repo_subdir) in (* TODO: enforce contraint about module/branch/subdir/tag depending * in src_repo_type *) schm, (fun features_data nm data -> SrcRepo (cmn_section_gen features_data nm data, { src_repo_type = typ data; src_repo_location = location data; src_repo_browser = browser data; src_repo_module = modul data; src_repo_branch = branch data; src_repo_tag = tag data; src_repo_subdir = subdir data; })) oasis-0.4.11/src/oasis/OASISSourceRepository.mli0000644000175000017500000000354713261073606021021 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** SourceRepository section @author Sylvain Le Gall *) open OASISTypes (** Schema for the section. {b Not exported}. *) val schema: (common_section * source_repository) OASISSchema.t oasis-0.4.11/src/oasis/OASISSourceRepository.ml0000644000175000017500000000335313261073606020643 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* END EXPORT *) let schema = OASISSourceRepository_intern.schema oasis-0.4.11/src/oasis/OASISSourcePatterns.mli0000644000175000017500000000534013261073606020433 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Search source files, using pattern and templates. @author Sylvain Le Gall @since 0.4.7 See `_oasis` fields 'InterfacePatterns' and 'ImplementationPatterns'. *) open OASISUnixPath (** A template to find a file. *) type t (** List of templates to search an implementation file matching a module. *) val implementation: t list (** List of templates to search an interface file metching a module. *) val interface: t list (** Parse the given string. *) val parse: string -> t (** Return the string representation of [t]. *) val to_string: t -> string (** List all possible files using the list of templates. @params modul The module name as defined in the field "Modules" and "InternalModules" @params path The base path of the module as defined in "Path" @raise Not_found if no templates match the given module @return The filename of the first matching template. *) val all_possible_files: t list -> path:unix_dirname -> modul:string -> unix_filename list (** Convert to OASISDataNotation. *) val odn_of_t: t -> OASISDataNotation.t oasis-0.4.11/src/oasis/OASISSourcePatterns.ml0000644000175000017500000001372713261073606020272 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISUtils open OASISGettext module Templater = struct (* TODO: use this module in BaseEnv.var_expand and BaseFileAB, at least. *) type t = { atoms: atom list; origin: string } and atom = | Text of string | Expr of expr and expr = | Ident of string | String of string | Call of string * expr type env = { variables: string MapString.t; functions: (string -> string) MapString.t; } let eval env t = let rec eval_expr env = function | String str -> str | Ident nm -> begin try MapString.find nm env.variables with Not_found -> (* TODO: add error location within the string. *) failwithf (f_ "Unable to find variable %S in source pattern %S") nm t.origin end | Call (fn, expr) -> begin try (MapString.find fn env.functions) (eval_expr env expr) with Not_found -> (* TODO: add error location within the string. *) failwithf (f_ "Unable to find function %S in source pattern %S") fn t.origin end in String.concat "" (List.map (function | Text str -> str | Expr expr -> eval_expr env expr) t.atoms) let parse env s = let lxr = Genlex.make_lexer [] in let parse_expr s = let st = lxr (Stream.of_string s) in match Stream.npeek 3 st with | [Genlex.Ident fn; Genlex.Ident nm] -> Call(fn, Ident nm) | [Genlex.Ident fn; Genlex.String str] -> Call(fn, String str) | [Genlex.String str] -> String str | [Genlex.Ident nm] -> Ident nm (* TODO: add error location within the string. *) | _ -> failwithf (f_ "Unable to parse expression %S") s in let parse s = let lst_exprs = ref [] in let ss = let buff = Buffer.create (String.length s) in Buffer.add_substitute buff (fun s -> lst_exprs := (parse_expr s) :: !lst_exprs; "\000") s; Buffer.contents buff in let rec join = function | hd1 :: tl1, hd2 :: tl2 -> Text hd1 :: Expr hd2 :: join (tl1, tl2) | [], tl -> List.map (fun e -> Expr e) tl | tl, [] -> List.map (fun e -> Text e) tl in join (OASISString.nsplit ss '\000', List.rev (!lst_exprs)) in let t = {atoms = parse s; origin = s} in (* We rely on a simple evaluation for checking variables/functions. It works because there is no if/loop statement. *) let _s : string = eval env t in t (* END EXPORT *) let odn_of_t t = let open OASISDataNotation in let modul = "OASISSourcePatterns.Templater" in let rec of_atom a = let nm, args = match a with | Text str -> "Text", [STR str] | Expr expr -> "Expr", [of_expr expr] in VRT(modul ^ "." ^ nm, args) and of_expr expr = let nm, args = match expr with | Ident str -> "Ident", [STR str] | String str -> "String", [STR str] | Call(str, expr) -> "Call", [STR str; of_expr expr] in VRT(modul ^ "." ^ nm, args) in REC( modul, ["atoms", LST (List.map of_atom t.atoms); "origin", STR t.origin]) (* START EXPORT *) end type t = Templater.t let env ~modul () = { Templater. variables = MapString.of_list ["module", modul]; functions = MapString.of_list [ "capitalize_file", OASISUnixPath.capitalize_file; "uncapitalize_file", OASISUnixPath.uncapitalize_file; ]; } let all_possible_files lst ~path ~modul = let eval = Templater.eval (env ~modul ()) in List.fold_left (fun acc pat -> OASISUnixPath.concat path (eval pat) :: acc) [] lst let to_string t = t.Templater.origin (* END EXPORT *) let parse = Templater.parse (env ~modul:"Foo" ()) let interface = List.map parse [ "${capitalize_file module}.mli"; "${uncapitalize_file module}.mli"; ] let implementation = List.map parse [ "${capitalize_file module}.ml"; "${uncapitalize_file module}.ml"; "${capitalize_file module}.mll"; "${uncapitalize_file module}.mll"; "${capitalize_file module}.mly"; "${uncapitalize_file module}.mly"; ] let odn_of_t = Templater.odn_of_t oasis-0.4.11/src/oasis/OASISSetupUpdate.ml0000644000175000017500000000331113261073606017540 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = NoUpdate | Weak | Dynamic oasis-0.4.11/src/oasis/OASISSection_intern.ml0000644000175000017500000000462613261073606020272 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open OASISSection (** Add section fields *) let section_fields hlp (schm: 'a OASISSchema_intern.t) (sync: 'a -> common_section) = fun (features_data: OASISFeatures.Data.t) nm data -> { cs_name = nm; cs_plugin_data = []; (* TODO *) cs_data = data; } (** {2 Containers for sections using id-only} *) module CIdSection = struct type t = section_kind * name let compare = compare end module MapSectionId = Map.Make(CIdSection) module SetSectionId = Set.Make(CIdSection) (** Convert a MapSection.t into a MapSectionId.t *) let map_section_id mp = MapSection.fold (fun k v mp -> MapSectionId.add (section_id k) v mp) mp MapSectionId.empty oasis-0.4.11/src/oasis/OASISSection.mli0000644000175000017500000000564613261073606017067 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Manipulate sections. @author Sylvain Le Gall *) open OASISTypes (** Convert [section_kind] to string. *) val string_of_section_kind: section_kind -> string (** {2 Manipulate a section} *) (** Extract generic information *) val section_kind_common: section -> section_kind * common_section (** Common section of a section *) val section_common: section -> common_section (** Set the common part of a section *) val section_common_set: common_section -> section -> section (** Key used to identify section *) val section_id: section -> section_kind * name (** Convert a section to a short string (only informations returned by {!section_id} *) val string_of_section: section -> string (** Find a section *) val section_find: section_kind * name -> section list -> section (** {2 Containers for sections} *) (** Comparable section, we only rely on section_id for comparison. {b Not exported} *) module CSection: sig type t = section val compare: section -> section -> int val equal: section -> section -> bool val hash: section -> int end (** Map using CSection. {b Not exported} *) module MapSection: Map.S with type key = CSection.t (** Set using CSection. {b Not exported} *) module SetSection: Set.S with type elt = CSection.t oasis-0.4.11/src/oasis/OASISSection.ml0000644000175000017500000000651413261073606016711 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes let section_kind_common = function | Library (cs, _, _) -> `Library, cs | Object (cs, _, _) -> `Object, cs | Executable (cs, _, _) -> `Executable, cs | Flag (cs, _) -> `Flag, cs | SrcRepo (cs, _) -> `SrcRepo, cs | Test (cs, _) -> `Test, cs | Doc (cs, _) -> `Doc, cs let section_common sct = snd (section_kind_common sct) let section_common_set cs = function | Library (_, bs, lib) -> Library (cs, bs, lib) | Object (_, bs, obj) -> Object (cs, bs, obj) | Executable (_, bs, exec) -> Executable (cs, bs, exec) | Flag (_, flg) -> Flag (cs, flg) | SrcRepo (_, src_repo) -> SrcRepo (cs, src_repo) | Test (_, tst) -> Test (cs, tst) | Doc (_, doc) -> Doc (cs, doc) (** Key used to identify section *) let section_id sct = let k, cs = section_kind_common sct in k, cs.cs_name let string_of_section_kind = function | `Library -> "library" | `Object -> "object" | `Executable -> "executable" | `Flag -> "flag" | `SrcRepo -> "src repository" | `Test -> "test" | `Doc -> "doc" let string_of_section sct = let k, nm = section_id sct in (string_of_section_kind k)^" "^nm let section_find id scts = List.find (fun sct -> id = section_id sct) scts module CSection = struct type t = section let id = section_id let compare t1 t2 = compare (id t1) (id t2) let equal t1 t2 = (id t1) = (id t2) let hash t = Hashtbl.hash (id t) end module MapSection = Map.Make(CSection) module SetSection = Set.Make(CSection) (* END EXPORT *) oasis-0.4.11/src/oasis/OASISSchema_intern.ml0000644000175000017500000002530613261073606020064 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Property list and schema checker @author Sylvain Le Gall *) open OASISTypes open OASISAst_types open OASISGettext open OASISUtils open OASISValues open OASISExpr open PropList module Sync = struct (* TODO: we should use a Queue or a list here or include the sync method directly in extra *) type 'a t = ('a -> (plugin_kind plugin) option -> PropList.Data.t -> PropList.Data.t) ref let create () = ref (fun _ _ data -> data) let add t schm value nm sync plugin = let fake_context = { cond = None; append = false; valid_flags = []; ctxt = !OASISContext.default; } in let prev_f = !t in let new_f = fun t plugin' data -> let data = prev_f t plugin' data in let is_field_active = match plugin, plugin' with | Some plg, Some plg' -> OASISPlugin.plugin_equal plg plg' | None, None -> true | Some _, _ | _, Some _ -> false in let () = if is_field_active then try (* TODO: we should just restore the value * wether or not it is printable should not * be important *) PropList.Schema.set schm data (* TODO: really need to kill this ~context *) ~context:fake_context nm (value.print (sync t)) with Not_printable -> () in data in t := new_f end type kind = | DefinePlugin of plugin_kind | DefinePlugins of plugin_kind | FieldFromPlugin of plugin_kind plugin | StandardField type extra = { kind: kind; qckstrt_lvl: string quickstart_level; qckstrt_q: unit -> string quickstart_question; feature: OASISFeatures.t option; } type 'a t = { schm: (ctxt, extra) PropList.Schema.t; sync: 'a Sync.t; plugin: 'a -> plugin_data; } let schema nm plg_data = { schm = Schema.create ~case_insensitive:true nm; sync = Sync.create (); plugin = plg_data; } (** Define extra data contained in the schema *) let extra ?(kind=StandardField) ?(quickstart_level=Expert) ?(quickstart_question=(fun () -> Field)) ?feature value = let qckstrt_lvl = match quickstart_level with | NoChoice v -> NoChoice (value.print v) | Beginner | Intermediate | Expert as l -> l in let qckstrt_q () = match quickstart_question () with | Choices lst -> Choices (List.map value.print lst) | ExclusiveChoices lst -> ExclusiveChoices (List.map value.print lst) | Field | Text as q -> q in { kind = kind; qckstrt_lvl = qckstrt_lvl; qckstrt_q = qckstrt_q; feature = feature; } (** Create a conditional field *) let new_field_conditional t name ?plugin ?default_cond ?default ?quickstart_level ?quickstart_question ?feature value help sync = let update ?context old_choices new_choices = let choices = match context with | Some {append = true} -> (* Append in conditional context means a cartesian product between the choices and the (None :: Some + appends). We then combine condition with && and values with value.update. WARNING: quadratic expansion in space *) let all_appends = None :: (List.map (fun v -> Some v) new_choices) in List.flatten (List.map (fun (cond, choice) -> List.map (function | None -> cond, choice | Some (new_cond, append) -> EAnd(cond, new_cond), value.update choice append) all_appends) old_choices) | _ -> old_choices @ new_choices in OASISExpr.reduce_choices choices in let default = match default_cond, default with | Some lst, Some x -> Some ((EBool true, x) :: lst) | Some lst, None -> Some lst | None, Some x -> Some [EBool true, x] | None, None -> None in let parse ?context s = match context with | Some ctxt -> begin let real_cond = match ctxt.cond with | Some e -> e | None -> EBool true in [real_cond, value.parse ~ctxt:ctxt.ctxt s] end | None -> (* TODO: this is ugly, try to find a solution without ?context *) failwithf (f_ "No context defined for field '%s' when parsing value %S") name s in let trivial_value = function | [] -> raise (PropList.Not_set(name, None)) | [EBool true, v] -> v | _ -> raise OASISValues.Not_printable in let print lst = value.print (trivial_value lst) in let kind = match plugin with | Some (knd, plg, ver) -> Some (FieldFromPlugin (knd, plg, ver)) | None -> None in let sync pkg = (* TODO: this prevent to synchronize complex * conditional value *) trivial_value (sync pkg) in Sync.add t.sync t.schm value name sync plugin; FieldRO.create ~schema:t.schm ~name ~parse ~print ~update ?default ~help (extra ?kind ?quickstart_level ?quickstart_question ?feature value) (** Default parser and updater for new_field and new_field_plugin *) let default_parse_update name value = let update ?context old_v v = match context with | Some {append = true} -> value.update old_v v | _ -> v in let parse ?context s = match context with | Some ctxt -> begin if ctxt.cond <> None then failwithf (f_ "Field '%s' cannot be conditional") name; value.parse ~ctxt:ctxt.ctxt s end | None -> (* TODO: this is ugly, try to find a solution without ?context *) failwithf (f_ "No context defined for field '%s' when parsing value %S") name s in update, parse (** Create a simple field *) let new_field t name ?plugin ?default ?quickstart_level ?quickstart_question ?feature value help sync = let update, parse = default_parse_update name value in let kind = match plugin with | Some (knd, plg, ver) -> Some (FieldFromPlugin (knd, plg, ver)) | None -> None in Sync.add t.sync t.schm value name sync plugin; FieldRO.create ~schema:t.schm ~name ~parse ~print:value.print ~update ?default ~help (extra ?kind ?quickstart_level ?quickstart_question ?feature value) (** Create a field that enables a plugin *) let new_field_plugin t name ?default ?quickstart_level ?quickstart_question ?feature knd value help sync = let update, parse = default_parse_update name value in Sync.add t.sync t.schm value name sync None; FieldRO.create ~schema:t.schm ~name ~parse ~print:value.print ~update ?default ~help (extra ~kind:(DefinePlugin knd) ?quickstart_level ?quickstart_question ?feature value) (** Create a field that enables some plugins *) let new_field_plugins t name (* TODO: constrain default and quickstart variant *) ?default ?quickstart_level (* TODO: merge quickstart_question and values *) ?quickstart_question ?feature knd value help sync = let values = comma_separated value in let update, parse = default_parse_update name values in Sync.add t.sync t.schm values name sync None; FieldRO.create ~schema:t.schm ~name ~parse ~print:values.print ~update ?default ~help (extra ~kind:(DefinePlugins knd) ?quickstart_level ?quickstart_question ?feature value) let to_proplist t plugins e = let data = (* First synchronization, no plugin *) !(t.sync) e None (PropList.Data.create ()) in let plugins = PropList.Schema.fold (fun acc key extra _ -> match extra.kind with | DefinePlugin knd -> let str = PropList.Schema.get t.schm data key in (OASISPlugin.plugin_of_string knd str) :: acc | DefinePlugins knd -> let str = PropList.Schema.get t.schm data key in (OASISPlugin.plugins_of_string knd str) @ acc | FieldFromPlugin _ | StandardField -> acc) plugins t.schm in (* Second synchronization only plugins *) t.schm, plugins, List.fold_left (fun data plg -> !(t.sync) e (Some plg) data) data plugins oasis-0.4.11/src/oasis/OASISSchema.mli0000644000175000017500000000647513261073606016664 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Add fields to _oasis for plugin @author Sylvain Le Gall *) open OASISTypes type 'a t = 'a OASISSchema_intern.t (** [new_field schm plugin_id name value help pivot_data sync] Create a field for a plugin. Create a new field for the plugin defined by [plugin_id] in the schema [schm]. The field basename is [name], for which we will add the name of the plugin and ["X"] before -- to know that this field is related to this plugin. [value] defines how to parse/print the value. [help] is a helper text for this field. [pivot_data] and [sync] defines how to match back the datastructure where the result will be stored with the field in _oasis. The result of this function is a getter that helps you to get the data from the field parsed in the _oasis file. You should use it to generate a datastructure (the one that will be used by [sync]). *) val new_field: ('b t) -> OASISPlugin.all_t -> name -> ?default:'a -> ?feature:OASISFeatures.t -> 'a OASISValues.t -> (unit -> string) -> 'c OASISPlugin.prop -> ('b -> 'c -> 'a) -> PropList.Data.t -> 'a (** Create a conditional field for a plugin. Sees {!new_field} for explanation. The extra [default_cond] parameter allows to define a complex default. If [default_cond] and [default] are defined together, they are concatened in this order. *) val new_field_conditional: ('b t) -> OASISPlugin.all_t -> name -> ?default_cond:('a OASISExpr.choices) -> ?default:'a -> ?feature:OASISFeatures.t -> 'a OASISValues.t -> (unit -> string) -> 'c OASISPlugin.prop -> ('b -> 'c -> 'a OASISExpr.choices) -> PropList.Data.t -> 'a OASISExpr.choices oasis-0.4.11/src/oasis/OASISSchema.ml0000644000175000017500000000570313261073606016504 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type 'a t = 'a OASISSchema_intern.t (** Create field name derived from a plugin *) let make_field_name (_, nm', _) nm = "X"^nm'^nm (** Synchronize between plugin datastructure and PropList.Data.t *) let sync_proxy schema t nm (_, get) sync ds = try let t' = (* Extract plugin data from datastructure *) get (ref (schema.OASISSchema_intern.plugin ds)) in sync ds t' with e -> Printf.eprintf "Field %S in schema %S: %s\n" (make_field_name t nm) (PropList.Schema.name schema.OASISSchema_intern.schm) (Printexc.to_string e); raise OASISValues.Not_printable let new_field schema t nm ?default ?feature parse hlp pivot_data sync = let plugin = OASISPlugin.to_plugin t in OASISSchema_intern.new_field schema (make_field_name plugin nm) ?default ?feature ~plugin parse hlp (sync_proxy schema plugin nm pivot_data sync) let new_field_conditional schema t nm ?default_cond ?default ?feature parse hlp pivot_data sync = let plugin = OASISPlugin.to_plugin t in OASISSchema_intern.new_field_conditional schema (make_field_name plugin nm) ?default_cond ?default ?feature ~plugin parse hlp (sync_proxy schema plugin nm pivot_data sync) oasis-0.4.11/src/oasis/OASISQuickstart.ml0000644000175000017500000006545513261073606017450 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Helper function to write an _oasis file @author Sylvain Le Gall *) open OASISGettext open OASISSchema_intern open OASISTypes open Format open FormatExt open OASISUtils open OASISMessage type 'a default = | Default_value of 'a | Default_answer of string | Default_not_printable | NoDefault type interface = | Human | Machine type 'a t = { id: string; interface: interface; default: 'a default; help: string; ctxt: OASISContext.t; question: string; parse: string -> 'a; } (** This expression is raised when an unprintable default * is chosen *) exception ChooseNotPrintableDefault (** Convert a default into a text *) let help_of_default = function | Default_answer dflt -> Printf.sprintf (f_ "Default is '%s'") dflt | Default_value _ | Default_not_printable -> s_ "A default exists, you can leave this field blank." | NoDefault -> s_ "No default exists, you need to answer this question." (** Ask a question until a correct answer is given *) let ask_until_correct t = let rec ask_until_correct_aux () = let () = (* Question *) match t.interface with | Human -> Printf.printf "%s %!" t.question | Machine -> Printf.printf "???%s %!" t.id in try let answer = (* try let _ = (* Check we have terminal *) Unix.tcgetattr Unix.stdin in (* TODO: use history file *) let q = Buffer.create 13 in let rec input () = let c = Ledit.input_char stdin in if c = "\n" then begin Buffer.contents q end else begin Buffer.add_string q c; input () end in input () with Unix.Unix_error _ -> *) (* Fallback if we don't have a terminal *) read_line () in match answer, t.default with | "?", _ -> print_endline t.help; ask_until_correct_aux () | "", Default_value v -> v | "", Default_answer s -> t.parse s | "", Default_not_printable -> raise ChooseNotPrintableDefault | s, _ -> t.parse s with | ChooseNotPrintableDefault as e -> begin raise e end | e -> begin Printf.printf (f_ "Error: %s\n") (Printexc.to_string e); begin match t.interface with | Human -> Printf.printf (f_ "Answer '?' for help on this question.\n%!") | Machine -> () end; ask_until_correct_aux () end in let () = match t.interface with | Human -> print_newline (); print_endline t.help | Machine -> () in ask_until_correct_aux () (** Try to transform a [Default_value _] into a [Default_answer _] if the value is among the choices *) let printable_default default choices = match default with | Default_answer _ | NoDefault | Default_not_printable as d -> d | Default_value v as d -> begin try let chc, _ = List.find (fun (_, v') -> v = v') choices in Default_answer chc with Not_found -> d end (** Extend [t] so that it can be processed using a choices list. *) let mk_shortcut_choices t choices = let help_choices = let fmt = str_formatter in pp_open_vbox fmt 0; pp_print_cut fmt (); pp_print_cut fmt (); pp_print_list (fun fmt (chc, nm, hlp, _) -> match hlp with | Some txt -> fprintf fmt "%s: @[%a, %a@]" chc pp_print_string_spaced nm pp_print_string_spaced txt | None -> fprintf fmt "%s: @[%a@]" chc pp_print_string_spaced nm) "@," fmt choices; pp_print_cut fmt (); pp_close_box fmt (); flush_str_formatter () in let choices_nohelp = List.map (fun (chc, _, _, vl) -> chc, vl) choices in let parse_shortcut s = List.assoc s choices_nohelp in (* The preprocessing we apply here, is that we also allow to use the name of choice. The difference is that you can give only a prefix of the name as long as it is not ambiguous. It also has lower priority than the shortcut. *) let name_choices = List.rev_map (fun (_, e, _, vl) -> e, vl) choices in let parse_name_choices s = (* [is_prefix pre str) Is [pre] a prefix of [str] *) let is_prefix pre (str, _) = if String.length str >= String.length pre then let pre_low = OASISString.lowercase_ascii pre in let ans_low = OASISString.lowercase_ascii (String.sub str 0 (String.length pre)) in pre_low = ans_low else false in let res = List.filter (is_prefix s) name_choices in match res with | [_, uniq] -> uniq | _ -> raise Not_found in let parse s = try begin parse_shortcut s end with Not_found -> begin try parse_name_choices s with Not_found -> (* Fallback to original parsing *) t.parse s end in let default = printable_default t.default choices_nohelp in {t with help = t.help^help_choices; default = default; parse = parse} let mk_numbered_choices t choices = let _, num_choices = List.fold_left (fun (i, acc) (e, hlp) -> (i + 1, (string_of_int i, e, hlp, e) :: acc)) (1, []) choices in mk_shortcut_choices {t with help = t.help ^(s_ "\nChoices:")} (List.rev num_choices) let mk_numbered_choices_multi t choices = let t = mk_numbered_choices t choices in let parse_one full s = try t.parse s with Failure _ -> failwithf (f_ "'%s' is not valid in answer '%s'") s full in let parse s = let lst = List.map (parse_one s) (* Split using " " and "," as separators *) (List.filter (fun s -> s <> "") (List.flatten (List.map (fun s -> OASISString.split_comma s) (OASISString.nsplit s ' ')))) in String.concat ", " lst in {t with parse = parse} let mk_yes_no t = mk_shortcut_choices t [ (s_ "y"), (s_ "yes"), None, true; (s_ "n"), (s_ "no"), None, false; ] (** Ask questions for a schema (Package, Library, Executable...) *) let ask_schema ~ctxt fields proplist_data features_data schema lvl interface plugins = let fake_context = { OASISAst_types.cond = None; append = false; valid_flags = []; ctxt = ctxt; } in let schm = schema.OASISSchema_intern.schm in let ask_field data key extra help = let default = try let s = PropList.Schema.get schm data key in Default_answer s with | OASISValues.Not_printable -> Default_not_printable | PropList.Not_set _ -> NoDefault in let has_default = default <> NoDefault in let set = PropList.Schema.set schm data key ~context:fake_context in begin match extra.qckstrt_lvl with | NoChoice s -> begin try set s with e -> failwithf (f_ "Trying to set field '%s' using mandatory \ value '%s': %s") key s (Printexc.to_string e) end | _ when not has_default || lvl >= extra.qckstrt_lvl -> begin let help = match help with | Some f -> Printf.sprintf (f_ "Field: %s\n%s\n%s\n") key (f ()) (help_of_default default) | None -> Printf.sprintf (f_ "Field: %s\n%s\n") (help_of_default default) key in let t = { id = OASISString.lowercase_ascii key; interface = interface; default = default; help = help; ctxt = ctxt; question = Printf.sprintf (f_ "Value for field '%s'?") key; parse = (fun s -> set s; s); } in try begin match extra.qckstrt_q () with | Field | Text -> begin (* TODO: text *) set (ask_until_correct t) end | Choices lst -> begin set (ask_until_correct (mk_numbered_choices_multi t (List.map (fun s -> s, None) lst))) end | ExclusiveChoices lst -> begin set (ask_until_correct (mk_numbered_choices t (List.map (fun s -> s, None) lst))) end end with ChooseNotPrintableDefault -> () end | _ -> () end; data in let ask_field_and_get_answer data key extra help = let data = ask_field data key extra help in let str = PropList.Schema.get schm data key in data, str in let ask_plugin_fields plg data = PropList.Schema.fold (fun data key extra help -> match extra.kind with | FieldFromPlugin plg' -> begin if OASISPlugin.plugin_compare plg plg' = 0 then ask_field data key extra help else data end | StandardField | DefinePlugin _ | DefinePlugins _ -> begin data end) data schm in let ask (data, new_plugins) key extra help = match extra.kind with | StandardField -> begin ask_field data key extra help, new_plugins end | DefinePlugin knd -> begin let data, plg_str = ask_field_and_get_answer data key extra help in let plg = OASISPlugin.plugin_of_string knd plg_str in let data = ask_plugin_fields plg data in data, (OASISPlugin.SetPlugin.add plg new_plugins) end | DefinePlugins knd -> begin let data, plg_str = ask_field_and_get_answer data key extra help in List.fold_left (fun (data, new_plugins) plg -> ask_plugin_fields plg data, OASISPlugin.SetPlugin.add plg new_plugins) (data, new_plugins) (OASISPlugin.plugins_of_string knd plg_str) end | FieldFromPlugin plg -> begin (* We process only fields that have been defined * out of this loop, since plugins define in the * loop are processed after the plugin definition *) if OASISPlugin.SetPlugin.mem plg plugins then ask_field data key extra help, new_plugins else data, new_plugins end in let all_fields = PropList.Schema.fold (fun mp key extra help -> MapString.add key (extra, help) mp) MapString.empty schm in List.fold_left (fun (data, new_plugins) fld -> try let extra, help = MapString.find fld all_fields in match extra.feature with | Some ftr -> let features_data = OASISPlugin.SetPlugin.fold (fun plg d -> OASISFeatures.Data.add_plugin plg d) new_plugins features_data in if OASISFeatures.data_test ftr features_data then ask (data, new_plugins) fld extra help else data, new_plugins | None -> ask (data, new_plugins) fld extra help with Not_found -> failwithf (f_ "Unable to find field %s in schema %s.") fld (PropList.Schema.name schm)) (proplist_data, plugins) fields (** Ask questions for a package and its sections *) let ask_package ~ctxt lvl intrf = let pkg_data, plugins, features_data = let first_fields = ["Name"; "Version"; "AlphaFeatures"; "BetaFeatures"] in let oasis_format = OASISConf.version_short in let other_fields = let first_fields_set = SetString.of_list first_fields in PropList.Schema.fold (fun acc key _ _ -> if SetString.mem key first_fields_set then acc else key :: acc) [] OASISPackage.schema.OASISSchema_intern.schm in let pkg_data_first, plugins_first = ask_schema ~ctxt first_fields (PropList.Data.create ()) (OASISFeatures.Data.create oasis_format [] []) OASISPackage.schema lvl intrf OASISPlugin.SetPlugin.empty in let features_data_first = OASISFeatures.Data.create oasis_format (OASISPackage_intern.alpha_features pkg_data_first) (OASISPackage_intern.beta_features pkg_data_first) in let pkg_data, plugins = ask_schema ~ctxt other_fields pkg_data_first features_data_first OASISPackage.schema lvl intrf plugins_first in let features_data = OASISPlugin.SetPlugin.fold (fun plg d -> OASISFeatures.Data.add_plugin plg d) plugins features_data_first in pkg_data, plugins, features_data in let mk_t nm hlp q = { id = nm; interface = intrf; default = NoDefault; help = hlp; ctxt = ctxt; question = q; parse = fun s -> s; } in let format_string s = let fmt = str_formatter in pp_open_box fmt 0; pp_print_string_spaced fmt s; pp_close_box fmt (); flush_str_formatter () in let section_data = let section gen schema q_name () = let nm = ask_until_correct (mk_t "name" "" q_name) in let fields = PropList.Schema.fold (fun acc key _ _ -> key :: acc) [] schema.schm in (* Plugin defined in sections don't propagate *) let data, _ = ask_schema ~ctxt fields (PropList.Data.create ()) features_data schema lvl intrf plugins in gen features_data nm data in let sections = [ s_ "n", s_ "stop", None, None; s_ "l", s_ "create a library", None, (Some (section OASISLibrary_intern.generator OASISLibrary.schema (s_ "Library name?"))); s_ "e", s_ "create an executable", None, (Some (section OASISExecutable_intern.generator OASISExecutable.schema (s_ "Executable name?"))); s_ "f", s_ "create a flag", None, (Some (section OASISFlag_intern.generator OASISFlag.schema (s_ "Flag name?"))); s_ "s", s_ "create a source repository", None, (Some (section OASISSourceRepository_intern.generator OASISSourceRepository.schema (s_ "Source repository identifier?"))); s_ "t", s_ "create a test", None, (Some (section OASISTest_intern.generator OASISTest.schema (s_ "Test name?"))); s_ "d", s_ "create a document", None, (Some (section OASISDocument_intern.generator OASISDocument.schema (s_ "Document name?"))); ] in let rec new_section acc hlp q = let next_opt = ask_until_correct (mk_shortcut_choices {(mk_t "create_section" hlp q) with parse = (fun s -> failwithf (f_ "'%s' is not a valid choice") s); default = Default_value None} sections) in match next_opt with | None -> List.rev acc | Some f -> new_section ((f ()) :: acc) (format_string (s_ "Section definition is complete. You can now \ now create additional sections:")) (s_ "Create another section?") in new_section [] (format_string (s_ "General package definition is complete. You can now \ create sections to describe various objects shipped \ by this package:")) (s_ "Create a section?") in let pkg = (* Build the basic data structure *) OASISPackage_intern.generator pkg_data section_data in (* Apply completion from plugin *) let plugins = (* Standard plugins *) [ (pkg.conf_type :> plugin_kind plugin); (pkg.build_type :> plugin_kind plugin); (pkg.install_type :> plugin_kind plugin); ] (* Extra plugins *) @ (pkg.plugins :> (plugin_kind plugin) list) (* Plugins from section *) @ (List.fold_left (fun lst sct -> match sct with | Executable _ | Library _ | Object _ -> lst | Test (cs, test) -> (test.test_type :> plugin_kind plugin) :: lst | Doc (cs, doc) -> (doc.doc_type :> plugin_kind plugin) :: lst | Flag _ | SrcRepo _ -> lst) []) pkg.sections in let pkg = List.fold_left (fun pkg plg -> (OASISPlugin.quickstart_completion plg) pkg) pkg plugins in pkg (** Create an _oasis file *) let to_file ~ctxt fn lvl intrf oasis_setup = let () = (* Print introduction *) let fmt = std_formatter in match intrf with | Human -> begin pp_open_vbox fmt 0; pp_open_box fmt 0; pp_print_string_spaced fmt (s_ "The program will ask some questions to create the \ `_oasis` file. If you answer '?' to a question, an help \ text will be displayed."); pp_close_box fmt (); pp_print_cut fmt (); pp_close_box fmt (); pp_print_flush fmt (); end | Machine -> () in let () = if Sys.file_exists fn then begin let a = ask_until_correct (mk_yes_no { id = "overwrite"; interface = intrf; default = Default_value false; help = ""; ctxt = ctxt; parse = bool_of_string; question = Printf.sprintf (f_ "File '%s' already exists, overwrite it?") fn; }) in if not a then failwithf (f_ "File '%s' already exists, remove it first") fn end in let pkg = ask_package ~ctxt lvl intrf in let content = let buf = Buffer.create 13 in let fmt = formatter_of_buffer buf in OASISFormat.pp_print_package fmt pkg; Format.pp_print_flush fmt (); buf in let default_program env_var prg = try begin let prg = Sys.getenv env_var in info ~ctxt (f_ "Environment variable %s is set to '%s'") env_var prg; Some prg end with Not_found -> begin try begin let prg = OASISFileUtil.which ~ctxt prg in info ~ctxt (f_ "Program '%s' exists") prg; Some prg end with Not_found -> info ~ctxt (f_ "Environment variable %s is not set and program '%s' \ doesn't exists") env_var prg; None end in let cmd_exec prg fn = let cmd = (Filename.quote prg) ^" "^ (Filename.quote fn) in info ~ctxt (f_ "Running command '%s'") cmd; match Sys.command cmd with | 0 -> () | i -> failwithf (f_ "Command '%s' exited with status code %d") cmd i in let dump_tmp content = let tmp_fn, chn = Filename.open_temp_file fn ".tmp" in Buffer.output_buffer chn content; close_out chn; tmp_fn in let editor content = match default_program "EDITOR" "editor" with | Some prg -> begin let tmp_fn = dump_tmp content in begin try (* Edit content *) cmd_exec prg tmp_fn; (* Reload content *) begin let chn = open_in tmp_fn in Buffer.clear content; Buffer.add_channel content chn (in_channel_length chn); close_in chn end; (* Remove temporary file *) Sys.remove tmp_fn with e -> Sys.remove tmp_fn; error ~ctxt "%s" (Printexc.to_string e) end end | None -> error ~ctxt "No way to edit the generated file." in let pager content = match default_program "PAGER" "pager" with | Some prg -> begin let tmp_fn = dump_tmp content in try cmd_exec prg tmp_fn; Sys.remove tmp_fn with e -> Sys.remove tmp_fn; error ~ctxt "%s" (Printexc.to_string e) end | None -> begin Buffer.output_buffer stdout content; flush stdout end in let create_fn content fn = let chn = open_out fn in info ~ctxt (f_ "Creating %s file\n%!") fn; Buffer.output_buffer chn content; close_out chn in let ask_end () = ask_until_correct (mk_shortcut_choices { id = "end"; interface = intrf; default = NoDefault; help = "Package definition is complete. Possible actions:"; ctxt = ctxt; question = "What do you want to do now?"; parse = (fun s -> failwithf (f_ "'%s' is not a valid choice.") s); } [ s_ "d", s_ "display the generated file", None, (fun () -> (* Send to pager *) pager content; true); s_ "e", s_ "edit the generated file", None, (fun () -> (* Send to editor *) editor content; true); s_ "w", s_ "write and exit", None, (fun () -> create_fn content fn; false); s_ "r", s_ "write, run 'oasis setup' and exit", None, (fun () -> create_fn content fn; oasis_setup (); false); s_ "q", s_ "exit without saving", None, (fun () -> false); ]) in while (ask_end ()) () do () done oasis-0.4.11/src/oasis/OASISPlugin.mli0000644000175000017500000002213013261073606016704 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Plugins creation and management The whole module is {b not exported}. @author Sylvain Le Gall *) (** {2 Types} *) open OASISTypes module MapPlugin: OASISUtils.MapExt.S with type key = plugin_kind plugin module SetPlugin: OASISUtils.SetExt.S with type elt = plugin_kind plugin (* Check that plugin exist even with a different version. *) val mem_no_version: plugin_kind plugin -> SetPlugin.t -> bool type 'a setter = plugin_data ref -> 'a -> unit type 'a getter = plugin_data ref -> 'a type 'a prop = 'a setter * 'a getter (** OCaml module embedded code. *) type modul = string (** Describe setup file changes. *) type ('a, 'b) setup_changes = { chng_moduls: modul list; (** OCaml module to be added to setup file *) chng_main: 'a OASISDataNotation.func; (** Main function to be added to BaseSetup.t (i.e. the one that that really do something: configure, build, test...) *) chng_clean: 'b OASISDataNotation.func option; (** Function to be called when cleaning *) chng_distclean: 'b OASISDataNotation.func option; (** Function to be called when distcleaning *) } (** Describe context when applying a plugin. *) type context_act = { ctxt: OASISContext.t; (** Global context. *) update: OASISSetupUpdate.t; (** What is the value given to -setup-update ? *) error: bool; (** Are there errors? *) files: OASISFileTemplate.templates; (** Generated files. *) other_actions: (unit -> unit) list; (** Extra actions. *) } (** Generator for sections (document, test). *) type ('a, 'b) section_act = context_act -> package -> (common_section * 'a) -> (* Result *) context_act * ((* Run *) (ctxt:OASISContext.t -> package -> (common_section * 'a) -> string array -> 'b), (* Clean & Distclean *) (ctxt:OASISContext.t -> package -> (common_section * 'a) -> string array -> unit)) setup_changes (** Generator with a package argument only (build, install). *) type package_act = context_act -> package -> (* Result *) context_act * ((* Run *) (ctxt:OASISContext.t -> package -> string array -> unit), (* Clean & Distclean *) (ctxt:OASISContext.t -> package -> string array -> unit)) setup_changes (** Base types to build plugin: register fields, action, generators... *) type 'a t (** Base types for all plugins *) type all_t = plugin_kind t (** Register a quickstart completion for this plugin *) val register_quickstart_completion: all_t -> (package -> package) -> unit (** Get quickstart completion *) val quickstart_completion: plugin_kind plugin -> package -> package (** Register a generator for package, to store data of a plugin *) val register_generator_package: all_t -> 'a prop -> (PropList.Data.t -> 'a) -> unit (** Call generator for provided plugin *) val generator_package: plugin_kind plugin -> plugin_data ref -> PropList.Data.t -> unit (** Register a generator for a section, to store data of a plugin *) val register_generator_section: section_kind -> all_t -> 'a prop -> (PropList.Data.t -> 'a) -> unit (** Call generator for provided plugin on a section *) val generator_section: section_kind -> plugin_kind plugin -> plugin_data ref -> PropList.Data.t -> unit (** List registered plugins of given kind. *) val ls: plugin_kind -> name list (** All registered plugin. *) val all_plugins: unit -> plugin_kind plugin list type help = { help_template: string list; help_order: int; } val help_default: string list -> help (** Register general help. We only rely on plugin name and version. The replacement field will be computed using the kind of the plugin. *) val register_help: [`All | plugin_kind] plugin -> help -> unit (** Get general help text *) val help: [`All] plugin -> help (** Convert back to plugin *) val to_plugin: 'a t -> 'a plugin (** Module to manage a set of plugins, of the same type. *) module type PLUGINS = sig type data type act type kind type self_t = kind t type self_plugin = kind plugin val create: self_plugin -> self_t * all_t (** Register the [section_act] or [package_act] datastructure. *) val register_act: self_t -> act -> unit (** Get action. *) val act: self_plugin -> act (** Quickstart question. *) val quickstart_question: unit -> self_plugin quickstart_question (** Parse a plugin field. *) val value: self_plugin OASISValues.t end (** {2 Modules for plugin type} *) (** This module manage plugin that can handle configure step. *) module Configure: PLUGINS with type act = package_act and type data = package and type kind = [`Configure] (** This module manage plugin that can handle build step. *) module Build: PLUGINS with type act = package_act and type data = package and type kind = [`Build] (** This module manage plugin that can handle building documents. *) module Doc: PLUGINS with type act = (doc, unit) section_act and type data = common_section * doc and type kind = [`Doc] (** This module manage plugin that can handle running tests. *) module Test: PLUGINS with type act = (test, float) section_act and type data = common_section * test and type kind = [`Test] (** This module manage plugin that can handle install/uninstall steps. *) module Install: PLUGINS with type act = package_act * package_act and type data = package and type kind = [`Install] (** This module manage plugin that can handle configure step. *) module Extra: PLUGINS with type act = context_act -> package -> context_act and type data = package and type kind = [`Extra] (** {2 General plugin functions} *) (** Check that a field name has the form to match a plugin. Don't check that the plugin exists. This functions help to ignore plugin fields. *) val test_field_name: string -> bool (** Use a builtin plugin (i.e. version = OASIS version). *) val builtin: 'a -> name -> 'a plugin (** Add a template to context *) val add_file: OASISFileTemplate.template -> context_act -> context_act (** Define an error in context. It doesn't stop processing, it just sets the {context_act.error} value. *) val set_error: bool -> string -> context_act -> context_act (** Get a plugin from a string *) val plugin_of_string: 'a -> string -> 'a plugin (** Get a list of plugins from a string *) val plugins_of_string: 'a -> string -> ('a plugin) list (** Get a list of plugins from a string *) val string_of_plugin: 'a plugin -> string (** Compare plugin, caseless for name and don't take into account version if one is not set. *) val plugin_compare: 'a plugin -> 'a plugin -> int (** Test equality for plugins, a special case of {!plugin_compare}. *) val plugin_equal: 'a plugin -> 'a plugin -> bool (** Create storage for plugin data. *) val data_create: unit -> plugin_data ref (** [data_new_property plg] Create a property that can store plugin data. Beware that the the couple [(plg, purpose)] must be unique. @param purpose An identifier to make possible the use of several properties for the same plugin. If not defined, it is derived from the kind of plugin. *) val data_new_property: ?purpose:plugin_data_purpose -> plugin_kind plugin -> 'a prop oasis-0.4.11/src/oasis/OASISPlugin.ml0000644000175000017500000003456513261073606016552 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes (* * Plugin operation *) let plugin_compare (k1, n1, vo1) (k2, n2, vo2) = match compare k1 k2 with | 0 -> begin match OASISUtils.compare_csl n1 n2 with | 0 -> begin match vo1, vo2 with | Some v1, Some v2 -> OASISVersion.version_compare v1 v2 | None, _ | _, None -> 0 end | n -> n end | n -> n let plugin_equal plg1 plg2 = plugin_compare plg1 plg2 = 0 let plugin_hash (k, n, _) = Hashtbl.hash (k, OASISString.lowercase_ascii n, None) (* * Plugin properties *) exception Not_set type 'a setter = plugin_data ref -> 'a -> unit type 'a getter = plugin_data ref -> 'a type 'a prop = 'a setter * 'a getter let data_create () = ref [] let data_new_property ?(purpose: plugin_data_purpose option) plg = let knd, _, _ = plg in let prp = match purpose, knd with | Some p, _ -> p | _, knd -> (knd :> plugin_data_purpose) in let v = ref None in let set t x = t := (plg, prp, (fun () -> v := Some x)) :: !t in let get t = try let _, _, f = List.find (fun (plg', prp', _) -> prp = prp' && plugin_equal plg plg') !t in f (); match !v with | Some x -> x | None -> raise Not_set with Not_found -> raise Not_set in (set, get) (* END EXPORT *) open OASISGettext open OASISUtils type modul = string type ('a, 'b) setup_changes = { chng_moduls: modul list; chng_main: 'a OASISDataNotation.func; chng_clean: ('b OASISDataNotation.func) option; chng_distclean: ('b OASISDataNotation.func) option; } type context_act = { ctxt: OASISContext.t; update: OASISSetupUpdate.t; error: bool; files: OASISFileTemplate.templates; other_actions: (unit -> unit) list; } type ('a, 'b) section_act = context_act -> package -> (common_section * 'a) -> context_act * ((ctxt:OASISContext.t -> package -> (common_section * 'a) -> string array -> 'b), (ctxt:OASISContext.t -> package -> (common_section * 'a) -> string array -> unit) ) setup_changes type package_act = context_act -> package -> context_act * ((ctxt:OASISContext.t -> package -> string array -> unit), (ctxt:OASISContext.t -> package -> string array -> unit) ) setup_changes type 'a t = 'a plugin type all_t = plugin_kind plugin module MapPlugin = MapExt.Make( struct type t = plugin_kind plugin let compare = plugin_compare end) module SetPlugin = SetExt.Make( struct type t = plugin_kind plugin let compare = plugin_compare end) let mem_no_version (knd, nm, _) plugins = SetPlugin.fold (fun (knd', nm', _) found -> if not found then knd = knd' && (OASISUtils.compare_csl nm nm' = 0) else found) plugins false module HashPlugin = Hashtbl.Make (struct type t = plugin_kind plugin let equal = plugin_equal let hash = plugin_hash end) module HashPluginAll = Hashtbl.Make (struct type t = [`All] plugin let equal = plugin_equal let hash = plugin_hash end) (** Find a plugin with or without version *) let find_fuzzy tbl ((knd, nm, _) as id) = try HashPlugin.find tbl id with Not_found -> HashPlugin.find tbl (knd, nm, None) let string_of_plugin (_, nm, vo) = match vo with | Some v -> Printf.sprintf "%s (%s)" nm (OASISVersion.string_of_version v) | None -> nm let plugin_of_string knd str = match OASISString.split_optional_parentheses str with | plg, Some ver -> knd, plg, Some (OASISVersion.version_of_string ver) | plg, None -> knd, plg, None let plugins_of_string knd str = List.map (plugin_of_string knd) (OASISString.split_comma str) (* General data for plugin *) type help = { help_template: string list; help_order: int; } let help_all = HashPluginAll.create 5 let help_default lst = { help_template = lst; help_order = 0; } let register_help (_, nm, vo) hlp = HashPluginAll.replace help_all (`All, nm, vo) hlp let help plg = HashPluginAll.find help_all plg let version_all = HashPlugin.create 5 let all = version_all let all_plugins () = HashPlugin.fold (fun k _ acc -> k :: acc) all [] let ls knd = HashPlugin.fold (fun ((knd', _, _) as id) _ lst -> if knd = knd' then (string_of_plugin id) :: lst else lst) all [] let load_if_absent ~ctxt ((_, nm, _) as plg) = if not (HashPlugin.mem all plg) then begin let plg_str = string_of_plugin plg in OASISMessage.info ~ctxt "Try to load plugin %s." plg_str; if ctxt.OASISContext.load_oasis_plugin nm then if not (HashPlugin.mem all plg) then failwithf (f_ "No matching registered plugin after loading plugin %s.") plg_str else OASISMessage.info ~ctxt "Plugin %s loaded." plg_str else OASISMessage.info ~ctxt "Plugin %s not found." plg_str end (* * Quickstart completion *) let qstrt_cmplt_all = HashPlugin.create 5 let register_quickstart_completion t f = HashPlugin.add qstrt_cmplt_all t f let quickstart_completion plg = try find_fuzzy qstrt_cmplt_all plg with Not_found -> (fun pkg -> pkg) (* * Generators *) let gen_all = HashPlugin.create 5 let register_generator_package t (prop_set, _) generator = HashPlugin.add gen_all t (fun t data -> prop_set t (generator data)) let generator_package plg rplugin_data data = try let lst = HashPlugin.find_all gen_all plg in List.iter (fun gen -> gen rplugin_data data) lst with Not_found -> () let gen_section = HashPlugin.create 5 let register_generator_section knd t (prop_set, _) generator = HashPlugin.add gen_section t (knd, (fun t data -> prop_set t (generator data))) let generator_section knd plg rplugin_data data = try let lst = HashPlugin.find_all gen_section plg in List.iter (fun (knd', gen) -> if knd = knd' then gen rplugin_data data) lst with Not_found -> () let to_plugin t = t module type PLUGINS = sig type data type act type kind type self_t = kind t type self_plugin = kind plugin val create: self_plugin -> self_t * all_t val register_act: self_t -> act -> unit val act: self_plugin -> act val quickstart_question: unit -> self_plugin quickstart_question val value: self_plugin OASISValues.t end (* Family of plugins data *) module type FAMILY = sig type act type data type kind = private [< plugin_kind] val kind_default: kind val to_plugin_kind: kind -> plugin_kind end module Make (F: FAMILY): PLUGINS with type data = F.data and type act = F.act and type kind = F.kind = struct (* * Types *) type data = F.data type act = F.act type kind = F.kind type self_t = kind plugin type self_plugin = kind plugin module HashPluginGlobal = HashPlugin let create plg = let ver = match plg with | _, _, Some v -> v | _, _, None -> failwithf (f_ "Plugin %s is defined without version.") (string_of_plugin plg) in let all_id :> plugin_kind plugin = plg in let self_id = plg in HashPlugin.add version_all all_id ver; self_id, all_id module HashPlugin = Hashtbl.Make (struct type t = self_plugin let equal = plugin_equal let hash = plugin_hash end) (* TODO: use a first-class module to handle this case and avoid * code duplication *) (** Find a plugin with or without version *) let find_fuzzy' tbl ((knd, nm, _) as id) = try HashPlugin.find tbl id with Not_found -> HashPlugin.find tbl (knd, nm, None) (* * Act *) let act_all = HashPlugin.create 5 let register_act t e = HashPlugin.add act_all t e let act plg = try find_fuzzy' act_all plg with Not_found -> failwithf (f_ "The plugin %s has no registered action.") (string_of_plugin plg) (** Parse value *) let value = let kind_default :> plugin_kind = F.kind_default in let not_found_of_kind = function | `Configure -> f_ "Unknown configure plugin '%s' (available: %s)" | `Build -> f_ "Unknown build plugin '%s' (available: %s)" | `Doc -> f_ "Unknown doc plugin '%s' (available: %s)" | `Test -> f_ "Unknown test plugin '%s' (available: %s)" | `Install -> f_ "Unknown install plugin '%s' (available: %s)" | `Extra -> f_ "Unknown extra plugin '%s' (available: %s)" in let parse ~ctxt s = let (knd, nm, ver_opt) as plg = plugin_of_string kind_default s in if not ctxt.OASISContext.ignore_plugins then begin load_if_absent ~ctxt plg; try let ver_plg = try find_fuzzy version_all (plg :> plugin_kind plugin) with Not_found -> failwithf (not_found_of_kind kind_default) (string_of_plugin plg) (String.concat ", " (ls kind_default)) in match ver_opt with | Some ver -> if OASISVersion.version_compare ver ver_plg <> 0 then OASISMessage.info ~ctxt (f_ "Plugin %s doesn't match the latest version of \ this plugin. Please check plugin's changelog \ and upgrade to the latest version %s.") (string_of_plugin plg) (OASISVersion.string_of_version ver_plg) | None -> OASISMessage.warning ~ctxt (f_ "Plugin %s is defined without version, use \ current version at least: %s.") nm (string_of_plugin (knd, nm, Some ver_plg)) with Not_found -> failwithf "Plugin %s doesn't exist." (string_of_plugin plg) end; (F.kind_default, nm, ver_opt) in { OASISValues.parse = parse; update = OASISValues.update_fail; print = string_of_plugin; } let quickstart_question () = let knd :> plugin_kind = F.kind_default in ExclusiveChoices (HashPluginGlobal.fold (fun (knd', nm, vo) _ lst -> if knd' = knd then (F.kind_default, nm, vo) :: lst else lst) all []) end (** Configure plugins *) module Configure = Make (struct type act = package_act type data = package type kind = [`Configure] let kind_default = `Configure let to_plugin_kind = function `Configure -> `Configure end) (** Build plugins *) module Build = Make (struct type act = package_act type data = package type kind = [`Build] let kind_default = `Build let to_plugin_kind = function `Build -> `Build end) (** Document plugins *) module Doc = Make (struct type act = (doc, unit) section_act type data = common_section * doc type kind = [`Doc] let kind_default = `Doc let to_plugin_kind = function `Doc -> `Doc end) (** Test plugins *) module Test = Make (struct type act = (test, float) section_act type data = common_section * test type kind = [`Test] let kind_default = `Test let to_plugin_kind = function `Test -> `Test end) (** Install/uninstall plugins *) module Install = Make (struct type act = package_act * package_act type data = package type kind = [`Install] let kind_default = `Install let to_plugin_kind = function `Install -> `Install end) (** Extra plugins *) module Extra = Make (struct type act = context_act -> package -> context_act type data = package type kind = [`Extra] let kind_default = `Extra let to_plugin_kind = function `Extra -> `Extra end) (** Functions for plugin writer *) (** Check that given field name belong to any plugin *) let test_field_name nm = String.length nm > 0 && (nm.[0] = 'x' || nm.[0] = 'X') (** Create value for a builtin plugin *) let builtin knd nm = let builtin_version = Some OASISConf.version_short in knd, nm, builtin_version (** Add a generated template file *) let add_file tmpl ctxt = {ctxt with files = OASISFileTemplate.add tmpl ctxt.files} (** Tests for error and set error status *) let set_error tst s ctxt = if tst then begin OASISMessage.error ~ctxt:ctxt.ctxt "%s" s; {ctxt with error = true} end else begin ctxt end oasis-0.4.11/src/oasis/OASISPath_intern.ml0000644000175000017500000000637213261073606017562 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let fn_reader ?(os_type=Sys.os_type) fn = let fn_part_of_string = function | "." -> `CurrentDir | ".." -> `ParentDir | str -> `Component str in if os_type = "Unix" || os_type = "Cygwin" then begin let sep = '/' in let fbeg, fn' = try (fun lst -> (`Root "") :: lst), OASISString.strip_starts_with ~what:(String.make 1 sep) fn with Not_found -> (fun lst -> lst), fn in fbeg (List.map fn_part_of_string (OASISString.nsplit fn sep)) end else if os_type = "Win32" then begin let lst = List.map fn_part_of_string (OASISString.nsplitf fn (fun c -> c = '\\' || c = '/')) in match lst with | `Component str :: tl -> begin try let drive_letter, rmng = OASISString.split str ':' in if rmng = "" then (`Root drive_letter) :: tl else (`RootRelative drive_letter) :: (`Component rmng) :: tl with Not_found -> lst end | lst -> lst end else invalid_arg "OASISHostPath.dir_reader" let rec fn_reduce acc = function | ((`Root _) | (`RootRelative _)) as hd :: tl -> fn_reduce [hd] tl | (`CurrentDir | `Component "") :: tl -> fn_reduce acc tl | `Component _ :: `ParentDir :: tl -> fn_reduce [] (List.rev_append acc tl) | (`Component _ | `ParentDir) as hd :: tl -> fn_reduce (hd :: acc) tl | [] -> if acc = [] then [`CurrentDir] else List.rev acc oasis-0.4.11/src/oasis/OASISParse.mli0000644000175000017500000000455313261073606016531 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Parse '_oasis' file The whole module is {b not exported}. @author Sylvain Le Gall *) open OASISTypes (** Default name of _oasis. *) val default_oasis_fn: host_filename (** [from_stream ~ctxt ~ignore_plugins ~fn st] Parse the OASIS file [~fn] and check it. If [~ignore_plugins] is set, ignore unknown plugin's fields in the file. *) val from_stream: ctxt:OASISContext.t -> ?fn:host_filename -> (char Stream.t) -> package (** See {!from_stream}, apply to a filename. *) val from_file: ctxt:OASISContext.t -> host_filename -> package (** See {!from_stream}, apply to a string. *) val from_string: ctxt:OASISContext.t -> ?fn:host_filename -> string -> package oasis-0.4.11/src/oasis/OASISParse.ml0000644000175000017500000000515713261073606016361 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext let default_oasis_fn = "_oasis" let critical = !OASISMutex.make () let parse ~ctxt ?fn lexbuf = let open Lexing in let pos_fname = match fn with | Some fn -> fn | None -> s_ "" in let ast = lexbuf.lex_curr_p <- {pos_fname = pos_fname; pos_lnum = 1; pos_bol = 0; pos_cnum = 0}; OASISMutex.section critical (fun () -> OASISAst_parser.main (OASISAst_lexer.token ~ctxt ()) lexbuf) in OASISAst.to_package ~ctxt ast let from_stream ~ctxt ?fn st = let str = let buf = Buffer.create 13 in Stream.iter (Buffer.add_char buf) st; Buffer.contents buf in parse ~ctxt ?fn (Lexing.from_string str) let from_file ~ctxt fn = let chn = open_in fn in let close () = close_in chn in try let pkg = parse ~ctxt ~fn (Lexing.from_channel chn) in close (); pkg with e -> close (); raise e let from_string ~ctxt ?fn str = parse ~ctxt ?fn (Lexing.from_string str) oasis-0.4.11/src/oasis/OASISPackage_intern.ml0000644000175000017500000004002113261073606020206 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Package schema and generator @author Sylvain Le Gall *) open OASISTypes (* END EXPORT *) open OASISValues open OASISUtils open OASISSchema_intern open OASISGettext let propagate_fields ~build_depends ~build_tools ~interface_patterns ~implementation_patterns pkg = let mod_bs bs = {bs with bs_build_depends = build_depends @ bs.bs_build_depends; bs_build_tools = build_tools @ bs.bs_build_tools; bs_implementation_patterns = implementation_patterns @ bs.bs_implementation_patterns; bs_interface_patterns = interface_patterns @ bs.bs_interface_patterns} in {pkg with sections = List.map (function | Library (cs, bs, lib) -> Library (cs, mod_bs bs, lib) | Object (cs, bs, obj) -> Object (cs, mod_bs bs, obj) | Executable (cs, bs, exec) -> Executable (cs, mod_bs bs, exec) | Test (cs, test) -> Test (cs, {test with test_tools = build_tools @ test.test_tools}) | Doc (cs, doc) -> Doc (cs, {doc with doc_build_tools = build_tools @ doc.doc_build_tools}) | Flag _ | SrcRepo _ as sct -> sct) pkg.sections} let schema = schema "Package" (fun pkg -> pkg.plugin_data) let oasis_version = let current_version = OASISConf.version_short in let extra_supported_versions = List.map OASISVersion.version_of_string ["0.3"] in new_field schema "OASISFormat" ~quickstart_level:(NoChoice current_version) { parse = (fun ~ctxt str -> let v = OASISVersion.value.parse ~ctxt str in if not (List.mem v (current_version :: extra_supported_versions)) then failwithf (f_ "OASIS format version '%s' is not supported.") str; v); update = update_fail; print = OASISVersion.value.print; } (fun () -> s_ "OASIS format version used to write file `_oasis`.") (fun pkg -> pkg.oasis_version) let alpha_features, beta_features = let value_feature stage = { parse = (fun ~ctxt:_ feature_name -> match OASISFeatures.get_stage feature_name with | OASISFeatures.InDev feature_stage -> if feature_stage <> stage then failwithf (f_ "Feature %s is in stage %s and not %s.") feature_name (OASISFeatures.string_of_stage feature_stage) (OASISFeatures.string_of_stage stage) else feature_name | OASISFeatures.SinceVersion min_version -> failwithf (f_ "Features %s has been published in OASISVersion %s.") feature_name (OASISVersion.string_of_version min_version)); update = update_fail; print = (fun s -> s) } in let alpha_features = new_field schema (OASISFeatures.field_of_stage OASISFeatures.Alpha) ~default:[] ~feature:OASISFeatures.features (comma_separated (value_feature OASISFeatures.Alpha)) (fun () -> s_ "Experimental features in alpha stage \ (frequent change, may never been shipped).") (fun pkg -> pkg.alpha_features) in let beta_features = new_field schema (OASISFeatures.field_of_stage OASISFeatures.Beta) ~default:[] ~feature:OASISFeatures.features (comma_separated (value_feature OASISFeatures.Beta)) (fun () -> s_ "Experimental features in beta stage \ (will ship, under review).") (fun pkg -> pkg.beta_features) in alpha_features, beta_features let generator = let schm = schema in let new_field ?quickstart_level ?quickstart_question ?default = new_field schm ?quickstart_level ?quickstart_question ?default in let new_field_plugin nm ?default ?quickstart_question value hlp sync = new_field_plugin schm nm ?default ?quickstart_question value hlp sync in let name = new_field "Name" string_not_empty (fun () -> s_ "Name of the package.") (fun pkg -> pkg.name) in let version = new_field "Version" OASISVersion.value (fun () -> s_ "Version of the package.") (fun pkg -> pkg.version) in let synopsis = new_field "Synopsis" string_not_empty (fun () -> s_ "Short description of the purpose of this package.") (fun pkg -> pkg.synopsis) in let description = new_field "Description" ~default:None (opt OASISText.value) (fun () -> s_ "Long description of the package purpose.") (fun pkg -> pkg.description) in let authors = new_field "Authors" (comma_separated string_not_empty) (fun () -> s_ "Real people that had contributed to the package.") (fun pkg -> pkg.authors) in let copyrights = new_field "Copyrights" ~default:[] (comma_separated copyright) (fun () -> s_ "Copyright owners.") (fun pkg -> pkg.copyrights) in let maintainers = new_field "Maintainers" ~default:[] (comma_separated string_not_empty) (fun () -> s_ "Current maintainers of the package.") (fun pkg -> pkg.maintainers) in let license_file = new_field "LicenseFile" ~default:None (opt file) (fun () -> s_ "File containing the license.") (fun pkg -> pkg.license_file) in let license = new_field "License" OASISLicense.value ~quickstart_question:(fun () -> ExclusiveChoices (OASISLicense.choices ())) (fun () -> (s_ "DEP-5 license of the package \ (See [DEP-5](http://dep.debian.net/deps/dep5/#index6h3)).")) (fun pkg -> pkg.license) in let ocaml_version = new_field "OCamlVersion" ~default:None (opt OASISVersion.comparator_value) (fun () -> s_ "Version constraint on OCaml.") (fun pkg -> pkg.ocaml_version) in let findlib_version = new_field "FindlibVersion" ~default:None (opt OASISVersion.comparator_value) (fun () -> s_ "Version constraint on Finblib.") (fun pkg -> pkg.findlib_version) in let conf_type = new_field_plugin "ConfType" ~default:(OASISPlugin.builtin `Configure "internal") ~quickstart_question:OASISPlugin.Configure.quickstart_question `Configure OASISPlugin.Configure.value (fun () -> s_ "Configuration system.") (fun pkg -> pkg.conf_type) in let conf_custom = OASISCustom.add_fields schm "Conf" (fun () -> s_ "Command to run before configuration.") (fun () -> s_ "Command to run after configuration.") (fun pkg -> pkg.conf_custom) in let build_type = new_field_plugin "BuildType" ~default:(OASISPlugin.builtin `Build "ocamlbuild") ~quickstart_question:OASISPlugin.Build.quickstart_question `Build OASISPlugin.Build.value (fun () -> s_ "Build system.") (fun pkg -> pkg.build_type) in let build_custom = OASISCustom.add_fields schm "Build" (fun () -> s_ "Command to run before build.") (fun () -> s_ "Command to run after build.") (fun pkg -> pkg.build_custom) in let install_type = new_field_plugin "InstallType" ~default:(OASISPlugin.builtin `Install "internal") ~quickstart_question:OASISPlugin.Install.quickstart_question `Install OASISPlugin.Install.value (fun () -> s_ "Install/uninstall system.") (fun pkg -> pkg.install_type) in let install_custom = OASISCustom.add_fields schm "Install" (fun () -> s_ "Command to run before install.") (fun () -> s_ "Command to run after install.") (fun pkg -> pkg.install_custom) in let uninstall_custom = OASISCustom.add_fields schm "Uninstall" (fun () -> s_ "Command to run before uninstall.") (fun () -> s_ "Command to run after uninstall.") (fun pkg -> pkg.uninstall_custom) in let clean_custom = OASISCustom.add_fields schm "Clean" (fun () -> s_ "Command to run before clean.") (fun () -> s_ "Command to run after clean.") (fun pkg -> pkg.clean_custom) in let distclean_custom = OASISCustom.add_fields schm "Distclean" (fun () -> s_ "Command to run before distclean.") (fun () -> s_ "Command to run after distclean.") (fun pkg -> pkg.distclean_custom) in let homepage = new_field "Homepage" ~default:None (opt url) (fun () -> s_ "URL of the package homepage.") (fun pkg -> pkg.homepage) in let bugreports = new_field "BugReports" ~default:None (opt url) (fun () -> s_ "URL of the page to report bugs about the package.") (fun pkg -> pkg.bugreports) in let tags = new_field "Tags" ~default:[] (comma_separated string_not_empty) (fun () -> s_ "List of semantic tags to classify the package.") (fun pkg -> pkg.tags) in let categories = new_field "Categories" ~default:[] categories (fun () -> s_ "URL(s) describing categories of the package.") (fun pkg -> pkg.categories) in let files_ab = new_field "FilesAB" ~default:[] (* TODO: check that filenames end with .ab *) (comma_separated file) (fun () -> s_ "Files to generate using environment variable \ substitution.") (fun pkg -> pkg.files_ab) in let plugins = let quickstart_question () = match OASISPlugin.Extra.quickstart_question () with | ExclusiveChoices lst -> Choices lst | Choices _ | Field | Text as q -> q in new_field_plugins schm "Plugins" ~default:[] ~quickstart_level:Beginner ~quickstart_question `Extra OASISPlugin.Extra.value (fun () -> s_ "Extra plugins to use.") (fun pkg -> pkg.plugins) in let disable_oasis_section = new_field "DisableOASISSection" ~default:[] ~feature:OASISFeatures.disable_oasis_section (comma_separated (expandable file)) (fun () -> s_ "Files to generate without OASIS section comments or \ digest.") (fun pkg -> pkg.disable_oasis_section) in let build_depends = OASISBuildSection_intern.build_depends_field schm (fun _ -> []) in let build_tools = OASISBuildSection_intern.build_tools_field schm (fun _ -> []) in let interface_patterns, implementation_patterns = OASISBuildSection_intern.source_patterns_fields schm [] (fun _ -> []) [] (fun _ -> []) in fun data sections -> let plugins = plugins data in let conf = conf_type data in let build = build_type data in let install = install_type data in (* Generate plugin data *) let set_plugin_data generator plugin_data data = let rplugin_data = ref plugin_data in List.iter (fun plg -> generator (plg :> plugin_kind plugin) rplugin_data data) plugins; generator (conf :> plugin_kind plugin) rplugin_data data; generator (build :> plugin_kind plugin) rplugin_data data; generator (install :> plugin_kind plugin) rplugin_data data; !rplugin_data in (* Plugin data for package *) let plugin_data = set_plugin_data OASISPlugin.generator_package [] data in (* Fix plugin data for sections, set data from plugin * defined at package level *) let sections = List.map (fun sct -> let knd, cs = OASISSection.section_kind_common sct in let plugin_data = set_plugin_data (OASISPlugin.generator_section knd) cs.cs_plugin_data cs.cs_data in OASISSection.section_common_set {cs with cs_plugin_data = plugin_data} sct) sections in let oasis_version = oasis_version data in let alpha_features = alpha_features data in let beta_features = beta_features data in if (alpha_features <> [] || beta_features <> []) && (OASISVersion.version_compare oasis_version OASISConf.version_short) <> 0 then begin failwithf (f_ "You need to use the latest OASISFormat to be able to use \ fields %s and %s. Change 'OASISFormat: %s' to \ 'OASISFormat: %s'") (OASISFeatures.field_of_stage OASISFeatures.Alpha) (OASISFeatures.field_of_stage OASISFeatures.Beta) (OASISVersion.string_of_version oasis_version) (OASISVersion.string_of_version OASISConf.version_short) end; propagate_fields ~build_tools:(build_tools data) ~build_depends:(build_depends data) ~interface_patterns:(interface_patterns data) ~implementation_patterns:(implementation_patterns data) { oasis_version = oasis_version; ocaml_version = ocaml_version data; findlib_version = findlib_version data; alpha_features = alpha_features; beta_features = beta_features; name = name data; version = version data; license = license data; license_file = license_file data; copyrights = copyrights data; maintainers = maintainers data; authors = authors data; homepage = homepage data; bugreports = bugreports data; synopsis = synopsis data; description = description data; tags = tags data; categories = categories data; conf_type = conf; conf_custom = conf_custom data; build_type = build; build_custom = build_custom data; install_type = install; install_custom = install_custom data; uninstall_custom = uninstall_custom data; clean_custom = clean_custom data; distclean_custom = distclean_custom data; files_ab = files_ab data; plugins = plugins; disable_oasis_section = disable_oasis_section data; sections = sections; schema_data = data; plugin_data = plugin_data; } oasis-0.4.11/src/oasis/OASISPackage.mli0000644000175000017500000000347313261073606017012 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Package toplevel @author Sylvain Le Gall *) (** Schema for the section. {b Not exported}. *) val schema: OASISTypes.package OASISSchema.t oasis-0.4.11/src/oasis/OASISPackage.ml0000644000175000017500000000334213261073606016634 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* END EXPORT *) let schema = OASISPackage_intern.schema oasis-0.4.11/src/oasis/OASISObject_intern.ml0000644000175000017500000000665413261073606020077 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext open OASISTypes open OASISSchema_intern open PropList.Field open OASISValues let schema, generator = let schm = schema "Object" (fun (cs, _, _) -> cs.cs_plugin_data) in let cmn_section_gen = OASISSection_intern.section_fields (fun () -> (s_ "object")) schm (fun (cs, _, _) -> cs) in let build_section_gen = OASISBuildSection_intern.section_fields (fun () -> (s_ "object")) Best schm (fun (_, bs, _) -> bs) in let modules = new_field schm "Modules" ~default:[] ~quickstart_level:Beginner modules (fun () -> s_ "List of modules to compile.") (fun (_, _, obj) -> obj.obj_modules) in let findlib_fullname = new_field schm "FindlibFullName" ~default:None (* TODO: Check that the name is correct if this value is None, the package name must be correct *) (opt (dot_separated findlib_name)) (fun () -> s_ "Name used by findlib.") (fun (_, _, obj) -> obj.obj_findlib_fullname) in let findlib_directory = new_field schm "FindlibDirectory" ~default:None ~feature:OASISFeatures.findlib_directory (opt directory) (fun () -> s_ "Directory used by findlib.") (fun (_, _, obj) -> obj.obj_findlib_directory) in schm, (fun features_data nm data -> OASISFeatures.data_assert OASISFeatures.section_object features_data (OASISFeatures.Section "Object"); Object (cmn_section_gen features_data nm data, (build_section_gen nm data), { obj_modules = modules data; obj_findlib_fullname = findlib_fullname data; obj_findlib_directory = findlib_directory data; })) oasis-0.4.11/src/oasis/OASISObject.mli0000644000175000017500000000524613261073606016665 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Object section @author Sylvain Le Gall *) open OASISTypes (** [source_unix_files (cs, bs, obj) source_file_exists] Source files for this object. The first part of the tuple is the file without extension for modules and the second part is the source files matching (e.g. .ml and .mli). *) val source_unix_files: ctxt:OASISContext.t -> common_section * build_section * object_ -> (unix_filename -> bool) -> (unix_filename * (unix_filename list)) list (** [generated_unix_files ~ctxt source_file_exists has_native_dynlink is_native ext_lib ext_dll (cs, bs, lib)] Compute all files expected by a build of the library. For each file a list of alternatives is provided. *) val generated_unix_files: ctxt:OASISContext.t -> is_native:bool -> source_file_exists:(unix_filename -> bool) -> common_section * build_section * object_ -> unix_filename list list (** Schema for the section. {b Not exported}. *) val schema: (common_section * build_section * object_) OASISSchema.t oasis-0.4.11/src/oasis/OASISObject.ml0000644000175000017500000000675613261073606016523 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open OASISGettext let find_module ~ctxt source_file_exists cs bs modul = match OASISBuildSection.find_module source_file_exists bs modul with | `Sources _ as res -> res | `No_sources _ as res -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching module '%s' in object %s.") modul cs.cs_name; OASISMessage.warning ~ctxt (f_ "Use InterfacePatterns or ImplementationPatterns to define \ this file with feature %S.") (OASISFeatures.source_patterns.OASISFeatures.name); res let source_unix_files ~ctxt (cs, bs, obj) source_file_exists = List.fold_left (fun acc modul -> match find_module ~ctxt source_file_exists cs bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> acc) [] obj.obj_modules let generated_unix_files ~ctxt ~is_native ~source_file_exists (cs, bs, obj) = let find_module ext modul = match find_module ~ctxt source_file_exists cs bs modul with | `Sources (base_fn, _) -> [base_fn ^ ext] | `No_sources lst -> lst in let header, byte, native, c_object, f = match obj.obj_modules with | [ m ] -> (find_module ".cmi" m, find_module ".cmo" m, find_module ".cmx" m, find_module ".o" m, fun x -> x) | _ -> ([cs.cs_name ^ ".cmi"], [cs.cs_name ^ ".cmo"], [cs.cs_name ^ ".cmx"], [cs.cs_name ^ ".o"], OASISUnixPath.concat bs.bs_path) in List.map (List.map f) ( match bs.bs_compiled_object with | Native -> native :: c_object :: byte :: header :: [] | Best when is_native -> native :: c_object :: byte :: header :: [] | Byte | Best -> byte :: header :: []) (* END EXPORT *) let schema = OASISObject_intern.schema oasis-0.4.11/src/oasis/OASISMutex.ml0000644000175000017500000000422113261073606016400 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Threads synchronisation. @author Sylvain Le Gall *) (** Create a pair of lock/unlock functions that will acquire a mutex. *) let make = ref (fun () -> (fun () -> ()), (fun () -> ())) (* Thread: let m = Mutex.create () in (fun () -> Mutex.lock m), (fun () -> Mutex.unlock m) *) (** Execute an action with locking/unlocking of a mutex. *) let section (lock, unlock) f = lock (); try let r = f () in unlock (); r with e -> unlock (); raise e oasis-0.4.11/src/oasis/OASISMessage.mli0000644000175000017500000000501713261073606017037 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Messages to user These functions display information depending on the verbosity level set in {!OASISContext.t}. They use [Printf.fprintf] syntax to output. You can use a [~after] function, that will be called if something has been displayed. @author Sylvain Le Gall *) (** Generic message. *) val generic_message: ctxt:OASISContext.t -> [`Debug|`Info|`Warning|`Error] -> ('a, unit, string, unit) format4 -> 'a (** Print a debug message. *) val debug: ctxt:OASISContext.t -> ('a, unit, string, unit) format4 -> 'a (** Print information message. *) val info: ctxt:OASISContext.t -> ('a, unit, string, unit) format4 -> 'a (** Print a warning message. *) val warning: ctxt:OASISContext.t -> ('a, unit, string, unit) format4 -> 'a (** Print an error message. *) val error: ctxt:OASISContext.t -> ('a, unit, string, unit) format4 -> 'a oasis-0.4.11/src/oasis/OASISMessage.ml0000644000175000017500000000437613261073606016675 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext open OASISContext let generic_message ~ctxt lvl fmt = let cond = if ctxt.quiet then false else match lvl with | `Debug -> ctxt.debug | `Info -> ctxt.info | _ -> true in Printf.ksprintf (fun str -> if cond then begin ctxt.printf lvl str end) fmt let debug ~ctxt fmt = generic_message ~ctxt `Debug fmt let info ~ctxt fmt = generic_message ~ctxt `Info fmt let warning ~ctxt fmt = generic_message ~ctxt `Warning fmt let error ~ctxt fmt = generic_message ~ctxt `Error fmt oasis-0.4.11/src/oasis/OASISLicense_types.ml0000644000175000017500000000337113261073606020111 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = | Or of t * t | And of t * t | License of string * (string option) oasis-0.4.11/src/oasis/OASISLicense_parser.mly0000644000175000017500000000451613261073606020434 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ %{ open OASISLicense_types %} %token TOKEN %token COMMA %token AND %token OR %token OR %token WITH %token EXCEPTION %token EOF %left COMMA %left OR %left AND %start main %type main %% main: licenses EOF { $1 } ; licenses: | licenses AND licenses { And ($1, $3) } | licenses OR licenses { Or ($1, $3) } | licenses COMMA AND licenses { And ($1, $4) } | licenses COMMA OR licenses { Or($1, $4) } | TOKEN WITH tokens EXCEPTION { let excpt = String.concat " " (List.rev $3) in License($1, Some excpt) } | TOKEN { License($1, None) } ; tokens: | tokens TOKEN { $2 :: $1 } | TOKEN { [$1] } ; oasis-0.4.11/src/oasis/OASISLicense_lexer.mll0000644000175000017500000000374413261073606020244 0ustar gildorgildor(********************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (********************************************************************************) { open OASISLicense_parser } rule token = parse [' ''\t''\n'] { token lexbuf } | ',' { COMMA } | "and" { AND } | "or" { OR } | "with" { WITH } | "exception" { EXCEPTION } | eof { EOF } | [^' ''\t''\n'',']+ as lxm { TOKEN lxm } oasis-0.4.11/src/oasis/OASISLicense.mli0000644000175000017500000001173013261073606017034 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** License definition This module allows to manipulate DEP-5 style license. @author Sylvain Le Gall @see DEP-5 *) (** Valid licenses *) type license (** Valid license exceptions. *) type license_exception (** License version. *) type license_version = | Version of OASISVersion.t | VersionOrLater of OASISVersion.t | NoVersion (** DEP-5 license, basic. *) type license_dep_5_unit = { license: license; excption: license_exception option; version: license_version; } (** DEP-5 license, complex. *) type license_dep_5 = | DEP5Unit of license_dep_5_unit | DEP5Or of license_dep_5 list | DEP5And of license_dep_5 list (** OASIS supported type of license. *) type t = | DEP5License of license_dep_5 | OtherLicense of string (* URL *) (** Extra data about license {b Not exported} *) type license_data = { long_name: string; (** Expanded name of the license. *) versions: OASISVersion.t list; (** Standard versions of the license. *) note: string option; (** Extra information about the license. *) deprecated: string option; (** Deprecated alternative. *) } (** Extra data about license exception {b Not exported} *) type license_exception_data = { explanation: string; (** Purpose of the exception. *) licenses: license list; (** Compatible licenses with the exception. *) } (** Convert a DEP-5 license to string. {b Not exported}. *) val to_string: t -> string (** Convert a DEP-5 license to a legal disclaimer for the product. {b Not exported}. *) val legal_disclaimer: string -> t -> string (** Convert a license to string. {b Not exported}. *) val string_of_license: license -> string (** Convert a license exception to string. {b Not exported}. *) val string_of_license_exception: license_exception -> string (** License value. {b Not exported}. *) val value: t OASISValues.t (** Choices for quickstart question. {b Not exported}. *) val choices: unit -> t list (** All available license, their short name, their long name, and compatible versions. {b Not exported}. *) val license_data: unit -> (license * license_data) list (** All available license exception, their name, and compatible license. {b Not exported}. *) val license_exception_data: unit -> (license_exception * license_exception_data) list (** Dump [OASISDataNotation.t]. {b Not exported}. *) val odn_of_t: t -> OASISDataNotation.t (** {2 License definitions} {b No licenses are exported.} *) val proprietary: license val apache: license val artistic: license val bsd2: license val bsd3: license val bsd4: license val cecill: license val cecillb: license val cecillc: license val freebsd: license val isc: license val cc_by: license val cc_by_sa: license val cc_by_nd: license val cc_by_nc: license val cc_by_nc_sa: license val cc_by_nc_nd: license val cc0: license val cddl: license val cpl: license val eiffel: license val expat: license val gpl: license val lgpl: license val agpl: license val gfdl: license val gfdl_niv: license val lppl: license val mpl: license val perl: license val psf: license val qpl: license val w3c_software: license val zlib: license val zope: license val mit: license val wtfpl: license val public_domain: license val ocaml_linking_exception: license_exception oasis-0.4.11/src/oasis/OASISLicense.ml0000644000175000017500000004426013261073606016667 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** License for _oasis fields @author Sylvain Le Gall *) type license = string type license_exception = string type license_version = | Version of OASISVersion.t | VersionOrLater of OASISVersion.t | NoVersion type license_dep_5_unit = { license: license; excption: license_exception option; version: license_version; } type license_dep_5 = | DEP5Unit of license_dep_5_unit | DEP5Or of license_dep_5 list | DEP5And of license_dep_5 list type t = | DEP5License of license_dep_5 | OtherLicense of string (* URL *) (* END EXPORT *) open OASISValues open OASISUtils open OASISGettext type license_data = { long_name: string; versions: OASISVersion.t list; note: string option; deprecated: string option; } let all_full_licenses = HashStringCsl.create 64 let deprecated_full_licenses = ref SetStringCsl.empty let all_licenses = ref [] let string_of_license s = s let string_of_license_exception s = s let string_of_license_dep_5 license_dep_5 = let ver = match license_dep_5.version with | Version v -> "-"^(OASISVersion.string_of_version v) | VersionOrLater v -> "-"^(OASISVersion.string_of_version v)^"+" | NoVersion -> "" in let exceptions = match license_dep_5.excption with | None -> "" | Some str -> " with "^str^" exception" in license_dep_5.license^ver^exceptions let long_name_of_license_dep_5 license_dep_5 = try let long_name = (List.assoc license_dep_5.license !all_licenses).long_name in let ver = match license_dep_5.version with | Version v -> " version "^(OASISVersion.string_of_version v) | VersionOrLater v -> " version "^(OASISVersion.string_of_version v)^" or later" | NoVersion -> "" in let exceptions = match license_dep_5.excption with | None -> "" | Some str -> " with "^str^" exception" in long_name^ver^exceptions with Not_found -> string_of_license_dep_5 license_dep_5 let mk_license nm ?(versions=[]) ?deprecated ?note long_name = let rec expand_version = function | hd :: tl -> begin try let hd' = OASISString.strip_ends_with ~what:".0" hd in hd :: (expand_version (hd' :: tl)) with Not_found -> hd :: (expand_version tl) end | [] -> [] in let t = { long_name = long_name; versions = List.map OASISVersion.version_of_string (expand_version versions); note = note; deprecated = deprecated; } in let license_dep_5 = { license = nm; excption = None; version = NoVersion; } in let add_full_license (full_nm, license_dep_5) = if HashStringCsl.mem all_full_licenses full_nm then failwithf (f_ "Duplicate license '%s'") full_nm; HashStringCsl.add all_full_licenses full_nm license_dep_5 in (* Add all expansion of license + version to the hashtable for easy * retrieval. *) add_full_license (nm, license_dep_5); List.iter (fun ver -> let make_nm license_dep_5 = (string_of_license_dep_5 license_dep_5), license_dep_5 in add_full_license (make_nm {license_dep_5 with version = Version ver}); add_full_license (make_nm {license_dep_5 with version = VersionOrLater ver})) t.versions; begin match deprecated with | Some str -> add_full_license (str, license_dep_5); deprecated_full_licenses := SetStringCsl.add str !deprecated_full_licenses | None -> () end; (* Append the license to all other licenses. *) all_licenses := (nm, t) :: !all_licenses; nm let license_data () = let lst = List.map (fun (license, data) -> (license, {data with (* Really translate strings *) long_name = s_ data.long_name; note = match data.note with | Some str -> Some (s_ str) | None -> None})) !all_licenses in List.sort (fun (nm1, _) (nm2, _) -> compare_csl nm1 nm2) lst let proprietary = mk_license "PROP" (ns_ "Proprietary license, all rights reserved") let apache = mk_license "Apache" ~versions:["1.0"; "1.1"; "2.0"] (ns_ "Apache license") let artistic = mk_license "Artistic" ~versions:["1.0"; "2.0"] (ns_ "Artistic license") let bsd2 = mk_license "BSD-2-clause" (ns_ "Berkeley software distribution license (2 clauses)") let bsd3 = mk_license "BSD-3-clause" ~deprecated:"BSD3" (ns_ "Berkeley software distribution license (3 clauses)") let bsd4 = mk_license "BSD-4-clause" ~deprecated:"BSD4" (ns_ "Berkeley software distribution license (4 clauses)") let cecill = mk_license "CeCILL" ~versions:["1"; "2"] ~note:(ns_ "GPL like.") (ns_ "CEA-CNRS-INRIA Logiciel Libre") let cecillb = mk_license "CeCILL-B" (ns_ "CEA-CNRS-INRIA Logiciel Libre, BSD-like") let cecillc = mk_license "CeCILL-C" (ns_ "CEA-CNRS-INRIA Logiciel Libre, LGPL-like") let freebsd = mk_license "FreeBSD" "FreeBSD Project license" let isc = mk_license "ISC" ~note:(ns_ "Sometimes also known as the OpenBSD License.") (ns_ "Internet Software Consortium's license") let cc_by = mk_license "CC-BY" (ns_ "Creative Commons Attribution license") let cc_by_sa = mk_license "CC-BY-SA" (ns_ "Creative Commons Attribution Share Alike license") let cc_by_nd = mk_license "CC-BY-ND" (ns_ "Creative Commons Attribution No Derivatives") let cc_by_nc = mk_license "CC-BY-NC" (ns_ "Creative Commons Attribution Non-Commercial") let cc_by_nc_sa = mk_license "CC-BY-NC-SA" (ns_ "Creative Commons Attribution Non-Commercial Share Alike") let cc_by_nc_nd = mk_license "CC-BY-NC-ND" (ns_ "Creative Commons Attribution Non-Commercial No Derivatives") let cc0 = mk_license "CC0" (ns_ "Creative Commons Universal waiver") let cddl = mk_license "CDDL" (ns_ "Common Development and Distribution License") let cpl = mk_license "CPL" ~versions:["1.0"] (ns_ "IBM Common Public License") let eiffel = mk_license "Eiffel" ~versions:["2"] (ns_ "The Eiffel Forum License") let expat = mk_license "Expat" (ns_ "The Expat license") let gpl = mk_license "GPL" ~versions:["1.0"; "2.0"; "3.0"] (ns_ "GNU General Public License") let lgpl = mk_license "LGPL" ~versions:["2.0"; "2.1"; "3.0"] ~note:"GNU Library General Public License for versions lower than 2.1" (ns_ "GNU Lesser General Public License") let agpl = mk_license "AGPL" ~versions:["3.0"] (ns_ "GNU Affero General Public License") let gfdl = mk_license "GFDL" ~versions:["1.1"; "1.2"; "1.3"] (ns_ "GNU Free Documentation License") let gfdl_niv = mk_license "GFDL-NIV" ~versions:["1.1"; "1.2"; "1.3"] (ns_ "GNU Free Documentation License, with no invariant sections") let lppl = mk_license "LPPL" ~versions:["1.3c"] (ns_ "LaTeX Project Public License") let mpl = mk_license "MPL" ~versions:["1.0"; "1.1"] (ns_ "Mozilla Public License") let perl = mk_license "Perl" ~note:(ns_ "Equates to GPL-1+ or Artistic-1.") (ns_ "Perl license") let psf = mk_license "PSF" ~versions:["2"] (ns_ "Python Software Foundation license") let qpl = mk_license "QPL" ~versions:["1.0"] (ns_ "Q Public License") let w3c_software = mk_license "W3C-Software" ~versions:["20021231"] (ns_ "W3C Software License") let zlib = mk_license "ZLIB" ~versions:["1.2.2"] (ns_ "zlib/libpng license") let zope = mk_license "Zope" ~versions:["1.0"; "2.0"; "2.1"] (ns_ "Zope Public License") let mit = mk_license "MIT" (ns_ "MIT License") let wtfpl = mk_license "WTFPL" (ns_ "Do What The F*ck You Want To Public License") let public_domain = mk_license "PD" ~note:(ns_ "This is not a true license.") (ns_ "Public domain") type license_exception_data = { explanation: string; licenses: license list; } let all_exceptions = HashStringCsl.create 13 let mk_exception nm explanation licenses = if HashStringCsl.mem all_exceptions nm then failwithf (f_ "Duplicate license exception '%s'") nm; HashStringCsl.add all_exceptions nm { explanation = explanation; licenses = licenses; }; nm let license_exception_data () = HashStringCsl.fold (fun license_exception data acc -> (license_exception, {data with (* Really translate strings *) explanation = s_ data.explanation}) :: acc) all_exceptions [] let ocaml_linking_exception = mk_exception "OCaml linking" (ns_ "Add an exception to allow static compilation without license \ propagation. Without this clause, compiling against an OCaml \ library force license propagation. The LGPL is equal to GPL \ without this exception.") [lgpl] let parse_dep_5 ~ctxt str = let rec solve_token = function | OASISLicense_types.Or (t1', t2') -> DEP5Or [solve_token t1'; solve_token t2'] | OASISLicense_types.And (t1', t2') -> DEP5And [solve_token t1'; solve_token t2'] | OASISLicense_types.License (lcs, Some exc) -> DEP5Unit {(decode_license lcs) with excption = decode_exception exc} | OASISLicense_types.License (lcs, None) -> DEP5Unit (decode_license lcs) and decode_license str = try let license_dep_5 = HashStringCsl.find all_full_licenses str in if SetStringCsl.mem str !deprecated_full_licenses then OASISMessage.warning ~ctxt (f_ "Deprecated license %s, use %s instead.") str (string_of_license_dep_5 license_dep_5); license_dep_5 with Not_found -> failwithf (f_ "Unknown license '%s'") str and decode_exception str = if not (HashStringCsl.mem all_exceptions str) then OASISMessage.warning ~ctxt (f_ "Unknown license exception '%s'") str; Some str in let rec merge = function | DEP5Or lst -> let lst = List.fold_left (fun acc -> function | DEP5Or lst -> List.rev_append lst acc | DEP5And _ | DEP5Unit _ as t -> t :: acc) [] (List.rev_map merge lst) in DEP5Or lst | DEP5And lst -> let lst = List.fold_left (fun acc -> function | DEP5And lst -> List.rev_append lst acc | DEP5Or _ | DEP5Unit _ as t -> t :: acc) [] (List.rev_map merge lst) in DEP5And lst | DEP5Unit _ as t -> t in let lexbuf = Lexing.from_string str in let t' = OASISLicense_parser.main OASISLicense_lexer.token lexbuf in merge (solve_token t') let parse ~ctxt str = try OtherLicense (OASISValues.url.parse ~ctxt str) with Failure _ -> try DEP5License (parse_dep_5 ~ctxt str) with e -> begin failwithf (f_ "Cannot parse license '%s': %s") str (Printexc.to_string e) end let rec string_of_dep_5_generic f dep_5 = let rec dep_5_str = function | DEP5Unit t -> f t | DEP5Or lst -> String.concat " or " (List.map dep_5_str lst) | DEP5And [DEP5Or _ as t1; DEP5Unit _ as t2] -> (dep_5_str t1)^", and "^(dep_5_str t2) | DEP5And lst -> String.concat " and " (List.map (fun t -> let str = dep_5_str t in match t with | DEP5Or _ -> "("^str^")" | _ -> str) lst) in dep_5_str dep_5 let to_string = function | DEP5License dep_5 -> string_of_dep_5_generic string_of_license_dep_5 dep_5 | OtherLicense url -> url let legal_disclaimer nm = function | DEP5License dep_5 -> Printf.sprintf "%s is distributed under the terms of the %s." nm (string_of_dep_5_generic long_name_of_license_dep_5 dep_5) | OtherLicense url -> Printf.sprintf "%s is distributed using the license describe at this [URL](%s)." nm url let value = { parse = parse; update = OASISValues.update_fail; print = to_string; } let choices () = let compare_license t1 t2 = match compare_csl t1.license t2.license with | 0 -> begin let v_cmp = match t1.version, t2.version with | NoVersion, NoVersion -> 0 | NoVersion, _ -> -1 | _, NoVersion -> 1 | Version v1, Version v2 | VersionOrLater v1, Version v2 | Version v1, VersionOrLater v2 | VersionOrLater v1, VersionOrLater v2 -> OASISVersion.version_compare v1 v2 in match v_cmp with | 0 -> begin compare t1.excption t2.excption end | n -> n end | n -> n in let exception_find license mp = try MapString.find license mp with Not_found -> [] in let exceptions_map = HashStringCsl.fold (fun excpt data mp -> List.fold_left (fun mp license -> let vl = exception_find license mp in MapString.add license (excpt :: vl) mp) mp data.licenses) all_exceptions MapString.empty in let all = List.fold_left (fun acc (license, data) -> let dflt = {license = license; version = NoVersion; excption = None} in List.fold_left (fun acc ver -> let dflt = {dflt with version = Version ver} in List.fold_left (fun acc excpt -> {dflt with excption = Some excpt} :: acc) (* only versions *) (dflt :: acc) (exception_find license exceptions_map)) (* only license *) (dflt :: acc) data.versions) [] !all_licenses in let all = List.sort compare_license all in let preferred = [ {license = lgpl; version = Version (OASISVersion.version_of_string "2.1"); excption = Some ocaml_linking_exception}; {license = bsd3; version = NoVersion; excption = None}; {license = gpl; version = Version (OASISVersion.version_of_string "3.0"); excption = None}; {license = agpl; version = Version (OASISVersion.version_of_string "3.0"); excption = None}; {license = qpl; version = Version (OASISVersion.version_of_string "1.0"); excption = None}; {license = mit; version = NoVersion; excption = None}; ] in let all = preferred @ (List.filter (fun l -> not (List.mem l preferred)) all) in List.map (fun t -> DEP5License (DEP5Unit t)) all let odn_of_t = let open OASISDataNotation in let odn_of_license = of_string in let odn_of_license_exception = of_string in let odn_of_license_version = function | Version v0 -> VRT ("OASISLicense.Version", [ OASISVersion.odn_of_t v0 ]) | VersionOrLater v0 -> VRT ("OASISLicense.VersionOrLater", [ OASISVersion.odn_of_t v0 ]) | NoVersion -> VRT ("OASISLicense.NoVersion", []) in let odn_of_license_dep_5_unit v = REC ("OASISLicense", [ ("license", (odn_of_license v.license)); ("excption", ((fun x -> of_option odn_of_license_exception x) v.excption)); ("version", (odn_of_license_version v.version)) ]) in let rec odn_of_license_dep_5 = function | DEP5Unit v0 -> VRT ("OASISLicense.DEP5Unit", [ odn_of_license_dep_5_unit v0 ]) | DEP5Or v0 -> VRT ("OASISLicense.DEP5Or", [ (fun x -> of_list odn_of_license_dep_5 x) v0 ]) | DEP5And v0 -> VRT ("OASISLicense.DEP5And", [ (fun x -> of_list odn_of_license_dep_5 x) v0 ]) in function | DEP5License v0 -> VRT ("OASISLicense.DEP5License", [ odn_of_license_dep_5 v0 ]) | OtherLicense v0 -> VRT ("OASISLicense.OtherLicense", [ of_string v0 ]) oasis-0.4.11/src/oasis/OASISLibrary_intern.ml0000644000175000017500000001135013261073606020262 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Library schema and generator @author Sylvain Le Gall *) open OASISTypes open OASISSchema_intern open OASISValues open OASISGettext open PropList.Field let schema, generator = let schm = schema "Library" (fun (cs, _, _) -> cs.cs_plugin_data) in let cmn_section_gen = OASISSection_intern.section_fields (fun () -> (s_ "library")) schm (fun (cs, _, _) -> cs) in let build_section_gen = OASISBuildSection_intern.section_fields (fun () -> (s_ "library")) Best schm (fun (_, bs, _) -> bs) in let external_modules = new_field schm "Modules" ~default:[] ~quickstart_level:Beginner modules (fun () -> s_ "List of modules to compile.") (fun (_, _, lib) -> lib.lib_modules) in let internal_modules = new_field schm "InternalModules" ~default:[] ~quickstart_level:Beginner modules (fun () -> s_ "List of modules to compile which are not exported.") (fun (_, _, lib) -> lib.lib_internal_modules) in let pack = new_field schm "Pack" ~default:false ~quickstart_level:Expert ~feature:OASISFeatures.pack boolean (fun () -> s_ "Set if we should build a packed library.") (fun (_, _, lib) -> lib.lib_pack) in let findlib_parent = new_field schm "FindlibParent" ~default:None (opt internal_library) (fun () -> s_ "Library which includes the current library. The current library \ will be built as its parents and installed along it.") (fun (_, _, lib) -> lib.lib_findlib_parent) in let findlib_name = new_field schm "FindlibName" ~default:None (* TODO: Check that the name is correct if this value is None, the package name must be correct *) (opt findlib_name) (fun () -> s_ "Name used by findlib.") (fun (_, _, lib) -> lib.lib_findlib_name) in let findlib_directory = new_field schm "FindlibDirectory" ~default:None ~feature:OASISFeatures.findlib_directory (opt directory) (fun () -> s_ "Directory used by findlib.") (fun (_, _, lib) -> lib.lib_findlib_directory) in let findlib_containers = new_field schm "FindlibContainers" ~default:[] (* TODO: check that a container doesn't overwrite a real package *) (dot_separated string_not_empty) (fun () -> s_ "Virtual containers for sub-package, dot-separated") (fun (_, _, lib) -> lib.lib_findlib_containers) in schm, (fun features_data nm data -> Library (cmn_section_gen features_data nm data, (build_section_gen nm data), { lib_modules = external_modules data; lib_pack = pack data; lib_internal_modules = internal_modules data; lib_findlib_parent = findlib_parent data; lib_findlib_name = findlib_name data; lib_findlib_directory = findlib_directory data; lib_findlib_containers = findlib_containers data; })) oasis-0.4.11/src/oasis/OASISLibrary.mli0000644000175000017500000000535613261073606017065 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Library section @author Sylvain Le Gall *) open OASISTypes (** [source_unix_files (cs, bs, lib) source_file_exists] Source files for this library. The first part of the tuple is the file without extension for modules and the second part is the source files matching (e.g. .ml and .mli). *) val source_unix_files: ctxt:OASISContext.t -> common_section * build_section * library -> (unix_filename -> bool) -> (unix_filename * (unix_filename list)) list (** [generated_unix_files ~ctxt source_file_exists has_native_dynlink is_native ext_lib ext_dll (cs, bs, lib)] Compute all files expected by a build of the library. For each file a list of alternatives is provided. *) val generated_unix_files: ctxt:OASISContext.t -> is_native:bool -> has_native_dynlink:bool -> ext_lib:string -> ext_dll:string -> source_file_exists:(unix_filename -> bool) -> common_section * build_section * library -> unix_filename list list (** Schema for the section. {b Not exported}. *) val schema: (common_section * build_section * library) OASISSchema.t oasis-0.4.11/src/oasis/OASISLibrary.ml0000644000175000017500000001274313261073606016712 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open OASISGettext let find_module ~ctxt source_file_exists cs bs modul = match OASISBuildSection.find_module source_file_exists bs modul with | `Sources _ as res -> res | `No_sources _ as res -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching module '%s' in library %s.") modul cs.cs_name; OASISMessage.warning ~ctxt (f_ "Use InterfacePatterns or ImplementationPatterns to define \ this file with feature %S.") (OASISFeatures.source_patterns.OASISFeatures.name); res let source_unix_files ~ctxt (cs, bs, lib) source_file_exists = List.fold_left (fun acc modul -> match find_module ~ctxt source_file_exists cs bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> acc) [] (lib.lib_modules @ lib.lib_internal_modules) let generated_unix_files ~ctxt ~is_native ~has_native_dynlink ~ext_lib ~ext_dll ~source_file_exists (cs, bs, lib) = let find_modules lst ext = let find_module modul = match find_module ~ctxt source_file_exists cs bs modul with | `Sources (_, [fn]) when ext <> "cmi" && Filename.check_suffix fn ".mli" -> None (* No implementation files for pure interface. *) | `Sources (base_fn, _) -> Some [base_fn] | `No_sources lst -> Some lst in List.fold_left (fun acc nm -> match find_module nm with | None -> acc | Some base_fns -> List.map (fun base_fn -> base_fn ^"."^ext) base_fns :: acc) [] lst in (* The .cmx that be compiled along *) let cmxs = let should_be_built = match bs.bs_compiled_object with | Native -> true | Best -> is_native | Byte -> false in if should_be_built then if lib.lib_pack then find_modules [cs.cs_name] "cmx" else find_modules (lib.lib_modules @ lib.lib_internal_modules) "cmx" else [] in let acc_nopath = [] in (* The headers and annot/cmt files that should be compiled along *) let headers = let sufx = if lib.lib_pack then [".cmti"; ".cmt"; ".annot"] else [".cmi"; ".cmti"; ".cmt"; ".annot"] in List.map (List.fold_left (fun accu s -> let dot = String.rindex s '.' in let base = String.sub s 0 dot in List.map ((^) base) sufx @ accu) []) (find_modules lib.lib_modules "cmi") in (* Compute what libraries should be built *) let acc_nopath = (* Add the packed header file if required *) let add_pack_header acc = if lib.lib_pack then [cs.cs_name^".cmi"; cs.cs_name^".cmti"; cs.cs_name^".cmt"] :: acc else acc in let byte acc = add_pack_header ([cs.cs_name^".cma"] :: acc) in let native acc = let acc = add_pack_header (if has_native_dynlink then [cs.cs_name^".cmxs"] :: acc else acc) in [cs.cs_name^".cmxa"] :: [cs.cs_name^ext_lib] :: acc in match bs.bs_compiled_object with | Native -> byte (native acc_nopath) | Best when is_native -> byte (native acc_nopath) | Byte | Best -> byte acc_nopath in (* Add C library to be built *) let acc_nopath = if bs.bs_c_sources <> [] then begin ["lib"^cs.cs_name^"_stubs"^ext_lib] :: if has_native_dynlink then ["dll"^cs.cs_name^"_stubs"^ext_dll] :: acc_nopath else acc_nopath end else begin acc_nopath end in (* All the files generated *) List.rev_append (List.rev_map (List.rev_map (OASISUnixPath.concat bs.bs_path)) acc_nopath) (headers @ cmxs) (* END EXPORT *) let schema = OASISLibrary_intern.schema oasis-0.4.11/src/oasis/OASISHostPath.mli0000644000175000017500000000460513261073606017207 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Manipulate host filenames @author Sylvain Le Gall *) open OASISTypes (** Create a filename out of its components. *) val make: host_filename list -> host_filename (** Convert a unix filename into host filename. *) val of_unix: unix_filename -> host_filename (** Convert a host filename into a unix filename. {b Not exported} *) val to_unix: host_filename -> unix_filename (** Compare host filename. {b Not exported} *) val compare: host_filename -> host_filename -> int (** See {!OASISUnixPath.add_extension}. {b Not exported} *) val add_extension: host_filename -> string -> host_filename (** Map for host filename. {b Not exported.} *) module Map: OASISUtils.MapExt.S with type key = host_filename oasis-0.4.11/src/oasis/OASISHostPath.ml0000644000175000017500000000766313261073606017045 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open Filename open OASISGettext module Unix = OASISUnixPath let make = function | [] -> invalid_arg "OASISHostPath.make" | hd :: tl -> List.fold_left Filename.concat hd tl let of_unix ufn = match Sys.os_type with | "Unix" | "Cygwin" -> ufn | "Win32" -> make (List.map (fun p -> if p = Unix.current_dir_name then current_dir_name else if p = Unix.parent_dir_name then parent_dir_name else p) (OASISString.nsplit ufn '/')) | os_type -> OASISUtils.failwithf (f_ "Don't know the path format of os_type %S when translating unix \ filename. %S") os_type ufn (* END EXPORT *) let fn_norm fn = match OASISPath_intern.fn_reduce [] (OASISPath_intern.fn_reader fn) with | (`RootRelative str) :: tl -> (`Root str) :: `CurrentDir :: tl | lst -> lst let compare fn1 fn2 = let fn_string = function | `Root str | `RootRelative str | `Component str -> str | `CurrentDir -> "." | `ParentDir -> ".." in let rec compare' = function | (hd1 :: tl1), (hd2 :: tl2) -> if hd1 = hd2 then compare' (tl1, tl2) else String.compare (fn_string hd1) (fn_string hd2) | [], [] -> 0 | _ :: _, [] -> 1 | [], _ :: _ -> -1 in compare' (fn_norm fn1, fn_norm fn2) let to_unix hfn = match Sys.os_type with | "Unix" | "Cygwin" -> hfn | "Win32" -> let rec to_unix_aux = function | `Root str :: _ | `RootRelative str :: _ -> OASISUtils.failwithf (f_ "Cannot translate %S to unix filename, it contains a root \ reference (%S).") hfn str | `Component str :: tl -> str :: (to_unix_aux tl) | `CurrentDir :: tl -> "." :: (to_unix_aux tl) | `ParentDir :: tl -> ".." :: (to_unix_aux tl) | [] -> [] in OASISUnixPath.make (to_unix_aux (fn_norm hfn)) | os_type -> OASISUtils.failwithf (f_ "Don't know the path format of os_type %S when translating host \ filename. %S") os_type hfn let add_extension fn ext = fn^"."^ext module Map = OASISUtils.MapExt.Make ( struct type t = Unix.host_filename let compare = compare end) oasis-0.4.11/src/oasis/OASISHelp.ml0000644000175000017500000004455713261073606016206 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* TODO: move this file to src/cli/Manual.ml *) (** Display help for OASIS @author Sylvain Le Gall *) open OASISLicense open OASISTypes open OASISSchema_intern open OASISGettext open OASISUtils open OASISFeatures open Format open FormatExt let escape_markdown str = let buff = Buffer.create (String.length str) in String.iter (function | '*' -> Buffer.add_string buff "\\*" | '_' -> Buffer.add_string buff "\\_" | c -> Buffer.add_char buff c) str; Buffer.contents buff let pp_print_escaped fmt str = pp_print_string_spaced fmt (escape_markdown str) let fields_of_section ?plugin schm = List.rev (PropList.Schema.fold (fun acc key extra help -> match extra.kind, plugin with | StandardField, None | DefinePlugin _, None | DefinePlugins _, None -> (key, (help, extra)) :: acc | FieldFromPlugin plg, Some plg' -> if OASISPlugin.plugin_compare plg' plg = 0 then (key, (help, extra)) :: acc else acc | FieldFromPlugin _, None | _, Some _ -> acc) [] schm) module Var = struct type t = { values: (unit -> string) MapString.t; used: (string * bool ref) list; plugin: ([`All | plugin_kind] plugin) option; } let create ?plugin () = { values = MapString.empty; used = []; plugin = plugin; } let loc = function | Some plg -> Printf.sprintf " in plugin %s" (OASISPlugin.string_of_plugin plg) | None -> "" let add nm f t = let used = ref false in if MapString.mem nm t.values then failwithf (f_ "Help variable '%s' already defined%s") nm (loc t.plugin); {t with values = MapString.add nm (fun () -> used := true; f ()) t.values; used = (nm, used) :: t.used; } let find ~line nm t = try MapString.find nm t.values with Not_found -> failwithf (f_ "Unknown help variable %s in line '%s'%s") nm line (loc t.plugin) let check t = let lst = List.map fst (List.filter (fun (_, r) -> not !r) t.used) in match lst with | [] -> () | lst -> failwithf (f_ "Unused help variable %s%s") (String.concat (s_ ", ") lst) (loc t.plugin) let of_list ?plugin lst = List.fold_left (fun t (nm, f) -> add nm f t) (create ?plugin ()) lst end exception Empty of string let pp_section_fields ?plugin ?allowed_fields schm nm = let schm = schm.schm in let fields = let all_fields = fields_of_section ?plugin schm in match allowed_fields with | Some st -> List.filter (fun (f, _) -> SetString.mem f st) all_fields | None -> all_fields in if fields = [] then raise (Empty nm); nm, fun () -> let fake_data = PropList.Data.create () in let fmt = str_formatter in pp_set_margin fmt 80; pp_open_vbox fmt 0; pp_print_list (fun fmt (key, (help, extra)) -> let extra_info = [] in let extra_info = try let _s: string = PropList.Schema.get schm fake_data key in extra_info with | PropList.Not_set _ -> s_ "__mandatory__" :: extra_info | PropList.No_printer _ | OASISValues.Not_printable -> extra_info in let extra_info = match extra.feature with | Some feature -> let requirement = match feature.publication with | InDev stage -> Printf.sprintf (f_ "__require %s: %s__") (field_of_stage stage) (escape_markdown feature.name) | SinceVersion ver -> Printf.sprintf (f_ "__since OASISFormat: %s__") (OASISVersion.string_of_version ver) in requirement :: extra_info | None -> extra_info in match help, extra_info with | Some h, [] -> fprintf fmt (f_ " * @[`%s`: %a@]") key pp_print_escaped (h ()) | Some h, lst -> fprintf fmt (f_ " * @[`%s`: %a (%s)@]") key pp_print_escaped (h ()) (String.concat ", " extra_info) | None, [] -> fprintf fmt (f_ " * @[`%s`: @]") key | None, lst -> fprintf fmt (f_ " * @[`%s`: (%s)@]") key (String.concat ", " extra_info)) "@," fmt fields; pp_close_box fmt (); flush_str_formatter () let pp_short_licenses () = let fmt = str_formatter in pp_set_margin fmt 80; pp_open_vbox fmt 0; pp_print_list (fun fmt (license, data) -> let str_license = string_of_license license in let long_name fmt = pp_print_escaped fmt data.long_name in let vers = List.map OASISVersion.string_of_version data.versions in match vers, data.note with | [], None -> fprintf fmt (f_ " * @[`%s`: %t@]") str_license long_name | [], Some txt -> fprintf fmt (f_ " * @[`%s`: %t. %a@]") str_license long_name pp_print_escaped txt | lst, None -> fprintf fmt (fn_ " * @[`%s`: %t (version@ %a)@]" " * @[`%s`: %t (versions@ %a)@]" (List.length vers)) str_license long_name (pp_print_list pp_print_string ",@, ") lst | lst, Some txt -> fprintf fmt (fn_ " * @[`%s`: %t. %a (version@ %a)@]" " * @[`%s`: %t. %a (versions@ %a)@]" (List.length vers)) str_license long_name pp_print_escaped txt (pp_print_list pp_print_string ",@, ") lst) "@," fmt (OASISLicense.license_data ()); pp_close_box fmt (); flush_str_formatter () let pp_license_exceptions () = let fmt = str_formatter in pp_set_margin fmt 80; pp_open_vbox fmt 0; pp_print_list (fun fmt (excpt, data) -> let excpt_str = string_of_license_exception excpt in let explanation fmt = pp_print_escaped fmt data.explanation in let licenses = List.map string_of_license data.licenses in match licenses with | [] -> fprintf fmt (f_ " * @[`%s`: %t@]") excpt_str explanation | lst -> fprintf fmt (fn_ " * @[`%s` compatible with %a: %t@]" " * @[`%s` compatible with %a: %t@]" (List.length licenses)) excpt_str (pp_print_list pp_print_string ",@, ") lst explanation) "@," fmt (OASISLicense.license_exception_data ()); pp_close_box fmt (); flush_str_formatter () let pp_standard_variables display schm = let env = PropList.Data.create () in let fmt = str_formatter in let vars = List.rev (PropList.Schema.fold (fun acc name def short_descr_opt -> if display name def then (name, (match short_descr_opt with | Some txt -> Some (txt ()) | None -> None), (try Some (PropList.Schema.get schm env name) with PropList.Not_set _ -> None)) :: acc else acc) [] schm) in pp_set_margin fmt 80; pp_open_vbox fmt 0; pp_print_list (fun fmt -> function | name, None, _ -> fprintf fmt (f_ " * `%s`") name | name, Some descr, _ -> fprintf fmt (f_ " * @[`%s`: %a@]") name pp_print_escaped descr) "@," fmt vars; pp_close_box fmt (); flush_str_formatter () let kind_str knd = match knd with | `Configure -> "conf" | `Build -> "build" | `Doc -> "doc" | `Test -> "test" | `Install -> "install" | `Extra -> "extra" (** Standard variables to replace in help files *) let mk_std_vars ?plugin ?(filter=(fun _ -> true)) acc = let bn = match plugin with | None -> "OASIS" | Some (knd, nm, ver) -> (OASISString.capitalize_ascii nm)^ (OASISString.capitalize_ascii (kind_str knd)) in let add_if_valid schm vars (pre, suf) = let nm = pre^bn^suf in try let nm, f = pp_section_fields ?plugin schm nm in if filter (nm, f) then Var.add nm f vars else vars with Empty nm -> vars in List.fold_left (fun acc (pre, suf, add) -> add acc (pre, suf)) acc [ "List", "PackageFields", add_if_valid OASISPackage.schema; "List", "FlagFields", add_if_valid OASISFlag.schema; "List", "LibraryFields", add_if_valid OASISLibrary.schema; "List", "ObjectFields", add_if_valid OASISObject.schema; "List", "ExecutableFields", add_if_valid OASISExecutable.schema; "List", "DocumentFields", add_if_valid OASISDocument.schema; "List", "TestFields", add_if_valid OASISTest.schema; "List", "SourceRepositoryFields", add_if_valid OASISSourceRepository.schema; ] let pp_list_all_features () = let fmt = str_formatter in let features = List.fold_left (fun acc feature -> match feature with | {publication = InDev stage} -> (feature.name, stage, feature.description ()) :: acc | _ -> acc) [] (OASISFeatures.list ()) in pp_set_margin fmt 80; pp_open_vbox fmt 0; pp_print_list (* TODO: add plugin after description. *) (fun fmt (name, stage, description) -> fprintf fmt (f_ " * @[`%s`: %a (%s)@]") name pp_print_escaped description (string_of_stage stage)) "@," fmt features; pp_close_box fmt (); flush_str_formatter () let pp_help_replace vars fmt str = let buff = Buffer.create 13 in List.iter (fun str -> (* Replace variables *) Buffer.add_substitute buff (fun nm -> (Var.find ~line:str nm vars) ()) str; pp_print_string fmt (Buffer.contents buff); pp_print_newline fmt (); Buffer.clear buff) str; Var.check vars let pp_print_help ?plugin fmt pp_print_cli_help env_schm env_display = let build_section_fields, library_fields, object_fields, executable_fields = let set_fields_of_section schm = SetString.of_list (List.rev_map fst (fields_of_section ?plugin schm.schm)) in let lib_flds = set_fields_of_section OASISLibrary.schema in let obj_flds = set_fields_of_section OASISObject.schema in let exec_flds = set_fields_of_section OASISExecutable.schema in let common_flds = SetString.inter (SetString.inter lib_flds obj_flds) exec_flds in common_flds, SetString.diff lib_flds common_flds, SetString.diff obj_flds common_flds, SetString.diff exec_flds common_flds in let pp_plugin fmt (nm, knds, vo, hlp) = (* Create additional variables that match the different * plugin kind. *) let mk_derived_vars acc knd = let plugin = knd, nm, vo in mk_std_vars ~plugin acc in let plugin = `All, nm, vo in let vars = List.fold_left mk_derived_vars (Var.create ~plugin ()) knds in let all_kinds = String.concat (s_ ", ") (List.map kind_str knds) in fprintf fmt (f_ "### Plugin %s (%s)\n\n") nm all_kinds; begin match vo with | Some ver -> fprintf fmt (f_ "__Version__: %s
\n\n") (OASISVersion.string_of_version ver) | None -> () end; pp_help_replace vars fmt hlp.OASISPlugin.help_template in let plugins = let module MapGen = Map.Make (struct type t = string * OASISVersion.t option let compare (nm1, vo1) (nm2, vo2) = OASISPlugin.plugin_compare (`All, nm1, vo1) (`All, nm2, vo2) end) in let mp = List.fold_left (fun mp (knd, nm, ver) -> let frmr = try MapGen.find (nm, ver) mp with Not_found -> [] in MapGen.add (nm, ver) (knd :: frmr) mp) MapGen.empty (OASISPlugin.all_plugins ()) in let lst = MapGen.fold (fun (nm, vo) knds acc -> (nm, knds, vo, OASISPlugin.help (`All, nm, vo)) :: acc) mp [] in List.sort (fun (nm1, _, vo1, {OASISPlugin.help_order = ord1}) (nm2, _, vo2, {OASISPlugin.help_order = ord2}) -> match ord1 - ord2 with | 0 -> OASISPlugin.plugin_compare (`All, nm1, vo1) (`All, nm2, vo2) | n -> n) lst in let vars = Var.of_list [ "ListAllFeatures", pp_list_all_features; "ListShortLicenses", pp_short_licenses; "ListLicenseExceptions", pp_license_exceptions; "ListStandardVariables", (fun () -> pp_standard_variables env_display env_schm); (* TODO "ListFunctionVariables", (fun () -> "TODO"); *) pp_section_fields ~allowed_fields:build_section_fields ?plugin OASISLibrary.schema "ListOASISBuildFields"; pp_section_fields ~allowed_fields:library_fields ?plugin OASISLibrary.schema "ListOASISLibraryFields"; pp_section_fields ~allowed_fields:object_fields ?plugin OASISObject.schema "ListOASISObjectFields"; pp_section_fields ~allowed_fields:executable_fields ?plugin OASISExecutable.schema "ListOASISExecutableFields"; "OASISCommandLineHelp", (fun () -> let fmt = str_formatter in pp_set_margin fmt 80; pp_print_cli_help fmt (); flush_str_formatter ()); "ListOASISPlugins", (fun () -> let buff = Buffer.create 13 in let fmt = formatter_of_buffer buff in pp_open_vbox fmt 0; pp_print_list (fun fmt e -> pp_open_box fmt 0; pp_plugin fmt e; pp_close_box fmt ()) "@," fmt plugins; pp_close_box fmt (); Buffer.contents buff); "ListOASISTests", (fun () -> String.concat "\n" (List.map (fun et -> Printf.sprintf "* `%s(X)`" (OASISExpr.string_of_test et)) OASISExpr.tests)); ] in let vars = mk_std_vars ~filter:(fun (nm, _) -> (* These three variables are handled directly, to make * a difference with common build fields. *) nm <> "ListOASISLibraryFields" && nm <> "ListOASISObjectFields" && nm <> "ListOASISExecutableFields") vars in pp_help_replace vars fmt OASISData.readme_template_mkd oasis-0.4.11/src/oasis/OASISGraph.ml0000644000175000017500000001072213261073606016342 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) 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 let () = visited.(v) <- true in (* 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 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 oasis-0.4.11/src/oasis/OASISGettext.mli0000644000175000017500000000524213261073606017077 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** i18n functions This module is mock for ocaml-gettext library. All these functions {b are exported} but their are bound to {b dummy functions} by default (i.e. not ocaml-gettext). Use oasis-plugin-i18n to replace them by real translating functions (TODO as of 2016-06-04). @author Sylvain Le Gall @see OCaml Gettext project *) (** Do nothing, but register it for translation *) val ns_: string -> string (** Translate a string. *) val s_: string -> string (** Translate a format string. *) val f_: ('a, 'b, 'c, 'd) format4 -> ('a, 'b, 'c, 'd) format4 (** [fn_ fmt_singular fmt_plural n] Translate a plural string using either [fmt_singular] or [fmt_plural], depending of the plural status of number [n] in the target language. *) val fn_: ('a, 'b, 'c, 'd) format4 -> ('a, 'b, 'c, 'd) format4 -> int -> ('a, 'b, 'c, 'd) format4 (** Gettext initialization. *) val init: (string * string option * string option) list oasis-0.4.11/src/oasis/OASISGettext.ml0000644000175000017500000000352013261073606016723 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) 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 = [] oasis-0.4.11/src/oasis/OASISFormat.ml0000644000175000017500000001267613261073606016543 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open Format open FormatExt (** Pretty printing of OASIS files *) let pp_print_fields fmt (schm, _, data) = let fake_data = PropList.Data.create () in let key_value = List.rev (PropList.Schema.fold (fun acc key _ _ -> try let str = PropList.Schema.get schm data key in let is_default = try let default = PropList.Schema.get schm fake_data key in str = default with | OASISValues.Not_printable | PropList.Not_set _ -> (* Unable to compare so this is not default *) false in if not is_default then (key, str) :: acc else acc with | OASISValues.Not_printable -> acc | PropList.Not_set _ -> (* TODO: is it really necessary *) (* when extra. <> None ->*) acc) [] schm) in let max_key_length = (* ":" *) 1 + (* Maximum length of a key *) (List.fold_left max 0 (* Only consider length of key *) (List.rev_map fst (* Remove key/value that exceed line length *) (List.filter (fun (k, v) -> k + v < pp_get_margin fmt ()) (* Consider only length of key/value *) (List.rev_map (fun (k, v) -> String.length k, String.length v) key_value)))) in let pp_print_field fmt k v = pp_open_box fmt 2; pp_print_string fmt k; pp_print_string fmt ":"; pp_print_break fmt (max 0 (max_key_length - String.length k)) 0; pp_print_string_spaced fmt v; pp_close_box fmt () in let _b : bool = pp_open_vbox fmt 0; List.fold_left (fun first (k, v) -> if not first then begin pp_print_cut fmt () end; pp_print_field fmt k v; false) true key_value in pp_close_box fmt () let pp_print_section plugins fmt sct = let pp_print_section' schm t = let (schm, _, _) as sct_data = OASISSchema_intern.to_proplist schm plugins t in let {cs_name = nm; _} = OASISSection.section_common sct in let pp_id_or_string fmt str = (* A string is an id if varname_of_string doesn't change it *) if OASISUtils.is_varname str then fprintf fmt "%s" str else fprintf fmt "%S" str in fprintf fmt "@[%s %a@,%a@]@," (PropList.Schema.name schm) pp_id_or_string nm pp_print_fields sct_data in match sct with | Library (cs, bs, lib) -> pp_print_section' OASISLibrary.schema (cs, bs, lib) | Object (cs, bs, obj) -> pp_print_section' OASISObject.schema (cs, bs, obj) | Executable (cs, bs, exec) -> pp_print_section' OASISExecutable.schema (cs, bs, exec) | SrcRepo (cs, src_repo) -> pp_print_section' OASISSourceRepository.schema (cs, src_repo) | Test (cs, test) -> pp_print_section' OASISTest.schema (cs, test) | Flag (cs, flag) -> pp_print_section' OASISFlag.schema (cs, flag) | Doc (cs, doc) -> pp_print_section' OASISDocument.schema (cs, doc) let pp_print_package fmt pkg = let (_, plugins, _) as pkg_data = OASISSchema_intern.to_proplist OASISPackage.schema [] pkg in pp_open_vbox fmt 0; pp_print_fields fmt pkg_data; pp_print_cut fmt (); List.iter (pp_print_section plugins fmt) pkg.sections; pp_close_box fmt () oasis-0.4.11/src/oasis/OASISFlag_intern.ml0000644000175000017500000000524713261073606017537 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Flag schema and generator @author Sylvain Le Gall *) (* END EXPORT *) open OASISTypes open OASISSchema_intern open OASISValues open OASISUtils open OASISGettext open PropList.Field let schema, generator = let schm = schema "Flag" (fun (cs, _) -> cs.cs_plugin_data) in let cmn_section_gen = OASISSection_intern.section_fields (fun () -> (s_ "flag")) schm (fun (cs, _) -> cs) in let descr = new_field schm "Description" ~default:None (opt string_not_empty) (fun () -> s_ "Help for the flag") (fun (_, flag) -> flag.flag_description) in let default = new_field_conditional schm "Default" ~default:true boolean (fun () -> s_ "Default value for the flag") (fun (_, flag) -> flag.flag_default) in schm, (fun features_data nm data -> Flag (cmn_section_gen features_data nm data, { flag_description = descr data; flag_default = default data; })) oasis-0.4.11/src/oasis/OASISFlag.mli0000644000175000017500000000351613261073606016326 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Flag section @author Sylvain Le Gall *) open OASISTypes (** Schema for the section. {b Not exported}. *) val schema: (common_section * flag) OASISSchema.t oasis-0.4.11/src/oasis/OASISFlag.ml0000644000175000017500000000333713261073606016156 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* END EXPORT *) let schema = OASISFlag_intern.schema oasis-0.4.11/src/oasis/OASISFindlib.mli0000644000175000017500000000614513261073606017025 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes type library_name = name type findlib_part_name = name type 'a map_of_findlib_part_name = 'a OASISUtils.MapString.t exception InternalLibraryNotFound of library_name exception FindlibPackageNotFound of findlib_name (** Library groups are organized in trees. *) type group_t = | Container of findlib_part_name * group_t list | Package of (findlib_part_name * common_section * build_section * [`Library of library | `Object of object_] * unix_dirname option * (* relative directory *) group_t list) (* TODO: use package_t to remove the 7 elements tuple. *) (** Compute groups of libraries, associate root libraries with a tree of its children. A group of libraries is defined by the fact that these libraries have a parental relationship and must be installed together, with the same META file. *) val findlib_mapping: package -> group_t list * (library_name -> findlib_name) * (findlib_name -> library_name) (** Return the findlib root name of a group, it takes into account containers. So the return group name is the toplevel name for both libraries and theirs containers. *) val findlib_of_group: group_t -> findlib_name (** Return the root library, i.e. the first found into the group tree that has no parent. *) val root_of_group: group_t -> common_section * build_section * [`Library of library | `Object of object_] oasis-0.4.11/src/oasis/OASISFindlib.ml0000644000175000017500000002517713261073606016662 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open OASISUtils open OASISGettext type library_name = name type findlib_part_name = name type 'a map_of_findlib_part_name = 'a OASISUtils.MapString.t exception InternalLibraryNotFound of library_name exception FindlibPackageNotFound of findlib_name type group_t = | Container of findlib_name * group_t list | Package of (findlib_name * common_section * build_section * [`Library of library | `Object of object_] * unix_dirname option * group_t list) type data = common_section * build_section * [`Library of library | `Object of object_] type tree = | Node of (data option) * (tree MapString.t) | Leaf of data let findlib_mapping pkg = (* Map from library name to either full findlib name or parts + parent. *) let fndlb_parts_of_lib_name = let fndlb_parts cs lib = let name = match lib.lib_findlib_name with | Some nm -> nm | None -> cs.cs_name in let name = String.concat "." (lib.lib_findlib_containers @ [name]) in name in List.fold_left (fun mp -> function | Library (cs, _, lib) -> begin let lib_name = cs.cs_name in let fndlb_parts = fndlb_parts cs lib in if MapString.mem lib_name mp then failwithf (f_ "The library name '%s' is used more than once.") lib_name; match lib.lib_findlib_parent with | Some lib_name_parent -> MapString.add lib_name (`Unsolved (lib_name_parent, fndlb_parts)) mp | None -> MapString.add lib_name (`Solved fndlb_parts) mp end | Object (cs, _, obj) -> begin let obj_name = cs.cs_name in if MapString.mem obj_name mp then failwithf (f_ "The object name '%s' is used more than once.") obj_name; let findlib_full_name = match obj.obj_findlib_fullname with | Some ns -> String.concat "." ns | None -> obj_name in MapString.add obj_name (`Solved findlib_full_name) mp end | Executable _ | Test _ | Flag _ | SrcRepo _ | Doc _ -> mp) MapString.empty pkg.sections in (* Solve the above graph to be only library name to full findlib name. *) let fndlb_name_of_lib_name = let rec solve visited mp lib_name lib_name_child = if SetString.mem lib_name visited then failwithf (f_ "Library '%s' is involved in a cycle \ with regard to findlib naming.") lib_name; let visited = SetString.add lib_name visited in try match MapString.find lib_name mp with | `Solved fndlb_nm -> fndlb_nm, mp | `Unsolved (lib_nm_parent, post_fndlb_nm) -> let pre_fndlb_nm, mp = solve visited mp lib_nm_parent lib_name in let fndlb_nm = pre_fndlb_nm^"."^post_fndlb_nm in fndlb_nm, MapString.add lib_name (`Solved fndlb_nm) mp with Not_found -> failwithf (f_ "Library '%s', which is defined as the findlib parent of \ library '%s', doesn't exist.") lib_name lib_name_child in let mp = MapString.fold (fun lib_name status mp -> match status with | `Solved _ -> (* Solved initialy, no need to go further *) mp | `Unsolved _ -> let _, mp = solve SetString.empty mp lib_name "" in mp) fndlb_parts_of_lib_name fndlb_parts_of_lib_name in MapString.map (function | `Solved fndlb_nm -> fndlb_nm | `Unsolved _ -> assert false) mp in (* Convert an internal library name to a findlib name. *) let findlib_name_of_library_name lib_nm = try MapString.find lib_nm fndlb_name_of_lib_name with Not_found -> raise (InternalLibraryNotFound lib_nm) in (* Add a library to the tree. *) let add sct mp = let fndlb_fullname = let cs, _, _ = sct in let lib_name = cs.cs_name in findlib_name_of_library_name lib_name in let rec add_children nm_lst (children: tree MapString.t) = match nm_lst with | (hd :: tl) -> begin let node = try add_node tl (MapString.find hd children) with Not_found -> (* New node *) new_node tl in MapString.add hd node children end | [] -> (* Should not have a nameless library. *) assert false and add_node tl node = if tl = [] then begin match node with | Node (None, children) -> Node (Some sct, children) | Leaf (cs', _, _) | Node (Some (cs', _, _), _) -> (* TODO: allow to merge Package, i.e. * archive(byte) = "foo.cma foo_init.cmo" *) let cs, _, _ = sct in failwithf (f_ "Library '%s' and '%s' have the same findlib name '%s'") cs.cs_name cs'.cs_name fndlb_fullname end else begin match node with | Leaf data -> Node (Some data, add_children tl MapString.empty) | Node (data_opt, children) -> Node (data_opt, add_children tl children) end and new_node = function | [] -> Leaf sct | hd :: tl -> Node (None, MapString.add hd (new_node tl) MapString.empty) in add_children (OASISString.nsplit fndlb_fullname '.') mp in let unix_directory dn lib = let directory = match lib with | `Library lib -> lib.lib_findlib_directory | `Object obj -> obj.obj_findlib_directory in match dn, directory with | None, None -> None | None, Some dn | Some dn, None -> Some dn | Some dn1, Some dn2 -> Some (OASISUnixPath.concat dn1 dn2) in let rec group_of_tree dn mp = MapString.fold (fun nm node acc -> let cur = match node with | Node (Some (cs, bs, lib), children) -> let current_dn = unix_directory dn lib in Package (nm, cs, bs, lib, current_dn, group_of_tree current_dn children) | Node (None, children) -> Container (nm, group_of_tree dn children) | Leaf (cs, bs, lib) -> let current_dn = unix_directory dn lib in Package (nm, cs, bs, lib, current_dn, []) in cur :: acc) mp [] in let group_mp = List.fold_left (fun mp -> function | Library (cs, bs, lib) -> add (cs, bs, `Library lib) mp | Object (cs, bs, obj) -> add (cs, bs, `Object obj) mp | _ -> mp) MapString.empty pkg.sections in let groups = group_of_tree None group_mp in let library_name_of_findlib_name = lazy begin (* Revert findlib_name_of_library_name. *) MapString.fold (fun k v mp -> MapString.add v k mp) fndlb_name_of_lib_name MapString.empty end in let library_name_of_findlib_name fndlb_nm = try MapString.find fndlb_nm (Lazy.force library_name_of_findlib_name) with Not_found -> raise (FindlibPackageNotFound fndlb_nm) in groups, findlib_name_of_library_name, library_name_of_findlib_name let findlib_of_group = function | Container (fndlb_nm, _) | Package (fndlb_nm, _, _, _, _, _) -> fndlb_nm let root_of_group grp = let rec root_lib_aux = (* We do a DFS in the group. *) function | Container (_, children) -> List.fold_left (fun res grp -> if res = None then root_lib_aux grp else res) None children | Package (_, cs, bs, lib, _, _) -> Some (cs, bs, lib) in match root_lib_aux grp with | Some res -> res | None -> failwithf (f_ "Unable to determine root library of findlib library '%s'") (findlib_of_group grp) (* END EXPORT *) let () = Printexc.register_printer (function | InternalLibraryNotFound lib_nm -> Some (Printf.sprintf (f_ "Unable to translate internal library name '%s' \ to findlib name.") lib_nm) | FindlibPackageNotFound fndlb_nm -> Some (Printf.sprintf (f_ "Unable to translate findlib name '%s' \ to internal library name.") fndlb_nm) | _ -> None) oasis-0.4.11/src/oasis/OASISFileUtil.mli0000644000175000017500000000560513261073606017173 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** File operations @author Sylvain Le Gall TODO: merge with OASISFileSystem. *) open OASISTypes (** [find_file paths exts] Find a file among all provided [paths], trying various extensiosn [exts]. Return the first combination of [paths] and [exts]. *) val find_file: ?case_sensitive:bool -> host_filename list list -> string list -> host_filename (** Find real filename of an executable. *) val which: ctxt:OASISContext.t -> host_filename -> host_filename (** Copy a file. *) val cp: ctxt:OASISContext.t -> ?recurse:bool -> host_filename -> host_filename -> unit (** Create a directory. *) val mkdir: ctxt:OASISContext.t -> host_filename -> unit (** [mkdir_parent f tgt] Create a directory and its parent, call f with directory name created, in order. *) val mkdir_parent: ctxt:OASISContext.t -> (host_filename -> 'a) -> host_filename -> unit (** Remove a directory. *) val rmdir: ctxt:OASISContext.t -> host_filename -> unit (** Expand a filename containing '*.ext' into corresponding real files. *) val glob: ctxt:OASISContext.t -> string -> host_filename list (** Test file existence, considering case even on case insensitive filesystem. *) val file_exists_case: string -> bool oasis-0.4.11/src/oasis/OASISFileUtil.ml0000644000175000017500000001344013261073606017016 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext let file_exists_case fn = let dirname = Filename.dirname fn in let basename = Filename.basename fn in if Sys.file_exists dirname then if basename = Filename.current_dir_name then true else List.mem basename (Array.to_list (Sys.readdir dirname)) else false let find_file ?(case_sensitive=true) paths exts = (* Cardinal product of two list *) let ( * ) lst1 lst2 = List.flatten (List.map (fun a -> List.map (fun b -> a, b) lst2) lst1) in let rec combined_paths lst = match lst with | p1 :: p2 :: tl -> let acc = (List.map (fun (a, b) -> Filename.concat a b) (p1 * p2)) in combined_paths (acc :: tl) | [e] -> e | [] -> [] in let alternatives = List.map (fun (p, e) -> if String.length e > 0 && e.[0] <> '.' then p ^ "." ^ e else p ^ e) ((combined_paths paths) * exts) in List.find (fun file -> (if case_sensitive then file_exists_case file else Sys.file_exists file) && not (Sys.is_directory file) ) alternatives let which ~ctxt prg = let path_sep = match Sys.os_type with | "Win32" -> ';' | _ -> ':' in let path_lst = OASISString.nsplit (Sys.getenv "PATH") path_sep in let exec_ext = match Sys.os_type with | "Win32" -> "" :: (OASISString.nsplit (Sys.getenv "PATHEXT") path_sep) | _ -> [""] in find_file ~case_sensitive:false [path_lst; [prg]] exec_ext (**/**) let rec fix_dir dn = (* Windows hack because Sys.file_exists "src\\" = false when * Sys.file_exists "src" = true *) let ln = String.length dn in if Sys.os_type = "Win32" && ln > 0 && dn.[ln - 1] = '\\' then fix_dir (String.sub dn 0 (ln - 1)) else dn let q = Filename.quote (**/**) let cp ~ctxt ?(recurse=false) src tgt = if recurse then match Sys.os_type with | "Win32" -> OASISExec.run ~ctxt "xcopy" [q src; q tgt; "/E"] | _ -> OASISExec.run ~ctxt "cp" ["-r"; q src; q tgt] else OASISExec.run ~ctxt (match Sys.os_type with | "Win32" -> "copy" | _ -> "cp") [q src; q tgt] let mkdir ~ctxt tgt = OASISExec.run ~ctxt (match Sys.os_type with | "Win32" -> "md" | _ -> "mkdir") [q tgt] let rec mkdir_parent ~ctxt f tgt = let tgt = fix_dir tgt in if Sys.file_exists tgt then begin if not (Sys.is_directory tgt) then OASISUtils.failwithf (f_ "Cannot create directory '%s', a file of the same name already \ exists") tgt end else begin mkdir_parent ~ctxt f (Filename.dirname tgt); if not (Sys.file_exists tgt) then begin f tgt; mkdir ~ctxt tgt end end let rmdir ~ctxt tgt = if Sys.readdir tgt = [||] then begin match Sys.os_type with | "Win32" -> OASISExec.run ~ctxt "rd" [q tgt] | _ -> OASISExec.run ~ctxt "rm" ["-r"; q tgt] end else begin OASISMessage.error ~ctxt (f_ "Cannot remove directory '%s': not empty.") tgt end let glob ~ctxt fn = let basename = Filename.basename fn in if String.length basename >= 2 && basename.[0] = '*' && basename.[1] = '.' then begin let ext_len = (String.length basename) - 2 in let ext = String.sub basename 2 ext_len in let dirname = Filename.dirname fn in Array.fold_left (fun acc fn -> try let fn_ext = String.sub fn ((String.length fn) - ext_len) ext_len in if fn_ext = ext then (Filename.concat dirname fn) :: acc else acc with Invalid_argument _ -> acc) [] (Sys.readdir dirname) end else begin if file_exists_case fn then [fn] else [] end oasis-0.4.11/src/oasis/OASISFileTemplate.mli0000644000175000017500000001431613261073606020030 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Generate files replacing parts of it This module allow to generate files using template. Each template files is split into three parts: an header, a body and a footer. We target at changing the body part. If target file already exists, we load the header and the footer from it. We merge the three parts and repalce the target files. There are some safety limits: - embed a digest to check nothing has changed in the body - if digest of the body has changed, create a backup - if we cannot find OASIS_START/OASIS_STOP body section, leave the file untouched The whole module is {b not exported}. @author Sylvain Le Gall *) open OASISUnixPath (** {2 Comments} *) (** Comment definition. *) type comment (** .ml comments. *) val comment_ml: comment (** Shell comments. *) val comment_sh: comment (** Makefile comments. *) val comment_makefile: comment (** OCamlbuild comments. *) val comment_ocamlbuild: comment (** .bat file comments. *) val comment_bat: comment (** META file comments. *) val comment_meta: comment (** Markdown comments. *) val comment_markdown: comment (** {2 Template} *) type line = string type body = NoBody | Body of line list | BodyWithDigest of Digest.t * line list type template = { fn: host_filename; comment: comment; header: line list; body: body; footer: line list; perm: int; important: bool; (** Determine if should be kept in dynamic mode. *) disable_oasis_section: bool; (** Determine if OASIS section comments and digest should be omitted. *) } (** [template_make fn cmt header body footer] Create a template for which target file is [fn]. *) val template_make: host_filename -> comment -> line list -> line list -> line list -> template (** [template_of_string_list ~ctxt ~template ~pure fn cmt lst] Split the list [lst] into a header, body and footer, using comment [cmt] to determine each part. Set [~template] if this is an embedded template (i.e. not a file loaded from disk). If [~disable_oasis_section] is set, then the list is processed on the assumption that there is no header and footer. See {!template_make} for other options. *) val template_of_string_list: ctxt:OASISContext.t -> template:bool -> ?disable_oasis_section:bool -> host_filename -> comment -> line list -> template (** [template_of_ml_file fn] Create an OCaml file template taking into account subtleties, like line modifier. See {!template_make} for other options. *) val template_of_mlfile: host_filename -> line list -> line list -> line list -> template (** {2 File generation} *) (** Create a list representation of the file. *) val to_string_list: template -> line list (** Describe what has been done to generate a file out of a template. *) type file_generate_change = Create of host_filename (** [Create fn], [fn] is the target file, nothing exists before *) | Change of host_filename * host_filename option (** [Change (fn, bak)], [bak] is the backup file, an existing file has been changed. *) | NoChange (** Nothing done, the file doesn't need to be updated *) (** Reset to pristine a generated file. *) val file_rollback: ctxt:OASISContext.t -> file_generate_change -> unit (** Generate a file using a template. Only the part between OASIS_START and OASIS_STOP will be really replaced if the file exists. If the file doesn't exist use the whole template. If [~remove] is [true], then an existing file will be deleted iff the template body is [[]] and the header and footer of the file match the template's (used by the -remove option for setup-clean). *) val file_generate: ctxt:OASISContext.t -> ?remove:bool -> backup:bool -> template -> file_generate_change (** {2 Multiple templates management } *) (** Try to add a file that is already in the set *) exception AlreadyExists of host_filename (** Set of templates. *) type templates (** No generated template files with the given set of files with the OASIS section disabled. *) val create: disable_oasis_section:unix_filename list -> unit -> templates (** Find a generated template file. *) val find: host_filename -> templates -> template (** Add a generated template file. *) val add: template -> templates -> templates (** Remove a generated template file. *) val remove: host_filename -> templates -> templates (** Add or replace a generated template file. *) val replace: template -> templates -> templates (** Fold over generated template files. *) val fold: (template -> 'b -> 'b) -> templates -> 'b -> 'b oasis-0.4.11/src/oasis/OASISFileTemplate.ml0000644000175000017500000004306513261073606017662 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISMessage open OASISGettext open OASISUtils open OASISTypes open OASISString (* TODO: logic of this file is brittle, we update digest frequently and not * always with the same content. * Proposal: create functions add_string [`Header|`Body|`Footer] t str (side * effect) and update digest into a single place. *) type comment = { (** Return the string as a comment. *) of_string: string -> string; (** Return the string if it was able to strip comments from it. *) to_string: string -> string option; start: string; stop: string; } type line = string type body = | NoBody | Body of line list | BodyWithDigest of Digest.t * line list type template = { fn: host_filename; comment: comment; header: line list; body: body; footer: line list; perm: int; important: bool; disable_oasis_section: bool; } let start_msg = "OASIS_START" let stop_msg = "OASIS_STOP" let comment cmt_beg cmt_end = let of_string = match cmt_end with | None -> Printf.sprintf "%s %s" cmt_beg | Some cmt_end -> (fun str -> Printf.sprintf "%s %s %s" cmt_beg str cmt_end) in let to_string str = try let str = trim str in let str = strip_starts_with ~what:cmt_beg str in let str = match cmt_end with | Some cmt_end -> strip_ends_with ~what:cmt_end str | None -> str in Some (trim str) with Not_found -> None in { of_string = of_string; to_string = to_string; start = of_string start_msg; stop = of_string stop_msg; } let comment_ml = comment "(*" (Some "*)") let comment_sh = comment "#" None let comment_makefile = comment_sh let comment_ocamlbuild = comment_sh let comment_bat = comment "rem" None let comment_meta = comment_sh let comment_markdown = comment "") let template_make fn comment header body footer = { fn = fn; comment = comment; header = header; body = Body body; footer = footer; perm = 0o644; important = false; disable_oasis_section = false; } let template_of_string_list ~ctxt ~template ?(disable_oasis_section=false) fn comment lst = (* Convert a Digest.to_hex string back into Digest.t *) let digest_of_hex s = let size = 16 in let d = Buffer.create size in for i = 0 to size - 1 do let hex_str = "0x" ^ String.make 1 s.[2 * i] ^ String.make 1 s.[2 * i + 1] in Buffer.add_char d (Char.chr (int_of_string hex_str)) done; Buffer.contents d in (* Match start and stop comment *) let is_start, is_stop = let test_comment msg str = match comment.to_string str with | Some msg' -> msg = msg' | None -> false in (test_comment start_msg), (test_comment stop_msg) in (* Match do not edit comment and extract digest. *) let extract_digest str = match comment.to_string str with | Some str' -> begin match tokenize ~tokens:["("; ")"; ":"] str' with | ["DO"; "NOT"; "EDIT"; "("; "digest"; ":"; digest; ")"] -> digest | _ -> raise Not_found end | None -> raise Not_found in (* Separate a list into three part: header, body and footer. Each part should be separated by the appropriate start/stop comment. *) let header, body, footer = (* Extract elem until the first that match condition. * The element that matched is removed *) let rec split_cond cond acc lst = match lst with | hd :: tl -> if cond hd then split_cond cond (hd :: acc) tl else (List.rev acc), tl | [] -> raise Not_found in (* Begin by extracting header, if that fail there * is no body/footer. *) try let lst_header, tl = split_cond (if disable_oasis_section then fun _ -> false else fun str -> if not (is_start str) then begin debug ~ctxt "Not start: %s" str; true end else begin debug ~ctxt "Start: %s" str; false end) [] lst in let digest_body, tl = match tl with | (hd :: tl) as lst-> begin try Some (digest_of_hex (extract_digest hd)), tl with Not_found -> None, lst end | lst -> None, lst in let lst_body, lst_footer = try split_cond (fun str -> not (is_stop str)) [] tl with Not_found -> tl, [] in match digest_body with | Some d -> lst_header, BodyWithDigest (d, lst_body), lst_footer | None -> lst_header, Body lst_body, lst_footer with Not_found -> if disable_oasis_section then [], Body [], [] else lst, NoBody, [] in let res = template_make fn comment header [] footer in if body = NoBody then warning ~ctxt (if template then (f_ "No replace section found in template for file %s") else (f_ "No replace section found in file %s")) fn; {res with body = body} let template_of_file ~template disable_oasis_section fn comment = let lst = let chn_in = open_in_bin fn in let lst = ref [] in begin try while true do lst := (input_line chn_in) :: !lst done with End_of_file -> () end; close_in chn_in; List.rev !lst in template_of_string_list ~template ~disable_oasis_section fn comment lst let template_of_mlfile fn header body footer = let rec count_line str line_cur str_start = if str_start < String.length str then begin try count_line str (line_cur + 1) ((String.index_from str str_start '\n') + 1) with Not_found -> (line_cur + 1) end else begin line_cur + 1 end in (* Make sure that line modifier contains reference to files that * really exist. If not modify the matching line. *) let check_line_modifier str = let found = ref false in let extract_line_modifier str = if starts_with "#" (trim str) then try match tokenize_genlex str with | [Genlex.Ident "#"; Genlex.Int _; Genlex.String fn] -> fn | _ -> raise Not_found with _ -> raise Not_found else raise Not_found in let lst = List.map (fun line -> try let windows_mode = ends_with ~what:"\r" line in let line_modifier_fn = extract_line_modifier line in found := true; if OASISFileUtil.file_exists_case line_modifier_fn then (* We found a valid match, keep it *) line (* The line modifier filename is not available, comment it. *) else if windows_mode then (comment_ml.of_string (sub_end line 1))^"\r" else comment_ml.of_string line with Not_found -> line) (split_newline ~do_trim:false str) in !found, (String.concat "\n" lst) in let insert_line_modifier lst line_start ~restore = let rlst, line_end = List.fold_left (fun (acc, line_cur) str -> (* Comment useless line modifier *) let contains_line_modifier, validated_str = check_line_modifier str in let line_cur = count_line validated_str line_cur 0 in if contains_line_modifier then ((Printf.sprintf "# %d %S" line_cur fn) :: validated_str :: acc), (line_cur + 1) else (validated_str :: acc), line_cur) ([], line_start) lst in if restore then (* Insert a line modifier at the end for the following lines to refer to the original file lines -- important for footer errors in setup.ml or myocamlbuild.ml. *) let line_end = line_end + 1 in List.rev(Printf.sprintf "# %d %S" line_end fn :: rlst), line_end else List.rev rlst, line_end in let header, line_end = insert_line_modifier header 1 ~restore:false in let body, line_end = (* Will add 2 lines of comments: start + digest *) insert_line_modifier body (line_end + 2) ~restore:true in let footer, _ = if footer <> [] then (* Will add 1 line of comments: stop *) insert_line_modifier footer (line_end + 1) ~restore:false else [], line_end in template_make fn comment_ml header body footer let digest_update t = {t with body = match t.body with | NoBody -> NoBody | BodyWithDigest (_, lst) | Body lst -> let d = Digest.string (String.concat "\n" lst) in BodyWithDigest(d, lst)} let digest_check t = let t' = digest_update t in match t'.body, t.body with | BodyWithDigest (d', _), BodyWithDigest (d, _) -> d' = d | _, _ -> true let merge t_org t_new = digest_update {t_new with header = t_org.header; body = (if t_org.body = NoBody then t_org.body else t_new.body); footer = t_org.footer} let to_string_list t = (* Be sure that digest match body content *) let t = digest_update t in (* Create header, body and footer in a list. Separate * each part by appropriate comment and digest. *) let split_further lst = split_newline ~do_trim:false (String.concat "\n" lst) in let oasis_section = match t.body with | NoBody -> [] | BodyWithDigest (d, lst) -> (t.comment.of_string (Printf.sprintf "DO NOT EDIT (digest: %s)" (Digest.to_hex d))) :: (split_further lst) | Body lst -> split_further lst in List.flatten [ t.header; if t.disable_oasis_section then oasis_section else t.comment.start :: oasis_section @ [t.comment.stop]; t.footer; ] let to_file t = let chn_out = open_out_gen [Open_wronly; Open_creat; Open_trunc; Open_binary] t.perm t.fn in List.iter (fun str -> output_string chn_out str; output_char chn_out '\n') (to_string_list t); close_out chn_out; Unix.chmod t.fn t.perm type file_generate_change = | Create of host_filename | Change of host_filename * host_filename option | NoChange let file_rollback ~ctxt = function | Create fn -> info ~ctxt (f_ "Remove generated file '%s'") fn; (try Sys.remove fn with _ -> ()) | Change (fn, Some bak) -> if Sys.file_exists bak then begin info ~ctxt (f_ "Restore file '%s' with backup file '%s'.") fn bak; Sys.rename bak fn end else begin warning ~ctxt (f_ "Backup file '%s' disappear, cannot restore \ file '%s'.") bak fn end | Change (fn, None) -> warning ~ctxt (f_ "Cannot restore file '%s', no backup.") fn | NoChange -> () let file_generate ~ctxt ?(remove=false) ~backup t = (* Check that the files differ *) let body_has_changed t_org t_new = if t_org.body <> t_new.body then begin match t_org.body, t_new.body with | Body lst1, Body lst2 | BodyWithDigest (_, lst1), BodyWithDigest (_, lst2) | BodyWithDigest (_, lst1), Body lst2 | Body lst1, BodyWithDigest (_, lst2) -> begin let org_fn = String.concat "\n" lst1 in let new_fn = String.concat "\n" lst2 in (String.compare org_fn new_fn) <> 0 end | b1, b2 -> b1 <> b2 end else false in (* Create a backup for a file and return its name *) let do_backup fn = let rec backup_aux = function | ext :: tl -> let fn_backup = fn ^ "." ^ ext in if not (Sys.file_exists fn_backup) then begin info ~ctxt (f_ "Rename '%s' to '%s'.") fn fn_backup; Sys.rename fn fn_backup; OASISFileUtil.cp ~ctxt fn_backup fn; fn_backup end else begin backup_aux tl end | [] -> failwithf (f_ "File %s need a backup, but all filenames for \ the backup already exist") fn in backup_aux ("bak" :: (Array.to_list (Array.init 10 (Printf.sprintf "ba%d")))) in if Sys.file_exists t.fn then begin let t_org = template_of_file ~ctxt ~template:false t.disable_oasis_section t.fn t.comment in (* If remove = true then backup is ignored. *) if remove && t_org.header = t.header && t_org.footer = t.footer && t.body = Body [] then begin info ~ctxt (f_ "%s is empty - removing") t.fn; if not (digest_check t_org) then warning ~ctxt (f_ "File %s has changed, doing a backup in %s") t.fn (do_backup t.fn); Sys.remove t.fn; NoChange end else match t_org.body, body_has_changed t_org t with | NoBody, _ -> (* No body, nothing to do *) begin NoChange end | _, true (* Body has changed -> regenerate *) | Body _, _ -> (* Missing digest -> regenerate *) begin (* Regenerate *) let () = info ~ctxt (f_ "Regenerating file %s") t.fn in let fn_backup = (* Create a backup if required *) if not (digest_check t_org) then begin let fn_bak = do_backup t.fn in warning ~ctxt (f_ "File %s has changed, doing a backup in %s") t.fn fn_bak; Some fn_bak end else if backup then begin Some (do_backup t.fn) end else None in to_file (merge t_org t); Change (t.fn, fn_backup) end | _, false -> (* No change *) begin info ~ctxt (f_ "File %s has not changed, skipping") t.fn; NoChange end end else begin if remove then begin info ~ctxt (f_ "File %s doesn't exist, deletion unnecessary.") t.fn; NoChange end else begin info ~ctxt (f_ "File %s doesn't exist, creating it.") t.fn; to_file t; Create t.fn end end exception AlreadyExists of host_filename module M = OASISHostPath.Map type templates = { files: template M.t; disable_oasis_section_files: OASISUnixPath.Set.t } let create ~disable_oasis_section () = { files = M.empty; disable_oasis_section_files = OASISUnixPath.Set.of_list disable_oasis_section; } let find e t = M.find e t.files let replace e t = let e = if OASISUnixPath.Set.mem (OASISHostPath.to_unix e.fn) t.disable_oasis_section_files then {e with disable_oasis_section = true} else e in {t with files = M.add e.fn e t.files} let add e t = if M.mem e.fn t.files then raise (AlreadyExists e.fn) else replace e t let remove fn t = {t with files = M.remove fn t.files} let fold f t acc = M.fold (fun k e acc -> f e acc) t.files acc oasis-0.4.11/src/oasis/OASISFileSystem.mli0000644000175000017500000000541213261073606017536 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type 'a filename val of_unix_filename: OASISUnixPath.unix_filename -> 'a filename val to_unix_filename: 'a filename -> OASISUnixPath.unix_filename class type closer = object method close: unit end class type reader = object inherit closer method input: Buffer.t -> int -> unit end class type writer = object inherit closer method output: Buffer.t -> unit end class type ['a] fs = object (** Return a string representation of the filename. It is may not be a real host filename. *) method string_of_filename: 'a filename -> string method open_out: ?mode:(open_flag list) -> ?perm:int -> 'a filename -> writer method open_in: ?mode:(open_flag list) -> ?perm:int -> 'a filename -> reader method file_exists: 'a filename -> bool method remove: 'a filename -> unit end val defer_close: (#closer as 'a) -> ('a -> 'b) -> 'b val binary_out: open_flag list val binary_in: open_flag list val stream_of_reader: #reader -> char Stream.t val read_all: Buffer.t -> #reader -> unit class ['a] host_fs: OASISUnixPath.host_filename -> ['a] fs oasis-0.4.11/src/oasis/OASISFileSystem.ml0000644000175000017500000001142413261073606017365 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** File System functions @author Sylvain Le Gall *) type 'a filename = string class type closer = object method close: unit end class type reader = object inherit closer method input: Buffer.t -> int -> unit end class type writer = object inherit closer method output: Buffer.t -> unit end class type ['a] fs = object method string_of_filename: 'a filename -> string method open_out: ?mode:(open_flag list) -> ?perm:int -> 'a filename -> writer method open_in: ?mode:(open_flag list) -> ?perm:int -> 'a filename -> reader method file_exists: 'a filename -> bool method remove: 'a filename -> unit end module Mode = struct let default_in = [Open_rdonly] let default_out = [Open_wronly; Open_creat; Open_trunc] let text_in = Open_text :: default_in let text_out = Open_text :: default_out let binary_in = Open_binary :: default_in let binary_out = Open_binary :: default_out end let std_length = 4096 (* Standard buffer/read length. *) let binary_out = Mode.binary_out let binary_in = Mode.binary_in let of_unix_filename ufn = (ufn: 'a filename) let to_unix_filename fn = (fn: string) let defer_close o f = try let r = f o in o#close; r with e -> o#close; raise e let stream_of_reader rdr = let buf = Buffer.create std_length in let pos = ref 0 in let eof = ref false in let rec next idx = let bpos = idx - !pos in if !eof then begin None end else if bpos < Buffer.length buf then begin Some (Buffer.nth buf bpos) end else begin pos := !pos + Buffer.length buf; Buffer.clear buf; begin try rdr#input buf std_length; with End_of_file -> if Buffer.length buf = 0 then eof := true end; next idx end in Stream.from next let read_all buf rdr = try while true do rdr#input buf std_length done with End_of_file -> () class ['a] host_fs rootdir : ['a] fs = object (self) method private host_filename fn = Filename.concat rootdir fn method string_of_filename = self#host_filename method open_out ?(mode=Mode.text_out) ?(perm=0o666) fn = let chn = open_out_gen mode perm (self#host_filename fn) in object method close = close_out chn method output buf = Buffer.output_buffer chn buf end method open_in ?(mode=Mode.text_in) ?(perm=0o666) fn = (* TODO: use Buffer.add_channel when minimal version of OCaml will * be >= 4.03.0 (previous version was discarding last chars). *) let chn = open_in_gen mode perm (self#host_filename fn) in let strm = Stream.of_channel chn in object method close = close_in chn method input buf len = let read = ref 0 in try for _i = 0 to len do Buffer.add_char buf (Stream.next strm); incr read done with Stream.Failure -> if !read = 0 then raise End_of_file end method file_exists fn = Sys.file_exists (self#host_filename fn) method remove fn = Sys.remove (self#host_filename fn) end oasis-0.4.11/src/oasis/OASISFeatures.ml0000644000175000017500000003033513261073606017061 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open OASISUtils open OASISGettext open OASISVersion module MapPlugin = Map.Make (struct type t = plugin_kind * name let compare = Pervasives.compare end) module Data = struct type t = { oasis_version: OASISVersion.t; plugin_versions: OASISVersion.t option MapPlugin.t; alpha_features: string list; beta_features: string list; } let create oasis_version alpha_features beta_features = { oasis_version = oasis_version; plugin_versions = MapPlugin.empty; alpha_features = alpha_features; beta_features = beta_features } let of_package pkg = create pkg.OASISTypes.oasis_version pkg.OASISTypes.alpha_features pkg.OASISTypes.beta_features let add_plugin (plugin_kind, plugin_name, plugin_version) t = {t with plugin_versions = MapPlugin.add (plugin_kind, plugin_name) plugin_version t.plugin_versions} let plugin_version plugin_kind plugin_name t = MapPlugin.find (plugin_kind, plugin_name) t.plugin_versions let to_string t = Printf.sprintf "oasis_version: %s; alpha_features: %s; beta_features: %s; \ plugins_version: %s" (OASISVersion.string_of_version (t:t).oasis_version) (String.concat ", " t.alpha_features) (String.concat ", " t.beta_features) (String.concat ", " (MapPlugin.fold (fun (_, plg) ver_opt acc -> (plg^ (match ver_opt with | Some v -> " "^(OASISVersion.string_of_version v) | None -> "")) :: acc) t.plugin_versions [])) end type origin = | Field of string * string | Section of string | NoOrigin type stage = Alpha | Beta let string_of_stage = function | Alpha -> "alpha" | Beta -> "beta" let field_of_stage = function | Alpha -> "AlphaFeatures" | Beta -> "BetaFeatures" type publication = InDev of stage | SinceVersion of OASISVersion.t type t = { name: string; plugin: all_plugin option; publication: publication; description: unit -> string; } (* TODO: mutex protect this. *) let all_features = Hashtbl.create 13 let since_version ver_str = SinceVersion (version_of_string ver_str) let alpha = InDev Alpha let beta = InDev Beta let to_string t = Printf.sprintf "feature: %s; plugin: %s; publication: %s" (t:t).name (match t.plugin with | None -> "" | Some (_, nm, _) -> nm) (match t.publication with | InDev stage -> string_of_stage stage | SinceVersion ver -> ">= "^(OASISVersion.string_of_version ver)) let data_check t data origin = let no_message = "no message" in let check_feature features stage = let has_feature = List.mem (t:t).name features in if not has_feature then match (origin:origin) with | Field (fld, where) -> Some (Printf.sprintf (f_ "Field %s in %s is only available when feature %s \ is in field %s.") fld where t.name (field_of_stage stage)) | Section sct -> Some (Printf.sprintf (f_ "Section %s is only available when features %s \ is in field %s.") sct t.name (field_of_stage stage)) | NoOrigin -> Some no_message else None in let version_is_good ~min_version version fmt = let version_is_good = OASISVersion.comparator_apply version (OASISVersion.VGreaterEqual min_version) in Printf.ksprintf (fun str -> if version_is_good then None else Some str) fmt in match origin, t.plugin, t.publication with | _, _, InDev Alpha -> check_feature data.Data.alpha_features Alpha | _, _, InDev Beta -> check_feature data.Data.beta_features Beta | Field(fld, where), None, SinceVersion min_version -> version_is_good ~min_version data.Data.oasis_version (f_ "Field %s in %s is only valid since OASIS v%s, update \ OASISFormat field from '%s' to '%s' after checking \ OASIS changelog.") fld where (string_of_version min_version) (string_of_version data.Data.oasis_version) (string_of_version min_version) | Field(fld, where), Some(plugin_knd, plugin_name, _), SinceVersion min_version -> begin try let plugin_version_current = try match Data.plugin_version plugin_knd plugin_name data with | Some ver -> ver | None -> failwithf (f_ "Field %s in %s is only valid for the OASIS \ plugin %s since v%s, but no plugin version is \ defined in the _oasis file, change '%s' to \ '%s (%s)' in your _oasis file.") fld where plugin_name (string_of_version min_version) plugin_name plugin_name (string_of_version min_version) with Not_found -> failwithf (f_ "Field %s in %s is only valid when the OASIS plugin %s \ is defined.") fld where plugin_name in version_is_good ~min_version plugin_version_current (f_ "Field %s in %s is only valid for the OASIS plugin %s \ since v%s, update your plugin from '%s (%s)' to \ '%s (%s)' after checking the plugin's changelog.") fld where plugin_name (string_of_version min_version) plugin_name (string_of_version plugin_version_current) plugin_name (string_of_version min_version) with Failure msg -> Some msg end | Section sct, None, SinceVersion min_version -> version_is_good ~min_version data.Data.oasis_version (f_ "Section %s is only valid for since OASIS v%s, update \ OASISFormat field from '%s' to '%s' after checking OASIS \ changelog.") sct (string_of_version min_version) (string_of_version data.Data.oasis_version) (string_of_version min_version) | Section sct, Some(plugin_knd, plugin_name, _), SinceVersion min_version -> begin try let plugin_version_current = try match Data.plugin_version plugin_knd plugin_name data with | Some ver -> ver | None -> failwithf (f_ "Section %s is only valid for the OASIS \ plugin %s since v%s, but no plugin version is \ defined in the _oasis file, change '%s' to \ '%s (%s)' in your _oasis file.") sct plugin_name (string_of_version min_version) plugin_name plugin_name (string_of_version min_version) with Not_found -> failwithf (f_ "Section %s is only valid when the OASIS plugin %s \ is defined.") sct plugin_name in version_is_good ~min_version plugin_version_current (f_ "Section %s is only valid for the OASIS plugin %s \ since v%s, update your plugin from '%s (%s)' to \ '%s (%s)' after checking the plugin's changelog.") sct plugin_name (string_of_version min_version) plugin_name (string_of_version plugin_version_current) plugin_name (string_of_version min_version) with Failure msg -> Some msg end | NoOrigin, None, SinceVersion min_version -> version_is_good ~min_version data.Data.oasis_version "%s" no_message | NoOrigin, Some(plugin_knd, plugin_name, _), SinceVersion min_version -> begin try let plugin_version_current = match Data.plugin_version plugin_knd plugin_name data with | Some ver -> ver | None -> raise Not_found in version_is_good ~min_version plugin_version_current "%s" no_message with Not_found -> Some no_message end let data_assert t data origin = match data_check t data origin with | None -> () | Some str -> failwith str let data_test t data = match data_check t data NoOrigin with | None -> true | Some _ -> false let package_test t pkg = data_test t (Data.of_package pkg) let create ?plugin name publication description = let () = if Hashtbl.mem all_features name then failwithf "Feature '%s' is already declared." name in let t = { name = name; plugin = plugin; publication = publication; description = description; } in Hashtbl.add all_features name t; t let get_stage name = try (Hashtbl.find all_features name).publication with Not_found -> failwithf (f_ "Feature %s doesn't exist.") name let list () = Hashtbl.fold (fun _ v acc -> v :: acc) all_features [] (* * Real flags. *) let features = create "features_fields" (since_version "0.4") (fun () -> s_ "Enable to experiment not yet official features.") let flag_docs = create "flag_docs" (since_version "0.3") (fun () -> s_ "Make building docs require '-docs' flag at configure.") let flag_tests = create "flag_tests" (since_version "0.3") (fun () -> s_ "Make running tests require '-tests' flag at configure.") let pack = create "pack" (since_version "0.3") (fun () -> s_ "Allow to create packed library.") let section_object = create "section_object" beta (fun () -> s_ "Implement an object section.") let dynrun_for_release = create "dynrun_for_release" alpha (fun () -> s_ "Make '-setup-update dynamic' suitable for releasing project.") let compiled_setup_ml = create "compiled_setup_ml" alpha (fun () -> s_ "Compile the setup.ml and speed-up actions done with it.") let disable_oasis_section = create "disable_oasis_section" alpha (fun () -> s_ "Allow the OASIS section comments and digests to be omitted in \ generated files.") let no_automatic_syntax = create "no_automatic_syntax" alpha (fun () -> s_ "Disable the automatic inclusion of -syntax camlp4o for packages \ that matches the internal heuristic (if a dependency ends with \ a .syntax or is a well known syntax).") let findlib_directory = create "findlib_directory" beta (fun () -> s_ "Allow to install findlib libraries in sub-directories of the target \ findlib directory.") let findlib_extra_files = create "findlib_extra_files" beta (fun () -> s_ "Allow to install extra files for findlib libraries.") let source_patterns = create "source_patterns" alpha (fun () -> s_ "Customize mapping between module name and source file.") oasis-0.4.11/src/oasis/OASISExpr.mli0000644000175000017500000000767013261073606016400 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Boolean expressions This module provides a boolean expression evaluator. See OASIS manual for the precise syntax of the boolean expression @author Sylvain Le Gall @see OASIS Manual *) (** {2 Test} *) (** Test definition. *) type test (** Mandatory tests. *) val tests: test list (** Convert a test to string. *) val string_of_test: test -> string (** Convert a string to test. *) val test_of_string: string -> test (** {2 Expression} *) type flag = string (** Boolean expression definition. *) type t = | EBool of bool (** true or false *) | ENot of t (** ! e *) | EAnd of t * t (** e1 && e2 *) | EOr of t * t (** e1 || e2 *) | EFlag of flag (** flag(foo), a boolean value. *) | ETest of test * string (** os_type(Win32), a value compared to a string. *) (** Choose among different values *) type 'a choices = (t * 'a) list (** [eval eval_tst t] Evaluates the expression. Use [eval_tst] to get values of flags and tests. *) val eval: (string -> string) -> t -> bool (** [choose ~printer ~name eval_tst choices] Evaluate each conditions of [choices] and choose the last condition that evaluates to [true]. If something goes wrong, use [printer] to display values and [~name] as the choice list name. See also {!eval}. *) val choose: ?printer:('a -> string) -> ?name:string -> (string -> string) -> 'a choices -> 'a (** Check that a boolean expression only use available flags. {b Not exported}. *) val check: (flag list) -> t -> unit (** Try to reduce the size of a boolean expression. {b Not exported}. *) val reduce: t -> t (** Try to reduce the size of a choice list. {b Not exported}. *) val reduce_choices: 'a choices -> 'a choices (** [if_then_else cond choices_if choices_else] Combine choices, if_then_else style. *) val if_then_else: t -> 'a choices -> 'a choices -> 'a choices (** Dump OASISDataNotation.t. {b Not exported}. *) val odn_of_choices: ('a -> OASISDataNotation.t) -> 'a choices -> OASISDataNotation.t (** Transform an expression into a string. {b Not exported} *) val to_string: t -> string (** Transform a list of choice into a string. {b Not exported} *) val string_of_choices: ('a -> string) -> 'a choices -> string oasis-0.4.11/src/oasis/OASISExpr.ml0000644000175000017500000001667713261073606016236 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext open OASISUtils type test = string type flag = string type t = | EBool of bool | ENot of t | EAnd of t * t | EOr of t * t | 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 in (v = vl) in eval' t let choose ?printer ?name var_get lst = let rec choose_aux = function | (cond, vl) :: tl -> if eval var_get cond then vl else choose_aux tl | [] -> let str_lst = if lst = [] then s_ "" else String.concat (s_ ", ") (List.map (fun (cond, vl) -> match printer with | Some p -> p vl | None -> s_ "") lst) in match name with | Some nm -> failwith (Printf.sprintf (f_ "No result for the choice list '%s': %s") nm str_lst) | None -> failwith (Printf.sprintf (f_ "No result for a choice list: %s") str_lst) in choose_aux (List.rev lst) (* END EXPORT *) let tests = [ "os_type"; "system"; "architecture"; "ccomp_type"; "ocaml_version"; ] let test_of_string str = (* TODO: check for correct syntax of str *) str let string_of_test t = t let check valid_flags = let rec check_aux valid_flags = function | EBool _ -> () | ENot e -> check_aux valid_flags e | EAnd (e1, e2) | EOr (e1, e2) -> check_aux valid_flags e1; check_aux valid_flags e2 | EFlag nm -> if not (List.exists (fun s -> compare_csl nm s = 0) valid_flags) then failwithf (f_ "Unknown flag '%s'") nm | ETest (_, _) -> () in check_aux valid_flags let rec reduce e = let e = match e with | (EBool _ | EFlag _ | ETest (_, _)) as e -> e | ENot e -> ENot (reduce e) | EAnd (e1, e2) -> EAnd (reduce e1, reduce e2) | EOr (e1, e2) -> EOr (reduce e1, reduce e2) in match e with | EAnd (e, EBool true) | EAnd (EBool true, e) | EOr (e, EBool false) | EOr (EBool false, e) -> e | EAnd (e, EBool false) | EAnd (EBool false, e) -> EBool false | EOr (e, EBool true) | EOr (EBool true, e) -> EBool true | ENot (EBool true) -> EBool false | ENot (EBool false) -> EBool true | ENot (ENot e) -> e | (ENot _ | EAnd (_, _) | EOr (_, _) | EFlag _ | ETest (_, _) | (EBool _)) as e -> e let reduce_choices choices = (* Naive reduction, we only look for exactly the same condition in * after one condition. It works but is not complete and not efficient *) let rec reduce_choices_aux acc lst = match lst with | (c1, _) as e :: tl -> ( let acc = try let _ = List.find (fun (c2, _) -> c1 = c2) tl in acc with Not_found -> e :: acc in reduce_choices_aux acc tl ) | [] -> List.rev acc in reduce_choices_aux [] (List.map (fun (cond, vl) -> reduce cond, vl) choices) let if_then_else t choices_if choices_else = let choices_if' = List.rev_map (fun (t', v) -> EAnd (t, t'), v) choices_if in let choices_else' = List.rev_map (fun (t', v) -> EAnd (ENot t, t'), v) choices_else in reduce_choices (List.rev_append choices_else' (List.rev choices_if')) let rec to_string = let id_or_qstring s = if is_varname s then s else Printf.sprintf "%S" s in function | EBool b -> string_of_bool b | EFlag nm -> "flag("^(id_or_qstring nm)^")" | ETest (nm, vl) -> nm^"("^(id_or_qstring vl)^")" | EOr (e1, e2) -> (to_string e1)^" || "^(to_string e2) | ENot (EBool _ | EFlag _ | ETest _ | ENot _ as e) -> "!"^(to_string e) | ENot (EAnd _ | EOr _ as e) -> "!("^(to_string e)^")" | EAnd ((EOr _ as e1), (EOr _ as e2)) -> "("^(to_string e1)^") && ("^(to_string e2)^")" | EAnd ((EOr _ as e1), e2) -> "("^(to_string e1)^") && "^(to_string e2) | EAnd (e1, (EOr _ as e2)) -> (to_string e1)^" && ("^(to_string e2)^")" | EAnd (e1, e2) -> (to_string e1)^" && "^(to_string e2) let string_of_choices f lst = "["^(String.concat "; " (List.rev_map (fun (e, vl) -> (to_string e)^" -> "^(f vl)) lst))^"]" let odn_of_choices odn_of_a x = let open OASISDataNotation in let rec odn_of_t = function | EBool v0 -> VRT ("OASISExpr.EBool", [ of_bool v0 ]) | ENot v0 -> VRT ("OASISExpr.ENot", [ odn_of_t v0 ]) | EAnd ((v1, v0)) -> VRT ("OASISExpr.EAnd", [ odn_of_t v1; odn_of_t v0 ]) | EOr ((v1, v0)) -> VRT ("OASISExpr.EOr", [ odn_of_t v1; odn_of_t v0 ]) | EFlag v0 -> VRT ("OASISExpr.EFlag", [ STR v0 ]) | ETest ((v1, v0)) -> VRT ("OASISExpr.ETest", [ of_string (string_of_test v1); of_string v0 ]) in of_list (fun (v1, v0) -> TPL [ odn_of_t v1; odn_of_a v0 ]) x oasis-0.4.11/src/oasis/OASISExecutable_intern.ml0000644000175000017500000000663413261073606020750 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Executable schema and generator @author Sylvain Le Gall *) open OASISTypes open OASISSchema_intern open OASISValues open OASISUtils open OASISGettext open PropList.Field let schema, generator = let schm = schema "Executable" (fun (cs, _, _) -> cs.cs_plugin_data) in let cmn_section_gen = OASISSection_intern.section_fields (fun () -> (s_ "executable")) schm (fun (cs, _, _) -> cs) in let build_section_gen = OASISBuildSection_intern.section_fields (fun () -> (s_ "executable")) Byte schm (fun (_, bs, _) -> bs) in let main_is = new_field schm "MainIs" (let base_value = { parse = (fun ~ctxt str -> if not (Filename.check_suffix str ".ml") then failwithf (f_ "'%s' is not a '.ml' file") str; str); update = update_fail; print = (fun s -> s); } in { parse = (fun ~ctxt str -> file.parse ~ctxt (base_value.parse ~ctxt str)); update = update_fail; print = (fun fn -> file.print (base_value.print fn)); }) (fun () -> s_ "OCaml file (.ml) containing main procedure for the executable.") (fun (_, _, exec) -> exec.exec_main_is) in let custom = new_field schm "Custom" ~default:false boolean (fun () -> s_ "Create custom bytecode executable.") (fun (_, _, exec) -> exec.exec_custom) in schm, (fun features_data nm data -> Executable (cmn_section_gen features_data nm data, build_section_gen nm data, { exec_main_is = main_is data; exec_custom = custom data; })) oasis-0.4.11/src/oasis/OASISExecutable.mli0000644000175000017500000000442313261073606017534 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Executable section @author Sylvain Le Gall *) open OASISTypes (** [unix_exec_is (cs, bs, exec) is_native ext_dll suffix_program] Compute the filename of the real executable, with full unix path. Also return executable library, if one exists (it happens when building bytecode executable with C stubs). *) val unix_exec_is: common_section * build_section * executable -> (unit -> bool) -> (unit -> string) -> (unit -> string) -> unix_filename * unix_filename option (** Schema for the section. {b Not exported}. *) val schema: (common_section * build_section * executable) OASISSchema.t oasis-0.4.11/src/oasis/OASISExecutable.ml0000644000175000017500000000443013261073606017361 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes let unix_exec_is (cs, bs, exec) is_native ext_dll suffix_program = let dir = OASISUnixPath.concat bs.bs_path (OASISUnixPath.dirname exec.exec_main_is) in let is_native_exec = match bs.bs_compiled_object with | Native -> true | Best -> is_native () | Byte -> false in OASISUnixPath.concat dir (cs.cs_name^(suffix_program ())), if not is_native_exec && not exec.exec_custom && bs.bs_c_sources <> [] then Some (dir^"/dll"^cs.cs_name^"_stubs"^(ext_dll ())) else None (* END EXPORT *) let schema = OASISExecutable_intern.schema oasis-0.4.11/src/oasis/OASISExec.mli0000644000175000017500000000466713261073606016351 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Running commands @author Sylvain Le Gall *) open OASISTypes (** Run a command. @param f_exit_code if provided, run this command on the exit code (even when it is [0]). Otherwise, a non-zero exit code raises [Failure]. @param quote quote the prog. *) val run: ctxt:OASISContext.t -> ?f_exit_code:(int -> unit) -> ?quote:bool -> prog -> args -> unit (** Run a command and returns its output as a list of lines. *) val run_read_output: ctxt:OASISContext.t -> ?f_exit_code:(int -> unit) -> prog -> args -> string list (** Run a command and returns only first line. @raise Failure if the output contains more than one line. *) val run_read_one_line: ctxt:OASISContext.t -> ?f_exit_code:(int -> unit) -> prog -> args -> string oasis-0.4.11/src/oasis/OASISExec.ml0000644000175000017500000000644313261073606016172 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext open OASISUtils open OASISMessage (* TODO: I don't like this quote, it is there because $(rm) foo expands to * 'rm -f' foo... *) let run ~ctxt ?f_exit_code ?(quote=true) cmd args = let cmd = if quote then if Sys.os_type = "Win32" then if String.contains cmd ' ' then (* Double the 1st double quote... win32... sigh *) "\""^(Filename.quote cmd) else cmd else Filename.quote cmd else cmd in let cmdline = String.concat " " (cmd :: args) in info ~ctxt (f_ "Running command '%s'") cmdline; match f_exit_code, Sys.command cmdline with | None, 0 -> () | None, i -> failwithf (f_ "Command '%s' terminated with error code %d") cmdline i | Some f, i -> f i let run_read_output ~ctxt ?f_exit_code cmd args = let fn = Filename.temp_file "oasis-" ".txt" in try begin let () = run ~ctxt ?f_exit_code cmd (args @ [">"; Filename.quote fn]) in let chn = open_in fn in let routput = ref [] in begin try while true do routput := (input_line chn) :: !routput done with End_of_file -> () end; close_in chn; Sys.remove fn; List.rev !routput end with e -> (try Sys.remove fn with _ -> ()); raise e let run_read_one_line ~ctxt ?f_exit_code cmd args = match run_read_output ~ctxt ?f_exit_code cmd args with | [fst] -> fst | lst -> failwithf (f_ "Command return unexpected output %S") (String.concat "\n" lst) oasis-0.4.11/src/oasis/OASISDocument_intern.ml0000644000175000017500000001632013261073606020436 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Test schema and generator @author Sylvain Le Gall *) (* END EXPORT *) open OASISTypes open OASISSchema_intern open OASISValues open OASISUtils open OASISGettext let schema, generator = let schm = schema "Document" (fun (cs, _) -> cs.cs_plugin_data) in let cmn_section_gen = OASISSection_intern.section_fields (fun () -> (s_ "document")) schm (fun (cs, _) -> cs) in let build_tools = OASISBuildSection_intern.build_tools_field schm (fun (_, doc) -> doc.doc_build_tools) in let typ = new_field_plugin schm "Type" ~default:(OASISPlugin.builtin `Doc "none") `Doc OASISPlugin.Doc.value (fun () -> s_ "Plugin to use to build documentation.") (fun (_, doc) -> doc.doc_type) in let custom = OASISCustom.add_fields schm "" (fun () -> s_ "Command to run before building the doc.") (fun () -> s_ "Command to run after building the doc.") (fun (_, doc) -> doc.doc_custom) in let title = new_field schm "Title" string_not_empty (fun () -> s_ "Title of the document.") (fun (_, doc) -> doc.doc_title) in let authors = new_field schm "Authors" ~default:[] (comma_separated string_not_empty) (fun () -> s_ "Authors of the document.") (fun (_, doc) -> doc.doc_authors) in let abstract = new_field schm "Abstract" ~default:None (opt string_not_empty) (fun () -> s_ "Short paragraph giving an overview of the document.") (fun (_, doc) -> doc.doc_abstract) in let doc_format = new_field schm "Format" ~default:OtherDoc (* TODO: document in the manual. *) (* TODO: Manpage ? *) (choices (fun () -> "document format") ["HTML", HTML "index.html"; "Text", DocText; "PDF", PDF; "PostScript", PostScript; "Info", Info "invalid.info"; "DVI", DVI; "Other", OtherDoc]) (fun () -> s_ "Format for the document.") (fun (_, doc) -> doc.doc_format) in let index = new_field schm "Index" ~default:None (opt file) (fun () -> s_ "Index or top-level file for the document, only apply to \ HTML and Info.") (fun (_, doc) -> match doc.doc_format with | HTML idx | Info idx -> Some idx | DocText | PDF | PostScript | DVI | OtherDoc -> None) in let install_dir = new_field schm "InstallDir" ~default:None (opt (expandable file)) (fun () -> s_ "Default target directory to install data and documentation.") (fun (_, doc) -> Some doc.doc_install_dir) in let build, install, data_files = OASISBuildSection_intern.build_install_data_fields schm (fun (_, doc) -> doc.doc_build) (fun (_, doc) -> doc.doc_install) (fun (_, doc) -> doc.doc_data_files) in schm, (fun features_data nm data -> let cs = cmn_section_gen features_data nm data in let typ = typ data in let rplugin_data = ref cs.cs_plugin_data in let cs = OASISPlugin.generator_section `Doc (typ :> plugin_kind plugin) rplugin_data cs.cs_data; {cs with cs_plugin_data = !rplugin_data} in let build = if OASISFeatures.data_test OASISFeatures.flag_docs features_data then (* TODO: establish a formal link between here and BaseStandardVars *) OASISExpr.if_then_else (OASISExpr.EFlag "docs") (build data) [OASISExpr.EBool true, false] else build data in Doc (cs, (* TODO: find a way to code that in a way compatible with * quickstart *) let doc_format = match doc_format data with | HTML _ -> begin match index data with | Some fn -> HTML fn | None -> failwithf (f_ "Index is mandatory for format HTML in \ document %s") nm end | Info fn -> begin match index data with | Some fn -> Info fn | None -> failwithf (f_ "Index is mandatory for format info in \ document %s") nm end | DocText | PDF | PostScript | DVI | OtherDoc as fmt -> fmt in let doc_install_dir = match install_dir data with | None -> begin match doc_format with | HTML _ -> "$htmldir" | DocText -> "$docdir" | PDF -> "$pdfdir" | PostScript -> "$psdir" | Info _ -> "$infodir" | DVI -> "$dvidir" | OtherDoc -> "$docdir" end | Some dir -> dir in { doc_type = typ; doc_custom = custom data; doc_build = build; doc_install = install data; doc_install_dir = doc_install_dir; doc_title = title data; doc_authors = authors data; doc_abstract = abstract data; doc_format = doc_format; doc_data_files = data_files data; doc_build_tools = build_tools data; })) oasis-0.4.11/src/oasis/OASISDocument.mli0000644000175000017500000000352113261073606017227 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Document section @author Sylvain Le Gall *) open OASISTypes (** Schema for the section. {b Not exported}. *) val schema: (common_section * doc) OASISSchema.t oasis-0.4.11/src/oasis/OASISDocument.ml0000644000175000017500000000334313261073606017060 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* END EXPORT *) let schema = OASISDocument_intern.schema oasis-0.4.11/src/oasis/OASISDataNotation.ml0000644000175000017500000001637313261073606017676 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** OCaml data notation. This module helps to translate OCaml data into a string following OCaml syntax. *) (** {2 Types} *) type module_name = string type field_name = string type variant_name = string type var_name = string type t = (** Record *) | REC of module_name * (field_name * t) list (** List *) | LST of t list (** String *) | STR of string (** Variant type constructor *) | VRT of variant_name * t list (** Boolean *) | BOO of bool (** Tuple *) | TPL of t list (** Unit () *) | UNT (** Function application *) | APP of var_name * (var_name * t) list * t list (** Variable *) | VAR of var_name (** Polymorphic variant *) | PVR of variant_name * t option (** {2 Basic conversion} *) let of_unit () = UNT let of_bool b = BOO b let of_string s = STR s let of_option f = function | Some v -> VRT("Some", [f v]) | None -> VRT("None", []) let of_list f lst = LST (List.map f lst) (** {2 Function conversion} *) (** Function that can be generated using func_call = APP(func, [], [func_arg]). *) type 'a func = { func_call: 'a; func_name: string; func_arg: t option; } (** Return the OCaml function corresponding to a [func]. *) let func f f_nm = { func_call = f; func_name = f_nm; func_arg = None; } (** Create a func with an argument *) let func_with_arg f f_nm arg odn_of_arg = { func_call = f arg; func_name = f_nm; func_arg = Some (odn_of_arg arg); } let func_with_arg_ctxt f f_nm arg odn_of_arg = { func_call = (fun ~ctxt -> f ~ctxt arg); func_name = f_nm; func_arg = Some (odn_of_arg arg); } (** Return the [t] code corresponding to a [func]. *) let odn_of_func t = match t.func_arg with | Some arg -> APP (t.func_name, [], [arg]) | None -> VAR t.func_name (** Return the OCaml function corresponding to a [func]. *) let func_call t = t.func_call (** {2 Formating} *) open Format let pp_odn ?(opened_modules=[]) fmt t = let opened_modules = (* Use opened modules starting with the bigger *) List.sort (fun mod1 mod2 -> String.length mod2 - String.length mod1) opened_modules in let pp_list pp_elem lst_sep fmt = function | [] -> () | hd :: tl -> pp_elem fmt hd; List.iter (fun e -> fprintf fmt lst_sep; pp_elem fmt e) tl in let pp_print_id fmt id = let chop_opened_module str = try let str_len = String.length str in let matching_opened_mod = List.find (fun opened_mod -> let opened_mod_len = String.length opened_mod in if opened_mod_len + 1 <= str_len then (opened_mod = String.sub str 0 opened_mod_len) && str.[opened_mod_len] = '.' else false) opened_modules in let chop_prefix_len = (String.length matching_opened_mod) + 1 in String.sub str chop_prefix_len (str_len - chop_prefix_len) with Not_found -> str in pp_print_string fmt (chop_opened_module id) in let rec pp_odn_aux fmt = function | REC (mod_nm, flds) -> begin let rec print_fields fmt first fields = let print_field fmt (fld, e) = fprintf fmt "@[%a =@ %a@]" (* We use the first field to add the module name at the * beginning. *) pp_print_id (if first then mod_nm^"."^fld else fld) pp_odn_aux e in match fields with | [fld, e] -> print_field fmt (fld, e) | (fld, e) :: tl -> print_field fmt (fld, e); fprintf fmt ";@ "; print_fields fmt false tl | [] -> () in fprintf fmt "@[{@[@,"; print_fields fmt true flds; fprintf fmt "@]@,}@]" end | LST lst -> fprintf fmt "@[[@[@,%a@]@,]@]" (pp_list pp_odn_aux ";@ ") lst | STR str -> fprintf fmt "%S" str | VRT (nm, []) -> pp_print_id fmt nm | VRT (nm, lst) -> fprintf fmt "@[%a@ %a@]" pp_print_id nm pp_odn_aux (TPL lst) | BOO b -> pp_print_bool fmt b | TPL [] -> pp_print_string fmt "()" | TPL [(STR _) as v] | TPL [(REC _) as v] | TPL [(LST _) as v] | TPL [(BOO _) as v] | TPL [UNT as v] | TPL [(VAR _) as v] -> pp_odn_aux fmt v | TPL lst -> fprintf fmt "@[(%a)@]" (pp_list pp_odn_aux ",@ ") lst | UNT -> pp_print_string fmt "()" | APP (fnm, named_args, args) -> fprintf fmt "@[%a%a%a@]" pp_print_id fnm (pp_list (fun fmt (nm, e) -> fprintf fmt "@ ~%s:%a" nm pp_odn_aux e) "") named_args (pp_list (fun fmt e -> fprintf fmt "@ %a" pp_odn_aux e) "") args | VAR nm -> pp_print_id fmt nm | PVR (nm, None) -> pp_print_id fmt ("`"^nm) | PVR (nm, Some tpl) -> fprintf fmt "@[`%a@ %a@]" pp_print_id nm pp_odn_aux tpl in pp_odn_aux fmt t oasis-0.4.11/src/oasis/OASISData.mlify0000644000175000017500000000027213261073606016661 0ustar gildorgildorVarString oasissys_ml "OASISSys.ml" VarString oasissyslight_ml "OASISSysLight.ml" VarString oasissysbundle_ml "OASISSysBundle.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.11/src/oasis/OASISCustom.ml0000644000175000017500000000452513261073606016557 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Custom command to run before/after specific actions @author Sylvain Le Gall *) (* END EXPORT *) open OASISSchema_intern open OASISValues open OASISTypes let add_fields schm nm hlp_pre hlp_post sync = let pre_command = new_field_conditional schm ("Pre"^nm^"Command") ~default:None (opt command_line) hlp_pre (fun pkg -> (sync pkg).pre_command) in let post_command = new_field_conditional schm ("Post"^nm^"Command") ~default:None (opt command_line) hlp_post (fun pkg -> (sync pkg).post_command) in (fun data -> { pre_command = pre_command data; post_command = post_command data; }) oasis-0.4.11/src/oasis/OASISContext.mli0000644000175000017500000000525413261073606017102 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Global context for messages and i18n @author Sylvain Le Gall *) type level = [ `Debug | `Info | `Warning | `Error] type source type source_filename = source OASISFileSystem.filename val in_srcdir: OASISUnixPath.unix_filename -> source_filename type t = { quiet: bool; (** Display nothing. *) info: bool; (** Display info messages. *) debug: bool; (** Display also debug messages. *) ignore_plugins: bool; (** Don't use plugins *) ignore_unknown_fields: bool; (** Ignore fields unknown *) printf: level -> string -> unit; (** Redirect output *) srcfs: source OASISFileSystem.fs; (** The file system containing the sources *) load_oasis_plugin: string -> bool; (** Load the named OASIS plugin and return if it was able to find it. *) } (** Default context *) val default: t ref (** Command line arguments to create {!t}. *) val fspecs: unit -> ((string * Arg.spec * string) list * (unit -> t)) (** Quiet context. *) val quiet: t oasis-0.4.11/src/oasis/OASISContext.ml0000644000175000017500000000714113261073606016726 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext type level = [ `Debug | `Info | `Warning | `Error] type source type source_filename = source OASISFileSystem.filename let in_srcdir ufn = OASISFileSystem.of_unix_filename ufn type t = { (* TODO: replace this by a proplist. *) quiet: bool; info: bool; debug: bool; ignore_plugins: bool; ignore_unknown_fields: bool; printf: level -> string -> unit; srcfs: source OASISFileSystem.fs; load_oasis_plugin: string -> bool; } let printf lvl str = let beg = match lvl with | `Error -> s_ "E: " | `Warning -> s_ "W: " | `Info -> s_ "I: " | `Debug -> s_ "D: " in prerr_endline (beg^str) let default = ref { quiet = false; info = false; debug = false; ignore_plugins = false; ignore_unknown_fields = false; printf = printf; srcfs = new OASISFileSystem.host_fs(Sys.getcwd ()); load_oasis_plugin = (fun _ -> false); } let quiet = {!default with quiet = true} let fspecs () = (* TODO: don't act on default. *) let ignore_plugins = ref false in ["-quiet", Arg.Unit (fun () -> default := {!default with quiet = true}), s_ " Run quietly"; "-info", Arg.Unit (fun () -> default := {!default with info = true}), s_ " Display information message"; "-debug", Arg.Unit (fun () -> default := {!default with debug = true}), s_ " Output debug message"; "-ignore-plugins", Arg.Set ignore_plugins, s_ " Ignore plugin's field."; "-C", Arg.String (fun str -> Sys.chdir str; default := {!default with srcfs = new OASISFileSystem.host_fs str}), s_ "dir Change directory before running (affects setup.{data,log})."], fun () -> {!default with ignore_plugins = !ignore_plugins} oasis-0.4.11/src/oasis/OASISConf.ml.ab0000644000175000017500000000343513261073606016552 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let version_full = OASISVersion.version_of_string "$(pkg_version)" let version_short = OASISVersion.chop version_full oasis-0.4.11/src/oasis/OASISCheck.ml0000644000175000017500000001451413261073606016321 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Check an OASIS package *) open OASISGettext open OASISSchema_intern open OASISUtils open OASISPlugin open OASISTypes open PropList let check_schema ~ctxt where schm plugins features_data data = let check_is_default schm data fld = let fake_data = Data.create () in try (Schema.get schm data fld) = (Schema.get schm fake_data fld) with | Not_set _ | No_printer _ | OASISValues.Not_printable -> (* TODO: Don't know what to answer *) true in let check_is_set schm data fld = let field_set = Data.elements data in List.mem fld field_set in (* Collect plugins and their version. *) let plugins = Schema.fold (fun plugins fld extra hlp -> match extra.kind with | DefinePlugin knd -> begin try let id = plugin_of_string knd (Schema.get schm data fld) in SetPlugin.add id plugins with _ -> plugins end | DefinePlugins knd -> begin try let lst = plugins_of_string knd (Schema.get schm data fld) in List.fold_left (fun acc id -> SetPlugin.add id acc) plugins lst with _ -> plugins end | StandardField | FieldFromPlugin _ -> plugins) plugins schm in (* Inject plugin data in features data. *) let features_data = SetPlugin.fold (fun plg_id features_data -> OASISFeatures.Data.add_plugin plg_id features_data) plugins features_data in (* Check all mandatory fields are set. *) let msgfld = let check_get schm data fld msgfld = try let _ = Schema.get schm data fld in msgfld with | Not_set _ -> fld :: msgfld | No_printer _ -> msgfld | OASISValues.Not_printable -> msgfld in Schema.fold (fun acc fld extra hlp -> match extra.kind with | DefinePlugin _ | DefinePlugins _ | StandardField -> check_get schm data fld acc | FieldFromPlugin ((_, nm, ver) as plg_id) -> if mem_no_version plg_id plugins then begin check_get schm data fld acc end else if check_is_set schm data fld && not (check_is_default schm data fld) then begin OASISMessage.warning ~ctxt (f_ "Field %s is set but matching plugin %s is not \ enabled.") fld nm; acc end else begin acc end) [] schm in let () = if msgfld <> [] then failwithf (f_ "Missing field in %s: %s") where (String.concat (s_ ", ") msgfld) in (** Check that all fields set are ok with OASISFormat. *) let () = Schema.fold (fun () fld extra _ -> if check_is_set schm data fld then match extra.feature with | Some feature -> OASISFeatures.data_assert feature features_data (OASISFeatures.Field (fld, where)) | None -> ()) () schm in plugins let check_package ~ctxt pkg = let standard_vars = SetString.of_list (List.flatten [ if OASISFeatures.package_test OASISFeatures.flag_docs pkg then ["tests"] else []; if OASISFeatures.package_test OASISFeatures.flag_tests pkg then ["docs"] else []; ]) in (** Check that there is no overlap in variable name. *) let _mp: string MapString.t = List.fold_left (fun mp -> function | Flag (cs, _) | Executable (cs, _, _) as sct -> let sct_str = OASISSection.string_of_section sct in let varname = cs.cs_name in if SetString.mem varname standard_vars then OASISMessage.warning ~ctxt (f_ "%s define variable '%s' which is also a standard \ variable, possible conflict.") sct_str varname; if MapString.mem varname mp then OASISMessage.warning ~ctxt (f_ "%s define variable '%s' which is also defined by \ %s, possible conflict.") sct_str varname (MapString.find varname mp); MapString.add varname sct_str mp | Library _ | Object _ | Doc _ | SrcRepo _ | Test _ -> mp) MapString.empty pkg.sections in () oasis-0.4.11/src/oasis/OASISBuildSection_intern.ml0000644000175000017500000002161213261073606021244 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Build section internal functions @author Sylvain Le Gall *) open OASISSchema_intern open OASISValues open OASISGettext open OASISTypes let build_depends_field schm sync = new_field schm "BuildDepends" ~default:[] (let base_value = comma_separated (with_optional_parentheses findlib_full OASISVersion.comparator_value) in { parse = (fun ~ctxt str -> List.map (fun (pkg, ver_constr_opt) -> FindlibPackage (pkg, ver_constr_opt)) (base_value.parse ~ctxt str)); update = List.append; print = (fun lst -> base_value.print (List.map (function | FindlibPackage (nm, ver) -> (nm, ver) | InternalLibrary nm -> (nm, None)) lst)); }) (fun () -> s_ "Dependencies on findlib packages, including internal \ findlib packages.") sync let build_tools_value = let base = comma_separated file in { parse = (fun ~ctxt str -> List.map (fun s -> ExternalTool s) (base.parse ~ctxt str)); update = List.append; print = (fun lst -> base.print (List.map (function | InternalExecutable nm | ExternalTool nm -> nm) lst)) } let build_tools_field schm sync = new_field schm "BuildTools" ~default:[] build_tools_value (fun () -> s_ "Tools required to compile, including internal executables.") sync let build_install_data_fields ?default_cond ?(default=true) schm sync_build sync_install sync_datafiles = let build = new_field_conditional schm "Build" ?default_cond ~default boolean (fun () -> s_ "Set if the section should be built.") sync_build in let install = new_field_conditional schm "Install" ~default:true boolean (fun () -> s_ "Set if the section should be distributed.") sync_install in let data_files = new_field schm "DataFiles" ~default:[] (comma_separated (with_optional_parentheses file_glob (expandable directory))) (fun () -> s_ "Comma separated list of files to be installed for run-time. \ ([see here](#data-files))") sync_datafiles in build, install, data_files let source_patterns_fields schm default_intf sync_intf default_impl sync_impl = let value_source_pattern = let open OASISValues in { parse = (fun ~ctxt:_ str -> OASISSourcePatterns.parse str); update = update_fail; print = OASISSourcePatterns.to_string; } in let value_source_patterns = OASISValues.comma_separated value_source_pattern in let interface_patterns = new_field schm "InterfacePatterns" ~default:default_intf ~feature:OASISFeatures.source_patterns value_source_patterns (fun () -> s_ "Patterns to use for locating source files.") sync_intf in let implementation_patterns = new_field schm "ImplementationPatterns" ~default:default_impl ~feature:OASISFeatures.source_patterns value_source_patterns (fun () -> s_ "Patterns to use for locating source files.") sync_impl in interface_patterns, implementation_patterns let section_fields _ comp_dflt schm sync = let path = new_field schm "Path" directory (fun () -> s_ "Directory containing the section") (fun pkg -> (sync pkg).bs_path) in let build, install, data_files = build_install_data_fields schm (fun pkg -> (sync pkg).bs_build) (fun pkg -> (sync pkg).bs_install) (fun pkg -> (sync pkg).bs_data_files) in let findlib_extra_files = new_field schm "FindlibExtraFiles" ~default:[] ~feature:OASISFeatures.findlib_extra_files (comma_separated string_not_empty) (fun () -> s_ "Comma separated list of extra files to be installed with \ ocamlfind.") (fun pkg -> (sync pkg).bs_findlib_extra_files) in let build_depends = build_depends_field schm (fun pkg -> (sync pkg).bs_build_depends) in let build_tools = build_tools_field schm (fun pkg -> (sync pkg).bs_build_tools) in let compiled_object = new_field schm "CompiledObject" ~default:comp_dflt (choices (fun () -> s_ "compiled object") ["byte", Byte; "native", Native; "best", Best]) (fun () -> s_ "Define the compilation type of the section: byte, native or best") (fun pkg -> (sync pkg).bs_compiled_object) in let interface_patterns, implementation_patterns = source_patterns_fields schm OASISSourcePatterns.interface (fun pkg -> (sync pkg).bs_interface_patterns) OASISSourcePatterns.implementation (fun pkg -> (sync pkg).bs_implementation_patterns) in let c_sources = new_field schm "CSources" ~default:[] files (fun () -> s_ "C source files.") (fun pkg -> (sync pkg).bs_c_sources) in let ccopt = new_field_conditional schm "CCOpt" ~default:[] command_line_options (fun () -> s_ "-ccopt arguments to use when building.") (fun pkg -> (sync pkg).bs_ccopt) in let cclib = new_field_conditional schm "CCLib" ~default:[] command_line_options (fun () -> s_ "-cclib arguments to use when building.") (fun pkg -> (sync pkg).bs_cclib) in let dlllib = new_field_conditional schm "DllLib" ~default:[] command_line_options (fun () -> s_ "-dlllib arguments to use when building.") (fun pkg -> (sync pkg).bs_dlllib) in let dllpath = new_field_conditional schm "DllPath" ~default:[] command_line_options (fun () -> s_ "-dllpath arguments to use when building.") (fun pkg -> (sync pkg).bs_dllpath) in let byteopt = new_field_conditional schm "ByteOpt" ~default:[] command_line_options (fun () -> s_ "ocamlc arguments to use when building.") (fun pkg -> (sync pkg).bs_byteopt) in let nativeopt = new_field_conditional schm "NativeOpt" ~default:[] command_line_options (fun () -> s_ "ocamlopt arguments to use when building.") (fun pkg -> (sync pkg).bs_nativeopt) in (fun _ data -> { bs_build = build data; bs_install = install data; bs_path = path data; bs_compiled_object = compiled_object data; bs_build_depends = build_depends data; bs_build_tools = build_tools data; bs_interface_patterns = interface_patterns data; bs_implementation_patterns = implementation_patterns data; bs_c_sources = c_sources data; bs_data_files = data_files data; bs_findlib_extra_files = findlib_extra_files data; bs_ccopt = ccopt data; bs_cclib = cclib data; bs_dlllib = dlllib data; bs_dllpath = dllpath data; bs_byteopt = byteopt data; bs_nativeopt = nativeopt data; }) oasis-0.4.11/src/oasis/OASISBuildSection.mli0000644000175000017500000000456613261073606020047 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Build section @author Sylvain Le Gall *) (** Search a module file. *) val find_module: (string -> bool) -> OASISTypes.build_section -> OASISUnixPath.unix_filename -> [ `No_sources of OASISUnixPath.unix_filename list | `Sources of OASISUnixPath.unix_filename * string list ] (** Compute the order of section building, taking into account build dependencies between sections. {b Not exported}. *) val build_order: OASISTypes.package -> OASISTypes.section list (** Compute a map between sections and its build depends. The build depends contains only libraries. {b Not exported}. *) val transitive_build_depends: OASISTypes.package -> OASISTypes.dependency list OASISSection.MapSection.t oasis-0.4.11/src/oasis/OASISBuildSection.ml0000644000175000017500000001515313261073606017670 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes (* Look for a module file, considering capitalization or not. *) let find_module source_file_exists bs modul = let possible_lst = OASISSourcePatterns.all_possible_files (bs.bs_interface_patterns @ bs.bs_implementation_patterns) ~path:bs.bs_path ~modul in match List.filter source_file_exists possible_lst with | (fn :: _) as fn_lst -> `Sources (OASISUnixPath.chop_extension fn, fn_lst) | [] -> let open OASISUtils in let _, rev_lst = List.fold_left (fun (set, acc) fn -> let base_fn = OASISUnixPath.chop_extension fn in if SetString.mem base_fn set then set, acc else SetString.add base_fn set, base_fn :: acc) (SetString.empty, []) possible_lst in `No_sources (List.rev rev_lst) (* END EXPORT *) open OASISSection module G = OASISGraph type extended_kind = [section_kind | `ExternalTool | `FindlibPackage] type vertex = extended_kind * string let build_graph pkg = 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 -> 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 add_build_tool vrtx lst = List.iter (function | InternalExecutable nm -> let dvrtx = G.vertex_of_value g (`Executable, nm) in G.add_edge g vrtx dvrtx | 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 = add_build_tool vrtx bs.bs_build_tools; List.iter (function | InternalLibrary nm -> let dvrtx = try G.vertex_of_value g (`Library, nm) with Not_found -> G.vertex_of_value g (`Object, nm) in G.add_edge g vrtx dvrtx | 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 (fun (vrtx, sct) -> match sct with | Library (_, bs, _) | Object (_, bs, _) | Executable (_, bs, _) -> add_build_section vrtx bs | Test (_, {test_tools = build_tools}) | Doc (_, {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 = 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 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 sct -> MapSection.add sct [] mp) MapSection.empty pkg.sections in 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 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 (fun _ lst -> List.rev_map (fun (_, dep) -> dep) (* Reverse order to match List.rev_map *) (List.sort (fun (o1, _) (o2, _) -> o2 - o1) lst)) map_deps oasis-0.4.11/src/oasis/OASISAst_types.ml0000644000175000017500000000675313261073606017265 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** AST types @author Sylvain Le Gall *) open OASISTypes (* TODO: get rid of that if possible. *) (** Context for parsing and checking AST *) type ctxt = { (** Current condition for conditional fields. *) cond: OASISExpr.t option; (** Valid flags *) valid_flags: name list; (** Combine values rather than setting it, when setting field values *) append: bool; (** Global context *) ctxt: OASISContext.t; } (** Abstract Syntax Tree *) type field_op = | FSet of string | FAdd of string | FEval of OASISExpr.t type stmt = | SField of name * field_op | SIfThenElse of OASISExpr.t * stmt * stmt | SBlock of stmt list type top_stmt = | TSSection of section_kind * name * stmt | TSStmt of stmt | TSBlock of top_stmt list let norm = let rec norm_top_stmt = function | TSSection(sct_knd, nm, stmt) -> TSSection(sct_knd, nm, norm_stmt stmt) | TSStmt stmt -> TSStmt(norm_stmt stmt) | TSBlock [tstmt] -> norm_top_stmt tstmt | TSBlock lst -> TSBlock(norm_flatten_tsblock lst) and norm_flatten_tsblock = function | (TSBlock l1) :: l2 -> norm_flatten_tsblock (l1 @ l2) | hd :: tl -> norm_top_stmt hd :: norm_flatten_tsblock tl | [] -> [] and norm_stmt = function | SField(nm, fop) -> SField(nm, norm_field_op fop) | SIfThenElse(expr, stmt1, stmt2) -> SIfThenElse(OASISExpr.reduce expr, norm_stmt stmt1, norm_stmt stmt2) | SBlock [stmt] -> norm_stmt stmt | SBlock lst -> SBlock(norm_flatten_sblock lst) and norm_flatten_sblock = function | (SBlock l1) :: l2 -> norm_flatten_sblock (l1 @ l2) | hd :: tl -> norm_stmt hd :: norm_flatten_sblock tl | [] -> [] and norm_field_op = function | FSet _ as e -> e | FAdd _ as e -> e | FEval expr -> FEval (OASISExpr.reduce expr) in norm_top_stmt oasis-0.4.11/src/oasis/OASISAst_parser.mly0000644000175000017500000000733013261073606017576 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ %{ open OASISAst_types open OASISExpr open OASISUtils open OASISGettext let parse_error s = failwithpf ~pos1:(Parsing.symbol_start_pos ()) ~pos2:(Parsing.symbol_end_pos ()) "%s" (s_ "syntax error") %} %token PLUS_COLON %token COLON %token DOLLAR_COLON %token IF ELSE %token RBRACE LBRACE %token SECTION %token NOT AND OR LPAREN RPAREN TRUE FALSE FLAG %token EOF %token IDENT %token QSTRING %left OR /* Lowest precedence */ %left AND /* Medium precedence */ %nonassoc NOT /* Highest precedence */ %start main %type main %% main: | top_stmt_list EOF {norm (TSBlock (List.rev $1))} ; top_stmt_list: | top_stmt_list top_stmt {$2 :: $1} | {[]} ; top_stmt: | SECTION id_or_qstring sblock {TSSection($1, $2, $3)} | LBRACE top_stmt_list RBRACE {TSBlock (List.rev $2)} | field {TSStmt($1)} | ifsblock {TSStmt($1)} ; stmt_list: | stmt_list stmt {$2 :: $1} | {[]} ; stmt: | field {$1} | ifsblock {$1} | sblock {$1} ; field: | IDENT COLON {SField($1, FSet($2))} | IDENT PLUS_COLON {SField($1, FAdd($2))} | IDENT DOLLAR_COLON expr {SField($1, FEval($3))} ; ifsblock: | IF expr sblock {SIfThenElse($2, $3, SBlock[])} | IF expr sblock ELSE ifsblock {SIfThenElse($2, $3, $5)} | IF expr sblock ELSE sblock {SIfThenElse($2, $3, $5)} ; sblock: | LBRACE stmt_list RBRACE {SBlock (List.rev $2)} ; expr: | TRUE {EBool true} | FALSE {EBool false} | LPAREN expr RPAREN {$2} | NOT expr {ENot $2} | expr AND expr {EAnd($1, $3)} | expr OR expr {EOr($1, $3)} | IDENT LPAREN id_or_qstring RPAREN {ETest(test_of_string $1, $3)} | FLAG LPAREN id_or_qstring RPAREN {EFlag($3)} ; id_or_qstring: | IDENT {$1} | QSTRING {$1} ; %% oasis-0.4.11/src/oasis/OASISAst_lexer.mll0000644000175000017500000001703413261073606017406 0ustar gildorgildor(********************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (********************************************************************************) { open OASISAst_parser open OASISUtils open OASISGettext let char_of_escape lexbuf = function | '\\' -> '\\' | '\'' -> '\'' | '"' -> '"' | 'n' -> '\n' | 't' -> '\t' | 'b' -> '\b' | 'r' -> '\r' | ' ' -> ' ' | c -> failwithpf ~lexbuf (f_ "Unknown escape sequence: \\%c") c let mkbuf () = Buffer.create 64 type t = | ASTToken of token | Indent of int | Eof let token_map = MapString.of_list [ "if", IF; "else", ELSE; (* TODO: only use 'true' and 'false' and drop the case of True and TRUE. * In order to do that, estimate the impact on the current oasis files. *) "true", TRUE; "True", TRUE; "TRUE", TRUE; "false", FALSE; "False", FALSE; "FALSE", FALSE; "flag", FLAG; "Flag", SECTION `Flag; "Library", SECTION `Library; "Object", SECTION `Object; "Executable", SECTION `Executable; "SourceRepository", SECTION `SrcRepo; "Test", SECTION `Test; "Document", SECTION `Doc; ] type lexer_state = { mutable first_call: bool; mutable indent: int; mutable use_tab: bool option; q: token Queue.t; ctxt: OASISContext.t; } let rec warn_if_mixed_indentation lexst lexbuf line = match lexst.use_tab with | None -> lexst.use_tab <- Some (String.contains line '\t') | Some use_tab -> let has_tab, has_space = String.contains line '\t', String.contains line ' ' in if (has_tab && not use_tab) || (has_space && use_tab) then failwithpf ~lexbuf (f_ "mixed use of '\\t' and ' ' to indent") } let eol = '\n' | "\r\n" let blank = [' ' '\t'] let id = ['A'-'Z''a'-'z''0'-'9''-''_']+ let comment = '#' [^'\n']* rule token lexst = parse | '"' {ASTToken (qstring (mkbuf ()) lexbuf)} | "+:" {ASTToken (PLUS_COLON(value (mkbuf ()) lexbuf))} | ":" {ASTToken (COLON(value (mkbuf ()) lexbuf))} | "$:" {ASTToken DOLLAR_COLON} | '!' {ASTToken NOT} | "&&" {ASTToken AND} | "||" {ASTToken OR} | '(' {ASTToken LPAREN} | ')' {ASTToken RPAREN} | comment {token lexst lexbuf} | eof {Eof} | blank {token lexst lexbuf} | id as lxm { try ASTToken (MapString.find lxm token_map) with Not_found -> ASTToken (IDENT(lxm)) } | eol { let () = Lexing.new_line lexbuf in let indent = indentation lexst lexbuf in Indent indent } | _ as c {failwithpf ~lexbuf "extraneous char %C" c} and indentation lexst = parse | (blank* as lxm) (comment? as cmt) eol { if lxm <> "" && cmt = "" then begin OASISMessage.warning ~ctxt:lexst.ctxt (f_ "%s: extraneous blanks at the beginning of the line") (OASISUtils.file_location ~lexbuf ()) end; warn_if_mixed_indentation lexst lexbuf lxm; Lexing.new_line lexbuf; indentation lexst lexbuf } | blank* as lxm { warn_if_mixed_indentation lexst lexbuf lxm; String.length lxm } and qstring buf = parse | '"' {QSTRING (Buffer.contents buf)} | '\\' (_ as esc) { Buffer.add_char buf (char_of_escape lexbuf esc); qstring buf lexbuf } | eol {Buffer.add_char buf '\n'; Lexing.new_line lexbuf; qstring buf lexbuf} | _ as c {Buffer.add_char buf c; qstring buf lexbuf} and value buf = parse | blank* {value_no_leading_ws buf lexbuf} and value_no_leading_ws buf = parse | blank* comment? eol {Lexing.new_line lexbuf; Buffer.contents buf} | blank* comment? eof {Buffer.contents buf} | _ as c {Buffer.add_char buf c; value_no_leading_ws buf lexbuf} { let token ~ctxt () = (* The state of the lexer. *) let lexst = { first_call = true; indent = 0; use_tab = None; q = Queue.create (); ctxt = ctxt; } in (* Reflect level of indentation by using { }. *) let rec update_indent indent' = if indent' < lexst.indent then begin Queue.push RBRACE lexst.q; lexst.indent <- lexst.indent - 1; update_indent indent' end else if indent' > lexst.indent then begin Queue.push LBRACE lexst.q; lexst.indent <- lexst.indent + 1; update_indent indent' end in (* Try to extract multiple lines value, if possible. *) let multiline str lexbuf = let open Buffer in let multiline_indent = indentation lexst lexbuf in let rec add_continuation first_line indent buf lexbuf = if indent >= multiline_indent then begin let line = value (mkbuf ()) lexbuf in (* Don't add EOL if first line is empty. *) if not (first_line && Buffer.length buf = 0) then add_char buf '\n'; (* Remove lines which are only ".", they represents an empty line. *) if indent > multiline_indent || line <> "." then begin add_string buf (String.make (indent - multiline_indent) ' '); add_string buf line end; add_continuation false (indentation lexst lexbuf) buf lexbuf end else begin update_indent indent; contents buf end in if multiline_indent > lexst.indent then begin (* Next line is a continuation, it defines the level of indentation for * the rest of the multiline value. *) let buf = Buffer.create 63 in add_string buf str; add_continuation true multiline_indent buf lexbuf end else begin (* Next line is not a continuation. *) update_indent multiline_indent; str end in let rec next lexbuf = if lexst.first_call then begin lexst.first_call <- false; update_indent (indentation lexst lexbuf); next lexbuf end else if not (Queue.is_empty lexst.q) then begin Queue.pop lexst.q end else begin match token lexst lexbuf with | ASTToken (COLON str) -> COLON (multiline str lexbuf) | ASTToken (PLUS_COLON str) -> PLUS_COLON (multiline str lexbuf) | ASTToken tok -> tok | Eof -> update_indent 0; Queue.push EOF lexst.q; next lexbuf | Indent indent -> update_indent indent; next lexbuf end in next } oasis-0.4.11/src/oasis/OASISAst.ml0000644000175000017500000002240713261073606016033 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** AST manipulation @author Sylvain Le Gall *) open OASISTypes open OASISUtils open OASISGettext open OASISAst_types open OASISExpr (** Convert OASIS stream into package *) let to_package ~ctxt ast = (* Merge an expression with a condition in a ctxt *) let ctxt_add_expr ctxt e = match ctxt with | {cond = None; _} -> {ctxt with cond = Some e} | {cond = Some e'; _} -> {ctxt with cond = Some (EAnd (e', e))} in (* Explore statement, at this level it is possible that value * depends from condition (if expression is possible) *) let rec stmt schm data ctxt = function | SField (nm, op) -> begin try let set = PropList.Schema.set schm data nm in let ctxt = {ctxt with append = false} in match op with | FSet s -> set ~context:ctxt s | FAdd s -> set ~context:{ctxt with append =true} s | FEval e -> set ~context:ctxt (string_of_bool false); set ~context:(ctxt_add_expr ctxt e) (string_of_bool true) with (PropList.Unknown_field _) as exc -> if OASISPlugin.test_field_name nm && ctxt.ctxt.OASISContext.ignore_plugins then () else if ctxt.ctxt.OASISContext.ignore_unknown_fields then () else raise exc end | SIfThenElse (e, stmt1, stmt2) -> (* Check that we have a valid expression *) OASISExpr.check ctxt.valid_flags e; (* Explore if branch *) stmt schm data (ctxt_add_expr ctxt e) stmt1; (* Explore then branch *) stmt schm data (ctxt_add_expr ctxt (ENot e)) stmt2 | SBlock blk -> List.iter (stmt schm data ctxt) blk in (* Explore statement and register data into a newly created * Schema.writer. *) let schema_stmt gen schm (ctxt, scts) nm stmt' = let data = PropList.Data.create () in let schm = schm.OASISSchema_intern.schm in let where = (PropList.Schema.name schm)^" "^nm in stmt schm data ctxt stmt'; ctxt, (schm, where, data, fun features_data -> gen features_data nm data) :: scts in (* Recurse into top-level statement. At this level there is no conditional * expression but there is Flag, Library and Executable structure defined. *) let rec top_stmt pkg_data (ctxt, _ as acc) = function | TSSection (sct_knd, nm, stmt) -> section sct_knd nm acc stmt | TSBlock blk -> List.fold_left (top_stmt pkg_data) acc blk | TSStmt stmt' -> stmt OASISPackage.schema.OASISSchema_intern.schm pkg_data ctxt stmt'; acc and section sct_knd nm (ctxt, scts) stmt = let gen = match sct_knd with | `Library -> schema_stmt OASISLibrary_intern.generator OASISLibrary.schema | `Object -> schema_stmt OASISObject_intern.generator OASISObject.schema | `Executable -> schema_stmt OASISExecutable_intern.generator OASISExecutable.schema | `Flag -> schema_stmt OASISFlag_intern.generator OASISFlag.schema | `Test -> schema_stmt OASISTest_intern.generator OASISTest.schema | `Doc -> schema_stmt OASISDocument_intern.generator OASISDocument.schema | `SrcRepo -> schema_stmt OASISSourceRepository_intern.generator OASISSourceRepository.schema in let acc = if sct_knd = `Flag then {ctxt with valid_flags = nm :: ctxt.valid_flags}, scts else ctxt, scts in gen acc nm stmt in (* Interpret AST and inject it into data. *) let data = PropList.Data.create () in let ctxt, sections = let default_ctxt = { cond = None; append = false; valid_flags = []; ctxt = ctxt; } in top_stmt data (default_ctxt, []) ast in (* Extract features_data *) let features_data = let oasis_version = try OASISPackage_intern.oasis_version data with PropList.Not_set _ -> failwith (s_ "OASISFormat not defined at the beginning of the file, \ consider starting with 'OASISFormat: ...'") in OASISFeatures.Data.create oasis_version (OASISPackage_intern.alpha_features data) (OASISPackage_intern.beta_features data) in (* Check all schema. *) let () = let plugins = OASISCheck.check_schema ~ctxt:ctxt.ctxt "package" OASISPackage.schema.OASISSchema_intern.schm OASISPlugin.SetPlugin.empty features_data data in List.iter (fun (schm, where, data, _) -> let _plugins: OASISPlugin.SetPlugin.t = OASISCheck.check_schema ~ctxt:ctxt.ctxt where schm plugins features_data data in ()) sections in let pkg = let sections = List.map (fun (_, _, _, gen) -> gen features_data) sections in OASISPackage_intern.generator data sections in (* Fix build depends to reflect internal dependencies *) let pkg = (* Map of findlib name to internal libraries *) let _, _, internal_of_findlib = OASISFindlib.findlib_mapping pkg in let map_internal_libraries sct = List.map (function | (FindlibPackage (lnm, ver_opt)) as bd -> let is_internal, lnm = try true, internal_of_findlib lnm with (OASISFindlib.FindlibPackageNotFound _) -> false, lnm in if is_internal then begin if ver_opt <> None then failwithf (f_ "Cannot use versioned build depends \ on internal library %s in %s") lnm (OASISSection.string_of_section sct); InternalLibrary lnm end else begin bd end | (InternalLibrary _) as bd -> bd) in let internal_tools = List.fold_left (fun st -> function | Executable (cs, _, _) -> SetString.add cs.cs_name st | _ -> st) SetString.empty pkg.sections in let map_internal_tools _ = List.map (function | ExternalTool lnm as bt -> if SetString.mem lnm internal_tools then InternalExecutable lnm else bt | InternalExecutable _ as bt -> bt) in let map_internal sct bs = {bs with bs_build_depends = map_internal_libraries sct bs.bs_build_depends; bs_build_tools = map_internal_tools sct bs.bs_build_tools} in {pkg with sections = List.map (function | Library (cs, bs, lib) as sct -> Library (cs, map_internal sct bs, lib) | Object (cs, bs, obj) as sct -> Object (cs, map_internal sct bs, obj) | Executable (cs, bs, exec) as sct -> Executable (cs, map_internal sct bs, exec) | Test (cs, tst) as sct -> Test (cs, {tst with test_tools = map_internal_tools sct tst.test_tools}) | Doc (cs, doc) as sct -> Doc (cs, {doc with doc_build_tools = map_internal_tools sct doc.doc_build_tools}) | Flag _ | SrcRepo _ as sct -> sct) pkg.sections} in (* Check recursion and re-order library/tools so that build order is respected *) let pkg = {pkg with sections = OASISBuildSection.build_order pkg} in OASISMessage.debug ~ctxt:ctxt.ctxt ""; OASISCheck.check_package ~ctxt:ctxt.ctxt pkg; pkg oasis-0.4.11/src/oasis/META0000644000175000017500000000610313261073627014622 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 31c8d4e190d7992e665740c3c97e36d3) version = "0.4.11" description = "_oasis file functions" requires = "unix" archive(byte) = "oasis.cma" archive(byte, plugin) = "oasis.cma" archive(native) = "oasis.cmxa" archive(native, plugin) = "oasis.cmxs" exists_if = "oasis.cma" package "dynrun" ( version = "0.4.11" description = "_oasis file functions" requires = "oasis.base oasis.builtin-plugins" archive(byte) = "dynrun.cma" archive(byte, plugin) = "dynrun.cma" archive(native) = "dynrun.cmxa" archive(native, plugin) = "dynrun.cmxs" exists_if = "dynrun.cma" ) package "cli" ( version = "0.4.11" description = "'setup.ml' modules for OASIS" requires = "oasis oasis.base plugin-loader" archive(byte) = "cli.cma" archive(byte, plugin) = "cli.cma" exists_if = "cli.cma" ) package "builtin-plugins" ( version = "0.4.11" description = "_oasis file functions" requires = "oasis oasis.base ocamlbuild" archive(byte) = "builtin-plugins.cma" archive(byte, plugin) = "builtin-plugins.cma" archive(native) = "builtin-plugins.cmxa" archive(native, plugin) = "builtin-plugins.cmxs" exists_if = "builtin-plugins.cma" ) package "base" ( version = "0.4.11" description = "'setup.ml' modules for OASIS" requires = "oasis" archive(byte) = "base.cma" archive(byte, plugin) = "base.cma" archive(native) = "base.cmxa" archive(native, plugin) = "base.cmxs" exists_if = "base.cma" ) # OASIS_STOP oasis-0.4.11/src/oasis/MANUAL-template.mkd0000644000175000017500000003627613261073606017447 0ustar gildorgildor% OASIS User Manual % author Sylvain Le Gall and others Introduction ============ OASIS is a tool to help OCaml developers to integrate configure, build and install systems in their projects. It should help to create standard entry points in the source code build system, allowing external tools to analyse projects easily. This tool is freely inspired by [Cabal][] which is the same kind of tool for [Haskell][]. [Cabal]: http://www.haskell.org/cabal [Haskell]: http://www.haskell.org Everything starts with a single text file, named `_oasis`, at the root of the project source directory. It contains semi-colon separated fields and sections that describe what is contained in the project and what to do with it. This file is used to generate a skeleton for build, configure and install systems. Generation can be customized through extra fields or directly inside generated files. The main entry point is an OCaml script `setup.ml`. It is self contained. Once generated there is no additional dependencies (just like an autoconf `configure` script). OASIS has been created with [OCamlbuild][] in mind. So there is probably some features/bugs that are oriented toward this build system. [OCamlbuild]: https://ocaml.org/learn/tutorials/ocamlbuild/ Features: * OCamlbuild support ([see here](#plugin-ocamlbuild)) * Standard files auto-generation (see here [1](#plugin-devfiles), [2](#plugin-meta), [3](#plugin-stdfiles)) * Generic support for all step ([see here](#plugin-custom)) * Internal configure/install ([see here](#plugin-internal)) Planned features: * [OCaml autoconf](http://ocaml-autoconf.forge.ocamlcore.org) * [OCamlMakefile](http://www.ocaml.info/software.html#build_tools) * [OMake](http://omake.metaprl.org/index.html) Writing `_oasis` file ===================== Syntax ------ The `_oasis` must be a valid UTF-8 text file. This file identify the toplevel directory of the project. Identifiers are just like variable names in OCaml, it cannot contains "-" or numbers at the beginning. Strings follow OCaml convention. For extra information on the parser/lexer see [Genlex][]. [Genlex]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Genlex.html A line beginning by `#` is a comment and is ignored. Blank line are ignored. The file contains semi-colon fields and sections. ### Fields Fields are defined as `field_name: field_value`: * Field name is an identifier, it contains only alphanumeric chars. * Field name is case insensitive. * Field value follow OCaml string convention, expect you don't need '"' around it. * Leading and trailing blanks of field value are removed. * A field value can continue on several lines, in this case the content of the value must be indented one level more then the field name. In the body of the value a blank line is represented by `.`. * If two fields have the same `field_name`, only the latter sets the value. The separator ':' can be replaced by '+:' which appends the `field_value` to the previous value of the value (rather than erasing it). Beware that appending is value dependent, some fields can concatenate, some cannot. The ':' can also be replaced by '\$:', see [Conditional value](#conditional-value). ### Sections Sections can be an identifier or a string: Library foo or Library "foo". Section name can be : `Library`, `Executable`, `Document`, `Test` and `SourceRepository`. Content of a section is indented relative to the section begin. Example: # Toplevel fields OASISFormat: 1.0 Library "foo" # Library fields Path: src/ # Back to toplevel fields Synopsis: bar ### Conditional value It is possible to define some fields conditionally. Not all fields can be specified this way, only fields that have no good default values and that must be evaluated at runtime is defined. For example: * Toplevel fields `Name` and `Version` cannot be conditional. * Library fields `Build` and `Install` can be conditional. A condition is defined using a `if ... else ...` construct. Example: Library bar if os_type(Win32) Build: true else Build: false Available tests are : $ListOASISTests The values from these tests are extracted from theoutput of `ocamlc -config`. An additional `flag` test is available which check that the a Flag is defined. See the chapter on the [Flag section](#flag). Tests and flags can be combined using standard boolean operation: * `(expr)` * `! expr`: negation of `expr`. * `expr1 && expr2`: boolean and. * `expr1 || expr2`: boolean or. * `true` and `false`. For boolean fields, you can replace the `if ... else ...` construct by `\$:`. For example: Library bar if os_type(Win32) Build: true else Build: false is equivalent to: Build\$: os_type(Win32) ### Features OASIS allows to experiment with non-official, experimental features. These features are included in the code but are not activated by default. In order to activate them. You need to list them in `AlphaFeatures` or `BetaFeatures` of your `_oasis`. Alpha features are under development and may only be used for testing. They are not yet well defined, they are evolving quickly and may be removed in future release of OASIS. Beta features are features almost ready to be shipped, they mostly need to be polished before release. You may use them as they will probably be ready for the next version of OASIS. Once you have activated a features, you get access to more fields and some parts of the code maybe be activated as well. Features allow the OASIS development team to release experiment early and should avoid long delay between release. Available features: $ListAllFeatures Package ------- Package fields are defined outside sections. They apply to the whole project. Fields: $ListOASISPackageFields `BuildDepends` and `BuildTools` are appended to all sections and not used directly in the package. Sections -------- There are 6 possible sections: * `Flag`: a command line flag. * `Library`: an OCaml library. * `Object`: a .cmo/.cmx object (__require BetaFeatures: section\_object__). * `Executable`: an OCaml executable. * `Document`: a document. * `Test`: a test. * `SourceRepository`: version control system information. None of these sections are mandatory. `Library`, `Executable`, `Document` and `Test` can be dependent on each other. This not a problem as long as there is no cycle inside the dependency graph. Dependencies can be expressed through `BuildDepends` and `BuildTools` fields. ### Flag A flag section defines a configure command line option. It will be translated to to `--enable-XXX` and `--disable-XXX` for the command line. It can be used inside conditional fields. Fields: $ListOASISFlagFields ### Common fields These fields are used inside `Library` and `Executable`. Fields: $ListOASISBuildFields All files defined in the section are relative to `Path`. ### Library Define an OCaml library. OCaml API is generated using `ocamldoc` applied to `Modules` with `BuildDepends` required flags. Fields: $ListOASISLibraryFields * Include all common fields. ### Object __require BetaFeatures: section\_object__ Define an OCaml object file. It is very close to a library except that an object when linked will evaluate all its toplevel statement. This may be ideal if you want to call for example an initialisation function. Fields: $ListOASISObjectFields * Include all common fields. ### Executable Define an OCaml executable. If the executable is a bytecode that use internal library, a helper script can be generated to set library path. Fields: $ListOASISExecutableFields * Include all common fields. ### Document Define a generated document. Fields: $ListOASISDocumentFields ### Test Define a test to run. Fields: $ListOASISTestFields ### SourceRepository Define VCS information. There are two special identified repositories: * head: identify the main development repository. * this: identify the repository at the state of the current version. Fields: $ListOASISSourceRepositoryFields Supported VCS types are: darcs, git, svn, cvs, hg, bzr, arch, monotone. License ------- We have adopted a [DEP-5][] license style description. [DEP-5]: http://dep.debian.net/deps/dep5/#license-specification The reason of this format is to have machine-readable license description. Using this former work, we hope to be compatible with future standards of Debian. We have limited the number of license to: $ListShortLicenses * or an URL describing the license And license exception to: $ListLicenseExceptions * or an URL describing the license exception You can specify a license version using a dash and only digits or dashes at the end of the license short name. Examples : * `LGPL-2.1 with OCaml linking exception`: LGPL v2.1 with OCaml linking exception * `GPL-2+`: GPL v2 or later Data files ---------- `DataFiles` fields help to install extra data inside `\$datadir/\$pkg_name`. This field is a comma separated list of file, with optional value inside parenthesis. You can override target directory using `fn (\$datadir/other_location)`. You can use wildcard `*` but only for a filename and followed by a single dot extension: `dir/*.html` is valid but `dir/*` and `dir/*.tar.gz` are not valid. Substitution inside text ------------------------ Substitution is performed using [Buffer.add\_substitute][]. [Buffer.add\_substitute]: http://caml.inria.fr/pub/docs/manual-ocaml/libref/Buffer.html#VALadd_substitute Variable are evaluated using environment. This is a mix of various data coming from `_oasis` file, `ocamlc -config` output and configure tests. So environment variables depends of each project. You can have a precise idea of what variables is available looking at the file `setup.data`. Here is a list of standard variables: $ListStandardVariables Other variables are defined depending on your `_oasis` file: * Variables from BuildDepends: `pkg_` and the name of the findlib package. It points to the directory containing the package. If there is a version constraint, it is also translated to a variable. It contains a boolean value to know if the version is ok or not. Internal findlib packages don't create variables. Example: `BuildDepends: oUnit (>= 1.0.3)` becomes two variables `pkg_oUnit = /usr/lib/ocaml/ounit` and `pkg_oUnit_ge_1_0_3 = true`. * Variables from external BuildTools: the variable is the name given in the field and its value the filename of the executable. Example: `BuildTools: make` becomes `make = /usr/bin/make`. * Dynamic variables from internal BuildTools: the variable is the name of the Executable section and its value the filename of the executable. Example: `Executable ocamlmod` becomes `ocamlmod = _build/src/tools/ocamlmod`. These variables are set through `setup.log` rather than `setup.data`. They are set only when the corresponding files is built. It is also possible to apply transformation through functions. This is useful when you need to use properties that need to be determined at runtime: * `utoh`: convert an Unix filename into a host filename (e.g. UNIX -> Win32 conversion). * `ocaml_escaped`: call to `String.escaped`. For example `\$(utoh src/test.ml)` will be replaced by `src\test.ml` on Windows. Customization of generated files -------------------------------- When OASIS generates file, it always replace only lines between `OASIS_START` and `OASIS_STOP`. These keywords are commented and followed by data to check that content is unchanged. If the file doesn't exist, OASIS will create the whole file using default header and footer. If OASIS detects a change inside the section being replaced, it will create a backup of the file and issue a warning. Customization of setup.ml ------------------------- `setup.ml` as any generated files can be customized in its header and footer. Moreover it can be customized through hook in the code directly. TODO: explains hook. Using OASIS during software development --------------------------------------- Since `_oasis` becomes a central place of information about the building process, it can be quite cumbersome to run again and again `oasis`. You can avoid it using the `-dev` flags when calling `oasis` for the first time. This way it will rebuilt very dependents build files each time you call `ocaml setup.ml`. A `setup.ml` built this way, should not be distributed. This intended for development purpose only. Plugins ------- OASIS is basically built around plugins. They are used to define specific behavior for generating files and including their own code in `setup.ml`. There are 6 categories of plugin: * __Conf__: apply to configure step, used in the field `ConfType` * __Build__: apply to build stepi, used in the field `BuildType` * __Test__: apply to test sections, used in the field `Type` of a test * __Doc__: apply to documentation sections, used in the field `Type` of a document * __Install__: apply to install and uninstall steps, used in the field `DocType` * __Extra__: everything else, used in the field `Plugins` $ListOASISPlugins Building and installing ======================= The file `setup.ml` is the base system to run every targets. It contains a self contained OCaml script, that only depends on OCaml standard installation that doesn't require using stublibs (no Str or Unix). This constraint is required to be fully portable even on system that doesn't support dynamic loading. The file `setup.data` is the result of the configure step and contains data that can be used for other step. It is removed only in `distclean` target. The format of this file is on variable and values per line: `var="value"`. The value is an OCaml string. The file in this form can be read by `make` and `sh`. Once generated this file should not be modified. The file `setup.log` contains a list of action done and is used and updated by action done and cancel (e.g. action `install` log files installed which action `uninstall` remove). ocaml setup.ml -configure ------------------------- This is the first step to perform. It is mandatory. It runs various test of the build environment to check that everything required is installed. ocaml setup.ml -build --------------------- This step is mandatory. Build libraries and executables. ocaml setup.ml -test -------------------- This step is optional. Run defined test. Need the build step before. ocaml setup.ml -doc ------------------- This step is optional. It builds API documentation for library and extra documentation as defined in `Document`. ocaml setup.ml -install ----------------------- This step is mandatory. Install what has been built in build and doc step. Also install data files as defined in `DataFiles` fields. ocaml setup.ml -uninstall ------------------------- This step is optional. Remove files and libraries installed. ocaml setup.ml -reinstall ------------------------- This step is optional. Perform an uninstall and then an install step. ocaml setup.ml -clean --------------------- This step is optional. Clean generated files during build and doc steps. ocaml setup.ml -distclean ------------------------- This step is optional. Try to go back to pristine source state. ocaml setup.ml -all ------------------- This step is optional. Run configure, build, test and doc step in one run. OASIS usage =================== Command line ------------ $OASISCommandLineHelp oasis-0.4.11/src/oasis/FormatExt.mli0000644000175000017500000000614713261073606016572 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Extra functions for Format Format functions that uses markdown syntax. @author Sylvain Le Gall *) (** Print a string considering ' ' as Format space. *) val pp_print_string_spaced: Format.formatter -> string -> unit (** [pp_print_list pp_elem sep fmt lst] Print the list [lst] of elements using [pp_elem] for each element and separate them by [sep]. *) val pp_print_list: (Format.formatter -> 'a -> unit) -> ('b, Format.formatter, unit) format -> Format.formatter -> 'a list -> unit (** [pp_print_para fmt str] Print a paragraph. '\n\n' mark the end of a paragraph. *) val pp_print_para: Format.formatter -> ?end_para:bool -> string -> unit (** See {! pp_print_para}. *) val pp_print_paraf: Format.formatter -> ?end_para:bool -> ('a, unit, string, unit) format4 -> 'a (** [pp_print_title fmt lvl str] Print a title using markdown formatting. *) val pp_print_title: Format.formatter -> int -> string -> unit (** See {! pp_print_title}. *) val pp_print_titlef: Format.formatter -> int -> ('a, unit, string, unit) format4 -> 'a (** Print two cut in a row. *) val pp_print_cut2: Format.formatter -> unit -> unit (** Print 1 or 2 newlines depending on the previous char. *) val pp_print_endblock: ?check_last_char:string -> Format.formatter -> unit -> unit (** Print a definition, as defined by pandoc (ext. of markdown)> *) val pp_print_def: Format.formatter -> string -> ((Format.formatter -> 'a -> unit) * 'a) list -> unit oasis-0.4.11/src/oasis/FormatExt.ml0000644000175000017500000001033213261073606016410 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open Format let pp_print_string_spaced fmt str = String.iter (function | ' ' -> Format.pp_print_space fmt () | '\n' -> Format.pp_print_space fmt () | c -> Format.pp_print_char fmt c) str let pp_print_list pp_elem lst_sep fmt = function | [] -> () | hd :: tl -> pp_elem fmt hd; List.iter (fun e -> fprintf fmt lst_sep; pp_elem fmt e) tl let pp_print_cut2 fmt () = pp_print_cut fmt (); pp_print_cut fmt () let pp_print_endblock ?(check_last_char="") fmt () = if OASISString.ends_with ~what:"\n" check_last_char then begin pp_print_newline fmt () end else begin pp_print_newline fmt (); pp_print_newline fmt () end let pp_print_para fmt ?(end_para=true) str = let str_len = String.length str in let rec decode_string i = if i < str_len then begin match str.[i] with | ' ' -> pp_print_space fmt (); decode_string (i + 1) | '\n' -> if i + 1 < str_len && str.[i + 1] = '\n' then begin pp_close_box fmt (); pp_print_cut2 fmt (); pp_open_box fmt 0; decode_string (i + 2) end else begin pp_print_space fmt (); decode_string (i + 1) end | c -> pp_print_char fmt c; decode_string (i + 1) end; in pp_open_vbox fmt 0; pp_open_box fmt 0; decode_string 0; pp_close_box fmt (); if end_para then pp_print_cut2 fmt (); pp_close_box fmt () let pp_print_paraf fmt ?end_para fmt' = Printf.ksprintf (pp_print_para fmt ?end_para) fmt' let pp_print_title fmt lvl str = let pp_print_underlined c fmt str = pp_print_string fmt str; pp_print_newline fmt (); pp_print_string fmt (String.make (String.length str) c) in if lvl = 1 then pp_print_underlined '=' fmt str else if lvl = 2 then pp_print_underlined '-' fmt str else begin (* ATX style *) pp_print_string fmt (String.make lvl '#'); pp_print_string fmt str end; pp_print_endblock fmt () let pp_print_titlef fmt lvl fmt' = Printf.ksprintf (pp_print_title fmt lvl) fmt' let pp_print_def fmt term defs = pp_print_string fmt term; pp_print_newline fmt (); List.iter (fun (pp_print_e, e) -> pp_print_string fmt ": "; pp_open_box fmt 0; pp_print_e fmt e; pp_close_box fmt (); pp_print_newline fmt ()) defs; pp_print_newline fmt () oasis-0.4.11/src/ext/0000755000175000017500000000000013261073606013630 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/0000755000175000017500000000000013261073606016372 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/0000755000175000017500000000000013261073606017351 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/data/0000755000175000017500000000000013261073606020262 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/data/findlib/0000755000175000017500000000000013261073606021671 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/0000755000175000017500000000000013261073606025005 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.mllib0000644000175000017500000000341213261073606031142 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6358d6dd34f78bae610d82b2933c82f2) PluginloaderLib # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.mldylib0000644000175000017500000000341213261073606031477 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6358d6dd34f78bae610d82b2933c82f2) PluginloaderLib # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.ml0000644000175000017500000000333013261073606030452 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let registered_plugins: string list ref = ref [] oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/META0000644000175000017500000000400213261073627025455 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 35c75b8ee3f5639936c53a2c622f8b84) version = "0.4.11" description = "test library loader" archive(byte) = "pluginloaderLib.cma" archive(byte, plugin) = "pluginloaderLib.cma" archive(native) = "pluginloaderLib.cmxa" archive(native, plugin) = "pluginloaderLib.cmxs" exists_if = "pluginloaderLib.cma" # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin3/0000755000175000017500000000000013261073606023252 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.mllib0000644000175000017500000000340213261073606025653 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 476f28492db73d8d3b435d24ae78858e) Plugin3 # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.mldylib0000644000175000017500000000340213261073606026210 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 476f28492db73d8d3b435d24ae78858e) Plugin3 # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.ml0000644000175000017500000000341413261073606025167 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = PluginloaderLib.registered_plugins := "plugin3" :: !PluginloaderLib.registered_plugins oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin3/META0000644000175000017500000000412013261073627023723 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: b5de6b3ca1b30d4c5e0c52a0316b7932) version = "0.4.11" description = "test library number 3" requires = "pluginloaderLib" archive(byte) = "plugin3.cma" archive(byte, plugin) = "plugin3.cma" archive(native) = "plugin3.cmxa" archive(native, plugin) = "plugin3.cmxs" plugin_system = "pluginloader" plugin_name = "plugin3" plugin_synopsis = "third plugin" exists_if = "plugin3.cma" # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin2/0000755000175000017500000000000013261073606023251 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.mllib0000644000175000017500000000340213261073606025651 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 1f1aeaa6bfdb5dc87a2c122bd3ce5eb6) Plugin2 # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.mldylib0000644000175000017500000000340213261073606026206 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 1f1aeaa6bfdb5dc87a2c122bd3ce5eb6) Plugin2 # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.ml0000644000175000017500000000341413261073606025165 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = PluginloaderLib.registered_plugins := "plugin2" :: !PluginloaderLib.registered_plugins oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin2/META0000644000175000017500000000413113261073627023724 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 222afc524b3c02915d5bcbfd0856fb53) version = "0.4.11" description = "test library number 2" requires = "pluginloaderLib plugin1" archive(byte) = "plugin2.cma" archive(byte, plugin) = "plugin2.cma" archive(native) = "plugin2.cmxa" archive(native, plugin) = "plugin2.cmxs" plugin_system = "pluginloader" plugin_name = "plugin2" plugin_synopsis = "second plugin" exists_if = "plugin2.cma" # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin1/0000755000175000017500000000000013261073606023250 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.mllib0000644000175000017500000000340213261073606025647 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: efc9da8b11268a70c1ab38946d979286) Plugin1 # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.mldylib0000644000175000017500000000340213261073606026204 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: efc9da8b11268a70c1ab38946d979286) Plugin1 # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.ml0000644000175000017500000000341413261073606025163 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = PluginloaderLib.registered_plugins := "plugin1" :: !PluginloaderLib.registered_plugins oasis-0.4.11/src/ext/plugin-loader/test/data/findlib/plugin1/META0000644000175000017500000000412013261073627023721 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 7ebc83b121d3ec816a9cc699ab0297a5) version = "0.4.11" description = "test library number 1" requires = "pluginloaderLib" archive(byte) = "plugin1.cma" archive(byte, plugin) = "plugin1.cma" archive(native) = "plugin1.cmxa" archive(native, plugin) = "plugin1.cmxs" plugin_system = "pluginloader" plugin_name = "plugin1" plugin_synopsis = "first plugin" exists_if = "plugin1.cma" # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/test/data/PluginLoaderMain.ml0000644000175000017500000000607313261073606024014 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type action = List | Load of string list let verbose = ref false let () = let action = ref List in let () = Arg.parse ["-load", Arg.String(fun str -> action := match !action with | List -> Load [str] | Load lst -> Load (lst @ [str])), "nm Load a plugin."] ignore (Sys.executable_name^" [options*]") in let () = PluginLoader.init ["pluginloaderLib"] in let t = {PluginLoader. system = "pluginloader"; msg = fun lvl str -> let prefix = match lvl with | `Error -> "E" | `Warning -> "W" | `Debug -> "D" in if !verbose then prerr_endline (prefix^": "^str)} in try match !action with | List -> List.iter (fun entry -> print_endline (entry.PluginLoader.name^": "^ (match entry.PluginLoader.synopsis with | Some str -> str | None -> ""))) (PluginLoader.list t) | Load lst -> let _t = List.iter (PluginLoader.load t) lst in print_endline ("plugin_loaded: "^ (String.concat ", "!PluginloaderLib.registered_plugins)) with e -> prerr_endline (Printexc.to_string e); Printexc.print_backtrace stderr; exit 1 oasis-0.4.11/src/ext/plugin-loader/test/TestLoader.ml0000644000175000017500000001045113261073606021752 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit2 let pluginloader = Conf.make_exec "pluginloader" let datadir = FilePath.make_filename ["src"; "ext"; "plugin-loader"; "test"; "data"] let findlibdir = FilePath.concat datadir "findlib" let setup_findlib test_ctxt = let dn = bracket_tmpdir test_ctxt in let builddir = FilePath.make_absolute (FileUtil.pwd ()) "_build" in let buildfindlibdir = FilePath.concat builddir findlibdir in let findlibdir = FilePath.make_absolute (FileUtil.pwd ()) findlibdir in let copy_to_dn fn_dir fn = let tgt = FilePath.reparent fn_dir dn fn in FileUtil.mkdir ~parent:true (FilePath.dirname tgt); logf test_ctxt `Info "Copy file '%s' to '%s'\n%!" fn tgt; FileUtil.cp [fn] tgt in (* Find all the .mlldir in findlibdir and copy .cma/.cmxs from * the _build dir and then all the META. *) logf test_ctxt `Info "Findlib dir: %s" findlibdir; FileUtil.find (FileUtil.Or (FileUtil.Has_extension "cma", FileUtil.Has_extension "cmxs")) buildfindlibdir (fun () fn -> copy_to_dn buildfindlibdir fn) (); FileUtil.find (FileUtil.Basename_is "META") findlibdir (fun () fn -> copy_to_dn findlibdir fn) (); dn let assert_pluginloader test_ctxt dn args = let buf = Buffer.create 13 in let lst = ref [] in let ocamlpath = try FilePath.string_of_path ((FilePath.path_of_string (Sys.getenv "OCAMLPATH")) @ [dn]) with Not_found -> dn in let env = Array.append [|"OCAMLPATH="^ocamlpath|] (Unix.environment ()) in assert_command ~env ~ctxt:test_ctxt ~use_stderr:true ~foutput:(Stream.iter (function | '\n' -> lst := Buffer.contents buf :: !lst; Buffer.clear buf | c -> Buffer.add_char buf c)) (pluginloader test_ctxt) args; List.rev (Buffer.contents buf :: !lst) let () = run_test_tt_main ("PluginLoader" >::: [ "list" >:: (fun test_ctxt -> let dn = setup_findlib test_ctxt in let lst = assert_pluginloader test_ctxt dn [] in assert_equal ~printer:(String.concat ", ") ["plugin1: first plugin"; "plugin2: second plugin"; "plugin3: third plugin"; ""] lst); "load" >:: (fun test_ctxt -> let dn = setup_findlib test_ctxt in let lst = assert_pluginloader test_ctxt dn ["-load"; "plugin1"] in assert_equal ~printer:(String.concat ", ") ["plugin_loaded: plugin1"; ""] lst) ]) oasis-0.4.11/src/ext/plugin-loader/src/0000755000175000017500000000000013261073606017161 5ustar gildorgildoroasis-0.4.11/src/ext/plugin-loader/src/plugin-loader.mllib0000644000175000017500000000340713261073606022750 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6f92f061f99224a7d433dbc90f7586b7) PluginLoader # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/src/plugin-loader.mldylib0000644000175000017500000000340713261073606023305 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6f92f061f99224a7d433dbc90f7586b7) PluginLoader # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/src/PluginLoader.ml0000644000175000017500000002100413261073606022075 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* The content of this file started with ocsigen_loader.ml * from the ocsigen project (http://www.ocsigen.org). * * It was: * Copyright (C) 2008 Stéphane Glondu *) exception Dynlink_error of string * exn exception Findlib_error of string * exn exception Plugin_not_found of string (**/**) (** TODO: Gettext related functions, to be replaced by real ones. *) let s_ s = s let f_ fmt = ""^^fmt (**/**) (* Error formatting *) open Printf let () = Printexc.register_printer (function | Dynlink_error (s, Dynlink.Error e) -> Some (sprintf (f_ "Dynlink error while loading '%s': %s") s (Dynlink.error_message e)) | Findlib_error (s, Fl_package_base.No_such_package (s', msg)) -> let pkg = if s = s' then "'"^s^"'" else sprintf (f_ "'%s' [while trying to load '%s']") s' s in let additional = if msg = "" then "" else sprintf " (%s)" msg in Some (sprintf (f_ "Findlib package %s not found%s") pkg additional) | Findlib_error (s, e) -> Some (sprintf "Findlib error while handling '%s': %s" s (Printexc.to_string e)) | Plugin_not_found nm -> Some (sprintf (f_ "Plugin '%s' not found") nm) | _ -> None); module StringSet = Set.Make(String) (* Loading files *) module SetString = Set.Make(String) let findlib_packages_loaded = ref SetString.empty let add_findlib_package e = findlib_packages_loaded := SetString.add e !findlib_packages_loaded (* Fake object, to keep in the generated program a reference to CamlinternalOO. *) class foo = object end let init findlib_packages_loaded = (* TODO: only_once *) List.iter add_findlib_package findlib_packages_loaded; Findlib.init () type 'a t = { system: string; msg: ([>`Debug | `Warning | `Error] as 'a) -> string -> unit; } type entry = { findlib_name: string; name: string; synopsis: string option; version: string option; deprecated: bool; } (* Using Findlib to locate files *) let findfiles t package = let rev_split_blank str = let buf = Buffer.create 13 in let lst = ref [] in String.iter (function | ' ' -> if Buffer.length buf > 0 then begin lst := Buffer.contents buf :: !lst; Buffer.clear buf end | c -> Buffer.add_char buf c) str; begin match Buffer.contents buf with | "" -> () | str -> lst := str :: !lst end; !lst in try let preds = [if Dynlink.is_native then "native" else "byte"] in let deps = List.filter (fun a -> not (SetString.mem a !findlib_packages_loaded)) (Findlib.package_deep_ancestors preds [package]) in t.msg `Debug (sprintf (f_ "Dependencies of %s: %s") package (String.concat ", " deps)); let fix_suffix = List.rev_map (fun fn -> (* Replacing .cmx/.cmxa by .cmxs *) if Filename.check_suffix fn "cmx" || Filename.check_suffix fn "cmxa" then (Filename.chop_extension fn) ^ ".cmxs" else fn) in let rec aux = function | [] -> [] | a :: tl -> let mods = try let raw = Findlib.package_property ("plugin" :: preds) a "archive" in List.rev (fix_suffix (rev_split_blank raw)) with Not_found -> begin try let raw = Findlib.package_property preds a "archive" in List.rev (fix_suffix (rev_split_blank raw)) with Not_found -> begin t.msg `Error (sprintf (f_ "Cannot find 'archive' attribute for findlib \ package %s") a); [] end end in let base = Findlib.package_directory a in add_findlib_package a; (List.map (Findlib.resolve_path ~base) mods) @ (aux tl) in let res = aux deps in t.msg `Debug (sprintf "Object files needed: %s" (String.concat ", " res)); res with e -> raise (Findlib_error (package, e)) module SetEntry = Set.Make (struct type t = entry let compare e1 e2 = String.compare e1.name e2.name end) let list t = let lst = Fl_package_base.list_packages () in let set = List.fold_left (fun acc pkg_str -> try let pkg = Fl_package_base.query pkg_str in let package_defs = pkg.Fl_package_base.package_defs in let plugin_system = Fl_metascanner.lookup "plugin_system" [] package_defs in let default_lookup var = try Some (Fl_metascanner.lookup var [] package_defs) with Not_found -> None in let default_lookup_val var dflt = match default_lookup var with | Some str -> str | None -> dflt in if plugin_system = t.system then begin let deprecated = let str = default_lookup_val "plugin_deprecated" "false" in try bool_of_string str with Invalid_argument _ -> t.msg `Warning (sprintf "Field plugin_deprecated of plugin '%s' \ should be true or false, got %s." pkg_str str); false in let entry = { findlib_name = pkg_str; name = default_lookup_val "plugin_name" pkg_str; synopsis = default_lookup "plugin_synopsis"; version = default_lookup "version"; deprecated = deprecated; } in if SetEntry.mem entry acc then t.msg `Warning (sprintf (f_ "Plugin '%s' already defined \ (findlib name: %s; directory: '%s').") entry.name pkg_str pkg.Fl_package_base.package_dir); SetEntry.add entry acc end else begin acc end with e -> acc) SetEntry.empty lst in SetEntry.elements set let load t nm = (* TODO: critical section. *) let entry = try List.find (fun e -> e.name = nm) (list t) with Not_found -> raise (Plugin_not_found nm) in let lst = findfiles t entry.findlib_name in try List.iter Dynlink.loadfile lst with e -> raise (Dynlink_error (nm, e)) oasis-0.4.11/src/ext/plugin-loader/src/META0000644000175000017500000000404713261073627017642 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 203886afbc0d9f11f6cc5afe970996cd) version = "0.4.11" description = "OCaml plugin management using findlib" requires = "dynlink findlib" archive(byte) = "plugin-loader.cma" archive(byte, plugin) = "plugin-loader.cma" archive(native) = "plugin-loader.cmxa" archive(native, plugin) = "plugin-loader.cmxs" exists_if = "plugin-loader.cma" # OASIS_STOP oasis-0.4.11/src/ext/plugin-loader/README.txt0000644000175000017500000000041413261073606020067 0ustar gildorgildor This project helps to load plugins that has dependencies. It uses two methods to detect plugins: * using findlib, if the META file contains the right keyword * in a directory a .cma/.cmo/.cmxs file + its .plugin counterpart. Just using text files (META and .plugin) oasis-0.4.11/src/ext/README.txt0000644000175000017500000000046613261073606015334 0ustar gildorgildorThis directory contains some generic piece of code that is not really related to OASIS. The plan is to externalize this project if other projects need one of them. Don't hesitate to mail the OASIS mailing-list if you wish to externalize one of this project. Contact: oasis-devel AT lists.forge.ocamlcore.org oasis-0.4.11/src/dynrun/0000755000175000017500000000000013261073606014347 5ustar gildorgildoroasis-0.4.11/src/dynrun/dynrun.mllib0000644000175000017500000000340613261073606016712 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 62eb0a8c35367ef6905fd8a62007fe9a) OASISDynRun # OASIS_STOP oasis-0.4.11/src/dynrun/dynrun.mldylib0000644000175000017500000000340613261073606017247 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 62eb0a8c35367ef6905fd8a62007fe9a) OASISDynRun # OASIS_STOP oasis-0.4.11/src/dynrun/OASISDynRun.ml0000644000175000017500000000663613261073606016732 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Dynamic runtime for building setup.ml. We use this to reduce setup.ml replaceable section to a few lines everything else is dynamically generated. *) let () = OASISBuiltinPlugins.init () open OASISTypes let dynrun_ctxt = !BaseContext.default let setup_t = let pkg = OASISParse.from_file ~ctxt:dynrun_ctxt OASISParse.default_oasis_fn in let _, setup_t = BaseSetup.of_package ~ctxt:dynrun_ctxt ~setup_update:false OASISSetupUpdate.Dynamic pkg in setup_t (* Re-export BaseSetup.setup so one can modify setup_t before passing it to setup(). *) module BaseSetup = struct include BaseSetup let setup ~ctxt setup_t = let tmp_setup_fn = Filename.temp_file (setup_t.package.name^"-setup") ".ml" in let restored = ref false in let cleanup ~ctxt () = if not !restored then begin restored := true; BaseGenerate.restore ~ctxt (); if Sys.file_exists tmp_setup_fn then Sys.remove tmp_setup_fn end in try let _lst: 'a list = BaseGenerate.generate ~ctxt ~backup:true ~setup_fn:tmp_setup_fn ~restore:true OASISSetupUpdate.NoUpdate (OASISParse.from_file ~ctxt:!BaseContext.default OASISParse.default_oasis_fn) in at_exit (cleanup ~ctxt); let setup_t = (* Override distclean, because it remove setup.log and we need it for * BaseGenerate.restore *) {setup_t with distclean = setup_t.distclean @ [fun ~ctxt _ _ -> cleanup ~ctxt ()]} in BaseSetup.setup setup_t; cleanup ~ctxt () with e -> cleanup ~ctxt (); raise e end let setup (): unit = BaseSetup.setup ~ctxt:dynrun_ctxt setup_t oasis-0.4.11/src/cli/0000755000175000017500000000000013261073606013577 5ustar gildorgildoroasis-0.4.11/src/cli/cli.mllib0000644000175000017500000000351613261073606015374 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: ac6e1e6f98879273cf02b1c2c45604e9) CLISubCommand CLIArgExt CLICommon CLIPager CLIData CLIPluginsLoaded CLIPluginLoader # OASIS_STOP oasis-0.4.11/src/cli/cli.mldylib0000644000175000017500000000351613261073606015731 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: ac6e1e6f98879273cf02b1c2c45604e9) CLISubCommand CLIArgExt CLICommon CLIPager CLIData CLIPluginsLoaded CLIPluginLoader # OASIS_STOP oasis-0.4.11/src/cli/VersionHelp.mkd0000644000175000017500000000005113261073606016526 0ustar gildorgildorDisplay version of the oasis executable. oasis-0.4.11/src/cli/Version.ml0000644000175000017500000000410513261073606015556 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Display version of the OASIS command *) open CLISubCommand open OASISGettext let main ~ctxt () = print_endline (OASISVersion.string_of_version OASISConf.version_full) let () = CLISubCommand.register "version" ~usage:"" ~synopsis:(s_ "Display the version of the OASIS program running") ~help:CLIData.version_mkd (CLISubCommand.make_run CLISubCommand.default_fspecs main) oasis-0.4.11/src/cli/SetupHelp.mkd0000644000175000017500000000206513261073606016210 0ustar gildorgildorThis is the main subcommand of `oasis`, it compiles the `_oasis` file into a self contained `setup.ml`. The generated file handle the various step to configure, build and install your project. This command can generate 3 differents kind of `setup.ml`, depending on the `-setup-update` command line argument: * none: the default mode, it generates a standalone `setup.ml`. * dynamic: a strong dependency on the library oasis but it generates a very small `setup.ml` and almost no extra files that can be autogenerated. * weak: only triggered to regenerate setup.ml and all files when something change in `_oasis`. It has a weak dependency on the executable oasis, because it only needs it when `_oasis` is changed. The update behavior of `setup.ml` can be disabled if it is called with `ocaml setup.ml -no-update-setup-ml [...]`. If you want contributor to checkout your VCS and be able to work without oasis installed, prefer the 'weak' mode. If you want to avoid VCS history pollution, use the 'dynamic' mode. Always distribute tarball with mode 'none' oasis-0.4.11/src/cli/SetupDevHelp.mkd0000644000175000017500000000023713261073606016646 0ustar gildorgildorThis subcommand is deprecated. The subcommand Setup now embeds into `setup.ml` a checks of `_oasis` for changes. See the subcommand Setup for further details. oasis-0.4.11/src/cli/SetupDev.ml0000644000175000017500000000455713261073606015703 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Like Setup but in development mode (deprecated). @author Sylvain Le Gall *) open OASISGettext let () = CLISubCommand.register "setup-dev" ~deprecated:true ~synopsis:(ns_ "Deprecated.") ~help:CLIData.setup_dev_mkd (CLICommon.define_oasis_fn (CLISubCommand.make_run (fun () -> (["-real-oasis", Arg.Unit ignore, s_ " Deprecated"; "-run", Arg.Rest ignore, s_ " Deprecated."; "-only-setup", Arg.Set (ref false), s_ " Deprecated."], CLISubCommand.default_anon), ignore) (fun ~ctxt () oasis_fn -> failwith (s_ "The SetupDev subcommand is deprecated, use Setup")))) oasis-0.4.11/src/cli/SetupCleanHelp.mkd0000644000175000017500000000041513261073606017150 0ustar gildorgildorThis subcommand go through every generated files and remove the replaceable part in it. It also tries to clean backup files made by a failed SetupDev subcommand invocation. The replaceable part of a generated file is everything between `OASIS_START` and `OASIS_STOP`. oasis-0.4.11/src/cli/SetupClean.ml0000644000175000017500000000642413261073606016202 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Clean generated template files @author Sylvain Le Gall *) open OASISGettext open OASISFileTemplate open OASISPlugin let main ~ctxt (replace_sections, remove) oasis_fn pkg = BaseGenerate.restore ~ctxt (); if replace_sections then begin let ctxt, _ = BaseSetup.of_package ~oasis_fn ~setup_update:false OASISSetupUpdate.NoUpdate pkg in OASISFileTemplate.fold (fun tmpl () -> match tmpl.body with | Body _ | BodyWithDigest _ -> begin let _chng: file_generate_change = file_generate ~ctxt:!BaseContext.default ~remove ~backup:false {tmpl with body = Body []} in () end | NoBody -> ()) ctxt.files () end let () = CLISubCommand.register "setup-clean" (ns_ "Clean all template files from their content") CLIData.setup_clean_mkd (CLICommon.parse_oasis_fn (CLISubCommand.make_run (fun () -> let replace_sections = ref false in let remove = ref false in (["-replace-sections", Arg.Set replace_sections, s_ "Empty replace section in generated files (i.e. remove \ content between OASIS_START and OASIS_STOP)."; "-remove", Arg.Set remove, s_ "Empty remove files which have unaltered header and footer."], CLISubCommand.default_anon), (fun () -> !remove || !replace_sections, !remove)) main)) oasis-0.4.11/src/cli/Setup.ml0000644000175000017500000000752013261073606015235 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Create the configure, build and install system @author Sylvain Le Gall *) open OASISGettext open OASISUtils open OASISSetupUpdate let fspecs () = let roasis_exec = ref None in let rupdate = ref NoUpdate in let rnocompat = ref false in let specs = [ "-real-oasis", Arg.Unit (fun () -> roasis_exec := Some (Sys.executable_name)), s_ " Use the real 'oasis' executable filename when generating \ setup.ml."; "-setup-update", Arg.Symbol (["none"; "weak"; "dynamic"], (function | "none" -> rupdate := NoUpdate | "weak" -> rupdate := Weak | "dynamic" -> rupdate := Dynamic | str -> failwithf (f_ "Unknown setup-update mode %S") str)), s_ " Define the way `setup.ml` should update when `_oasis` change."; "-nocompat", Arg.Unit (fun () -> rnocompat := true), s_ " Don't generate compatibility layer in `setup.ml`."; ] in (specs, CLISubCommand.default_anon), (fun () -> !roasis_exec, !rupdate, !rnocompat) let main ~ctxt (oasis_exec, update, nocompat) oasis_fn pkg = let oasis_setup_args = List.flatten [ if oasis_exec <> None then ["-real-oasis"] else []; if ctxt.OASISContext.ignore_plugins then ["-ignore-plugins"] else []; if oasis_fn <> OASISParse.default_oasis_fn then ["-oasis"; oasis_fn] else []; if update = Weak then ["-setup-update"; "weak"] else if update = Dynamic then ["-setup-update"; "dynamic"] else []; if nocompat then ["-no-compat"] else []; ] in let _chngs: OASISFileTemplate.file_generate_change list = BaseGenerate.generate ~ctxt ~backup:false ~setup_fn:BaseSetup.default_filename ~restore:false ~oasis_fn ?oasis_exec ~oasis_setup_args ~nocompat update pkg in () let () = CLISubCommand.register "setup" (ns_ "Translate _oasis into a build system") CLIData.setup_mkd (CLICommon.parse_oasis_fn (CLISubCommand.make_run fspecs main)) oasis-0.4.11/src/cli/QuickstartHelp.mkd0000644000175000017500000000051313261073606017236 0ustar gildorgildorThis subcommand is a helper to write `_oasis` file. It asks a serie of questions to create an initial `_oasis` file. The questions depend on the level of the user, you can set this level with the `-level` command line option. At the end of the process, you have the possibility to edit, to display or to write the generated file. oasis-0.4.11/src/cli/Quickstart.ml0000644000175000017500000000563313261073606016272 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Run a oasis writer helper @author Sylvain Le Gall *) open OASISGettext open OASISQuickstart open OASISTypes open CLISubCommand let main ~ctxt (qckstrt_lvl, interf, setup_data) oasis_fn = let post_run () = let pkg = OASISParse.from_file ~ctxt oasis_fn in Setup.main ~ctxt setup_data oasis_fn pkg in OASISQuickstart.to_file ~ctxt oasis_fn qckstrt_lvl interf post_run let fspecs () = let (specs, anon), gen = Setup.fspecs () in let lvls = [ "beginner", Beginner; "intermediate", Intermediate; "expert", Expert; ] in let qckstrt_lvl = ref Beginner in let interf = ref Human in let specs' = ["-level", Arg.Symbol ((List.map fst lvls), (fun s -> qckstrt_lvl := List.assoc s lvls)), (s_ " Quickstart level, skip questions according to this \ level."); "-machine", Arg.Unit (fun () -> interf := Machine), (s_ " Computer readable questions for automatic completion.")] @ specs in let gen' () = !qckstrt_lvl, !interf, gen () in (specs', anon), gen' let () = CLISubCommand.register "quickstart" (ns_ "Launch a helper to write `_oasis` file") CLIData.quickstart_mkd (CLICommon.define_oasis_fn (CLISubCommand.make_run fspecs main)) oasis-0.4.11/src/cli/Query_types.ml0000644000175000017500000000363413261073606016470 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type field = string type field_name = string type section_kind = string type section_name = string type t = | QueryListSections | QueryListFields | QueryField of field_name | QuerySectionField of section_kind * section_name * field_name oasis-0.4.11/src/cli/Query_parser.mly0000644000175000017500000000413313261073606017004 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ %{ open Query_types %} %token ID %token STR %token LPAREN RPAREN %token DOT %token EOF %start main %type main %% main: | ID LPAREN value RPAREN DOT ID EOF { QuerySectionField($1, $3, $6) } | ID EOF { match $1 with | "ListSections" -> QueryListSections | "ListFields" -> QueryListFields | s -> QueryField(s) } ; value: | ID { $1 } | STR { $1 } ; oasis-0.4.11/src/cli/Query_lexer.mll0000644000175000017500000000422013261073606016607 0ustar gildorgildor(********************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (********************************************************************************) { open Query_parser } rule token = parse [' ''\t''\n'] { token lexbuf } | ['A'-'Z' 'a'-'z' '0'-'9' '_']+ as lxm { ID lxm } | '"' { STR (str (Buffer.create 13) lexbuf) } | '(' { LPAREN } | ')' { RPAREN } | '.' { DOT } | eof { EOF } and str buf = parse '\\' '"' {Buffer.add_char buf '"'; str buf lexbuf} | '"' {Buffer.contents buf} | _ as c {Buffer.add_char buf c; str buf lexbuf} oasis-0.4.11/src/cli/QueryHelp.mkd0000644000175000017500000000102513261073606016210 0ustar gildorgildorThis subcommand load an `_oasis` file and search its content for information. The query string follow this convention: * `ListSections`: return all the section found * `ListFields`: return all the fields, it recurses through sections * field: search for this field in the toplevel * section.field: search for this field in the section Query examples: * version: return the version * executable("test").install: return the field "install" of the executable "test". You can use multiple queries, they will be executed in order. oasis-0.4.11/src/cli/Query.ml0000644000175000017500000001301713261073606015240 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Load and query _oasis file @author Sylvain Le Gall *) open OASISGettext open OASISTypes open OASISSection open OASISUtils open Query_types let query pkg separator str = let proplist_schema schm = (* TODO: oops access to unpublished module _intern *) schm.OASISSchema_intern.schm in let assoc_sections = [ "Library", (`Library, proplist_schema OASISLibrary.schema); "Executable", (`Executable, proplist_schema OASISExecutable.schema); "Flag", (`Flag, proplist_schema OASISFlag.schema); "SrcRepo", (`SrcRepo, proplist_schema OASISSourceRepository.schema); "Test", (`Test, proplist_schema OASISTest.schema); "Doc", (`Doc, proplist_schema OASISDocument.schema); ] in let mk_section sct = let knd, nm = OASISSection.section_id sct in let start, (_, schm) = List.find (fun (_, (knd', _)) -> knd = knd') assoc_sections in let fmt = if OASISUtils.is_varname nm then Printf.sprintf "%s(%s)" else Printf.sprintf "%s(%S)" in fmt start nm, schm in let q = let lexbuf = Lexing.from_string str in Query_parser.main Query_lexer.token lexbuf in match q with | QueryField fld -> begin PropList.Schema.get (proplist_schema OASISPackage.schema) pkg.schema_data fld end | QuerySectionField (knd, nm, fld) -> begin let kind, schm = try List.assoc (OASISString.lowercase_ascii knd) (List.map (fun (nm, e) -> OASISString.lowercase_ascii nm, e) assoc_sections) with Not_found -> failwithf (f_ "Don't know section kind '%s' in query '%s'") knd str in let sct = OASISSection.section_find (kind, nm) pkg.sections in let data = (OASISSection.section_common sct).cs_data in PropList.Schema.get schm data fld end | QueryListSections -> begin String.concat separator (List.map (fun sct -> fst (mk_section sct)) pkg.sections) end | QueryListFields -> begin let fold_schm prefix schm data acc = PropList.Schema.fold (fun acc nm extra _ -> try let _v: string = PropList.Schema.get schm data nm in match extra.OASISSchema_intern.feature with | Some ftr -> if OASISFeatures.package_test ftr pkg then (prefix^nm) :: acc else acc | None -> (prefix^nm) :: acc with _ -> acc) acc schm in let lst = List.fold_left (fun acc sct -> let prefix, schm = mk_section sct in let data = (section_common sct).cs_data in fold_schm (prefix^".") schm data acc) (* Start with the package fields *) (fold_schm "" (proplist_schema OASISPackage.schema) pkg.schema_data []) (* Continue with section fields *) pkg.sections in String.concat separator (List.rev lst) end let main ~ctxt:_ (queries, separator) _ pkg = let answers = List.rev_map (query pkg separator) queries in print_endline (String.concat separator answers) let () = CLISubCommand.register "query" ~usage:(ns_ "[options*] query*") ~synopsis:(ns_ "Query an _oasis file") ~help:CLIData.query_mkd (CLICommon.parse_oasis_fn (CLISubCommand.make_run (fun () -> let separator = ref "\n" in let queries = ref [] in (["-separator", Arg.Set_string separator, s_ "str String to add between answers."], (fun e -> queries := e :: !queries)), (fun () -> !queries, !separator)) main)) oasis-0.4.11/src/cli/ManualHelp.mkd0000644000175000017500000000055713261073606016331 0ustar gildorgildorThis subcommand print the manual of OASIS. It uses the [markdown][] syntax to print it and more precisely the [pandoc][] extension of this syntax. [markdown]: http://daringfireball.net/projects/markdown/ [pandoc]: http://johnmacfarlane.net/pandoc/ This manual describes the command line tool `oasis`, the `_oasis` file format and the generated `setup.ml` file. oasis-0.4.11/src/cli/Manual.ml0000644000175000017500000000543513261073606015355 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Display the manual @author Sylvain Le Gall *) open CLISubCommand open OASISGettext open CLIArgExt let main ~ctxt output = let fmt, fclose = match output with | Some fn -> let chn = open_out fn in Format.formatter_of_out_channel chn, (fun () -> close_out chn) | None -> let pager, fmt = CLIPager.open_out () in fmt, (fun () -> CLIPager.close_out pager) in OASISHelp.pp_print_help fmt (* CLI help *) (pp_print_help ~ctxt AllSubCommand Markdown) (* Fields from schema *) BaseEnv.schema (* Environment variable *) (let lst = BaseEnv.var_all () in fun nm _ -> List.mem nm lst); fclose () let () = CLISubCommand.register "manual" (ns_ "Display user manual") CLIData.manual_mkd (CLISubCommand.make_run (fun () -> let output = ref None in (["-o", Arg.String (fun s -> output := Some s), "fn Output manual to filename."], CLISubCommand.default_anon), (fun () -> !output)) main) oasis-0.4.11/src/cli/MainHelp.mkd0000644000175000017500000000046713261073606016000 0ustar gildorgildorThis program allows to manipulate OASIS enabled package, i.e. package that contains an `_oasis` file. It is made of several subcommands that provide features around this file. Some subcommands require the installation of third party plugins. You need to specify a subcommand as defined in the following above. oasis-0.4.11/src/cli/Main.ml0000644000175000017500000000503713261073606015022 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Main for OASIS *) open OASISTypes open OASISUtils open OASISPlugin open OASISBuiltinPlugins open BaseMessage open CLISubCommand open Format open FormatExt open Setup open SetupDev open SetupClean open Quickstart open Manual open Check open Query open Version open Help let () = (* Run subcommand *) try OASISBuiltinPlugins.init (); CLIArgExt.parse_and_run () with e -> begin if Printexc.backtrace_status () then Printexc.print_backtrace stderr; begin match e with | Failure str -> error "%s" str | e -> begin error "%s" (Printexc.to_string e); if Printexc.backtrace_status () then List.iter (debug "%s") (OASISString.nsplit (Printexc.get_backtrace ()) '\n') end end; exit 1 end oasis-0.4.11/src/cli/HelpHelp.mkd0000644000175000017500000000011113261073606015766 0ustar gildorgildorThis subcommand display help of other subcommands or of all subcommands. oasis-0.4.11/src/cli/Help.ml0000644000175000017500000000465413261073606015032 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Help on subcommands *) open CLISubCommand open CLIArgExt open OASISGettext let main ~ctxt scmd_name = let hext = match scmd_name with | None -> NoSubCommand | Some "all" -> AllSubCommand | Some nm -> (SubCommand nm) in let pager, fmt = CLIPager.open_out () in try pp_print_help ~ctxt hext Output fmt (); CLIPager.close_out pager with e -> CLIPager.close_out pager; raise e let () = CLISubCommand.register "help" ~synopsis:(ns_ "Display help for a subcommand") ~help:CLIData.help_mkd ~usage:(ns_ "[subcommand|all]") (CLISubCommand.make_run (fun () -> let scmd_name = ref None in ([], (fun s -> scmd_name := Some s)), (fun () -> !scmd_name)) main) oasis-0.4.11/src/cli/CheckHelp.mkd0000644000175000017500000000010113261073606016112 0ustar gildorgildorThis subcommand load an `_oasis` file and apply standard checks. oasis-0.4.11/src/cli/Check.ml0000644000175000017500000000410113261073606015142 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Check an _oasis file @author Sylvain Le Gall *) open OASISGettext open CLISubCommand let main ~ctxt () oasis_fn pkg = (* Side effect of parsing pkg, it is already checked. *) () let () = CLISubCommand.register "check" (ns_ "Check an _oasis file") CLIData.check_mkd (CLICommon.parse_oasis_fn (CLISubCommand.make_run CLISubCommand.default_fspecs main)) oasis-0.4.11/src/cli/CLISubCommand.mli0000644000175000017500000001021613261073606016662 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** SubCommand definition @author Sylvain Le Gall *) open OASISTypes (** Define the command line arguments required for a subcommand. *) type cli_parsing_t = (Arg.key * Arg.spec * Arg.doc) list * Arg.anon_fun (** Function to run after parsing command line arguments. *) type 'a cli_parsing_post_t = unit -> 'a (** The main function to run the subcommand. *) type 'a main_t = ctxt:OASISContext.t -> 'a (** Generate command line arguments and the function to run the main of the subcommand. *) type 'a run_t = unit -> cli_parsing_t * 'a main_t type t = { scmd_name: name; (** Name of the subcommand, used to call it *) scmd_synopsis: string; (** Short description of the subcommnad, displayed when doing a summary of the available subcommands *) scmd_help: string; (** Long description of the subcommand, displayed when showing help of the subcommand. It can contains variable substitution as defined in [Buffer.add_substitute]. *) scmd_usage: string; (** [Arg] usage text *) scmd_deprecated: bool; (** Is this subcommand deprecated. *) scmd_run: unit run_t; (** Generate the specs and a main function. *) } val default_anon: Arg.anon_fun val default_fspecs: (unit -> cli_parsing_t * unit cli_parsing_post_t) (** Produces an empty list of specs. See also {!OASISContext.fspecs} *) (** [make_run fspecs main] Create a [run_t] by combining argument parsing with the main function. The goal is to make [main] not use global variable and create what is need to store them in fspecs. This allow to make the whole subcommand invocation thread safe. *) val make_run: (unit -> cli_parsing_t * 'a cli_parsing_post_t) -> ('a -> 'b) main_t -> 'b run_t (** [register ~usage name synopsis help run] Create a subcommand using provided data, see {!t} for their meanings. See {!make_run} to define a run function. You can also see {!CLICommon} for useful functions to wrap your [run]. *) val register: ?usage:string -> ?deprecated:bool -> name -> synopsis:string -> help:string -> unit run_t -> unit (** Find a subcommand. *) val find: name -> t (** List all PluginLoader entries registered. Set [deprecated] to false to filter out deprecated plugin *) val list_plugin: ?deprecated:bool -> unit -> PluginLoader.entry list (** List all builtin plugin registered. Set [deprecated] to false to filter out deprecated builtin. *) val list_builtin: ?deprecated:bool -> unit -> t list oasis-0.4.11/src/cli/CLISubCommand.ml0000644000175000017500000001313313261073606016512 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISUtils open OASISGettext type cli_parsing_t = (Arg.key * Arg.spec * Arg.doc) list * Arg.anon_fun type 'a cli_parsing_post_t = unit -> 'a type 'a main_t = ctxt:OASISContext.t -> 'a type 'a run_t = unit -> cli_parsing_t * 'a main_t type t = { scmd_name: string; scmd_synopsis: string; scmd_help: string; scmd_usage: string; scmd_deprecated: bool; scmd_run: unit run_t; } type registered_t = Builtin of t | Plugin of (PluginLoader.entry * t option) (** Default values for anon and specs. *) let default_usage = ns_ "[options*]" let default_anon = failwithf (f_ "Don't know what to do with '%s'.") let default_fspecs () = ([], default_anon), (fun () -> ()) let make_run (fspecs: unit -> cli_parsing_t * 'a cli_parsing_post_t) (main: ('a -> 'b) main_t) () = let cli_parsing, cli_parsing_post = fspecs () in let main' ~ctxt = let a = cli_parsing_post () in main ~ctxt a in cli_parsing, main' (* TODO: protect with mutex. *) let all = Hashtbl.create 20 (* TODO: protect with synchronisation. *) let loading_plugin = ref None let () = List.iter (fun e -> Hashtbl.add all e.PluginLoader.name (Plugin(e, None))) (PluginLoader.list (CLIPluginLoader.plugin_cli_t ())) let register ?(usage=default_usage) ?(deprecated=false) nm ~synopsis ~help run = let merge_option opt txt = match opt with | Some txt -> txt | None -> txt in let t = { scmd_name = nm; scmd_synopsis = synopsis; scmd_help = help; scmd_usage = usage; scmd_deprecated = deprecated; scmd_run = run; } in try match Hashtbl.find all t.scmd_name with | Plugin (e, None) -> let t' = {t with scmd_synopsis = merge_option e.PluginLoader.synopsis t.scmd_synopsis; scmd_deprecated = e.PluginLoader.deprecated || t.scmd_deprecated} in Hashtbl.replace all t.scmd_name (Plugin(e, Some t')) | Builtin _ -> failwithf (f_ "Trying to double-register the builtin subcommand %s.") t.scmd_name | Plugin (e, Some _) -> failwithf (f_ "Trying to double-register the plugin subcommand %s (%s).") nm (e.PluginLoader.findlib_name) with Not_found -> match !loading_plugin with | None -> Hashtbl.add all t.scmd_name (Builtin t) | Some findlib_name -> failwithf (f_ "Trying to register unknown plugin subcommand %s within loading \ of %s.") nm findlib_name let find nm = let load_plugin nm = match !loading_plugin with | Some nm' -> failwithf (f_ "Recursive loading of plugins (%s and %s).") nm nm' | None -> loading_plugin := Some nm; PluginLoader.load (CLIPluginLoader.plugin_cli_t ()) nm; loading_plugin := None in let rec find' retry = try match Hashtbl.find all nm with | Builtin t | Plugin(_, Some t) -> t | Plugin(e, None) -> if retry then failwithf (f_ "Loading findlib %s should register subcommand %s, but the \ loading didn't registered it.") e.PluginLoader.findlib_name nm; load_plugin nm; find' true with Not_found -> failwithf (f_ "Subcommand '%s' doesn't exist") nm in find' false let list_plugin ?(deprecated=true) () = Hashtbl.fold (fun _ v acc -> match v with | Builtin _ -> acc | Plugin(e, _) -> if deprecated || not e.PluginLoader.deprecated then e :: acc else acc) all [] let list_builtin ?(deprecated=true) () = let lst = Hashtbl.fold (fun _ v acc -> match v with | Builtin t -> if deprecated || not t.scmd_deprecated then t :: acc else acc | Plugin(_, _) -> acc) all [] in lst oasis-0.4.11/src/cli/CLIPluginLoader.ml0000644000175000017500000000444113261073606017051 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = PluginLoader.init CLIPluginsLoaded.exec_oasis_build_depends_rec (** Plugin for the command line. *) let plugin_cli_t () = { PluginLoader. system = "oasis-cli"; msg = (fun lvl str -> OASISMessage.generic_message ~ctxt:!BaseContext.default lvl "%s" str) } (** Plugin for OASIS. *) let plugin_t () = { PluginLoader. system = "oasis"; msg = (fun lvl str -> OASISMessage.generic_message ~ctxt:!BaseContext.default lvl "%s" str) } let load_oasis_plugin nm = try PluginLoader.load (plugin_t ()) nm; true with PluginLoader.Plugin_not_found _ -> false oasis-0.4.11/src/cli/CLIPager.ml0000644000175000017500000000554613261073606015531 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Handle 'pager' command *) open BaseMessage open OASISGettext open OASISUtils let pager_cmd = try Some (try Sys.getenv "OASIS_PAGER" with Not_found -> begin try Sys.getenv "PAGER" with Not_found -> OASISFileUtil.which ~ctxt:!BaseContext.default "pager" end) with Not_found -> None let open_out () = let buf = Buffer.create 13 in let fmt = Format.formatter_of_buffer buf in (buf, fmt), fmt let close_out (buf, fmt) = let () = Format.pp_print_flush fmt () in match pager_cmd with | Some cmd -> begin let proc = Unix.open_process_out cmd in let () = Buffer.output_buffer proc buf in match Unix.close_process_out proc with | Unix.WEXITED 0 -> () | Unix.WEXITED n | Unix.WSIGNALED n | Unix.WSTOPPED n -> failwithf (f_ "Command %S exited with error code %d") cmd n end | None -> begin warning "%s" "Environment variable OASIS_PAGER not set."; Buffer.output_buffer stdout buf end oasis-0.4.11/src/cli/CLIData.mlify0000644000175000017500000000060613261073606016044 0ustar gildorgildorVarString manual_mkd "ManualHelp.mkd" VarString setup_mkd "SetupHelp.mkd" VarString setup_dev_mkd "SetupDevHelp.mkd" VarString setup_clean_mkd "SetupCleanHelp.mkd" VarString quickstart_mkd "QuickstartHelp.mkd" VarString main_mkd "MainHelp.mkd" VarString help_mkd "HelpHelp.mkd" VarString check_mkd "CheckHelp.mkd" VarString query_mkd "QueryHelp.mkd" VarString version_mkd "VersionHelp.mkd" oasis-0.4.11/src/cli/CLICommon.mli0000644000175000017500000000371313261073606016066 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open CLISubCommand (** Add arguments to define where is located '_oasis'. *) val define_oasis_fn: ((OASISTypes.host_filename -> 'a) run_t) -> ('a run_t) (** Locate '_oasis' and parse it. *) val parse_oasis_fn: ((OASISTypes.host_filename -> OASISTypes.package -> 'a) run_t) -> ('a run_t) oasis-0.4.11/src/cli/CLICommon.ml0000644000175000017500000000436013261073606015714 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Common arguments *) open OASISGettext let define_oasis_fn f () = let oasis_fn = ref OASISParse.default_oasis_fn in let specs' = "-oasis", Arg.Set_string oasis_fn, s_ "fn _oasis file to use."; in let wrap g ~ctxt = g ~ctxt !oasis_fn in let (specs, anon), run = f () in (specs' :: specs, anon), wrap run let parse_oasis_fn f = define_oasis_fn (fun () -> let wrap g ~ctxt fn = let pkg = OASISParse.from_file ~ctxt fn in g ~ctxt fn pkg in let (specs, anon), run = f () in (specs, anon), wrap run) oasis-0.4.11/src/cli/CLIArgExt.ml0000644000175000017500000002625713261073606015667 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Parsing of command line arguments *) open OASISGettext open OASISMessage open CLISubCommand open OASISUtils open Format open FormatExt type help_extent = | NoSubCommand | SubCommand of string | AllSubCommand type help_style = | Markdown | Output let usage_msg = Printf.sprintf (f_ "\ OASIS v%s (C) 2009-2014 OCamlCore SARL, Sylvain Le Gall oasis [global-options*] subcommand [subcommand-options*] Environment variables: OASIS_PAGER: pager to use to display long textual output. Global command line options:") (OASISVersion.string_of_version OASISConf.version_full) let fspecs = OASISContext.fspecs let pp_print_help ~ctxt hext hsty fmt () = (* Print with a precise length *) let pp_print_justified sz fmt str = let padding = String.make (sz - String.length str) ' ' in pp_print_string fmt (str ^ padding) in (* Print definition for the output style *) let pp_print_output_def sz fmt (term, def) = pp_print_string fmt " "; pp_print_justified sz fmt term; pp_print_string fmt " "; pp_open_box fmt 0; pp_print_string_spaced fmt def; pp_close_box fmt (); pp_print_newline fmt () in let pp_print_specs spec_help fmt specs = let help_specs = List.rev_append (List.rev_map (fun (cli, t, hlp) -> let arg, hlp = match OASISString.nsplit hlp ' ' with | hd :: tl -> hd, (String.concat " " tl) | [] -> "", "" in let arg = match t with | Arg.Symbol (lst, _) -> "{"^(String.concat "|" lst)^"}" | _ -> arg in let term = if arg <> "" then cli^" "^arg else cli in term, hlp) specs) (if spec_help then ["-help|--help", s_ "Display this list of options"] else []) in let sz = List.fold_left (fun acc (s, _) -> max (String.length s) acc) 0 help_specs in let pp_print_spec fmt (term, hlp) = match hsty with | Markdown -> pp_print_def fmt ("`"^term^"`") [pp_print_string_spaced, hlp] | Output -> pp_print_output_def sz fmt (term, hlp) in pp_print_list pp_print_spec "" fmt help_specs; if hsty = Output then pp_print_newline fmt () in let pp_print_scmds fmt () = let scmds = List.rev_map (fun scmd -> scmd.scmd_name, `Builtin scmd) (CLISubCommand.list_builtin ~deprecated:false ()) in let plugin_scmds = if not ctxt.OASISContext.ignore_plugins then List.rev_map (fun plugin -> plugin.PluginLoader.name, `Plugin plugin) (CLISubCommand.list_plugin ~deprecated:false ()) else [] in let all_scmds = List.sort (fun (nm1, _) (nm2, _) -> String.compare nm1 nm2) (List.rev_append scmds plugin_scmds) in let sz = (* Compute max size of the name. *) List.fold_left (fun sz (nm, _) -> max sz (String.length nm)) 0 all_scmds in let plugin_synopsis plg = match plg.PluginLoader.synopsis with | Some e -> e | None -> "No synopsis" in let plugin_markdown_data plg = let lst = match plg.PluginLoader.version with | Some v -> ["Version: "^v] | None -> [] in (plugin_synopsis plg) :: ("Findlib: "^plg.PluginLoader.findlib_name) :: lst in let plugin_output_data plg = let findlib_name = plg.PluginLoader.findlib_name in let synopsis = plugin_synopsis plg in match plg.PluginLoader.version with | Some ver_str -> Printf.sprintf "%s (%s v%s)" synopsis findlib_name ver_str | None -> Printf.sprintf "%s (%s)" synopsis findlib_name in pp_print_para fmt (s_ "Available subcommands:"); List.iter (fun (name, e) -> match hsty, e with | Markdown, `Builtin scmd -> pp_print_def fmt ("`"^name^"`") [pp_print_string_spaced, scmd.scmd_synopsis] | Markdown, `Plugin plg -> pp_print_def fmt ("`"^name^"`") (List.map (fun s -> pp_print_string_spaced, s) (plugin_markdown_data plg)) | Output, `Builtin scmd -> pp_print_output_def sz fmt (name, scmd.scmd_synopsis) | Output, `Plugin plg -> pp_print_output_def sz fmt (name, plugin_output_data plg)) all_scmds; if hsty = Output then pp_print_newline fmt () in let pp_print_scmd fmt ~global_options ?origin scmd = let (scmd_specs, _), _ = scmd.scmd_run () in if not scmd.scmd_deprecated then pp_print_title fmt 2 (Printf.sprintf (f_ "Subcommand %s") scmd.scmd_name) else pp_print_title fmt 2 (Printf.sprintf (f_ "Subcommand %s (deprecated)") scmd.scmd_name); begin match origin with | Some (`Plugin plg) -> fprintf fmt "@[__Version__: %s
@,__Findlib__: %s
@]" (match plg.PluginLoader.version with | Some ver_str -> ver_str | None -> "undefined") plg.PluginLoader.findlib_name; | Some `Builtin | None -> () end; pp_print_string fmt scmd.scmd_help; pp_print_endblock ~check_last_char:scmd.scmd_help fmt (); fprintf fmt (f_ "Usage: oasis [global-options*] %s %s") scmd.scmd_name (s_ scmd.scmd_usage); pp_print_endblock fmt (); if global_options then begin pp_print_para fmt (s_ "Global options: "); pp_print_specs true fmt (fst (fspecs ())) end; if scmd_specs <> [] then begin pp_print_para fmt (s_ "Options: "); pp_print_specs false fmt scmd_specs end in (* Write general introduction. *) begin match hext with | NoSubCommand | AllSubCommand -> begin pp_print_string fmt usage_msg; pp_print_endblock fmt (); pp_print_string fmt CLIData.main_mkd; pp_print_endblock ~check_last_char:CLIData.main_mkd fmt (); pp_print_specs true fmt (fst (fspecs ())); pp_print_scmds fmt (); end | SubCommand _ -> () end; (* Write body, focusing on specific command selected. *) begin match hext with | NoSubCommand -> () | SubCommand nm -> pp_print_scmd fmt ~global_options:true (CLISubCommand.find nm) | AllSubCommand -> let scmds = List.rev_map (fun scmd -> scmd, `Builtin) (CLISubCommand.list_builtin ~deprecated:false ()) in let plugin_scmds = if not ctxt.OASISContext.ignore_plugins then List.rev_map (fun plugin -> CLISubCommand.find plugin.PluginLoader.name, `Plugin plugin) (CLISubCommand.list_plugin ~deprecated:false ()) else [] in List.iter (fun (scmd, origin) -> pp_print_scmd fmt ~global_options:false ~origin scmd) (List.sort (fun (scmd1, _) (scmd2, _) -> String.compare scmd1.scmd_name scmd2.scmd_name) (List.rev_append plugin_scmds scmds)) end let parse_and_run () = let pos = ref 0 in (* Common args. *) let ctxt_specs, ctxt_gen = fspecs () in let ctxt_gen () = {(ctxt_gen ()) with OASISContext.load_oasis_plugin = CLIPluginLoader.load_oasis_plugin} in (* Choose a command. *) let scmd = ref None in let scmd_args = ref [||] in let set_scmd s = scmd := Some (CLISubCommand.find s); (* Get the rest of arguments *) scmd_args := Array.sub Sys.argv !pos ((Array.length Sys.argv) - !pos); (* Skip arguments *) pos := !pos + Array.length !scmd_args in let handle_error exc hext = let get_bad str = match OASISString.split_newline ~do_trim:false str with | fst :: _ -> fst | [] -> s_ "Unknown error on the command line" in match exc with | Arg.Bad txt -> pp_print_help ~ctxt:(ctxt_gen ()) hext Output err_formatter (); prerr_newline (); prerr_endline (get_bad txt); exit 2 | Arg.Help txt -> pp_print_help ~ctxt:(ctxt_gen ()) hext Output std_formatter (); exit 0 | e -> raise e in (* Parse global options and set scmd *) let () = try Arg.parse_argv ~current:pos Sys.argv (Arg.align ctxt_specs) set_scmd usage_msg with e -> handle_error e NoSubCommand in (* Parse subcommand options *) let scmd = match !scmd with | Some scmd -> scmd | None -> failwith (s_ "No subcommand defined, call 'oasis help' for help") in let (scmd_specs, scmd_anon), main = scmd.scmd_run () in let () = try Arg.parse_argv ~current:(ref 0) !scmd_args (Arg.align scmd_specs) scmd_anon (Printf.sprintf (f_ "Subcommand %s options:\n") scmd.scmd_name) with e -> handle_error e (SubCommand scmd.scmd_name) in let ctxt = ctxt_gen () in if scmd.scmd_deprecated then warning ~ctxt "Subcommand %s is deprecated." scmd.scmd_name; main ~ctxt oasis-0.4.11/src/builtin-plugins.mllib0000644000175000017500000000510513261073606017177 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 1faad5f5152bd9637e893d82e983eb23) OASISBuiltinPlugins plugins/extra/META/METAPlugin plugins/internal/InternalConfigurePlugin plugins/internal/InternalInstallPlugin plugins/none/NonePlugin plugins/ocamlbuild/OCamlbuildPlugin plugins/ocamlbuild/OCamlbuildDocPlugin plugins/ocamlbuild/OCamlbuildCommon plugins/custom/CustomPlugin plugins/extra/devfiles/DevFilesPlugin plugins/extra/stdfiles/StdFilesPlugin plugins/omake/OMakePlugin plugins/none/NoneData plugins/internal/InternalData plugins/internal/InternalId plugins/ocamlbuild/OCamlbuildData plugins/ocamlbuild/OCamlbuildId plugins/ocamlbuild/MyOCamlbuildBase plugins/ocamlbuild/MyOCamlbuildFindlib plugins/custom/CustomData plugins/extra/META/METAData plugins/extra/devfiles/DevFilesData plugins/extra/stdfiles/StdFilesData plugins/omake/OMakeData plugins/omake/OMakeFields plugins/omake/OMakeEquip plugins/omake/OMakeFormat # OASIS_STOP oasis-0.4.11/src/builtin-plugins.mldylib0000644000175000017500000000510513261073606017534 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 1faad5f5152bd9637e893d82e983eb23) OASISBuiltinPlugins plugins/extra/META/METAPlugin plugins/internal/InternalConfigurePlugin plugins/internal/InternalInstallPlugin plugins/none/NonePlugin plugins/ocamlbuild/OCamlbuildPlugin plugins/ocamlbuild/OCamlbuildDocPlugin plugins/ocamlbuild/OCamlbuildCommon plugins/custom/CustomPlugin plugins/extra/devfiles/DevFilesPlugin plugins/extra/stdfiles/StdFilesPlugin plugins/omake/OMakePlugin plugins/none/NoneData plugins/internal/InternalData plugins/internal/InternalId plugins/ocamlbuild/OCamlbuildData plugins/ocamlbuild/OCamlbuildId plugins/ocamlbuild/MyOCamlbuildBase plugins/ocamlbuild/MyOCamlbuildFindlib plugins/custom/CustomData plugins/extra/META/METAData plugins/extra/devfiles/DevFilesData plugins/extra/stdfiles/StdFilesData plugins/omake/OMakeData plugins/omake/OMakeFields plugins/omake/OMakeEquip plugins/omake/OMakeFormat # OASIS_STOP oasis-0.4.11/src/base/0000755000175000017500000000000013261073606013742 5ustar gildorgildoroasis-0.4.11/src/base/dynrun_for_release.ml0000644000175000017500000000563613261073606020173 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* Load topfind with checks. *) let () = begin try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () end; (* Create a reference error to compare it with a real load. *) let ref_error = let str = (* It should be impossible to have a file with \000 in it, hence it should * fail. *) Topdirs.dir_use Format.str_formatter "topfin\000"; Format.flush_str_formatter () in for i = 0 to (String.length str) - 1 do if str.[i] = '\000' then str.[i] <- 'd' done; str in let status = Topdirs.dir_use Format.str_formatter "topfind"; Format.flush_str_formatter () in if status = ref_error then failwith "Unable to load 'topfind'. Please install findlib and check that \ topfind.cmo is present." ;; (* Check presence of oasis.dynrun. *) let () = try let _str : string = Findlib.package_directory "oasis.dynrun" in () with Fl_package_base.No_such_package (_, _) -> failwith "Cannot load findlib package 'oasis.dynrun'. Please install \ oasis (>= 0.3.0) and check that 'oasis.dynrun' is present \ in the list of findlib packages (`ocamlfind list`)." ;; #require "oasis.dynrun";; open OASISDynRun;; oasis-0.4.11/src/base/dynrun.ml0000644000175000017500000000351213261073606015614 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;; #use "topfind";; #require "oasis.dynrun";; open OASISDynRun;; oasis-0.4.11/src/base/compiled_setup_ml.ml0000644000175000017500000000326713261073606020010 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISDynRun oasis-0.4.11/src/base/base.mllib0000644000175000017500000000371413261073606015702 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 0fe2c29d0e142b5eb3d9f7fdf0a342bc) BaseArgExt BaseBuilt BaseCheck BaseCustom BaseData BaseDoc BaseEnvLight BaseEnv BaseFileAB BaseGenerate BaseLog BaseOCamlcConfig BaseSetup BaseStandardVar BaseTest BaseDynVar BaseMessage BaseContext BaseCompat # OASIS_STOP oasis-0.4.11/src/base/base.mldylib0000644000175000017500000000371413261073606016237 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 0fe2c29d0e142b5eb3d9f7fdf0a342bc) BaseArgExt BaseBuilt BaseCheck BaseCustom BaseData BaseDoc BaseEnvLight BaseEnv BaseFileAB BaseGenerate BaseLog BaseOCamlcConfig BaseSetup BaseStandardVar BaseTest BaseDynVar BaseMessage BaseContext BaseCompat # OASIS_STOP oasis-0.4.11/src/base/BaseTest.mli0000644000175000017500000000423713261073606016165 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Run tests @author Sylvain Le Gall *) open OASISTypes (** [test lst pkg extra_args] Run all tests. [lst] elements are tuples [(f, cs, test)], apply in turn [f pkg (cs, test) extra_args] and collect their results. Combine all results to give a percentage of failure. *) val test: ctxt:OASISContext.t -> ((ctxt:OASISContext.t -> package -> common_section * test -> arg array -> float) * common_section * test) list -> package -> arg array -> unit oasis-0.4.11/src/base/BaseTest.ml0000644000175000017500000000702613261073606016013 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open BaseEnv open BaseMessage open OASISTypes open OASISGettext let test ~ctxt lst pkg extra_args = let one_test (failure, n) (test_plugin, cs, test) = if var_choose ~name:(Printf.sprintf (f_ "test %s run") cs.cs_name) ~printer:string_of_bool test.test_run then begin let () = info (f_ "Running test '%s'") cs.cs_name in let back_cwd = match test.test_working_directory with | Some dir -> let cwd = Sys.getcwd () in let chdir d = info (f_ "Changing directory to '%s'") d; Sys.chdir d in chdir dir; fun () -> chdir cwd | None -> fun () -> () in try let failure_percent = BaseCustom.hook test.test_custom (test_plugin ~ctxt pkg (cs, test)) extra_args in back_cwd (); (failure_percent +. failure, n + 1) with e -> begin back_cwd (); raise e end end else begin info (f_ "Skipping test '%s'") cs.cs_name; (failure, n) end in let failed, n = List.fold_left one_test (0.0, 0) lst in let failure_percent = if n = 0 then 0.0 else failed /. (float_of_int n) in let msg = Printf.sprintf (f_ "Tests had a %.2f%% failure rate") (100. *. failure_percent) in if failure_percent > 0.0 then failwith msg else info "%s" msg; (* Possible explanation why the tests where not run. *) if OASISFeatures.package_test OASISFeatures.flag_tests pkg && not (bool_of_string (BaseStandardVar.tests ())) && lst <> [] then BaseMessage.warning "Tests are turned off, consider enabling with \ 'ocaml setup.ml -configure --enable-tests'" oasis-0.4.11/src/base/BaseSysEnvironment.mod0000644000175000017500000000002013261073606020231 0ustar gildorgildorBaseEnvLight.ml oasis-0.4.11/src/base/BaseSysBundle.mod0000644000175000017500000000012413261073606017143 0ustar gildorgildorBaseContext.ml BaseMessage.ml BaseEnvLight.ml BaseEnv.ml BaseArgExt.ml BaseCheck.ml oasis-0.4.11/src/base/BaseSys.mod0000644000175000017500000000033713261073606016017 0ustar gildorgildorBaseContext.ml BaseMessage.ml BaseEnv.ml BaseArgExt.ml BaseCheck.ml BaseOCamlcConfig.ml BaseStandardVar.ml BaseFileAB.ml BaseLog.ml BaseBuilt.ml BaseCustom.ml BaseDynVar.ml BaseTest.ml BaseDoc.ml BaseSetup.ml BaseCompat.ml oasis-0.4.11/src/base/BaseStandardVar.mli0000644000175000017500000001126213261073606017453 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Standard variables @author Sylvain Le Gall *) open OASISTypes (** {2 Programs} *) val ocamlfind: unit -> host_filename val ocamlc: unit -> host_filename val ocamlopt: unit -> host_filename val ocamlbuild: unit -> host_filename val flexlink: unit -> host_filename val flexdll_version: unit -> string (** {2 Variables from OASIS package} See {!OASISTypes.package} for more information. *) val pkg_name: unit -> name val pkg_version: unit -> OASISVersion.StringVersion.t (** {2 ocamlc config variables} *) val os_type: unit -> string val system: unit -> string val architecture: unit -> string val ccomp_type: unit -> string val ocaml_version: unit -> string val standard_library_default: unit -> host_dirname val standard_library: unit -> host_dirname val standard_runtime: unit -> host_filename val bytecomp_c_compiler: unit -> string val native_c_compiler: unit -> string val model: unit -> string val ext_obj: unit -> string val ext_asm: unit -> string val ext_lib: unit -> string val ext_dll: unit -> string val default_executable_name: unit -> string val systhread_supported: unit -> string (** {2 Paths} See {{:http://www.gnu.org/prep/standards/html_node/Directory-Variables.html} GNU standards}. *) val prefix: unit -> host_dirname val exec_prefix: unit -> host_dirname val bindir: unit -> host_dirname val sbindir: unit -> host_dirname val libexecdir: unit -> host_dirname val sysconfdir: unit -> host_dirname val sharedstatedir: unit -> host_dirname val localstatedir: unit -> host_dirname val libdir: unit -> host_dirname val datarootdir: unit -> host_dirname val datadir: unit -> host_dirname val infodir: unit -> host_dirname val localedir: unit -> host_dirname val mandir: unit -> host_dirname val docdir: unit -> host_dirname val htmldir: unit -> host_dirname val dvidir: unit -> host_dirname val pdfdir: unit -> host_dirname val psdir: unit -> host_dirname val destdir: unit -> host_dirname (** {2 Various} *) (** Findlib version. *) val findlib_version: unit -> OASISVersion.StringVersion.t (** Check that the platform is a native platform (can compile native exec/library). *) val is_native: unit -> string (** Compute the default suffix for program (e.g. '.exe' on Win32). *) val ext_program: unit -> string (** Host command to delete a file. *) val rm: unit -> string (** Host command to delete a directory. *) val rmdir: unit -> string (** Compile in debug mode. *) val debug: unit -> string (** Compile in profile mode. *) val profile: unit -> string (** Run tests. *) val tests: unit -> string (** Compile docs. *) val docs: unit -> string (** Support for .cmxs. *) val native_dynlink: unit -> string (** Initialize some variables. *) val init: OASISTypes.package -> unit oasis-0.4.11/src/base/BaseStandardVar.ml0000644000175000017500000002433313261073606017305 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext open OASISTypes open BaseCheck open BaseEnv let ocamlfind = BaseCheck.ocamlfind let ocamlc = BaseOCamlcConfig.ocamlc let ocamlopt = prog_opt "ocamlopt" let ocamlbuild = prog "ocamlbuild" (**/**) let rpkg = ref None let pkg_get () = match !rpkg with | Some pkg -> pkg | None -> failwith (s_ "OASIS Package is not set") let var_cond = ref [] let var_define_cond ~since_version f dflt = let holder = ref (fun () -> dflt) in let since_version = OASISVersion.VGreaterEqual (OASISVersion.version_of_string since_version) in var_cond := (fun ver -> if OASISVersion.comparator_apply ver since_version then holder := f ()) :: !var_cond; fun () -> !holder () (**/**) let pkg_name = var_define ~short_desc:(fun () -> s_ "Package name") "pkg_name" (fun () -> (pkg_get ()).name) let pkg_version = var_define ~short_desc:(fun () -> s_ "Package version") "pkg_version" (fun () -> (OASISVersion.string_of_version (pkg_get ()).version)) let c = BaseOCamlcConfig.var_define let os_type = c "os_type" let system = c "system" let architecture = c "architecture" let ccomp_type = c "ccomp_type" let ocaml_version = c "ocaml_version" (* TODO: Check standard variable presence at runtime *) let standard_library_default = c "standard_library_default" let standard_library = c "standard_library" let standard_runtime = c "standard_runtime" let bytecomp_c_compiler = c "bytecomp_c_compiler" let native_c_compiler = c "native_c_compiler" let model = c "model" let ext_obj = c "ext_obj" let ext_asm = c "ext_asm" let ext_lib = c "ext_lib" let ext_dll = c "ext_dll" let default_executable_name = c "default_executable_name" let systhread_supported = c "systhread_supported" let flexlink = BaseCheck.prog "flexlink" let flexdll_version = var_define ~short_desc:(fun () -> "FlexDLL version (Win32)") "flexdll_version" (fun () -> let lst = OASISExec.run_read_output ~ctxt:!BaseContext.default (flexlink ()) ["-help"] in match lst with | line :: _ -> Scanf.sscanf line "FlexDLL version %s" (fun ver -> ver) | [] -> raise Not_found) (**/**) let p name hlp dflt = var_define ~short_desc:hlp ~cli:CLIAuto ~arg_help:"dir" name dflt let (/) a b = if os_type () = Sys.os_type then Filename.concat a b else if os_type () = "Unix" || os_type () = "Cygwin" then OASISUnixPath.concat a b else OASISUtils.failwithf (f_ "Cannot handle os_type %s filename concat") (os_type ()) (**/**) let prefix = p "prefix" (fun () -> s_ "Install architecture-independent files dir") (fun () -> match os_type () with | "Win32" -> let program_files = Sys.getenv "PROGRAMFILES" in program_files/(pkg_name ()) | _ -> "/usr/local") let exec_prefix = p "exec_prefix" (fun () -> s_ "Install architecture-dependent files in dir") (fun () -> "$prefix") let bindir = p "bindir" (fun () -> s_ "User executables") (fun () -> "$exec_prefix"/"bin") let sbindir = p "sbindir" (fun () -> s_ "System admin executables") (fun () -> "$exec_prefix"/"sbin") let libexecdir = p "libexecdir" (fun () -> s_ "Program executables") (fun () -> "$exec_prefix"/"libexec") let sysconfdir = p "sysconfdir" (fun () -> s_ "Read-only single-machine data") (fun () -> "$prefix"/"etc") let sharedstatedir = p "sharedstatedir" (fun () -> s_ "Modifiable architecture-independent data") (fun () -> "$prefix"/"com") let localstatedir = p "localstatedir" (fun () -> s_ "Modifiable single-machine data") (fun () -> "$prefix"/"var") let libdir = p "libdir" (fun () -> s_ "Object code libraries") (fun () -> "$exec_prefix"/"lib") let datarootdir = p "datarootdir" (fun () -> s_ "Read-only arch-independent data root") (fun () -> "$prefix"/"share") let datadir = p "datadir" (fun () -> s_ "Read-only architecture-independent data") (fun () -> "$datarootdir") let infodir = p "infodir" (fun () -> s_ "Info documentation") (fun () -> "$datarootdir"/"info") let localedir = p "localedir" (fun () -> s_ "Locale-dependent data") (fun () -> "$datarootdir"/"locale") let mandir = p "mandir" (fun () -> s_ "Man documentation") (fun () -> "$datarootdir"/"man") let docdir = p "docdir" (fun () -> s_ "Documentation root") (fun () -> "$datarootdir"/"doc"/"$pkg_name") let htmldir = p "htmldir" (fun () -> s_ "HTML documentation") (fun () -> "$docdir") let dvidir = p "dvidir" (fun () -> s_ "DVI documentation") (fun () -> "$docdir") let pdfdir = p "pdfdir" (fun () -> s_ "PDF documentation") (fun () -> "$docdir") let psdir = p "psdir" (fun () -> s_ "PS documentation") (fun () -> "$docdir") let destdir = p "destdir" (fun () -> s_ "Prepend a path when installing package") (fun () -> raise (PropList.Not_set ("destdir", Some (s_ "undefined by construct")))) let findlib_version = var_define "findlib_version" (fun () -> BaseCheck.package_version "findlib") let is_native = var_define "is_native" (fun () -> try let _s: string = ocamlopt () in "true" with PropList.Not_set _ -> let _s: string = ocamlc () in "false") let ext_program = var_define "suffix_program" (fun () -> match os_type () with | "Win32" | "Cygwin" -> ".exe" | _ -> "") let rm = var_define ~short_desc:(fun () -> s_ "Remove a file.") "rm" (fun () -> match os_type () with | "Win32" -> "del" | _ -> "rm -f") let rmdir = var_define ~short_desc:(fun () -> s_ "Remove a directory.") "rmdir" (fun () -> match os_type () with | "Win32" -> "rd" | _ -> "rm -rf") let debug = var_define ~short_desc:(fun () -> s_ "Turn ocaml debug flag on") ~cli:CLIEnable "debug" (fun () -> "true") let profile = var_define ~short_desc:(fun () -> s_ "Turn ocaml profile flag on") ~cli:CLIEnable "profile" (fun () -> "false") let tests = var_define_cond ~since_version:"0.3" (fun () -> var_define ~short_desc:(fun () -> s_ "Compile tests executable and library and run them") ~cli:CLIEnable "tests" (fun () -> "false")) "true" let docs = var_define_cond ~since_version:"0.3" (fun () -> var_define ~short_desc:(fun () -> s_ "Create documentations") ~cli:CLIEnable "docs" (fun () -> "true")) "true" let native_dynlink = var_define ~short_desc:(fun () -> s_ "Compiler support generation of .cmxs.") ~cli:CLINone "native_dynlink" (fun () -> let res = let ocaml_lt_312 () = OASISVersion.comparator_apply (OASISVersion.version_of_string (ocaml_version ())) (OASISVersion.VLesser (OASISVersion.version_of_string "3.12.0")) in let flexdll_lt_030 () = OASISVersion.comparator_apply (OASISVersion.version_of_string (flexdll_version ())) (OASISVersion.VLesser (OASISVersion.version_of_string "0.30")) in let has_native_dynlink = let ocamlfind = ocamlfind () in try let fn = OASISExec.run_read_one_line ~ctxt:!BaseContext.default ocamlfind ["query"; "-predicates"; "native"; "dynlink"; "-format"; "%d/%a"] in Sys.file_exists fn with _ -> false in if not has_native_dynlink then false else if ocaml_lt_312 () then false else if (os_type () = "Win32" || os_type () = "Cygwin") && flexdll_lt_030 () then begin BaseMessage.warning (f_ ".cmxs generation disabled because FlexDLL needs to be \ at least 0.30. Please upgrade FlexDLL from %s to 0.30.") (flexdll_version ()); false end else true in string_of_bool res) let init pkg = rpkg := Some pkg; List.iter (fun f -> f pkg.oasis_version) !var_cond oasis-0.4.11/src/base/BaseSetup.mli0000644000175000017500000001161013261073606016337 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Entry points for 'setup.ml' @author Sylvain Le Gall *) open OASISTypes type std_args_fun = ctxt:OASISContext.t -> package -> arg array -> unit type ('a, 'b) section_args_fun = name * (ctxt:OASISContext.t -> package -> (common_section * 'a) -> arg array -> 'b) type t = { configure: std_args_fun; build: std_args_fun; doc: ((doc, unit) section_args_fun) list; test: ((test, float) section_args_fun) list; install: std_args_fun; uninstall: std_args_fun; clean: std_args_fun list; clean_doc: (doc, unit) section_args_fun list; clean_test: (test, unit) section_args_fun list; distclean: std_args_fun list; distclean_doc: (doc, unit) section_args_fun list; distclean_test: (test, unit) section_args_fun list; package: package; oasis_fn: string option; (** Filename of _oasis that matches the package field. *) oasis_version: string; (** OASIS version that has generated this structure. *) oasis_digest: Digest.t option; (** Digest of _oasis that matches the package field. *) oasis_exec: string option; (** Name of oasis executable to use, only for testing. *) oasis_setup_args: string list; (** Args to use when updating the setup.ml. *) setup_update: bool; (** Are we allowed to update the setup.ml (eq. of -setup-update weak). *) } (** Run the configure step. *) val configure: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the build step. *) val build: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the doc step: build all documents. *) val doc: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the test step: run all tests. *) val test: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the install step. *) val install: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the uninstall step. *) val uninstall: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the clean step. *) val clean: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the distclean step. *) val distclean: ctxt:OASISContext.t -> t -> arg array -> unit (** Run the reinstall step: deinstall and install. *) val reinstall: ctxt:OASISContext.t -> t -> arg array -> unit (** Run all steps: configure, build, doc, test and install. *) val all: ctxt:OASISContext.t -> t -> arg array -> unit (** Display OASIS version used to generate this setup.ml. *) val version: ctxt:OASISContext.t -> t -> arg array -> unit (** The first function called when running 'setup.ml'. *) val setup: t -> unit (** Default filename for '_oasis'. *) val default_oasis_fn: host_filename (** Default filename for 'setup.ml'. {b Not exported} *) val default_filename: host_filename (** Get template 'setup.ml' file out of the plugin context. {b Not exported}. *) val find: OASISPlugin.context_act -> OASISFileTemplate.template (** Create [t] and plugin context from an OASIS package and the matching _oasis. {b Not exported}. *) val of_package: ?ctxt:OASISContext.t -> ?oasis_fn:host_filename -> ?oasis_exec:host_filename -> ?oasis_setup_args:string list -> setup_update:bool -> OASISSetupUpdate.t -> package -> OASISPlugin.context_act * t oasis-0.4.11/src/base/BaseSetup.ml0000644000175000017500000006214713261073606016201 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISContext open BaseEnv open BaseMessage open OASISTypes open OASISGettext open OASISUtils type std_args_fun = ctxt:OASISContext.t -> package -> string array -> unit type ('a, 'b) section_args_fun = name * (ctxt:OASISContext.t -> package -> (common_section * 'a) -> string array -> 'b) type t = { configure: std_args_fun; build: std_args_fun; doc: ((doc, unit) section_args_fun) list; test: ((test, float) section_args_fun) list; install: std_args_fun; uninstall: std_args_fun; clean: std_args_fun list; clean_doc: (doc, unit) section_args_fun list; clean_test: (test, unit) section_args_fun list; distclean: std_args_fun list; distclean_doc: (doc, unit) section_args_fun list; distclean_test: (test, unit) section_args_fun list; package: package; oasis_fn: string option; oasis_version: string; oasis_digest: Digest.t option; oasis_exec: string option; oasis_setup_args: string list; setup_update: bool; } (* Associate a plugin function with data from package *) let join_plugin_sections filter_map lst = List.rev (List.fold_left (fun acc sct -> match filter_map sct with | Some e -> e :: acc | None -> acc) [] lst) (* Search for plugin data associated with a section name *) let lookup_plugin_section plugin action nm lst = try List.assoc nm lst with Not_found -> failwithf (f_ "Cannot find plugin %s matching section %s for %s action") plugin nm action let configure ~ctxt t args = (* Run configure *) BaseCustom.hook t.package.conf_custom (fun () -> (* Reload if preconf has changed it *) begin try unload (); load ~ctxt (); with _ -> () end; (* Run plugin's configure *) t.configure ~ctxt t.package args; (* Dump to allow postconf to change it *) dump ~ctxt ()) (); (* Reload environment *) unload (); load ~ctxt (); (* Save environment *) print (); (* Replace data in file *) BaseFileAB.replace ~ctxt t.package.files_ab let build ~ctxt t args = BaseCustom.hook t.package.build_custom (t.build ~ctxt t.package) args let doc ~ctxt t args = BaseDoc.doc ~ctxt (join_plugin_sections (function | Doc (cs, e) -> Some (lookup_plugin_section "documentation" (s_ "build") cs.cs_name t.doc, cs, e) | _ -> None) t.package.sections) t.package args let test ~ctxt t args = BaseTest.test ~ctxt (join_plugin_sections (function | Test (cs, e) -> Some (lookup_plugin_section "test" (s_ "run") cs.cs_name t.test, cs, e) | _ -> None) t.package.sections) t.package args let all ~ctxt t args = let rno_doc = ref false in let rno_test = ref false in let arg_rest = ref [] in Arg.parse_argv ~current:(ref 0) (Array.of_list ((Sys.executable_name^" all") :: (Array.to_list args))) [ "-no-doc", Arg.Set rno_doc, s_ "Don't run doc target"; "-no-test", Arg.Set rno_test, s_ "Don't run test target"; "--", Arg.Rest (fun arg -> arg_rest := arg :: !arg_rest), s_ "All arguments for configure."; ] (failwithf (f_ "Don't know what to do with '%s'")) ""; info "Running configure step"; configure ~ctxt t (Array.of_list (List.rev !arg_rest)); info "Running build step"; build ~ctxt t [||]; (* Load setup.log dynamic variables *) BaseDynVar.init ~ctxt t.package; if not !rno_doc then begin info "Running doc step"; doc ~ctxt t [||] end else begin info "Skipping doc step" end; if not !rno_test then begin info "Running test step"; test ~ctxt t [||] end else begin info "Skipping test step" end let install ~ctxt t args = BaseCustom.hook t.package.install_custom (t.install ~ctxt t.package) args let uninstall ~ctxt t args = BaseCustom.hook t.package.uninstall_custom (t.uninstall ~ctxt t.package) args let reinstall ~ctxt t args = uninstall ~ctxt t args; install ~ctxt t args let clean, distclean = let failsafe f a = try f a with e -> warning (f_ "Action fail with error: %s") (match e with | Failure msg -> msg | e -> Printexc.to_string e) in let generic_clean ~ctxt t cstm mains docs tests args = BaseCustom.hook ~failsafe:true cstm (fun () -> (* Clean section *) List.iter (function | Test (cs, test) -> let f = try List.assoc cs.cs_name tests with Not_found -> fun ~ctxt:_ _ _ _ -> () in failsafe (f ~ctxt t.package (cs, test)) args | Doc (cs, doc) -> let f = try List.assoc cs.cs_name docs with Not_found -> fun ~ctxt:_ _ _ _ -> () in failsafe (f ~ctxt t.package (cs, doc)) args | Library _ | Object _ | Executable _ | Flag _ | SrcRepo _ -> ()) t.package.sections; (* Clean whole package *) List.iter (fun f -> failsafe (f ~ctxt t.package) args) mains) () in let clean ~ctxt t args = generic_clean ~ctxt t t.package.clean_custom t.clean t.clean_doc t.clean_test args in let distclean ~ctxt t args = (* Call clean *) clean ~ctxt t args; (* Call distclean code *) generic_clean ~ctxt t t.package.distclean_custom t.distclean t.distclean_doc t.distclean_test args; (* Remove generated source files. *) List.iter (fun fn -> if ctxt.srcfs#file_exists fn then begin info (f_ "Remove '%s'") (ctxt.srcfs#string_of_filename fn); ctxt.srcfs#remove fn end) ([BaseEnv.default_filename; BaseLog.default_filename] @ (List.rev_map BaseFileAB.to_filename t.package.files_ab)) in clean, distclean let version ~ctxt:_ (t: t) _ = print_endline t.oasis_version let update_setup_ml, no_update_setup_ml_cli = let b = ref true in b, ("-no-update-setup-ml", Arg.Clear b, s_ " Don't try to update setup.ml, even if _oasis has changed.") (* TODO: srcfs *) let default_oasis_fn = "_oasis" let update_setup_ml t = let oasis_fn = match t.oasis_fn with | Some fn -> fn | None -> default_oasis_fn in let oasis_exec = match t.oasis_exec with | Some fn -> fn | None -> "oasis" in let ocaml = Sys.executable_name in let setup_ml, args = match Array.to_list Sys.argv with | setup_ml :: args -> setup_ml, args | [] -> failwith (s_ "Expecting non-empty command line arguments.") in let ocaml, setup_ml = if Sys.executable_name = Sys.argv.(0) then (* We are not running in standard mode, probably the script * is precompiled. *) "ocaml", "setup.ml" else ocaml, setup_ml in let no_update_setup_ml_cli, _, _ = no_update_setup_ml_cli in let do_update () = let oasis_exec_version = OASISExec.run_read_one_line ~ctxt:!BaseContext.default ~f_exit_code: (function | 0 -> () | 1 -> failwithf (f_ "Executable '%s' is probably an old version \ of oasis (< 0.3.0), please update to version \ v%s.") oasis_exec t.oasis_version | 127 -> failwithf (f_ "Cannot find executable '%s', please install \ oasis v%s.") oasis_exec t.oasis_version | n -> failwithf (f_ "Command '%s version' exited with code %d.") oasis_exec n) oasis_exec ["version"] in if OASISVersion.comparator_apply (OASISVersion.version_of_string oasis_exec_version) (OASISVersion.VGreaterEqual (OASISVersion.version_of_string t.oasis_version)) then begin (* We have a version >= for the executable oasis, proceed with * update. *) (* TODO: delegate this check to 'oasis setup'. *) if Sys.os_type = "Win32" then failwithf (f_ "It is not possible to update the running script \ setup.ml on Windows. Please update setup.ml by \ running '%s'.") (String.concat " " (oasis_exec :: "setup" :: t.oasis_setup_args)) else begin OASISExec.run ~ctxt:!BaseContext.default ~f_exit_code: (fun n -> if n <> 0 then failwithf (f_ "Unable to update setup.ml using '%s', \ please fix the problem and retry.") oasis_exec) oasis_exec ("setup" :: t.oasis_setup_args); OASISExec.run ~ctxt:!BaseContext.default ocaml (setup_ml :: args) end end else failwithf (f_ "The version of '%s' (v%s) doesn't match the version of \ oasis used to generate the %s file. Please install at \ least oasis v%s.") oasis_exec oasis_exec_version setup_ml t.oasis_version in if !update_setup_ml then begin try match t.oasis_digest with | Some dgst -> if Sys.file_exists oasis_fn && dgst <> Digest.file default_oasis_fn then begin do_update (); true end else false | None -> false with e -> error (f_ "Error when updating setup.ml. If you want to avoid this error, \ you can bypass the update of %s by running '%s %s %s %s'") setup_ml ocaml setup_ml no_update_setup_ml_cli (String.concat " " args); raise e end else false let setup t = let catch_exn = ref true in let act_ref = ref (fun ~ctxt:_ _ -> failwithf (f_ "No action defined, run '%s %s -help'") Sys.executable_name Sys.argv.(0)) in let extra_args_ref = ref [] in let allow_empty_env_ref = ref false in let arg_handle ?(allow_empty_env=false) act = Arg.Tuple [ Arg.Rest (fun str -> extra_args_ref := str :: !extra_args_ref); Arg.Unit (fun () -> allow_empty_env_ref := allow_empty_env; act_ref := act); ] in try let () = Arg.parse (Arg.align ([ "-configure", arg_handle ~allow_empty_env:true configure, s_ "[options*] Configure the whole build process."; "-build", arg_handle build, s_ "[options*] Build executables and libraries."; "-doc", arg_handle doc, s_ "[options*] Build documents."; "-test", arg_handle test, s_ "[options*] Run tests."; "-all", arg_handle ~allow_empty_env:true all, s_ "[options*] Run configure, build, doc and test targets."; "-install", arg_handle install, s_ "[options*] Install libraries, data, executables \ and documents."; "-uninstall", arg_handle uninstall, s_ "[options*] Uninstall libraries, data, executables \ and documents."; "-reinstall", arg_handle reinstall, s_ "[options*] Uninstall and install libraries, data, \ executables and documents."; "-clean", arg_handle ~allow_empty_env:true clean, s_ "[options*] Clean files generated by a build."; "-distclean", arg_handle ~allow_empty_env:true distclean, s_ "[options*] Clean files generated by a build and configure."; "-version", arg_handle ~allow_empty_env:true version, s_ " Display version of OASIS used to generate this setup.ml."; "-no-catch-exn", Arg.Clear catch_exn, s_ " Don't catch exception, useful for debugging."; ] @ (if t.setup_update then [no_update_setup_ml_cli] else []) @ (BaseContext.args ()))) (failwithf (f_ "Don't know what to do with '%s'")) (s_ "Setup and run build process current package\n") in (* Instantiate the context. *) let ctxt = !BaseContext.default in (* Build initial environment *) load ~ctxt ~allow_empty:!allow_empty_env_ref (); (** Initialize flags *) List.iter (function | Flag (cs, {flag_description = hlp; flag_default = choices}) -> begin let apply ?short_desc () = var_ignore (var_define ~cli:CLIEnable ?short_desc (OASISUtils.varname_of_string cs.cs_name) (fun () -> string_of_bool (var_choose ~name:(Printf.sprintf (f_ "default value of flag %s") cs.cs_name) ~printer:string_of_bool choices))) in match hlp with | Some hlp -> apply ~short_desc:(fun () -> hlp) () | None -> apply () end | _ -> ()) t.package.sections; BaseStandardVar.init t.package; BaseDynVar.init ~ctxt t.package; if not (t.setup_update && update_setup_ml t) then !act_ref ~ctxt t (Array.of_list (List.rev !extra_args_ref)) with e when !catch_exn -> error "%s" (Printexc.to_string e); exit 1 (* END EXPORT *) open OASISPlugin let default_filename = "setup.ml" let find ctxt = try OASISFileTemplate.find default_filename ctxt.files with Not_found -> failwithf (f_ "Cannot find setup template file '%s'") default_filename let of_package ?ctxt ?oasis_fn ?oasis_exec ?(oasis_setup_args=[]) ~setup_update update pkg = let ctxt = (* Initial context *) { error = false; other_actions = []; update = update; files = OASISFileTemplate.create ~disable_oasis_section:pkg.disable_oasis_section (); ctxt = (match ctxt with | Some ctxt -> ctxt | None -> !BaseContext.default); } in let ctxt, configure_changes = (Configure.act pkg.conf_type) ctxt pkg in let ctxt, build_changes = (Build.act pkg.build_type) ctxt pkg in let ctxt, test_odn, test_changes = let ctxt, test_odns, test_changes = List.fold_left (fun ((ctxt, test_odns, test_changes) as acc) -> function | Test (cs, tst) -> begin let ctxt, chng = (Test.act tst.test_type) ctxt pkg (cs, tst) in ctxt, (OASISDataNotation.TPL [OASISDataNotation.STR cs.cs_name; OASISDataNotation.odn_of_func chng.chng_main] :: test_odns), (cs.cs_name, chng) :: test_changes end | _ -> acc) (ctxt, [], []) pkg.sections in ctxt, OASISDataNotation.LST (List.rev test_odns), List.rev test_changes in let ctxt, doc_odn, doc_changes = let ctxt, doc_odns, doc_changes = List.fold_left (fun ((ctxt, doc_odns, doc_changes) as acc) -> function | Doc (cs, doc) -> begin let ctxt, chng = (Doc.act doc.doc_type) ctxt pkg (cs, doc) in ctxt, (OASISDataNotation.TPL [OASISDataNotation.STR cs.cs_name; OASISDataNotation.odn_of_func chng.chng_main] :: doc_odns), (cs.cs_name, chng) :: doc_changes end | _ -> acc) (ctxt, [], []) pkg.sections in ctxt, OASISDataNotation.LST (List.rev doc_odns), List.rev doc_changes in let ctxt, install_changes, uninstall_changes = let inst, uninst = Install.act pkg.install_type in let ctxt, install_changes = inst ctxt pkg in let ctxt, uninstall_changes = uninst ctxt pkg in ctxt, install_changes, uninstall_changes in let ctxt = (* Run extra plugin *) List.fold_left (fun ctxt nm -> (Extra.act nm) ctxt pkg) ctxt pkg.plugins in let std_changes = [ configure_changes; build_changes; install_changes; uninstall_changes; ] in let clean_funcs, clean_doc_funcs, clean_test_funcs, distclean_funcs, distclean_doc_funcs, distclean_test_funcs = let acc_non_opt f lst = let acc_non_opt_aux acc e = match f e with | Some v -> v :: acc | None -> acc in List.rev (List.fold_left acc_non_opt_aux [] lst) in let acc_non_opt_assoc f = let assoc_f (nm, e) = match f e with | Some v -> Some (nm, v) | None -> None in acc_non_opt assoc_f in let clean_of_changes chng = chng.chng_clean in let distclean_of_changes chng = chng.chng_distclean in acc_non_opt clean_of_changes std_changes, acc_non_opt_assoc clean_of_changes doc_changes, acc_non_opt_assoc clean_of_changes test_changes, acc_non_opt distclean_of_changes std_changes, acc_non_opt_assoc distclean_of_changes doc_changes, acc_non_opt_assoc distclean_of_changes test_changes in let moduls = (* Extract and deduplicate modules *) let extract lst = List.map (fun chng -> chng.chng_moduls) lst in let moduls = List.flatten ([ OASISData.oasissys_ml; BaseData.basesysenvironment_ml; BaseData.basesys_ml; ] :: ((extract std_changes) @ (extract (List.map snd doc_changes)) @ (extract (List.map snd test_changes)))) in let rmoduls, _ = List.fold_left (fun ((moduls, moduls_seen) as acc) modul -> if SetString.mem modul moduls_seen then acc else (modul :: moduls, SetString.add modul moduls_seen)) ([], SetString.empty) moduls in List.rev rmoduls in let oasis_digest = match oasis_fn with | None -> None | Some fn -> Some (Digest.file fn) in let setup_t_odn, t = let setup_func_calls lst = List.map (fun (nm, chng) -> nm, OASISDataNotation.func_call chng.chng_main) lst in let func_calls lst = List.map (fun (nm, func) -> nm, OASISDataNotation.func_call func) lst in let odn_of_funcs lst = OASISDataNotation.LST (List.map OASISDataNotation.odn_of_func lst) in let odn_of_assocs lst = OASISDataNotation.LST (List.map (fun (nm, func) -> OASISDataNotation.TPL[OASISDataNotation.STR nm; OASISDataNotation.odn_of_func func]) lst) in OASISDataNotation.REC ("BaseSetup", [ "configure", OASISDataNotation.odn_of_func configure_changes.chng_main; "build", OASISDataNotation.odn_of_func build_changes.chng_main; "test", test_odn; "doc", doc_odn; "install", OASISDataNotation.odn_of_func install_changes.chng_main; "uninstall", OASISDataNotation.odn_of_func uninstall_changes.chng_main; "clean", odn_of_funcs clean_funcs; "clean_test", odn_of_assocs clean_test_funcs; "clean_doc", odn_of_assocs clean_doc_funcs; "distclean", odn_of_funcs distclean_funcs; "distclean_test", odn_of_assocs distclean_test_funcs; "distclean_doc", odn_of_assocs distclean_doc_funcs; "package", OASISTypes.odn_of_package pkg; "oasis_fn", OASISDataNotation.of_option OASISDataNotation.of_string oasis_fn; "oasis_version", OASISVersion.odn_of_t OASISConf.version_full; "oasis_digest", OASISDataNotation.of_option OASISDataNotation.of_string oasis_digest; "oasis_exec", OASISDataNotation.of_option OASISDataNotation.of_string oasis_exec; "oasis_setup_args", OASISDataNotation.of_list OASISDataNotation.of_string oasis_setup_args; "setup_update", OASISDataNotation.of_bool setup_update; ]), { configure = OASISDataNotation.func_call configure_changes.chng_main; build = OASISDataNotation.func_call build_changes.chng_main; doc = setup_func_calls doc_changes; test = setup_func_calls test_changes; install = OASISDataNotation.func_call install_changes.chng_main; uninstall = OASISDataNotation.func_call uninstall_changes.chng_main; clean = List.map OASISDataNotation.func_call clean_funcs; clean_test = func_calls clean_test_funcs; clean_doc = func_calls clean_doc_funcs; distclean = List.map OASISDataNotation.func_call distclean_funcs; distclean_test = func_calls distclean_test_funcs; distclean_doc = func_calls distclean_doc_funcs; package = pkg; oasis_fn = oasis_fn; oasis_version = OASISVersion.string_of_version OASISConf.version_full; oasis_digest = oasis_digest; oasis_exec = oasis_exec; oasis_setup_args = oasis_setup_args; setup_update = setup_update; } in (* Create setup file *) let setup_t_str = Format.fprintf Format.str_formatter "@[let setup_t =@ %a;;@]" (OASISDataNotation.pp_odn ~opened_modules:["OASISTypes"]) setup_t_odn; Format.flush_str_formatter () in let setup_tmpl = OASISFileTemplate.template_of_mlfile default_filename (* Header *) [ "(* "^default_filename^" generated for the first time by "^ "OASIS v"^(OASISVersion.string_of_version OASISConf.version_full) ^" *)"; ""; ] (* Body *) ( [ "(*"; " Regenerated by OASIS v"^(OASISVersion.string_of_version OASISConf.version_full); " Visit http://oasis.forge.ocamlcore.org for more information and"; " documentation about functions used in this file."; "*)"; ] @ moduls @ [ "open OASISTypes;;"; ""; setup_t_str; ""; "let setup () = BaseSetup.setup setup_t;;"; "" ] ) (* Footer *) ["let () = setup ();;"] in {ctxt with files = OASISFileTemplate.replace setup_tmpl ctxt.files}, t oasis-0.4.11/src/base/BaseOCamlcConfig.mli0000644000175000017500000000416713261073606017534 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Handle output of 'ocamlc -config' Read output of command ocamlc -config and transform it into environment variables. @author Sylvain Le Gall *) open OASISTypes (** The ocamlc command line tool. Use {!BaseStandardVar.ocamlc} variable if you want a safe way to access this variable. *) val ocamlc: unit -> string (** Look for the variable name in the 'ocamlc -config' output and define it. *) val var_define: name -> (unit -> string) oasis-0.4.11/src/base/BaseOCamlcConfig.ml0000644000175000017500000001002513261073606017351 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open BaseEnv open OASISUtils open OASISGettext module SMap = Map.Make(String) let ocamlc = BaseCheck.prog_opt "ocamlc" let ocamlc_config_map = (* Map name to value for ocamlc -config output (name ^": "^value) *) let rec split_field mp lst = match lst with | line :: tl -> let mp = try let pos_semicolon = String.index line ':' in if pos_semicolon > 1 then ( let name = String.sub line 0 pos_semicolon in let linelen = String.length line in let value = if linelen > pos_semicolon + 2 then String.sub line (pos_semicolon + 2) (linelen - pos_semicolon - 2) else "" in SMap.add name value mp ) else ( mp ) with Not_found -> ( mp ) in split_field mp tl | [] -> mp in let cache = lazy (var_protect (Marshal.to_string (split_field SMap.empty (OASISExec.run_read_output ~ctxt:!BaseContext.default (ocamlc ()) ["-config"])) [])) in var_redefine "ocamlc_config_map" ~hide:true ~dump:false (fun () -> (* TODO: update if ocamlc change !!! *) Lazy.force cache) let var_define nm = (* Extract data from ocamlc -config *) let avlbl_config_get () = Marshal.from_string (ocamlc_config_map ()) 0 in let chop_version_suffix s = try String.sub s 0 (String.index s '+') with _ -> s in let nm_config, value_config = match nm with | "ocaml_version" -> "version", chop_version_suffix | _ -> nm, (fun x -> x) in var_redefine nm (fun () -> try let map = avlbl_config_get () in let value = SMap.find nm_config map in value_config value with Not_found -> failwithf (f_ "Cannot find field '%s' in '%s -config' output") nm (ocamlc ())) oasis-0.4.11/src/base/BaseMessage.mli0000644000175000017500000000423413261073606016627 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Message to user This module is the same as {!OASISMessage}, except we use the context {!BaseContext.default}. @author Sylvain Le Gall *) (** See {!OASISMessage.debug}. *) val debug: ('a, unit, string, unit) format4 -> 'a (** See {!OASISMessage.info}. *) val info: ('a, unit, string, unit) format4 -> 'a (** See {!OASISMessage.warning}. *) val warning: ('a, unit, string, unit) format4 -> 'a (** See {!OASISMessage.error}. *) val error: ('a, unit, string, unit) format4 -> 'a oasis-0.4.11/src/base/BaseMessage.ml0000644000175000017500000000370313261073606016456 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Message to user, overrid for Base @author Sylvain Le Gall *) open OASISMessage open BaseContext let debug fmt = debug ~ctxt:!default fmt let info fmt = info ~ctxt:!default fmt let warning fmt = warning ~ctxt:!default fmt let error fmt = error ~ctxt:!default fmt oasis-0.4.11/src/base/BaseLog.mli0000644000175000017500000000453613261073606015771 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Maintain a log of actions done @author Sylvain Le Gall *) open OASISTypes (** Default file for registering log. *) val default_filename: OASISContext.source_filename (** Load the log file. *) val load: ctxt:OASISContext.t -> unit -> (name * string) list (** Add an event to the log file. *) val register: ctxt:OASISContext.t -> name -> string -> unit (** Remove an event from the log file. *) val unregister: ctxt:OASISContext.t -> name -> string -> unit (** Filter events of the log file. *) val filter: ctxt:OASISContext.t -> name list -> (name * string) list (** Check if an event exists in the log file. *) val exists: ctxt:OASISContext.t -> name -> string -> bool oasis-0.4.11/src/base/BaseLog.ml0000644000175000017500000000753513261073606015622 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISUtils open OASISContext open OASISGettext open OASISFileSystem let default_filename = in_srcdir "setup.log" let load ~ctxt () = let module SetTupleString = Set.Make (struct type t = string * string let compare (s11, s12) (s21, s22) = match String.compare s11 s21 with | 0 -> String.compare s12 s22 | n -> n end) in if ctxt.srcfs#file_exists default_filename then begin defer_close (ctxt.srcfs#open_in default_filename) (fun rdr -> let line = ref 1 in let lxr = Genlex.make_lexer [] (stream_of_reader rdr) in let rec read_aux (st, lst) = match Stream.npeek 2 lxr with | [Genlex.String e; Genlex.String d] -> let t = e, d in Stream.junk lxr; Stream.junk lxr; if SetTupleString.mem t st then read_aux (st, lst) else read_aux (SetTupleString.add t st, t :: lst) | [] -> List.rev lst | _ -> failwithf (f_ "Malformed log file '%s' at line %d") (ctxt.srcfs#string_of_filename default_filename) !line in read_aux (SetTupleString.empty, [])) end else begin [] end let register ~ctxt event data = defer_close (ctxt.srcfs#open_out ~mode:[Open_append; Open_creat; Open_text] ~perm:0o644 default_filename) (fun wrtr -> let buf = Buffer.create 13 in Printf.bprintf buf "%S %S\n" event data; wrtr#output buf) let unregister ~ctxt event data = let lst = load ~ctxt () in let buf = Buffer.create 13 in List.iter (fun (e, d) -> if e <> event || d <> data then Printf.bprintf buf "%S %S\n" e d) lst; if Buffer.length buf > 0 then defer_close (ctxt.srcfs#open_out default_filename) (fun wrtr -> wrtr#output buf) else ctxt.srcfs#remove default_filename let filter ~ctxt events = let st_events = SetString.of_list events in List.filter (fun (e, _) -> SetString.mem e st_events) (load ~ctxt ()) let exists ~ctxt event data = List.exists (fun v -> (event, data) = v) (load ~ctxt ()) oasis-0.4.11/src/base/BaseGenerate.mli0000644000175000017500000000444513261073606017001 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Generate 'setup.ml' and other files @author Sylvain Le Gall *) open OASISTypes (** Restore generated files, when [generate] has been called with [~restore:true]. {b Not exported}. *) val restore: ctxt:OASISContext.t -> unit -> unit (** Generate 'setup.ml' file and the rest of the build system. {b Not exported}. *) val generate: ctxt:OASISContext.t -> restore:bool -> backup:bool -> setup_fn:host_filename -> ?nocompat:bool -> ?oasis_exec:host_filename -> ?oasis_fn:host_filename -> ?oasis_setup_args:string list -> OASISSetupUpdate.t -> package -> OASISFileTemplate.file_generate_change list oasis-0.4.11/src/base/BaseGenerate.ml0000644000175000017500000001615013261073606016624 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISFileTemplate open OASISPlugin open BaseMessage open OASISGettext open OASISSetupUpdate let required_modules = [ OASISData.oasissys_ml; BaseData.basesysenvironment_ml; (* TODO: is this module really required ? *) BaseData.basesys_ml; ] (**/**) let ev_create, ev_backup = "restore_create", "restore_backup" let log_change f ~ctxt = function | NoChange -> () | Create fn -> f ~ctxt ev_create fn | Change (fn, Some bak) -> f ~ctxt ev_backup (Printf.sprintf "%S -> %S" fn bak) | Change (fn, None) -> warning (f_ "File '%s' has no backup, won't be able to restore it.") fn (**/**) (** Register a generated file. *) let register = log_change BaseLog.register (** Unregister a generated file. *) let unregister = log_change BaseLog.unregister let restore ~ctxt () = List.iter (fun (ev, d) -> let chng = if ev = ev_create then Create d else if ev = ev_backup then Scanf.sscanf d "%S -> %S" (fun fn bak -> Change (fn, Some bak)) else NoChange in file_rollback ~ctxt chng; BaseLog.unregister ~ctxt ev d) (BaseLog.filter ~ctxt [ev_create; ev_backup]) let generate ~ctxt ~restore ~backup ~setup_fn ?(nocompat=false) ?oasis_exec ?oasis_fn ?oasis_setup_args update pkg = let plgn_ctxt, _ = BaseSetup.of_package ~ctxt ?oasis_fn ?oasis_exec ?oasis_setup_args ~setup_update:(update = Weak) update pkg in let change_setup_fn = (* Do we need to change setup filename *) setup_fn <> BaseSetup.default_filename in let plgn_ctxt = let default_fn = BaseSetup.default_filename in if change_setup_fn then begin (* Copy the setup.ml file to its right filename * and update context accordingly *) let setup_tmpl = BaseSetup.find plgn_ctxt in if Sys.file_exists default_fn then OASISFileUtil.cp ~ctxt default_fn setup_fn; {plgn_ctxt with files = OASISFileTemplate.add {setup_tmpl with fn = setup_fn} (OASISFileTemplate.remove setup_tmpl.fn plgn_ctxt.files)} end else begin plgn_ctxt end in let plgn_ctxt = (* Fix setup for dynamic update. *) if update = Dynamic then begin (* We just keep setup.ml, Makefile and configure. *) let files = OASISFileTemplate.fold (fun tmpl acc -> if tmpl.fn = setup_fn then OASISFileTemplate.add {tmpl with body = Body [ if OASISFeatures.package_test OASISFeatures.dynrun_for_release pkg then BaseData.dynrun_for_release_ml else if OASISFeatures.package_test OASISFeatures.compiled_setup_ml pkg then BaseData.compiled_setup_ml else BaseData.dynrun_ml ]} acc else if tmpl.important then OASISFileTemplate.add tmpl acc else acc) plgn_ctxt.files (OASISFileTemplate.create ~disable_oasis_section:pkg.OASISTypes.disable_oasis_section ()) in {plgn_ctxt with files = files} end else begin plgn_ctxt end in let plgn_ctxt = if nocompat then plgn_ctxt else let files = OASISFileTemplate.fold (fun tmpl acc -> if tmpl.fn = setup_fn then let body = match tmpl.body with | Body lst | BodyWithDigest(_, lst) -> Body (lst @ BaseCompat.setup_ml_text pkg) | NoBody -> NoBody in OASISFileTemplate.add {tmpl with body = body} acc else OASISFileTemplate.add tmpl acc) plgn_ctxt.files (OASISFileTemplate.create ~disable_oasis_section:pkg.OASISTypes.disable_oasis_section ()) in {plgn_ctxt with files = files} in let () = if plgn_ctxt.error then failwith (s_ "There are errors during the file generation.") in let chngs = (* Generate files *) OASISFileTemplate.fold (fun tmpl acc -> let chng = try file_generate ~ctxt ~backup tmpl with e -> List.iter (file_rollback ~ctxt) acc; raise e in if restore then register ~ctxt chng; chng :: acc) plgn_ctxt.files [] in (* Do other actions *) List.iter (fun act -> act ()) plgn_ctxt.other_actions; if change_setup_fn then (* Look for the change of the setup_fn. If we change the name of setup.ml * we have made a copy of it and it's a creation rather than a changer. * So remove the backup file and change the matching file event. *) List.map (function | Change (fn, bak) as chng when setup_fn = fn -> begin let () = unregister ~ctxt chng; match bak with | Some fn -> Sys.remove fn | None -> () in let chng = Create fn in if restore then register ~ctxt chng; chng end | e -> e) chngs else chngs oasis-0.4.11/src/base/BaseFileAB.mli0000644000175000017500000000443413261073606016327 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** File generated using environment variables This is the same kind of file as .in file for autoconf, except we use the variable definition of [Buffer.add_substitute]. This is the default file to be generated by configure step (even for autoconf, except that it produce a master file before). The file must end with '.ab'. @author Sylvain Le Gall *) open OASISTypes (** Compute the target filename of an .ab file. *) val to_filename: unix_filename -> OASISContext.source_filename (** Replace variable in file %.ab to generate %. *) val replace: ctxt:OASISContext.t -> unix_filename list -> unit oasis-0.4.11/src/base/BaseFileAB.ml0000644000175000017500000000460413261073606016155 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open BaseEnv open OASISGettext open BaseMessage open OASISContext let to_filename fn = if not (Filename.check_suffix fn ".ab") then warning (f_ "File '%s' doesn't have '.ab' extension") fn; OASISFileSystem.of_unix_filename (Filename.chop_extension fn) let replace ~ctxt fn_lst = let open OASISFileSystem in let ibuf, obuf = Buffer.create 13, Buffer.create 13 in List.iter (fun fn -> Buffer.clear ibuf; Buffer.clear obuf; defer_close (ctxt.srcfs#open_in (of_unix_filename fn)) (read_all ibuf); Buffer.add_string obuf (var_expand (Buffer.contents ibuf)); defer_close (ctxt.srcfs#open_out (to_filename fn)) (fun wrtr -> wrtr#output obuf)) fn_lst oasis-0.4.11/src/base/BaseEnvLight.mli0000644000175000017500000000512013261073606016756 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Read-only access to 'setup.data' This module defines the minimal set of functions to access data contained in 'setup.data'. It allows to build third party OCaml script, without embedding hundreeds line of code. It doesn't take into account '-C' and other options. @author Sylvain Le Gall *) module MapString: Map.S with type key = string type t = string MapString.t (** Environment default file. *) val default_filename: string (** Load environment. *) val load: ?allow_empty:bool -> ?filename:string -> ?stream:char Stream.t -> unit -> t (** Expand a variable, replacing $(X) by variable X recursively. *) val var_expand: string -> t -> string (** Get a variable that evaluate expression that can be found in it (see [Buffer.add_substitute]). *) val var_get: string -> t -> string (** Choose a value among conditional expressions. *) val var_choose: 'a OASISExpr.choices -> t -> 'a oasis-0.4.11/src/base/BaseEnvLight.ml0000644000175000017500000000713213261073606016612 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) 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) ?stream () = let line = ref 1 in let lexer st = let st_line = Stream.from (fun _ -> try match Stream.next st with | '\n' -> incr line; Some '\n' | c -> Some c with Stream.Failure -> None) in Genlex.make_lexer ["="] st_line in let rec read_file lxr mp = match Stream.npeek 3 lxr with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> Stream.junk lxr; Stream.junk lxr; Stream.junk lxr; read_file lxr (MapString.add nm value mp) | [] -> mp | _ -> failwith (Printf.sprintf "Malformed data file '%s' line %d" filename !line) in match stream with | Some st -> read_file (lexer st) MapString.empty | None -> if Sys.file_exists filename then begin let chn = open_in_bin filename in let st = Stream.of_channel chn in try let mp = read_file (lexer st) MapString.empty in close_in chn; mp with e -> close_in chn; raise e end else if allow_empty then begin MapString.empty end else begin failwith (Printf.sprintf "Unable to load environment, the file '%s' doesn't exist." filename) end let rec var_expand str env = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try var_expand (MapString.find var env) env with Not_found -> failwith (Printf.sprintf "No variable %s defined when trying to expand %S." var str)) str; Buffer.contents buff let var_get name env = var_expand (MapString.find name env) env let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst oasis-0.4.11/src/base/BaseEnv.mli0000644000175000017500000001123113261073606015766 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Read-write access to 'setup.data' @author Sylvain Le Gall *) open OASISTypes (** Origin of the variable, if a variable has been already set with a higher origin, it won't be set again. *) type origin_t = | ODefault (** Default computed value. *) | OGetEnv (** Extracted from environment, using Sys.getenv. *) | OFileLoad (** From loading file setup.data. *) | OCommandLine (** Set on command line. *) (** Command line handling for variable. *) type cli_handle_t = | CLINone (** No command line argument. *) | CLIAuto (** Build using variable name and help text. *) | CLIWith (** Use prefix --with-. *) | CLIEnable (** Use --enable/--disable. *) | CLIUser of (Arg.key * Arg.spec * Arg.doc) list (** Fully define the command line arguments. *) (** Variable type. *) type definition_t = { hide: bool; (** Hide the variable. *) dump: bool; (** Dump the variable. *) cli: cli_handle_t; (** Command line handling for the variable. *) arg_help: string option; (** Help about the variable. *) group: name option; (** Group of the variable. *) } (** Schema for environment. *) val schema: (origin_t, definition_t) PropList.Schema.t (** Data for environment. *) val env: PropList.Data.t (** Expand variable that can be found in string. Variable follow definition of variable for [Buffer.add_substitute]. *) val var_expand: string -> string (** Get variable. *) val var_get: name -> string (** Choose a value among conditional expressions. *) val var_choose: ?printer:('a -> string) -> ?name:string -> 'a OASISExpr.choices -> 'a (** Protect a variable content, to avoid expansion. *) val var_protect: string -> string (** Define a variable. *) val var_define: ?hide:bool -> ?dump:bool -> ?short_desc:(unit -> string) -> ?cli:cli_handle_t -> ?arg_help:string -> ?group:string -> name -> (unit -> string) -> (unit -> string) (** Define a variable or redefine it. *) val var_redefine: ?hide:bool -> ?dump:bool -> ?short_desc:(unit -> string) -> ?cli:cli_handle_t -> ?arg_help:string -> ?group:string -> name -> (unit -> string) -> (unit -> string) (** Well-typed ignore for [var_define]. *) val var_ignore: (unit -> string) -> unit (** Display all variables, even hidden one. *) val print_hidden: unit -> string (** Get all variables. *) val var_all: unit -> name list (** Environment default file. *) val default_filename: OASISContext.source_filename (** Initialize environment. *) val load: ctxt:OASISContext.t -> ?allow_empty:bool -> ?filename:OASISContext.source_filename -> unit -> unit (** Uninitialize environment. *) val unload: unit -> unit (** Save environment on disk. *) val dump: ctxt:OASISContext.t -> ?filename:OASISContext.source_filename -> unit -> unit (** Display environment to user. *) val print: unit -> unit (** Default command line arguments, computed using variable definitions. *) val args: unit -> (Arg.key * Arg.spec * Arg.doc) list oasis-0.4.11/src/base/BaseEnv.ml0000644000175000017500000003156213261073606015626 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISGettext open OASISUtils open OASISContext open PropList module MapString = BaseEnvLight.MapString type origin_t = | ODefault | OGetEnv | OFileLoad | OCommandLine type cli_handle_t = | CLINone | CLIAuto | CLIWith | CLIEnable | CLIUser of (Arg.key * Arg.spec * Arg.doc) list type definition_t = { hide: bool; dump: bool; cli: cli_handle_t; arg_help: string option; group: string option; } let schema = Schema.create "environment" (* Environment data *) let env = Data.create () (* Environment data from file *) let env_from_file = ref MapString.empty (* Lexer for var *) let var_lxr = Genlex.make_lexer [] let rec var_expand str = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try (* TODO: this is a quick hack to allow calling Test.Command * without defining executable name really. I.e. if there is * an exec Executable toto, then $(toto) should be replace * by its real name. It is however useful to have this function * for other variable that depend on the host and should be * written better than that. *) let st = var_lxr (Stream.of_string var) in match Stream.npeek 3 st with | [Genlex.Ident "utoh"; Genlex.Ident nm] -> OASISHostPath.of_unix (var_get nm) | [Genlex.Ident "utoh"; Genlex.String s] -> OASISHostPath.of_unix s | [Genlex.Ident "ocaml_escaped"; Genlex.Ident nm] -> String.escaped (var_get nm) | [Genlex.Ident "ocaml_escaped"; Genlex.String s] -> String.escaped s | [Genlex.Ident nm] -> var_get nm | _ -> failwithf (f_ "Unknown expression '%s' in variable expansion of %s.") var str with | Unknown_field (_, _) -> failwithf (f_ "No variable %s defined when trying to expand %S.") var str | Stream.Error e -> failwithf (f_ "Syntax error when parsing '%s' when trying to \ expand %S: %s") var str e) str; Buffer.contents buff and var_get name = let vl = try Schema.get schema env name with Unknown_field _ as e -> begin try MapString.find name !env_from_file with Not_found -> raise e end in var_expand vl let var_choose ?printer ?name lst = OASISExpr.choose ?printer ?name var_get lst let var_protect vl = let buff = Buffer.create (String.length vl) in String.iter (function | '$' -> Buffer.add_string buff "\\$" | c -> Buffer.add_char buff c) vl; Buffer.contents buff let var_define ?(hide=false) ?(dump=true) ?short_desc ?(cli=CLINone) ?arg_help ?group name (* TODO: type constraint on the fact that name must be a valid OCaml id *) dflt = let default = [ OFileLoad, (fun () -> MapString.find name !env_from_file); ODefault, dflt; OGetEnv, (fun () -> Sys.getenv name); ] in let extra = { hide = hide; dump = dump; cli = cli; arg_help = arg_help; group = group; } in (* Try to find a value that can be defined *) let var_get_low lst = let errors, res = List.fold_left (fun (errors, res) (_, v) -> if res = None then begin try errors, Some (v ()) with | Not_found -> errors, res | Failure rsn -> (rsn :: errors), res | e -> (Printexc.to_string e) :: errors, res end else errors, res) ([], None) (List.sort (fun (o1, _) (o2, _) -> Pervasives.compare o2 o1) lst) in match res, errors with | Some v, _ -> v | None, [] -> raise (Not_set (name, None)) | None, lst -> raise (Not_set (name, Some (String.concat (s_ ", ") lst))) in let help = match short_desc with | Some fs -> Some fs | None -> None in let var_get_lst = FieldRO.create ~schema ~name ~parse:(fun ?(context=ODefault) s -> [context, fun () -> s]) ~print:var_get_low ~default ~update:(fun ?context:_ x old_x -> x @ old_x) ?help extra in fun () -> var_expand (var_get_low (var_get_lst env)) let var_redefine ?hide ?dump ?short_desc ?cli ?arg_help ?group name dflt = if Schema.mem schema name then begin (* TODO: look suspsicious, we want to memorize dflt not dflt () *) Schema.set schema env ~context:ODefault name (dflt ()); fun () -> var_get name end else begin var_define ?hide ?dump ?short_desc ?cli ?arg_help ?group name dflt end let var_ignore (_: unit -> string) = () let print_hidden = var_define ~hide:true ~dump:false ~cli:CLIAuto ~arg_help:"Print even non-printable variable. (debug)" "print_hidden" (fun () -> "false") let var_all () = List.rev (Schema.fold (fun acc nm def _ -> if not def.hide || bool_of_string (print_hidden ()) then nm :: acc else acc) [] schema) let default_filename = in_srcdir "setup.data" let load ~ctxt ?(allow_empty=false) ?(filename=default_filename) () = let open OASISFileSystem in env_from_file := let repr_filename = ctxt.srcfs#string_of_filename filename in if ctxt.srcfs#file_exists filename then begin let buf = Buffer.create 13 in defer_close (ctxt.srcfs#open_in ~mode:binary_in filename) (read_all buf); defer_close (ctxt.srcfs#open_in ~mode:binary_in filename) (fun rdr -> OASISMessage.info ~ctxt "Loading environment from %S." repr_filename; BaseEnvLight.load ~allow_empty ~filename:(repr_filename) ~stream:(stream_of_reader rdr) ()) end else if allow_empty then begin BaseEnvLight.MapString.empty end else begin failwith (Printf.sprintf (f_ "Unable to load environment, the file '%s' doesn't exist.") repr_filename) end let unload () = env_from_file := MapString.empty; Data.clear env let dump ~ctxt ?(filename=default_filename) () = let open OASISFileSystem in defer_close (ctxt.OASISContext.srcfs#open_out ~mode:binary_out filename) (fun wrtr -> let buf = Buffer.create 63 in let output nm value = Buffer.add_string buf (Printf.sprintf "%s=%S\n" nm value) in let mp_todo = (* Dump data from schema *) Schema.fold (fun mp_todo nm def _ -> if def.dump then begin try output nm (Schema.get schema env nm) with Not_set _ -> () end; MapString.remove nm mp_todo) !env_from_file schema in (* Dump data defined outside of schema *) MapString.iter output mp_todo; wrtr#output buf) let print () = let printable_vars = Schema.fold (fun acc nm def short_descr_opt -> if not def.hide || bool_of_string (print_hidden ()) then begin try let value = Schema.get schema env nm in let txt = match short_descr_opt with | Some s -> s () | None -> nm in (txt, value) :: acc with Not_set _ -> acc end else acc) [] schema in let max_length = List.fold_left max 0 (List.rev_map String.length (List.rev_map fst printable_vars)) in let dot_pad str = String.make ((max_length - (String.length str)) + 3) '.' in Printf.printf "\nConfiguration:\n"; List.iter (fun (name, value) -> Printf.printf "%s: %s" name (dot_pad name); if value = "" then Printf.printf "\n" else Printf.printf " %s\n" value) (List.rev printable_vars); Printf.printf "\n%!" let args () = let arg_concat = OASISUtils.varname_concat ~hyphen:'-' in [ "--override", Arg.Tuple ( let rvr = ref "" in let rvl = ref "" in [ Arg.Set_string rvr; Arg.Set_string rvl; Arg.Unit (fun () -> Schema.set schema env ~context:OCommandLine !rvr !rvl) ] ), "var+val Override any configuration variable."; ] @ List.flatten (Schema.fold (fun acc name def short_descr_opt -> let var_set s = Schema.set schema env ~context:OCommandLine name s in let arg_name = OASISUtils.varname_of_string ~hyphen:'-' name in let hlp = match short_descr_opt with | Some txt -> txt () | None -> "" in let arg_hlp = match def.arg_help with | Some s -> s | None -> "str" in let default_value = try Printf.sprintf (f_ " [%s]") (Schema.get schema env name) with Not_set _ -> "" in let args = match def.cli with | CLINone -> [] | CLIAuto -> [ arg_concat "--" arg_name, Arg.String var_set, Printf.sprintf (f_ "%s %s%s") arg_hlp hlp default_value ] | CLIWith -> [ arg_concat "--with-" arg_name, Arg.String var_set, Printf.sprintf (f_ "%s %s%s") arg_hlp hlp default_value ] | CLIEnable -> let dflt = if default_value = " [true]" then s_ " [default: enabled]" else s_ " [default: disabled]" in [ arg_concat "--enable-" arg_name, Arg.Unit (fun () -> var_set "true"), Printf.sprintf (f_ " %s%s") hlp dflt; arg_concat "--disable-" arg_name, Arg.Unit (fun () -> var_set "false"), Printf.sprintf (f_ " %s%s") hlp dflt ] | CLIUser lst -> lst in args :: acc) [] schema) oasis-0.4.11/src/base/BaseDynVar.mli0000644000175000017500000000405713261073606016451 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Dynamic variables sets using 'setup.log' This variables are typically executable real name that are initially not set and then are set while building. They are computed and set once the matching executable had been successfully created. @author Sylvain Le Gall *) (** Read 'setup.log' and sets variables. *) val init: ctxt:OASISContext.t -> OASISTypes.package -> unit oasis-0.4.11/src/base/BaseDynVar.ml0000644000175000017500000000566513261073606016306 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open OASISGettext open BaseEnv open BaseBuilt let init ~ctxt pkg = (* TODO: disambiguate exec vs other variable by adding exec_VARNAME. *) (* TODO: provide compile option for library libary_byte_args_VARNAME... *) List.iter (function | Executable (cs, bs, _) -> if var_choose bs.bs_build then var_ignore (var_redefine (* We don't save this variable *) ~dump:false ~short_desc:(fun () -> Printf.sprintf (f_ "Filename of executable '%s'") cs.cs_name) (OASISUtils.varname_of_string cs.cs_name) (fun () -> let fn_opt = fold ~ctxt BExec cs.cs_name (fun _ fn -> Some fn) None in match fn_opt with | Some fn -> fn | None -> raise (PropList.Not_set (cs.cs_name, Some (Printf.sprintf (f_ "Executable '%s' not yet built.") cs.cs_name))))) | Library _ | Object _ | Flag _ | Test _ | SrcRepo _ | Doc _ -> ()) pkg.sections oasis-0.4.11/src/base/BaseDoc.mli0000644000175000017500000000412113261073606015743 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Build documentation @author Sylvain Le Gall *) open OASISTypes (** [doc lst pkg extra_args] Build all documents. [lst] elements are tuples [(f, cs, doc)], apply in turn [f pkg (cs, doc) extra_args]. *) val doc: ctxt:OASISContext.t -> ((ctxt:OASISContext.t -> package -> common_section * doc -> arg array -> unit) * common_section * doc) list -> package -> arg array -> unit oasis-0.4.11/src/base/BaseDoc.ml0000644000175000017500000000471313261073606015601 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open BaseEnv open BaseMessage open OASISTypes open OASISGettext let doc ~ctxt lst pkg extra_args = let one_doc (doc_plugin, cs, doc) = if var_choose ~name:(Printf.sprintf (f_ "documentation %s build") cs.cs_name) ~printer:string_of_bool doc.doc_build then begin info (f_ "Building documentation '%s'") cs.cs_name; BaseCustom.hook doc.doc_custom (doc_plugin ~ctxt pkg (cs, doc)) extra_args end in List.iter one_doc lst; if OASISFeatures.package_test OASISFeatures.flag_docs pkg && not (bool_of_string (BaseStandardVar.docs ())) && lst <> [] then BaseMessage.warning "Docs are turned off, consider enabling with \ 'ocaml setup.ml -configure --enable-docs'" oasis-0.4.11/src/base/BaseData.mlify0000644000175000017500000000046313261073606016453 0ustar gildorgildorVarString basesys_ml "BaseSys.ml" VarString basesysenvironment_ml "BaseSysEnvironment.ml" VarString basesysbundle_ml "BaseSysBundle.ml" VarString dynrun_ml "dynrun.ml" VarString dynrun_for_release_ml "dynrun_for_release.ml" VarString compiled_setup_ml "compiled_setup_ml.ml" oasis-0.4.11/src/base/BaseData.mli0000644000175000017500000000464613261073606016123 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Exported modules for embedding The whole module is {b not exported}. It is auto-generated using other modules. *) (** All exported modules from base library, default content for 'setup.ml'. *) val basesys_ml: string (** Minimal set of exported modules to load the 'setup.data' files. Use to create OCaml script that will use 'setup.data'. Example auto-generated 'myocamlbuild.ml' contains this set. *) val basesysenvironment_ml: string (** Set of modules to load for the 'bundle' subcommand *) val basesysbundle_ml: string (** Toploop for dynrun. *) val dynrun_ml: string (** Toploop for dynrun (alternative). *) val dynrun_for_release_ml: string (** Toploop for dynrun (yet another alternative). *) val compiled_setup_ml: string oasis-0.4.11/src/base/BaseCustom.mli0000644000175000017500000000404013261073606016510 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Run custom command for pre/post hook @author Sylvain Le Gall *) open OASISTypes (** [run prg args extra_args] Expand and run command. *) val run: prog -> args -> string array -> unit (** [hook ~failsafe custom f a] Apply a function nested in a [custom] block as defined by {!OASISTypes.custom}. *) val hook: ?failsafe:bool -> custom -> ('a -> 'b) -> 'a -> 'b oasis-0.4.11/src/base/BaseCustom.ml0000644000175000017500000000531013261073606016340 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open BaseEnv open BaseMessage open OASISTypes open OASISGettext let run cmd args extra_args = OASISExec.run ~ctxt:!BaseContext.default ~quote:false (var_expand cmd) (List.map var_expand (args @ (Array.to_list extra_args))) let hook ?(failsafe=false) cstm f e = let optional_command lst = let printer = function | Some (cmd, args) -> String.concat " " (cmd :: args) | None -> s_ "No command" in match var_choose ~name:(s_ "Pre/Post Command") ~printer lst with | Some (cmd, args) -> begin try run cmd args [||] with e when failsafe -> warning (f_ "Command '%s' fail with error: %s") (String.concat " " (cmd :: args)) (match e with | Failure msg -> msg | e -> Printexc.to_string e) end | None -> () in let res = optional_command cstm.pre_command; f e in optional_command cstm.post_command; res oasis-0.4.11/src/base/BaseContext.mli0000644000175000017500000000372113261073606016667 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Global context for messages and i18n This module is the same as {!OASISContext}. It is only aliases. @author Sylvain Le Gall *) (** See {!OASISContext.args}. *) val args: unit -> (string * Arg.spec * string) list (** See {!OASISContext.default} *) val default: OASISContext.t ref oasis-0.4.11/src/base/BaseContext.ml0000644000175000017500000000342513261073606016517 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* TODO: get rid of this module. *) open OASISContext let args () = fst (fspecs ()) let default = default oasis-0.4.11/src/base/BaseCompat.ml0000644000175000017500000001543413261073606016321 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Compatibility layer to provide a stable API inside setup.ml. This layer allows OASIS to change in between minor versions (e.g. 0.4.6 -> 0.4.7) but still provides a stable API inside setup.ml. This enables to write functions that manipulate setup_t inside setup.ml. See deps.ml for an example. The module opened by default will depend on the version of the _oasis. E.g. if we have "OASISFormat: 0.3", the module Compat_0_3 will be opened and the function Compat_0_3 will be called. If setup.ml is generated with the -nocompat, no module will be opened. @author Sylvain Le Gall *) module Compat_0_4 = struct let rctxt = ref !BaseContext.default module BaseSetup = struct module Original = BaseSetup open OASISTypes type std_args_fun = package -> string array -> unit type ('a, 'b) section_args_fun = name * (package -> (common_section * 'a) -> string array -> 'b) type t = { configure: std_args_fun; build: std_args_fun; doc: ((doc, unit) section_args_fun) list; test: ((test, float) section_args_fun) list; install: std_args_fun; uninstall: std_args_fun; clean: std_args_fun list; clean_doc: (doc, unit) section_args_fun list; clean_test: (test, unit) section_args_fun list; distclean: std_args_fun list; distclean_doc: (doc, unit) section_args_fun list; distclean_test: (test, unit) section_args_fun list; package: package; oasis_fn: string option; oasis_version: string; oasis_digest: Digest.t option; oasis_exec: string option; oasis_setup_args: string list; setup_update: bool; } let setup t = let mk_std_args_fun f = fun ~ctxt pkg args -> rctxt := ctxt; f pkg args in let mk_section_args_fun l = List.map (fun (nm, f) -> nm, (fun ~ctxt pkg sct args -> rctxt := ctxt; f pkg sct args)) l in let t' = { Original. configure = mk_std_args_fun t.configure; build = mk_std_args_fun t.build; doc = mk_section_args_fun t.doc; test = mk_section_args_fun t.test; install = mk_std_args_fun t.install; uninstall = mk_std_args_fun t.uninstall; clean = List.map mk_std_args_fun t.clean; clean_doc = mk_section_args_fun t.clean_doc; clean_test = mk_section_args_fun t.clean_test; distclean = List.map mk_std_args_fun t.distclean; distclean_doc = mk_section_args_fun t.distclean_doc; distclean_test = mk_section_args_fun t.distclean_test; package = t.package; oasis_fn = t.oasis_fn; oasis_version = t.oasis_version; oasis_digest = t.oasis_digest; oasis_exec = t.oasis_exec; oasis_setup_args = t.oasis_setup_args; setup_update = t.setup_update; } in Original.setup t' end let adapt_setup_t setup_t = let module O = BaseSetup.Original in let mk_std_args_fun f = fun pkg args -> f ~ctxt:!rctxt pkg args in let mk_section_args_fun l = List.map (fun (nm, f) -> nm, (fun pkg sct args -> f ~ctxt:!rctxt pkg sct args)) l in { BaseSetup. configure = mk_std_args_fun setup_t.O.configure; build = mk_std_args_fun setup_t.O.build; doc = mk_section_args_fun setup_t.O.doc; test = mk_section_args_fun setup_t.O.test; install = mk_std_args_fun setup_t.O.install; uninstall = mk_std_args_fun setup_t.O.uninstall; clean = List.map mk_std_args_fun setup_t.O.clean; clean_doc = mk_section_args_fun setup_t.O.clean_doc; clean_test = mk_section_args_fun setup_t.O.clean_test; distclean = List.map mk_std_args_fun setup_t.O.distclean; distclean_doc = mk_section_args_fun setup_t.O.distclean_doc; distclean_test = mk_section_args_fun setup_t.O.distclean_test; package = setup_t.O.package; oasis_fn = setup_t.O.oasis_fn; oasis_version = setup_t.O.oasis_version; oasis_digest = setup_t.O.oasis_digest; oasis_exec = setup_t.O.oasis_exec; oasis_setup_args = setup_t.O.oasis_setup_args; setup_update = setup_t.O.setup_update; } end module Compat_0_3 = struct include Compat_0_4 end (* END EXPORT *) let setup_ml_text pkg = let modul = let buf = Buffer.create 15 in Buffer.add_string buf "BaseCompat.Compat_"; String.iter (fun c -> Buffer.add_char buf (if c = '.' then '_' else c)) (OASISVersion.string_of_version pkg.OASISTypes.oasis_version); Buffer.contents buf in [ Printf.sprintf "let setup_t = %s.adapt_setup_t setup_t" modul; Printf.sprintf "open %s" modul; ] oasis-0.4.11/src/base/BaseCheck.mli0000644000175000017500000000564513261073606016267 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Check host system features @author Sylvain Le Gall *) open OASISTypes (** Look for a program among a list of alternative program * the first found is returned. *) val prog_best: prog -> prog list -> unit -> host_filename (** Check the presence of a particular program. *) val prog: prog -> unit -> host_filename (** Check the presence of a program or its native version. *) val prog_opt: prog -> unit -> host_filename (** The ocamlfind command line tool, used to query version of package. Use {!BaseStandardVar.ocamlfind} variable if you want a safe way to access this variable. *) val ocamlfind: unit -> host_filename (** [version var_pref cmp ver ()] Check version [ver ()], using [cmp] and {!OASISVersion.comparator_apply}. Generate a variable prefixed by [var_pref] and using [OASISVersion.varname_of_comparator]. *) val version: string -> OASISVersion.comparator -> (unit -> OASISVersion.StringVersion.t) -> unit -> OASISVersion.StringVersion.t (** Get findlib package version . *) val package_version: findlib_full -> OASISVersion.StringVersion.t (** Check for findlib package and version. Return install directory. *) val package: ?version_comparator:OASISVersion.comparator -> findlib_full -> unit -> host_dirname oasis-0.4.11/src/base/BaseCheck.ml0000644000175000017500000001057713261073606016116 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open BaseEnv open BaseMessage open OASISUtils open OASISGettext let prog_best prg prg_lst = var_redefine prg (fun () -> let alternate = List.fold_left (fun res e -> match res with | Some _ -> res | None -> try Some (OASISFileUtil.which ~ctxt:!BaseContext.default e) with Not_found -> None) None prg_lst in match alternate with | Some prg -> prg | None -> raise Not_found) let prog prg = prog_best prg [prg] let prog_opt prg = prog_best prg [prg^".opt"; prg] let ocamlfind = prog "ocamlfind" let version var_prefix cmp fversion () = (* Really compare version provided *) let var = var_prefix^"_version_"^(OASISVersion.varname_of_comparator cmp) in var_redefine ~hide:true var (fun () -> let version_str = match fversion () with | "[Distributed with OCaml]" -> begin try (var_get "ocaml_version") with Not_found -> warning (f_ "Variable ocaml_version not defined, fallback \ to default"); Sys.ocaml_version end | res -> res in let version = OASISVersion.version_of_string version_str in if OASISVersion.comparator_apply version cmp then version_str else failwithf (f_ "Cannot satisfy version constraint on %s: %s (version: %s)") var_prefix (OASISVersion.string_of_comparator cmp) version_str) () let package_version pkg = OASISExec.run_read_one_line ~ctxt:!BaseContext.default (ocamlfind ()) ["query"; "-format"; "%v"; pkg] let package ?version_comparator pkg () = let var = OASISUtils.varname_concat "pkg_" (OASISUtils.varname_of_string pkg) in let findlib_dir pkg = let dir = OASISExec.run_read_one_line ~ctxt:!BaseContext.default (ocamlfind ()) ["query"; "-format"; "%d"; pkg] in if Sys.file_exists dir && Sys.is_directory dir then dir else failwithf (f_ "When looking for findlib package %s, \ directory %s return doesn't exist") pkg dir in let vl = var_redefine var (fun () -> findlib_dir pkg) () in ( match version_comparator with | Some ver_cmp -> ignore (version var ver_cmp (fun _ -> package_version pkg) ()) | None -> () ); vl oasis-0.4.11/src/base/BaseBuilt.mli0000644000175000017500000000736713261073606016334 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Register files built to be installed @author Sylvain Le Gall *) (* TODO: replace host_filename here by OASISContext.build_filename, using the same scheme as source_filename. *) open OASISTypes type t = | BExec (* Executable. *) | BExecLib (* Library coming with executable. *) | BLib (* Library. *) | BObj (* Object. *) | BDoc (* Document. *) (** Register files built. Each files built is provided as a list of alternatives. At least one alternative file should exist when registering and we only register existing ones. *) val register: ctxt:OASISContext.t -> t -> name -> host_filename list list -> unit (** Unregister all files built. *) val unregister: ctxt:OASISContext.t -> t -> name -> unit (** Fold-left files built, filter existing and non-existing files. *) val fold: ctxt:OASISContext.t -> t -> name -> ('a -> host_filename -> 'a) -> 'a -> 'a (** Check if a library/object/doc/exec has been built. *) val is_built: ctxt:OASISContext.t -> t -> name -> bool (** [of_executable loc_fn (cs, bs, exec)] Compute at the same time events that should be registered by {!register} and data returned by {!OASISExecutable.unix_exec_is}. Use [loc_fn], if generated files are moved to a directory different from sources (e.g. in directory "_build"). *) val of_executable: (unix_filename -> host_filename) -> common_section * build_section * executable -> (t * name * host_filename list list) list * unix_filename * unix_filename option (** [of_library loc_fn (cs, bs, lib)] Same as {!of_executable}, but using {!OASISLibrary.generated_unix_files}. *) val of_library: (unix_filename -> host_filename) -> common_section * build_section * library -> (t * name * host_filename list list) list * unix_filename list list (** [of_object loc_fn (cs, bs, lib)] Same as {!of_executable}, but using {!OASISObject.generated_unix_files}. *) val of_object: (unix_filename -> host_filename) -> common_section * build_section * object_ -> (t * name * host_filename list list) list * unix_filename list list oasis-0.4.11/src/base/BaseBuilt.ml0000644000175000017500000001241613261073606016152 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISTypes open OASISGettext open BaseStandardVar open BaseMessage type t = | BExec (* Executable *) | BExecLib (* Library coming with executable *) | BLib (* Library *) | BObj (* Library *) | BDoc (* Document *) let to_log_event_file t nm = "built_"^ (match t with | BExec -> "exec" | BExecLib -> "exec_lib" | BLib -> "lib" | BObj -> "obj" | BDoc -> "doc")^ "_"^nm let to_log_event_done t nm = "is_"^(to_log_event_file t nm) let register ~ctxt t nm lst = BaseLog.register ~ctxt (to_log_event_done t nm) "true"; List.iter (fun alt -> let registered = List.fold_left (fun registered fn -> if OASISFileUtil.file_exists_case fn then begin BaseLog.register ~ctxt (to_log_event_file t nm) (if Filename.is_relative fn then Filename.concat (Sys.getcwd ()) fn else fn); true end else begin registered end) false alt in if not registered then warning (f_ "Cannot find an existing alternative files among: %s") (String.concat (s_ ", ") alt)) lst let unregister ~ctxt t nm = List.iter (fun (e, d) -> BaseLog.unregister ~ctxt e d) (BaseLog.filter ~ctxt [to_log_event_file t nm; to_log_event_done t nm]) let fold ~ctxt t nm f acc = List.fold_left (fun acc (_, fn) -> if OASISFileUtil.file_exists_case fn then begin f acc fn end else begin warning (f_ "File '%s' has been marked as built \ for %s but doesn't exist") fn (Printf.sprintf (match t with | BExec | BExecLib -> (f_ "executable %s") | BLib -> (f_ "library %s") | BObj -> (f_ "object %s") | BDoc -> (f_ "documentation %s")) nm); acc end) acc (BaseLog.filter ~ctxt [to_log_event_file t nm]) let is_built ~ctxt t nm = List.fold_left (fun _ (_, d) -> try bool_of_string d with _ -> false) false (BaseLog.filter ~ctxt [to_log_event_done t nm]) let of_executable ffn (cs, bs, exec) = let unix_exec_is, unix_dll_opt = OASISExecutable.unix_exec_is (cs, bs, exec) (fun () -> bool_of_string (is_native ())) ext_dll ext_program in let evs = (BExec, cs.cs_name, [[ffn unix_exec_is]]) :: (match unix_dll_opt with | Some fn -> [BExecLib, cs.cs_name, [[ffn fn]]] | None -> []) in evs, unix_exec_is, unix_dll_opt let of_library ffn (cs, bs, lib) = let unix_lst = OASISLibrary.generated_unix_files ~ctxt:!BaseContext.default ~source_file_exists:(fun fn -> OASISFileUtil.file_exists_case (OASISHostPath.of_unix fn)) ~is_native:(bool_of_string (is_native ())) ~has_native_dynlink:(bool_of_string (native_dynlink ())) ~ext_lib:(ext_lib ()) ~ext_dll:(ext_dll ()) (cs, bs, lib) in let evs = [BLib, cs.cs_name, List.map (List.map ffn) unix_lst] in evs, unix_lst let of_object ffn (cs, bs, obj) = let unix_lst = OASISObject.generated_unix_files ~ctxt:!BaseContext.default ~source_file_exists:(fun fn -> OASISFileUtil.file_exists_case (OASISHostPath.of_unix fn)) ~is_native:(bool_of_string (is_native ())) (cs, bs, obj) in let evs = [BObj, cs.cs_name, List.map (List.map ffn) unix_lst] in evs, unix_lst oasis-0.4.11/src/base/BaseArgExt.mli0000644000175000017500000000361713261073606016441 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Handle command line argument @author Sylvain Le Gall *) (** Parse command line argument, using provided arguments. Works like [Arg.parse_argv]. *) val parse: string array -> (Arg.key * Arg.spec * Arg.doc) list -> unit oasis-0.4.11/src/base/BaseArgExt.ml0000644000175000017500000000417013261073606016263 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISUtils open OASISGettext let parse argv args = (* Simulate command line for Arg *) let current = ref 0 in try Arg.parse_argv ~current:current (Array.concat [[|"none"|]; argv]) (Arg.align args) (failwithf (f_ "Don't know what to do with arguments: '%s'")) (s_ "configure options:") with | Arg.Help txt -> print_endline txt; exit 0 | Arg.Bad txt -> prerr_endline txt; exit 1 oasis-0.4.11/src/api-oasis.odocl0000644000175000017500000000552313261073606015744 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 5807d65e823480d9efda44d63833870e) oasis/FormatExt oasis/PropList oasis/OASISUtils oasis/OASISUnixPath oasis/OASISFileSystem oasis/OASISContext oasis/OASISSourcePatterns oasis/OASISGettext oasis/OASISMessage oasis/OASISText oasis/OASISTypes oasis/OASISParse oasis/OASISValues oasis/OASISExpr oasis/OASISVersion oasis/OASISLicense oasis/OASISFileTemplate oasis/OASISBuildSection oasis/OASISDocument oasis/OASISExecutable oasis/OASISFlag oasis/OASISSetupUpdate oasis/OASISLibrary oasis/OASISObject oasis/OASISPackage oasis/OASISSourceRepository oasis/OASISTest oasis/OASISPlugin oasis/OASISFindlib oasis/OASISSchema oasis/OASISSection oasis/OASISData oasis/OASISString oasis/OASISExec oasis/OASISFileUtil oasis/OASISHostPath oasis/OASISGraph oasis/OASISFeatures oasis/OASISDataNotation base/BaseArgExt base/BaseBuilt base/BaseCheck base/BaseCustom base/BaseData base/BaseDoc base/BaseEnvLight base/BaseEnv base/BaseFileAB base/BaseGenerate base/BaseLog base/BaseOCamlcConfig base/BaseSetup base/BaseStandardVar base/BaseTest base/BaseDynVar base/BaseMessage base/BaseContext base/BaseCompat cli/CLISubCommand cli/CLIArgExt cli/CLICommon cli/CLIPager # OASIS_STOP oasis-0.4.11/src/OASISBuiltinPlugins.ml0000644000175000017500000000374013261073606017135 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (** Load builtin plugins *) let init () = NonePlugin.init (); InternalInstallPlugin.init (); InternalConfigurePlugin.init (); OCamlbuildPlugin.init (); OCamlbuildDocPlugin.init (); CustomPlugin.init (); OMakePlugin.init (); METAPlugin.init (); DevFilesPlugin.init (); StdFilesPlugin.init () oasis-0.4.11/setup.ml0000644000175000017500000151254713261073627013755 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* OASIS_START *) (* DO NOT EDIT (digest: 6bf336bd3a817bf7523ab66c3f46186c) *) (* Regenerated by OASIS v0.4.11~HEAD Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) module OASISGettext = struct # 22 "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 OASISString = struct # 22 "src/oasis/OASISString.ml" (** Various string utilities. Mostly inspired by extlib and batteries ExtString and BatString libraries. @author Sylvain Le Gall *) let nsplitf str f = if str = "" then [] else let buf = Buffer.create 13 in let lst = ref [] in let push () = lst := Buffer.contents buf :: !lst; Buffer.clear buf in let str_len = String.length str in for i = 0 to str_len - 1 do if f str.[i] then push () else Buffer.add_char buf str.[i] done; push (); List.rev !lst (** [nsplit c s] Split the string [s] at char [c]. It doesn't include the separator. *) let nsplit str c = nsplitf str ((=) c) let find ~what ?(offset=0) str = let what_idx = ref 0 in let str_idx = ref offset in while !str_idx < String.length str && !what_idx < String.length what do if str.[!str_idx] = what.[!what_idx] then incr what_idx else what_idx := 0; incr str_idx done; if !what_idx <> String.length what then raise Not_found else !str_idx - !what_idx let sub_start str len = let str_len = String.length str in if len >= str_len then "" else String.sub str len (str_len - len) let sub_end ?(offset=0) str len = let str_len = String.length str in if len >= str_len then "" else String.sub str 0 (str_len - len) let starts_with ~what ?(offset=0) str = let what_idx = ref 0 in let str_idx = ref offset in let ok = ref true in while !ok && !str_idx < String.length str && !what_idx < String.length what do if str.[!str_idx] = what.[!what_idx] then incr what_idx else ok := false; incr str_idx done; !what_idx = String.length what let strip_starts_with ~what str = if starts_with ~what str then sub_start str (String.length what) else raise Not_found let ends_with ~what ?(offset=0) str = let what_idx = ref ((String.length what) - 1) in let str_idx = ref ((String.length str) - 1) in let ok = ref true in while !ok && offset <= !str_idx && 0 <= !what_idx do if str.[!str_idx] = what.[!what_idx] then decr what_idx else ok := false; decr str_idx done; !what_idx = -1 let strip_ends_with ~what str = if ends_with ~what str then sub_end str (String.length what) else raise Not_found let replace_chars f s = let buf = Buffer.create (String.length s) in String.iter (fun c -> Buffer.add_char buf (f c)) s; Buffer.contents buf let lowercase_ascii = replace_chars (fun c -> if (c >= 'A' && c <= 'Z') then Char.chr (Char.code c + 32) else c) let uncapitalize_ascii s = if s <> "" then (lowercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1)) else s let uppercase_ascii = replace_chars (fun c -> if (c >= 'a' && c <= 'z') then Char.chr (Char.code c - 32) else c) let capitalize_ascii s = if s <> "" then (uppercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1)) else s end module OASISUtils = struct # 22 "src/oasis/OASISUtils.ml" open OASISGettext module MapExt = struct module type S = sig include Map.S val add_list: 'a t -> (key * 'a) list -> 'a t val of_list: (key * 'a) list -> 'a t val to_list: 'a t -> (key * 'a) list end module Make (Ord: Map.OrderedType) = struct include Map.Make(Ord) let rec add_list t = function | (k, v) :: tl -> add_list (add k v t) tl | [] -> t let of_list lst = add_list empty lst let to_list t = fold (fun k v acc -> (k, v) :: acc) t [] end end module MapString = MapExt.Make(String) module SetExt = struct module type S = sig include Set.S val add_list: t -> elt list -> t val of_list: elt list -> t val to_list: t -> elt list end module Make (Ord: Set.OrderedType) = struct include Set.Make(Ord) let rec add_list t = function | e :: tl -> add_list (add e t) tl | [] -> t let of_list lst = add_list empty lst let to_list = elements end end module SetString = SetExt.Make(String) let compare_csl s1 s2 = String.compare (OASISString.lowercase_ascii s1) (OASISString.lowercase_ascii s2) module HashStringCsl = Hashtbl.Make (struct type t = string let equal s1 s2 = (compare_csl s1 s2) = 0 let hash s = Hashtbl.hash (OASISString.lowercase_ascii s) end) module SetStringCsl = SetExt.Make (struct type t = string let compare = compare_csl end) let varname_of_string ?(hyphen='_') s = if String.length s = 0 then begin invalid_arg "varname_of_string" end else begin let buf = OASISString.replace_chars (fun c -> if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') then c else hyphen) s; in let buf = (* Start with a _ if digit *) if '0' <= s.[0] && s.[0] <= '9' then "_"^buf else buf in OASISString.lowercase_ascii buf end let varname_concat ?(hyphen='_') p s = let what = String.make 1 hyphen in let p = try OASISString.strip_ends_with ~what p with Not_found -> p in let s = try OASISString.strip_starts_with ~what s with Not_found -> s in p^what^s let is_varname str = str = varname_of_string str let failwithf fmt = Printf.ksprintf failwith fmt let rec file_location ?pos1 ?pos2 ?lexbuf () = match pos1, pos2, lexbuf with | Some p, None, _ | None, Some p, _ -> file_location ~pos1:p ~pos2:p ?lexbuf () | Some p1, Some p2, _ -> let open Lexing in let fn, lineno = p1.pos_fname, p1.pos_lnum in let c1 = p1.pos_cnum - p1.pos_bol in let c2 = c1 + (p2.pos_cnum - p1.pos_cnum) in Printf.sprintf (f_ "file %S, line %d, characters %d-%d") fn lineno c1 c2 | _, _, Some lexbuf -> file_location ~pos1:(Lexing.lexeme_start_p lexbuf) ~pos2:(Lexing.lexeme_end_p lexbuf) () | None, None, None -> s_ "" let failwithpf ?pos1 ?pos2 ?lexbuf fmt = let loc = file_location ?pos1 ?pos2 ?lexbuf () in Printf.ksprintf (fun s -> failwith (Printf.sprintf "%s: %s" loc s)) fmt end module OASISUnixPath = struct # 22 "src/oasis/OASISUnixPath.ml" type unix_filename = string type unix_dirname = string type host_filename = string type host_dirname = string let current_dir_name = "." let parent_dir_name = ".." let is_current_dir fn = fn = current_dir_name || fn = "" let concat f1 f2 = if is_current_dir f1 then f2 else let f1' = try OASISString.strip_ends_with ~what:"/" f1 with Not_found -> f1 in f1'^"/"^f2 let make = function | hd :: tl -> List.fold_left (fun f p -> concat f p) hd tl | [] -> invalid_arg "OASISUnixPath.make" let dirname f = try String.sub f 0 (String.rindex f '/') with Not_found -> current_dir_name let basename f = try let pos_start = (String.rindex f '/') + 1 in String.sub f pos_start ((String.length f) - pos_start) with Not_found -> f let chop_extension f = try let last_dot = String.rindex f '.' in let sub = String.sub f 0 last_dot in try let last_slash = String.rindex f '/' in if last_slash < last_dot then sub else f with Not_found -> sub with Not_found -> f let capitalize_file f = let dir = dirname f in let base = basename f in concat dir (OASISString.capitalize_ascii base) let uncapitalize_file f = let dir = dirname f in let base = basename f in concat dir (OASISString.uncapitalize_ascii base) end module OASISHostPath = struct # 22 "src/oasis/OASISHostPath.ml" open Filename open OASISGettext module Unix = OASISUnixPath let make = function | [] -> invalid_arg "OASISHostPath.make" | hd :: tl -> List.fold_left Filename.concat hd tl let of_unix ufn = match Sys.os_type with | "Unix" | "Cygwin" -> ufn | "Win32" -> make (List.map (fun p -> if p = Unix.current_dir_name then current_dir_name else if p = Unix.parent_dir_name then parent_dir_name else p) (OASISString.nsplit ufn '/')) | os_type -> OASISUtils.failwithf (f_ "Don't know the path format of os_type %S when translating unix \ filename. %S") os_type ufn end module OASISFileSystem = struct # 22 "src/oasis/OASISFileSystem.ml" (** File System functions @author Sylvain Le Gall *) type 'a filename = string class type closer = object method close: unit end class type reader = object inherit closer method input: Buffer.t -> int -> unit end class type writer = object inherit closer method output: Buffer.t -> unit end class type ['a] fs = object method string_of_filename: 'a filename -> string method open_out: ?mode:(open_flag list) -> ?perm:int -> 'a filename -> writer method open_in: ?mode:(open_flag list) -> ?perm:int -> 'a filename -> reader method file_exists: 'a filename -> bool method remove: 'a filename -> unit end module Mode = struct let default_in = [Open_rdonly] let default_out = [Open_wronly; Open_creat; Open_trunc] let text_in = Open_text :: default_in let text_out = Open_text :: default_out let binary_in = Open_binary :: default_in let binary_out = Open_binary :: default_out end let std_length = 4096 (* Standard buffer/read length. *) let binary_out = Mode.binary_out let binary_in = Mode.binary_in let of_unix_filename ufn = (ufn: 'a filename) let to_unix_filename fn = (fn: string) let defer_close o f = try let r = f o in o#close; r with e -> o#close; raise e let stream_of_reader rdr = let buf = Buffer.create std_length in let pos = ref 0 in let eof = ref false in let rec next idx = let bpos = idx - !pos in if !eof then begin None end else if bpos < Buffer.length buf then begin Some (Buffer.nth buf bpos) end else begin pos := !pos + Buffer.length buf; Buffer.clear buf; begin try rdr#input buf std_length; with End_of_file -> if Buffer.length buf = 0 then eof := true end; next idx end in Stream.from next let read_all buf rdr = try while true do rdr#input buf std_length done with End_of_file -> () class ['a] host_fs rootdir : ['a] fs = object (self) method private host_filename fn = Filename.concat rootdir fn method string_of_filename = self#host_filename method open_out ?(mode=Mode.text_out) ?(perm=0o666) fn = let chn = open_out_gen mode perm (self#host_filename fn) in object method close = close_out chn method output buf = Buffer.output_buffer chn buf end method open_in ?(mode=Mode.text_in) ?(perm=0o666) fn = (* TODO: use Buffer.add_channel when minimal version of OCaml will * be >= 4.03.0 (previous version was discarding last chars). *) let chn = open_in_gen mode perm (self#host_filename fn) in let strm = Stream.of_channel chn in object method close = close_in chn method input buf len = let read = ref 0 in try for _i = 0 to len do Buffer.add_char buf (Stream.next strm); incr read done with Stream.Failure -> if !read = 0 then raise End_of_file end method file_exists fn = Sys.file_exists (self#host_filename fn) method remove fn = Sys.remove (self#host_filename fn) end end module OASISContext = struct # 22 "src/oasis/OASISContext.ml" open OASISGettext type level = [ `Debug | `Info | `Warning | `Error] type source type source_filename = source OASISFileSystem.filename let in_srcdir ufn = OASISFileSystem.of_unix_filename ufn type t = { (* TODO: replace this by a proplist. *) quiet: bool; info: bool; debug: bool; ignore_plugins: bool; ignore_unknown_fields: bool; printf: level -> string -> unit; srcfs: source OASISFileSystem.fs; load_oasis_plugin: string -> bool; } let printf lvl str = let beg = match lvl with | `Error -> s_ "E: " | `Warning -> s_ "W: " | `Info -> s_ "I: " | `Debug -> s_ "D: " in prerr_endline (beg^str) let default = ref { quiet = false; info = false; debug = false; ignore_plugins = false; ignore_unknown_fields = false; printf = printf; srcfs = new OASISFileSystem.host_fs(Sys.getcwd ()); load_oasis_plugin = (fun _ -> false); } let quiet = {!default with quiet = true} let fspecs () = (* TODO: don't act on default. *) let ignore_plugins = ref false in ["-quiet", Arg.Unit (fun () -> default := {!default with quiet = true}), s_ " Run quietly"; "-info", Arg.Unit (fun () -> default := {!default with info = true}), s_ " Display information message"; "-debug", Arg.Unit (fun () -> default := {!default with debug = true}), s_ " Output debug message"; "-ignore-plugins", Arg.Set ignore_plugins, s_ " Ignore plugin's field."; "-C", Arg.String (fun str -> Sys.chdir str; default := {!default with srcfs = new OASISFileSystem.host_fs str}), s_ "dir Change directory before running (affects setup.{data,log})."], fun () -> {!default with ignore_plugins = !ignore_plugins} end module PropList = struct # 22 "src/oasis/PropList.ml" open OASISGettext type name = string exception Not_set of name * string option exception No_printer of name exception Unknown_field of name * name let () = Printexc.register_printer (function | Not_set (nm, Some rsn) -> Some (Printf.sprintf (f_ "Field '%s' is not set: %s") nm rsn) | Not_set (nm, None) -> Some (Printf.sprintf (f_ "Field '%s' is not set") nm) | No_printer nm -> Some (Printf.sprintf (f_ "No default printer for value %s") nm) | Unknown_field (nm, schm) -> Some (Printf.sprintf (f_ "Field %s is not defined in schema %s") nm schm) | _ -> None) module Data = struct type t = (name, unit -> unit) Hashtbl.t let create () = Hashtbl.create 13 let clear t = Hashtbl.clear t # 77 "src/oasis/PropList.ml" end module Schema = struct type ('ctxt, 'extra) value = { get: Data.t -> string; set: Data.t -> ?context:'ctxt -> string -> unit; help: (unit -> string) option; extra: 'extra; } type ('ctxt, 'extra) t = { name: name; fields: (name, ('ctxt, 'extra) value) Hashtbl.t; order: name Queue.t; name_norm: string -> string; } let create ?(case_insensitive=false) nm = { name = nm; fields = Hashtbl.create 13; order = Queue.create (); name_norm = (if case_insensitive then OASISString.lowercase_ascii else fun s -> s); } let add t nm set get extra help = let key = t.name_norm nm in if Hashtbl.mem t.fields key then failwith (Printf.sprintf (f_ "Field '%s' is already defined in schema '%s'") nm t.name); Hashtbl.add t.fields key { set = set; get = get; help = help; extra = extra; }; Queue.add nm t.order let mem t nm = Hashtbl.mem t.fields nm let find t nm = try Hashtbl.find t.fields (t.name_norm nm) with Not_found -> raise (Unknown_field (nm, t.name)) let get t data nm = (find t nm).get data let set t data nm ?context x = (find t nm).set data ?context x let fold f acc t = Queue.fold (fun acc k -> let v = find t k in f acc k v.extra v.help) acc t.order let iter f t = fold (fun () -> f) () t let name t = t.name end module Field = struct type ('ctxt, 'value, 'extra) t = { set: Data.t -> ?context:'ctxt -> 'value -> unit; get: Data.t -> 'value; sets: Data.t -> ?context:'ctxt -> string -> unit; gets: Data.t -> string; help: (unit -> string) option; extra: 'extra; } let new_id = let last_id = ref 0 in fun () -> incr last_id; !last_id let create ?schema ?name ?parse ?print ?default ?update ?help extra = (* Default value container *) let v = ref None in (* If name is not given, create unique one *) let nm = match name with | Some s -> s | None -> Printf.sprintf "_anon_%d" (new_id ()) in (* Last chance to get a value: the default *) let default () = match default with | Some d -> d | None -> raise (Not_set (nm, Some (s_ "no default value"))) in (* Get data *) let get data = (* Get value *) try (Hashtbl.find data nm) (); match !v with | Some x -> x | None -> default () with Not_found -> default () in (* Set data *) let set data ?context x = let x = match update with | Some f -> begin try f ?context (get data) x with Not_set _ -> x end | None -> x in Hashtbl.replace data nm (fun () -> v := Some x) in (* Parse string value, if possible *) let parse = match parse with | Some f -> f | None -> fun ?context s -> failwith (Printf.sprintf (f_ "Cannot parse field '%s' when setting value %S") nm s) in (* Set data, from string *) let sets data ?context s = set ?context data (parse ?context s) in (* Output value as string, if possible *) let print = match print with | Some f -> f | None -> fun _ -> raise (No_printer nm) in (* Get data, as a string *) let gets data = print (get data) in begin match schema with | Some t -> Schema.add t nm sets gets extra help | None -> () end; { set = set; get = get; sets = sets; gets = gets; help = help; extra = extra; } let fset data t ?context x = t.set data ?context x let fget data t = t.get data let fsets data t ?context s = t.sets data ?context s let fgets data t = t.gets data end module FieldRO = struct let create ?schema ?name ?parse ?print ?default ?update ?help extra = let fld = Field.create ?schema ?name ?parse ?print ?default ?update ?help extra in fun data -> Field.fget data fld end end module OASISMessage = struct # 22 "src/oasis/OASISMessage.ml" open OASISGettext open OASISContext let generic_message ~ctxt lvl fmt = let cond = if ctxt.quiet then false else match lvl with | `Debug -> ctxt.debug | `Info -> ctxt.info | _ -> true in Printf.ksprintf (fun str -> if cond then begin ctxt.printf lvl str end) fmt let debug ~ctxt fmt = generic_message ~ctxt `Debug fmt let info ~ctxt fmt = generic_message ~ctxt `Info fmt let warning ~ctxt fmt = generic_message ~ctxt `Warning fmt let error ~ctxt fmt = generic_message ~ctxt `Error fmt end module OASISVersion = struct # 22 "src/oasis/OASISVersion.ml" open OASISGettext type t = string type comparator = | VGreater of t | VGreaterEqual of t | VEqual of t | VLesser of t | VLesserEqual of t | VOr of comparator * comparator | VAnd of comparator * comparator (* Range of allowed characters *) let is_digit c = '0' <= c && c <= '9' let is_alpha c = ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') let is_special = function | '.' | '+' | '-' | '~' -> true | _ -> false let rec version_compare v1 v2 = if v1 <> "" || v2 <> "" then begin (* Compare ascii string, using special meaning for version * related char *) let val_ascii c = if c = '~' then -1 else if is_digit c then 0 else if c = '\000' then 0 else if is_alpha c then Char.code c else (Char.code c) + 256 in let len1 = String.length v1 in let len2 = String.length v2 in let p = ref 0 in (** Compare ascii part *) let compare_vascii () = let cmp = ref 0 in while !cmp = 0 && !p < len1 && !p < len2 && not (is_digit v1.[!p] && is_digit v2.[!p]) do cmp := (val_ascii v1.[!p]) - (val_ascii v2.[!p]); incr p done; if !cmp = 0 && !p < len1 && !p = len2 then val_ascii v1.[!p] else if !cmp = 0 && !p = len1 && !p < len2 then - (val_ascii v2.[!p]) else !cmp in (** Compare digit part *) let compare_digit () = let extract_int v p = let start_p = !p in while !p < String.length v && is_digit v.[!p] do incr p done; let substr = String.sub v !p ((String.length v) - !p) in let res = match String.sub v start_p (!p - start_p) with | "" -> 0 | s -> int_of_string s in res, substr in let i1, tl1 = extract_int v1 (ref !p) in let i2, tl2 = extract_int v2 (ref !p) in i1 - i2, tl1, tl2 in match compare_vascii () with | 0 -> begin match compare_digit () with | 0, tl1, tl2 -> if tl1 <> "" && is_digit tl1.[0] then 1 else if tl2 <> "" && is_digit tl2.[0] then -1 else version_compare tl1 tl2 | n, _, _ -> n end | n -> n end else begin 0 end let version_of_string str = str let string_of_version t = t let chop t = try let pos = String.rindex t '.' in String.sub t 0 pos with Not_found -> t let rec comparator_apply v op = match op with | VGreater cv -> (version_compare v cv) > 0 | VGreaterEqual cv -> (version_compare v cv) >= 0 | VLesser cv -> (version_compare v cv) < 0 | VLesserEqual cv -> (version_compare v cv) <= 0 | VEqual cv -> (version_compare v cv) = 0 | VOr (op1, op2) -> (comparator_apply v op1) || (comparator_apply v op2) | VAnd (op1, op2) -> (comparator_apply v op1) && (comparator_apply v op2) let rec string_of_comparator = function | VGreater v -> "> "^(string_of_version v) | VEqual v -> "= "^(string_of_version v) | VLesser v -> "< "^(string_of_version v) | VGreaterEqual v -> ">= "^(string_of_version v) | VLesserEqual v -> "<= "^(string_of_version v) | VOr (c1, c2) -> (string_of_comparator c1)^" || "^(string_of_comparator c2) | VAnd (c1, c2) -> (string_of_comparator c1)^" && "^(string_of_comparator c2) let rec varname_of_comparator = let concat p v = OASISUtils.varname_concat p (OASISUtils.varname_of_string (string_of_version v)) in function | VGreater v -> concat "gt" v | VLesser v -> concat "lt" v | VEqual v -> concat "eq" v | VGreaterEqual v -> concat "ge" v | VLesserEqual v -> concat "le" v | VOr (c1, c2) -> (varname_of_comparator c1)^"_or_"^(varname_of_comparator c2) | VAnd (c1, c2) -> (varname_of_comparator c1)^"_and_"^(varname_of_comparator c2) end module OASISLicense = struct # 22 "src/oasis/OASISLicense.ml" (** License for _oasis fields @author Sylvain Le Gall *) type license = string type license_exception = string type license_version = | Version of OASISVersion.t | VersionOrLater of OASISVersion.t | NoVersion type license_dep_5_unit = { license: license; excption: license_exception option; version: license_version; } type license_dep_5 = | DEP5Unit of license_dep_5_unit | DEP5Or of license_dep_5 list | DEP5And of license_dep_5 list type t = | DEP5License of license_dep_5 | OtherLicense of string (* URL *) end module OASISExpr = struct # 22 "src/oasis/OASISExpr.ml" open OASISGettext open OASISUtils type test = string type flag = string type t = | EBool of bool | ENot of t | EAnd of t * t | EOr of t * t | 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 in (v = vl) in eval' t let choose ?printer ?name var_get lst = let rec choose_aux = function | (cond, vl) :: tl -> if eval var_get cond then vl else choose_aux tl | [] -> let str_lst = if lst = [] then s_ "" else String.concat (s_ ", ") (List.map (fun (cond, vl) -> match printer with | Some p -> p vl | None -> s_ "") lst) in match name with | Some nm -> failwith (Printf.sprintf (f_ "No result for the choice list '%s': %s") nm str_lst) | None -> failwith (Printf.sprintf (f_ "No result for a choice list: %s") str_lst) in choose_aux (List.rev lst) end module OASISText = struct # 22 "src/oasis/OASISText.ml" type elt = | Para of string | Verbatim of string | BlankLine type t = elt list end module OASISSourcePatterns = struct # 22 "src/oasis/OASISSourcePatterns.ml" open OASISUtils open OASISGettext module Templater = struct (* TODO: use this module in BaseEnv.var_expand and BaseFileAB, at least. *) type t = { atoms: atom list; origin: string } and atom = | Text of string | Expr of expr and expr = | Ident of string | String of string | Call of string * expr type env = { variables: string MapString.t; functions: (string -> string) MapString.t; } let eval env t = let rec eval_expr env = function | String str -> str | Ident nm -> begin try MapString.find nm env.variables with Not_found -> (* TODO: add error location within the string. *) failwithf (f_ "Unable to find variable %S in source pattern %S") nm t.origin end | Call (fn, expr) -> begin try (MapString.find fn env.functions) (eval_expr env expr) with Not_found -> (* TODO: add error location within the string. *) failwithf (f_ "Unable to find function %S in source pattern %S") fn t.origin end in String.concat "" (List.map (function | Text str -> str | Expr expr -> eval_expr env expr) t.atoms) let parse env s = let lxr = Genlex.make_lexer [] in let parse_expr s = let st = lxr (Stream.of_string s) in match Stream.npeek 3 st with | [Genlex.Ident fn; Genlex.Ident nm] -> Call(fn, Ident nm) | [Genlex.Ident fn; Genlex.String str] -> Call(fn, String str) | [Genlex.String str] -> String str | [Genlex.Ident nm] -> Ident nm (* TODO: add error location within the string. *) | _ -> failwithf (f_ "Unable to parse expression %S") s in let parse s = let lst_exprs = ref [] in let ss = let buff = Buffer.create (String.length s) in Buffer.add_substitute buff (fun s -> lst_exprs := (parse_expr s) :: !lst_exprs; "\000") s; Buffer.contents buff in let rec join = function | hd1 :: tl1, hd2 :: tl2 -> Text hd1 :: Expr hd2 :: join (tl1, tl2) | [], tl -> List.map (fun e -> Expr e) tl | tl, [] -> List.map (fun e -> Text e) tl in join (OASISString.nsplit ss '\000', List.rev (!lst_exprs)) in let t = {atoms = parse s; origin = s} in (* We rely on a simple evaluation for checking variables/functions. It works because there is no if/loop statement. *) let _s : string = eval env t in t # 144 "src/oasis/OASISSourcePatterns.ml" end type t = Templater.t let env ~modul () = { Templater. variables = MapString.of_list ["module", modul]; functions = MapString.of_list [ "capitalize_file", OASISUnixPath.capitalize_file; "uncapitalize_file", OASISUnixPath.uncapitalize_file; ]; } let all_possible_files lst ~path ~modul = let eval = Templater.eval (env ~modul ()) in List.fold_left (fun acc pat -> OASISUnixPath.concat path (eval pat) :: acc) [] lst let to_string t = t.Templater.origin end module OASISTypes = struct # 22 "src/oasis/OASISTypes.ml" type name = string type package_name = string type url = string type unix_dirname = string type unix_filename = string (* TODO: replace everywhere. *) type host_dirname = string (* TODO: replace everywhere. *) type host_filename = string (* TODO: replace everywhere. *) type prog = string type arg = string type args = string list type command_line = (prog * arg list) type findlib_name = string type findlib_full = string type compiled_object = | Byte | Native | Best type dependency = | FindlibPackage of findlib_full * OASISVersion.comparator option | InternalLibrary of name type tool = | ExternalTool of name | InternalExecutable of name type vcs = | Darcs | Git | Svn | Cvs | Hg | Bzr | Arch | Monotone | OtherVCS of url type plugin_kind = [ `Configure | `Build | `Doc | `Test | `Install | `Extra ] type plugin_data_purpose = [ `Configure | `Build | `Install | `Clean | `Distclean | `Install | `Uninstall | `Test | `Doc | `Extra | `Other of string ] type 'a plugin = 'a * name * OASISVersion.t option type all_plugin = plugin_kind plugin type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list type 'a conditional = 'a OASISExpr.choices type custom = { pre_command: (command_line option) conditional; post_command: (command_line option) conditional; } type common_section = { cs_name: name; cs_data: PropList.Data.t; cs_plugin_data: plugin_data; } type build_section = { bs_build: bool conditional; bs_install: bool conditional; bs_path: unix_dirname; bs_compiled_object: compiled_object; bs_build_depends: dependency list; bs_build_tools: tool list; bs_interface_patterns: OASISSourcePatterns.t list; bs_implementation_patterns: OASISSourcePatterns.t list; bs_c_sources: unix_filename list; bs_data_files: (unix_filename * unix_filename option) list; bs_findlib_extra_files: unix_filename list; bs_ccopt: args conditional; bs_cclib: args conditional; bs_dlllib: args conditional; bs_dllpath: args conditional; bs_byteopt: args conditional; bs_nativeopt: args conditional; } type library = { lib_modules: string list; lib_pack: bool; lib_internal_modules: string list; lib_findlib_parent: findlib_name option; lib_findlib_name: findlib_name option; lib_findlib_directory: unix_dirname option; lib_findlib_containers: findlib_name list; } type object_ = { obj_modules: string list; obj_findlib_fullname: findlib_name list option; obj_findlib_directory: unix_dirname option; } type executable = { exec_custom: bool; exec_main_is: unix_filename; } type flag = { flag_description: string option; flag_default: bool conditional; } type source_repository = { src_repo_type: vcs; src_repo_location: url; src_repo_browser: url option; src_repo_module: string option; src_repo_branch: string option; src_repo_tag: string option; src_repo_subdir: unix_filename option; } type test = { test_type: [`Test] plugin; test_command: command_line conditional; test_custom: custom; test_working_directory: unix_filename option; test_run: bool conditional; test_tools: tool list; } type doc_format = | HTML of unix_filename (* TODO: source filename. *) | DocText | PDF | PostScript | Info of unix_filename (* TODO: source filename. *) | DVI | OtherDoc type doc = { doc_type: [`Doc] plugin; doc_custom: custom; doc_build: bool conditional; doc_install: bool conditional; doc_install_dir: unix_filename; (* TODO: dest filename ?. *) doc_title: string; doc_authors: string list; doc_abstract: string option; doc_format: doc_format; (* TODO: src filename. *) doc_data_files: (unix_filename * unix_filename option) list; doc_build_tools: tool list; } type section = | Library of common_section * build_section * library | Object of common_section * build_section * object_ | Executable of common_section * build_section * executable | Flag of common_section * flag | SrcRepo of common_section * source_repository | Test of common_section * test | Doc of common_section * doc type section_kind = [ `Library | `Object | `Executable | `Flag | `SrcRepo | `Test | `Doc ] type package = { oasis_version: OASISVersion.t; ocaml_version: OASISVersion.comparator option; findlib_version: OASISVersion.comparator option; alpha_features: string list; beta_features: string list; name: package_name; version: OASISVersion.t; license: OASISLicense.t; license_file: unix_filename option; (* TODO: source filename. *) copyrights: string list; maintainers: string list; authors: string list; homepage: url option; bugreports: url option; synopsis: string; description: OASISText.t option; tags: string list; categories: url list; conf_type: [`Configure] plugin; conf_custom: custom; build_type: [`Build] plugin; build_custom: custom; install_type: [`Install] plugin; install_custom: custom; uninstall_custom: custom; clean_custom: custom; distclean_custom: custom; files_ab: unix_filename list; (* TODO: source filename. *) sections: section list; plugins: [`Extra] plugin list; disable_oasis_section: unix_filename list; (* TODO: source filename. *) schema_data: PropList.Data.t; plugin_data: plugin_data; } end module OASISFeatures = struct # 22 "src/oasis/OASISFeatures.ml" open OASISTypes open OASISUtils open OASISGettext open OASISVersion module MapPlugin = Map.Make (struct type t = plugin_kind * name let compare = Pervasives.compare end) module Data = struct type t = { oasis_version: OASISVersion.t; plugin_versions: OASISVersion.t option MapPlugin.t; alpha_features: string list; beta_features: string list; } let create oasis_version alpha_features beta_features = { oasis_version = oasis_version; plugin_versions = MapPlugin.empty; alpha_features = alpha_features; beta_features = beta_features } let of_package pkg = create pkg.OASISTypes.oasis_version pkg.OASISTypes.alpha_features pkg.OASISTypes.beta_features let add_plugin (plugin_kind, plugin_name, plugin_version) t = {t with plugin_versions = MapPlugin.add (plugin_kind, plugin_name) plugin_version t.plugin_versions} let plugin_version plugin_kind plugin_name t = MapPlugin.find (plugin_kind, plugin_name) t.plugin_versions let to_string t = Printf.sprintf "oasis_version: %s; alpha_features: %s; beta_features: %s; \ plugins_version: %s" (OASISVersion.string_of_version (t:t).oasis_version) (String.concat ", " t.alpha_features) (String.concat ", " t.beta_features) (String.concat ", " (MapPlugin.fold (fun (_, plg) ver_opt acc -> (plg^ (match ver_opt with | Some v -> " "^(OASISVersion.string_of_version v) | None -> "")) :: acc) t.plugin_versions [])) end type origin = | Field of string * string | Section of string | NoOrigin type stage = Alpha | Beta let string_of_stage = function | Alpha -> "alpha" | Beta -> "beta" let field_of_stage = function | Alpha -> "AlphaFeatures" | Beta -> "BetaFeatures" type publication = InDev of stage | SinceVersion of OASISVersion.t type t = { name: string; plugin: all_plugin option; publication: publication; description: unit -> string; } (* TODO: mutex protect this. *) let all_features = Hashtbl.create 13 let since_version ver_str = SinceVersion (version_of_string ver_str) let alpha = InDev Alpha let beta = InDev Beta let to_string t = Printf.sprintf "feature: %s; plugin: %s; publication: %s" (t:t).name (match t.plugin with | None -> "" | Some (_, nm, _) -> nm) (match t.publication with | InDev stage -> string_of_stage stage | SinceVersion ver -> ">= "^(OASISVersion.string_of_version ver)) let data_check t data origin = let no_message = "no message" in let check_feature features stage = let has_feature = List.mem (t:t).name features in if not has_feature then match (origin:origin) with | Field (fld, where) -> Some (Printf.sprintf (f_ "Field %s in %s is only available when feature %s \ is in field %s.") fld where t.name (field_of_stage stage)) | Section sct -> Some (Printf.sprintf (f_ "Section %s is only available when features %s \ is in field %s.") sct t.name (field_of_stage stage)) | NoOrigin -> Some no_message else None in let version_is_good ~min_version version fmt = let version_is_good = OASISVersion.comparator_apply version (OASISVersion.VGreaterEqual min_version) in Printf.ksprintf (fun str -> if version_is_good then None else Some str) fmt in match origin, t.plugin, t.publication with | _, _, InDev Alpha -> check_feature data.Data.alpha_features Alpha | _, _, InDev Beta -> check_feature data.Data.beta_features Beta | Field(fld, where), None, SinceVersion min_version -> version_is_good ~min_version data.Data.oasis_version (f_ "Field %s in %s is only valid since OASIS v%s, update \ OASISFormat field from '%s' to '%s' after checking \ OASIS changelog.") fld where (string_of_version min_version) (string_of_version data.Data.oasis_version) (string_of_version min_version) | Field(fld, where), Some(plugin_knd, plugin_name, _), SinceVersion min_version -> begin try let plugin_version_current = try match Data.plugin_version plugin_knd plugin_name data with | Some ver -> ver | None -> failwithf (f_ "Field %s in %s is only valid for the OASIS \ plugin %s since v%s, but no plugin version is \ defined in the _oasis file, change '%s' to \ '%s (%s)' in your _oasis file.") fld where plugin_name (string_of_version min_version) plugin_name plugin_name (string_of_version min_version) with Not_found -> failwithf (f_ "Field %s in %s is only valid when the OASIS plugin %s \ is defined.") fld where plugin_name in version_is_good ~min_version plugin_version_current (f_ "Field %s in %s is only valid for the OASIS plugin %s \ since v%s, update your plugin from '%s (%s)' to \ '%s (%s)' after checking the plugin's changelog.") fld where plugin_name (string_of_version min_version) plugin_name (string_of_version plugin_version_current) plugin_name (string_of_version min_version) with Failure msg -> Some msg end | Section sct, None, SinceVersion min_version -> version_is_good ~min_version data.Data.oasis_version (f_ "Section %s is only valid for since OASIS v%s, update \ OASISFormat field from '%s' to '%s' after checking OASIS \ changelog.") sct (string_of_version min_version) (string_of_version data.Data.oasis_version) (string_of_version min_version) | Section sct, Some(plugin_knd, plugin_name, _), SinceVersion min_version -> begin try let plugin_version_current = try match Data.plugin_version plugin_knd plugin_name data with | Some ver -> ver | None -> failwithf (f_ "Section %s is only valid for the OASIS \ plugin %s since v%s, but no plugin version is \ defined in the _oasis file, change '%s' to \ '%s (%s)' in your _oasis file.") sct plugin_name (string_of_version min_version) plugin_name plugin_name (string_of_version min_version) with Not_found -> failwithf (f_ "Section %s is only valid when the OASIS plugin %s \ is defined.") sct plugin_name in version_is_good ~min_version plugin_version_current (f_ "Section %s is only valid for the OASIS plugin %s \ since v%s, update your plugin from '%s (%s)' to \ '%s (%s)' after checking the plugin's changelog.") sct plugin_name (string_of_version min_version) plugin_name (string_of_version plugin_version_current) plugin_name (string_of_version min_version) with Failure msg -> Some msg end | NoOrigin, None, SinceVersion min_version -> version_is_good ~min_version data.Data.oasis_version "%s" no_message | NoOrigin, Some(plugin_knd, plugin_name, _), SinceVersion min_version -> begin try let plugin_version_current = match Data.plugin_version plugin_knd plugin_name data with | Some ver -> ver | None -> raise Not_found in version_is_good ~min_version plugin_version_current "%s" no_message with Not_found -> Some no_message end let data_assert t data origin = match data_check t data origin with | None -> () | Some str -> failwith str let data_test t data = match data_check t data NoOrigin with | None -> true | Some _ -> false let package_test t pkg = data_test t (Data.of_package pkg) let create ?plugin name publication description = let () = if Hashtbl.mem all_features name then failwithf "Feature '%s' is already declared." name in let t = { name = name; plugin = plugin; publication = publication; description = description; } in Hashtbl.add all_features name t; t let get_stage name = try (Hashtbl.find all_features name).publication with Not_found -> failwithf (f_ "Feature %s doesn't exist.") name let list () = Hashtbl.fold (fun _ v acc -> v :: acc) all_features [] (* * Real flags. *) let features = create "features_fields" (since_version "0.4") (fun () -> s_ "Enable to experiment not yet official features.") let flag_docs = create "flag_docs" (since_version "0.3") (fun () -> s_ "Make building docs require '-docs' flag at configure.") let flag_tests = create "flag_tests" (since_version "0.3") (fun () -> s_ "Make running tests require '-tests' flag at configure.") let pack = create "pack" (since_version "0.3") (fun () -> s_ "Allow to create packed library.") let section_object = create "section_object" beta (fun () -> s_ "Implement an object section.") let dynrun_for_release = create "dynrun_for_release" alpha (fun () -> s_ "Make '-setup-update dynamic' suitable for releasing project.") let compiled_setup_ml = create "compiled_setup_ml" alpha (fun () -> s_ "Compile the setup.ml and speed-up actions done with it.") let disable_oasis_section = create "disable_oasis_section" alpha (fun () -> s_ "Allow the OASIS section comments and digests to be omitted in \ generated files.") let no_automatic_syntax = create "no_automatic_syntax" alpha (fun () -> s_ "Disable the automatic inclusion of -syntax camlp4o for packages \ that matches the internal heuristic (if a dependency ends with \ a .syntax or is a well known syntax).") let findlib_directory = create "findlib_directory" beta (fun () -> s_ "Allow to install findlib libraries in sub-directories of the target \ findlib directory.") let findlib_extra_files = create "findlib_extra_files" beta (fun () -> s_ "Allow to install extra files for findlib libraries.") let source_patterns = create "source_patterns" alpha (fun () -> s_ "Customize mapping between module name and source file.") end module OASISSection = struct # 22 "src/oasis/OASISSection.ml" open OASISTypes let section_kind_common = function | Library (cs, _, _) -> `Library, cs | Object (cs, _, _) -> `Object, cs | Executable (cs, _, _) -> `Executable, cs | Flag (cs, _) -> `Flag, cs | SrcRepo (cs, _) -> `SrcRepo, cs | Test (cs, _) -> `Test, cs | Doc (cs, _) -> `Doc, cs let section_common sct = snd (section_kind_common sct) let section_common_set cs = function | Library (_, bs, lib) -> Library (cs, bs, lib) | Object (_, bs, obj) -> Object (cs, bs, obj) | Executable (_, bs, exec) -> Executable (cs, bs, exec) | Flag (_, flg) -> Flag (cs, flg) | SrcRepo (_, src_repo) -> SrcRepo (cs, src_repo) | Test (_, tst) -> Test (cs, tst) | Doc (_, doc) -> Doc (cs, doc) (** Key used to identify section *) let section_id sct = let k, cs = section_kind_common sct in k, cs.cs_name let string_of_section_kind = function | `Library -> "library" | `Object -> "object" | `Executable -> "executable" | `Flag -> "flag" | `SrcRepo -> "src repository" | `Test -> "test" | `Doc -> "doc" let string_of_section sct = let k, nm = section_id sct in (string_of_section_kind k)^" "^nm let section_find id scts = List.find (fun sct -> id = section_id sct) scts module CSection = struct type t = section let id = section_id let compare t1 t2 = compare (id t1) (id t2) let equal t1 t2 = (id t1) = (id t2) let hash t = Hashtbl.hash (id t) end module MapSection = Map.Make(CSection) module SetSection = Set.Make(CSection) end module OASISBuildSection = struct # 22 "src/oasis/OASISBuildSection.ml" open OASISTypes (* Look for a module file, considering capitalization or not. *) let find_module source_file_exists bs modul = let possible_lst = OASISSourcePatterns.all_possible_files (bs.bs_interface_patterns @ bs.bs_implementation_patterns) ~path:bs.bs_path ~modul in match List.filter source_file_exists possible_lst with | (fn :: _) as fn_lst -> `Sources (OASISUnixPath.chop_extension fn, fn_lst) | [] -> let open OASISUtils in let _, rev_lst = List.fold_left (fun (set, acc) fn -> let base_fn = OASISUnixPath.chop_extension fn in if SetString.mem base_fn set then set, acc else SetString.add base_fn set, base_fn :: acc) (SetString.empty, []) possible_lst in `No_sources (List.rev rev_lst) end module OASISExecutable = struct # 22 "src/oasis/OASISExecutable.ml" open OASISTypes let unix_exec_is (cs, bs, exec) is_native ext_dll suffix_program = let dir = OASISUnixPath.concat bs.bs_path (OASISUnixPath.dirname exec.exec_main_is) in let is_native_exec = match bs.bs_compiled_object with | Native -> true | Best -> is_native () | Byte -> false in OASISUnixPath.concat dir (cs.cs_name^(suffix_program ())), if not is_native_exec && not exec.exec_custom && bs.bs_c_sources <> [] then Some (dir^"/dll"^cs.cs_name^"_stubs"^(ext_dll ())) else None end module OASISLibrary = struct # 22 "src/oasis/OASISLibrary.ml" open OASISTypes open OASISGettext let find_module ~ctxt source_file_exists cs bs modul = match OASISBuildSection.find_module source_file_exists bs modul with | `Sources _ as res -> res | `No_sources _ as res -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching module '%s' in library %s.") modul cs.cs_name; OASISMessage.warning ~ctxt (f_ "Use InterfacePatterns or ImplementationPatterns to define \ this file with feature %S.") (OASISFeatures.source_patterns.OASISFeatures.name); res let source_unix_files ~ctxt (cs, bs, lib) source_file_exists = List.fold_left (fun acc modul -> match find_module ~ctxt source_file_exists cs bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> acc) [] (lib.lib_modules @ lib.lib_internal_modules) let generated_unix_files ~ctxt ~is_native ~has_native_dynlink ~ext_lib ~ext_dll ~source_file_exists (cs, bs, lib) = let find_modules lst ext = let find_module modul = match find_module ~ctxt source_file_exists cs bs modul with | `Sources (_, [fn]) when ext <> "cmi" && Filename.check_suffix fn ".mli" -> None (* No implementation files for pure interface. *) | `Sources (base_fn, _) -> Some [base_fn] | `No_sources lst -> Some lst in List.fold_left (fun acc nm -> match find_module nm with | None -> acc | Some base_fns -> List.map (fun base_fn -> base_fn ^"."^ext) base_fns :: acc) [] lst in (* The .cmx that be compiled along *) let cmxs = let should_be_built = match bs.bs_compiled_object with | Native -> true | Best -> is_native | Byte -> false in if should_be_built then if lib.lib_pack then find_modules [cs.cs_name] "cmx" else find_modules (lib.lib_modules @ lib.lib_internal_modules) "cmx" else [] in let acc_nopath = [] in (* The headers and annot/cmt files that should be compiled along *) let headers = let sufx = if lib.lib_pack then [".cmti"; ".cmt"; ".annot"] else [".cmi"; ".cmti"; ".cmt"; ".annot"] in List.map (List.fold_left (fun accu s -> let dot = String.rindex s '.' in let base = String.sub s 0 dot in List.map ((^) base) sufx @ accu) []) (find_modules lib.lib_modules "cmi") in (* Compute what libraries should be built *) let acc_nopath = (* Add the packed header file if required *) let add_pack_header acc = if lib.lib_pack then [cs.cs_name^".cmi"; cs.cs_name^".cmti"; cs.cs_name^".cmt"] :: acc else acc in let byte acc = add_pack_header ([cs.cs_name^".cma"] :: acc) in let native acc = let acc = add_pack_header (if has_native_dynlink then [cs.cs_name^".cmxs"] :: acc else acc) in [cs.cs_name^".cmxa"] :: [cs.cs_name^ext_lib] :: acc in match bs.bs_compiled_object with | Native -> byte (native acc_nopath) | Best when is_native -> byte (native acc_nopath) | Byte | Best -> byte acc_nopath in (* Add C library to be built *) let acc_nopath = if bs.bs_c_sources <> [] then begin ["lib"^cs.cs_name^"_stubs"^ext_lib] :: if has_native_dynlink then ["dll"^cs.cs_name^"_stubs"^ext_dll] :: acc_nopath else acc_nopath end else begin acc_nopath end in (* All the files generated *) List.rev_append (List.rev_map (List.rev_map (OASISUnixPath.concat bs.bs_path)) acc_nopath) (headers @ cmxs) end module OASISObject = struct # 22 "src/oasis/OASISObject.ml" open OASISTypes open OASISGettext let find_module ~ctxt source_file_exists cs bs modul = match OASISBuildSection.find_module source_file_exists bs modul with | `Sources _ as res -> res | `No_sources _ as res -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching module '%s' in object %s.") modul cs.cs_name; OASISMessage.warning ~ctxt (f_ "Use InterfacePatterns or ImplementationPatterns to define \ this file with feature %S.") (OASISFeatures.source_patterns.OASISFeatures.name); res let source_unix_files ~ctxt (cs, bs, obj) source_file_exists = List.fold_left (fun acc modul -> match find_module ~ctxt source_file_exists cs bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> acc) [] obj.obj_modules let generated_unix_files ~ctxt ~is_native ~source_file_exists (cs, bs, obj) = let find_module ext modul = match find_module ~ctxt source_file_exists cs bs modul with | `Sources (base_fn, _) -> [base_fn ^ ext] | `No_sources lst -> lst in let header, byte, native, c_object, f = match obj.obj_modules with | [ m ] -> (find_module ".cmi" m, find_module ".cmo" m, find_module ".cmx" m, find_module ".o" m, fun x -> x) | _ -> ([cs.cs_name ^ ".cmi"], [cs.cs_name ^ ".cmo"], [cs.cs_name ^ ".cmx"], [cs.cs_name ^ ".o"], OASISUnixPath.concat bs.bs_path) in List.map (List.map f) ( match bs.bs_compiled_object with | Native -> native :: c_object :: byte :: header :: [] | Best when is_native -> native :: c_object :: byte :: header :: [] | Byte | Best -> byte :: header :: []) end module OASISFindlib = struct # 22 "src/oasis/OASISFindlib.ml" open OASISTypes open OASISUtils open OASISGettext type library_name = name type findlib_part_name = name type 'a map_of_findlib_part_name = 'a OASISUtils.MapString.t exception InternalLibraryNotFound of library_name exception FindlibPackageNotFound of findlib_name type group_t = | Container of findlib_name * group_t list | Package of (findlib_name * common_section * build_section * [`Library of library | `Object of object_] * unix_dirname option * group_t list) type data = common_section * build_section * [`Library of library | `Object of object_] type tree = | Node of (data option) * (tree MapString.t) | Leaf of data let findlib_mapping pkg = (* Map from library name to either full findlib name or parts + parent. *) let fndlb_parts_of_lib_name = let fndlb_parts cs lib = let name = match lib.lib_findlib_name with | Some nm -> nm | None -> cs.cs_name in let name = String.concat "." (lib.lib_findlib_containers @ [name]) in name in List.fold_left (fun mp -> function | Library (cs, _, lib) -> begin let lib_name = cs.cs_name in let fndlb_parts = fndlb_parts cs lib in if MapString.mem lib_name mp then failwithf (f_ "The library name '%s' is used more than once.") lib_name; match lib.lib_findlib_parent with | Some lib_name_parent -> MapString.add lib_name (`Unsolved (lib_name_parent, fndlb_parts)) mp | None -> MapString.add lib_name (`Solved fndlb_parts) mp end | Object (cs, _, obj) -> begin let obj_name = cs.cs_name in if MapString.mem obj_name mp then failwithf (f_ "The object name '%s' is used more than once.") obj_name; let findlib_full_name = match obj.obj_findlib_fullname with | Some ns -> String.concat "." ns | None -> obj_name in MapString.add obj_name (`Solved findlib_full_name) mp end | Executable _ | Test _ | Flag _ | SrcRepo _ | Doc _ -> mp) MapString.empty pkg.sections in (* Solve the above graph to be only library name to full findlib name. *) let fndlb_name_of_lib_name = let rec solve visited mp lib_name lib_name_child = if SetString.mem lib_name visited then failwithf (f_ "Library '%s' is involved in a cycle \ with regard to findlib naming.") lib_name; let visited = SetString.add lib_name visited in try match MapString.find lib_name mp with | `Solved fndlb_nm -> fndlb_nm, mp | `Unsolved (lib_nm_parent, post_fndlb_nm) -> let pre_fndlb_nm, mp = solve visited mp lib_nm_parent lib_name in let fndlb_nm = pre_fndlb_nm^"."^post_fndlb_nm in fndlb_nm, MapString.add lib_name (`Solved fndlb_nm) mp with Not_found -> failwithf (f_ "Library '%s', which is defined as the findlib parent of \ library '%s', doesn't exist.") lib_name lib_name_child in let mp = MapString.fold (fun lib_name status mp -> match status with | `Solved _ -> (* Solved initialy, no need to go further *) mp | `Unsolved _ -> let _, mp = solve SetString.empty mp lib_name "" in mp) fndlb_parts_of_lib_name fndlb_parts_of_lib_name in MapString.map (function | `Solved fndlb_nm -> fndlb_nm | `Unsolved _ -> assert false) mp in (* Convert an internal library name to a findlib name. *) let findlib_name_of_library_name lib_nm = try MapString.find lib_nm fndlb_name_of_lib_name with Not_found -> raise (InternalLibraryNotFound lib_nm) in (* Add a library to the tree. *) let add sct mp = let fndlb_fullname = let cs, _, _ = sct in let lib_name = cs.cs_name in findlib_name_of_library_name lib_name in let rec add_children nm_lst (children: tree MapString.t) = match nm_lst with | (hd :: tl) -> begin let node = try add_node tl (MapString.find hd children) with Not_found -> (* New node *) new_node tl in MapString.add hd node children end | [] -> (* Should not have a nameless library. *) assert false and add_node tl node = if tl = [] then begin match node with | Node (None, children) -> Node (Some sct, children) | Leaf (cs', _, _) | Node (Some (cs', _, _), _) -> (* TODO: allow to merge Package, i.e. * archive(byte) = "foo.cma foo_init.cmo" *) let cs, _, _ = sct in failwithf (f_ "Library '%s' and '%s' have the same findlib name '%s'") cs.cs_name cs'.cs_name fndlb_fullname end else begin match node with | Leaf data -> Node (Some data, add_children tl MapString.empty) | Node (data_opt, children) -> Node (data_opt, add_children tl children) end and new_node = function | [] -> Leaf sct | hd :: tl -> Node (None, MapString.add hd (new_node tl) MapString.empty) in add_children (OASISString.nsplit fndlb_fullname '.') mp in let unix_directory dn lib = let directory = match lib with | `Library lib -> lib.lib_findlib_directory | `Object obj -> obj.obj_findlib_directory in match dn, directory with | None, None -> None | None, Some dn | Some dn, None -> Some dn | Some dn1, Some dn2 -> Some (OASISUnixPath.concat dn1 dn2) in let rec group_of_tree dn mp = MapString.fold (fun nm node acc -> let cur = match node with | Node (Some (cs, bs, lib), children) -> let current_dn = unix_directory dn lib in Package (nm, cs, bs, lib, current_dn, group_of_tree current_dn children) | Node (None, children) -> Container (nm, group_of_tree dn children) | Leaf (cs, bs, lib) -> let current_dn = unix_directory dn lib in Package (nm, cs, bs, lib, current_dn, []) in cur :: acc) mp [] in let group_mp = List.fold_left (fun mp -> function | Library (cs, bs, lib) -> add (cs, bs, `Library lib) mp | Object (cs, bs, obj) -> add (cs, bs, `Object obj) mp | _ -> mp) MapString.empty pkg.sections in let groups = group_of_tree None group_mp in let library_name_of_findlib_name = lazy begin (* Revert findlib_name_of_library_name. *) MapString.fold (fun k v mp -> MapString.add v k mp) fndlb_name_of_lib_name MapString.empty end in let library_name_of_findlib_name fndlb_nm = try MapString.find fndlb_nm (Lazy.force library_name_of_findlib_name) with Not_found -> raise (FindlibPackageNotFound fndlb_nm) in groups, findlib_name_of_library_name, library_name_of_findlib_name let findlib_of_group = function | Container (fndlb_nm, _) | Package (fndlb_nm, _, _, _, _, _) -> fndlb_nm let root_of_group grp = let rec root_lib_aux = (* We do a DFS in the group. *) function | Container (_, children) -> List.fold_left (fun res grp -> if res = None then root_lib_aux grp else res) None children | Package (_, cs, bs, lib, _, _) -> Some (cs, bs, lib) in match root_lib_aux grp with | Some res -> res | None -> failwithf (f_ "Unable to determine root library of findlib library '%s'") (findlib_of_group grp) end module OASISFlag = struct # 22 "src/oasis/OASISFlag.ml" end module OASISPackage = struct # 22 "src/oasis/OASISPackage.ml" end module OASISSourceRepository = struct # 22 "src/oasis/OASISSourceRepository.ml" end module OASISTest = struct # 22 "src/oasis/OASISTest.ml" end module OASISDocument = struct # 22 "src/oasis/OASISDocument.ml" end module OASISExec = struct # 22 "src/oasis/OASISExec.ml" open OASISGettext open OASISUtils open OASISMessage (* TODO: I don't like this quote, it is there because $(rm) foo expands to * 'rm -f' foo... *) let run ~ctxt ?f_exit_code ?(quote=true) cmd args = let cmd = if quote then if Sys.os_type = "Win32" then if String.contains cmd ' ' then (* Double the 1st double quote... win32... sigh *) "\""^(Filename.quote cmd) else cmd else Filename.quote cmd else cmd in let cmdline = String.concat " " (cmd :: args) in info ~ctxt (f_ "Running command '%s'") cmdline; match f_exit_code, Sys.command cmdline with | None, 0 -> () | None, i -> failwithf (f_ "Command '%s' terminated with error code %d") cmdline i | Some f, i -> f i let run_read_output ~ctxt ?f_exit_code cmd args = let fn = Filename.temp_file "oasis-" ".txt" in try begin let () = run ~ctxt ?f_exit_code cmd (args @ [">"; Filename.quote fn]) in let chn = open_in fn in let routput = ref [] in begin try while true do routput := (input_line chn) :: !routput done with End_of_file -> () end; close_in chn; Sys.remove fn; List.rev !routput end with e -> (try Sys.remove fn with _ -> ()); raise e let run_read_one_line ~ctxt ?f_exit_code cmd args = match run_read_output ~ctxt ?f_exit_code cmd args with | [fst] -> fst | lst -> failwithf (f_ "Command return unexpected output %S") (String.concat "\n" lst) end module OASISFileUtil = struct # 22 "src/oasis/OASISFileUtil.ml" open OASISGettext let file_exists_case fn = let dirname = Filename.dirname fn in let basename = Filename.basename fn in if Sys.file_exists dirname then if basename = Filename.current_dir_name then true else List.mem basename (Array.to_list (Sys.readdir dirname)) else false let find_file ?(case_sensitive=true) paths exts = (* Cardinal product of two list *) let ( * ) lst1 lst2 = List.flatten (List.map (fun a -> List.map (fun b -> a, b) lst2) lst1) in let rec combined_paths lst = match lst with | p1 :: p2 :: tl -> let acc = (List.map (fun (a, b) -> Filename.concat a b) (p1 * p2)) in combined_paths (acc :: tl) | [e] -> e | [] -> [] in let alternatives = List.map (fun (p, e) -> if String.length e > 0 && e.[0] <> '.' then p ^ "." ^ e else p ^ e) ((combined_paths paths) * exts) in List.find (fun file -> (if case_sensitive then file_exists_case file else Sys.file_exists file) && not (Sys.is_directory file) ) alternatives let which ~ctxt prg = let path_sep = match Sys.os_type with | "Win32" -> ';' | _ -> ':' in let path_lst = OASISString.nsplit (Sys.getenv "PATH") path_sep in let exec_ext = match Sys.os_type with | "Win32" -> "" :: (OASISString.nsplit (Sys.getenv "PATHEXT") path_sep) | _ -> [""] in find_file ~case_sensitive:false [path_lst; [prg]] exec_ext (**/**) let rec fix_dir dn = (* Windows hack because Sys.file_exists "src\\" = false when * Sys.file_exists "src" = true *) let ln = String.length dn in if Sys.os_type = "Win32" && ln > 0 && dn.[ln - 1] = '\\' then fix_dir (String.sub dn 0 (ln - 1)) else dn let q = Filename.quote (**/**) let cp ~ctxt ?(recurse=false) src tgt = if recurse then match Sys.os_type with | "Win32" -> OASISExec.run ~ctxt "xcopy" [q src; q tgt; "/E"] | _ -> OASISExec.run ~ctxt "cp" ["-r"; q src; q tgt] else OASISExec.run ~ctxt (match Sys.os_type with | "Win32" -> "copy" | _ -> "cp") [q src; q tgt] let mkdir ~ctxt tgt = OASISExec.run ~ctxt (match Sys.os_type with | "Win32" -> "md" | _ -> "mkdir") [q tgt] let rec mkdir_parent ~ctxt f tgt = let tgt = fix_dir tgt in if Sys.file_exists tgt then begin if not (Sys.is_directory tgt) then OASISUtils.failwithf (f_ "Cannot create directory '%s', a file of the same name already \ exists") tgt end else begin mkdir_parent ~ctxt f (Filename.dirname tgt); if not (Sys.file_exists tgt) then begin f tgt; mkdir ~ctxt tgt end end let rmdir ~ctxt tgt = if Sys.readdir tgt = [||] then begin match Sys.os_type with | "Win32" -> OASISExec.run ~ctxt "rd" [q tgt] | _ -> OASISExec.run ~ctxt "rm" ["-r"; q tgt] end else begin OASISMessage.error ~ctxt (f_ "Cannot remove directory '%s': not empty.") tgt end let glob ~ctxt fn = let basename = Filename.basename fn in if String.length basename >= 2 && basename.[0] = '*' && basename.[1] = '.' then begin let ext_len = (String.length basename) - 2 in let ext = String.sub basename 2 ext_len in let dirname = Filename.dirname fn in Array.fold_left (fun acc fn -> try let fn_ext = String.sub fn ((String.length fn) - ext_len) ext_len in if fn_ext = ext then (Filename.concat dirname fn) :: acc else acc with Invalid_argument _ -> acc) [] (Sys.readdir dirname) end else begin if file_exists_case fn then [fn] else [] end end # 3159 "setup.ml" module BaseEnvLight = struct # 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) ?stream () = let line = ref 1 in let lexer st = let st_line = Stream.from (fun _ -> try match Stream.next st with | '\n' -> incr line; Some '\n' | c -> Some c with Stream.Failure -> None) in Genlex.make_lexer ["="] st_line in let rec read_file lxr mp = match Stream.npeek 3 lxr with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> Stream.junk lxr; Stream.junk lxr; Stream.junk lxr; read_file lxr (MapString.add nm value mp) | [] -> mp | _ -> failwith (Printf.sprintf "Malformed data file '%s' line %d" filename !line) in match stream with | Some st -> read_file (lexer st) MapString.empty | None -> if Sys.file_exists filename then begin let chn = open_in_bin filename in let st = Stream.of_channel chn in try let mp = read_file (lexer st) MapString.empty in close_in chn; mp with e -> close_in chn; raise e end else if allow_empty then begin MapString.empty end else begin failwith (Printf.sprintf "Unable to load environment, the file '%s' doesn't exist." filename) end let rec var_expand str env = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try var_expand (MapString.find var env) env with Not_found -> failwith (Printf.sprintf "No variable %s defined when trying to expand %S." var str)) str; Buffer.contents buff let var_get name env = var_expand (MapString.find name env) env let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst end # 3239 "setup.ml" module BaseContext = struct # 22 "src/base/BaseContext.ml" (* TODO: get rid of this module. *) open OASISContext let args () = fst (fspecs ()) let default = default end module BaseMessage = struct # 22 "src/base/BaseMessage.ml" (** Message to user, overrid for Base @author Sylvain Le Gall *) open OASISMessage open BaseContext let debug fmt = debug ~ctxt:!default fmt let info fmt = info ~ctxt:!default fmt let warning fmt = warning ~ctxt:!default fmt let error fmt = error ~ctxt:!default fmt end module BaseEnv = struct # 22 "src/base/BaseEnv.ml" open OASISGettext open OASISUtils open OASISContext open PropList module MapString = BaseEnvLight.MapString type origin_t = | ODefault | OGetEnv | OFileLoad | OCommandLine type cli_handle_t = | CLINone | CLIAuto | CLIWith | CLIEnable | CLIUser of (Arg.key * Arg.spec * Arg.doc) list type definition_t = { hide: bool; dump: bool; cli: cli_handle_t; arg_help: string option; group: string option; } let schema = Schema.create "environment" (* Environment data *) let env = Data.create () (* Environment data from file *) let env_from_file = ref MapString.empty (* Lexer for var *) let var_lxr = Genlex.make_lexer [] let rec var_expand str = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try (* TODO: this is a quick hack to allow calling Test.Command * without defining executable name really. I.e. if there is * an exec Executable toto, then $(toto) should be replace * by its real name. It is however useful to have this function * for other variable that depend on the host and should be * written better than that. *) let st = var_lxr (Stream.of_string var) in match Stream.npeek 3 st with | [Genlex.Ident "utoh"; Genlex.Ident nm] -> OASISHostPath.of_unix (var_get nm) | [Genlex.Ident "utoh"; Genlex.String s] -> OASISHostPath.of_unix s | [Genlex.Ident "ocaml_escaped"; Genlex.Ident nm] -> String.escaped (var_get nm) | [Genlex.Ident "ocaml_escaped"; Genlex.String s] -> String.escaped s | [Genlex.Ident nm] -> var_get nm | _ -> failwithf (f_ "Unknown expression '%s' in variable expansion of %s.") var str with | Unknown_field (_, _) -> failwithf (f_ "No variable %s defined when trying to expand %S.") var str | Stream.Error e -> failwithf (f_ "Syntax error when parsing '%s' when trying to \ expand %S: %s") var str e) str; Buffer.contents buff and var_get name = let vl = try Schema.get schema env name with Unknown_field _ as e -> begin try MapString.find name !env_from_file with Not_found -> raise e end in var_expand vl let var_choose ?printer ?name lst = OASISExpr.choose ?printer ?name var_get lst let var_protect vl = let buff = Buffer.create (String.length vl) in String.iter (function | '$' -> Buffer.add_string buff "\\$" | c -> Buffer.add_char buff c) vl; Buffer.contents buff let var_define ?(hide=false) ?(dump=true) ?short_desc ?(cli=CLINone) ?arg_help ?group name (* TODO: type constraint on the fact that name must be a valid OCaml id *) dflt = let default = [ OFileLoad, (fun () -> MapString.find name !env_from_file); ODefault, dflt; OGetEnv, (fun () -> Sys.getenv name); ] in let extra = { hide = hide; dump = dump; cli = cli; arg_help = arg_help; group = group; } in (* Try to find a value that can be defined *) let var_get_low lst = let errors, res = List.fold_left (fun (errors, res) (_, v) -> if res = None then begin try errors, Some (v ()) with | Not_found -> errors, res | Failure rsn -> (rsn :: errors), res | e -> (Printexc.to_string e) :: errors, res end else errors, res) ([], None) (List.sort (fun (o1, _) (o2, _) -> Pervasives.compare o2 o1) lst) in match res, errors with | Some v, _ -> v | None, [] -> raise (Not_set (name, None)) | None, lst -> raise (Not_set (name, Some (String.concat (s_ ", ") lst))) in let help = match short_desc with | Some fs -> Some fs | None -> None in let var_get_lst = FieldRO.create ~schema ~name ~parse:(fun ?(context=ODefault) s -> [context, fun () -> s]) ~print:var_get_low ~default ~update:(fun ?context:_ x old_x -> x @ old_x) ?help extra in fun () -> var_expand (var_get_low (var_get_lst env)) let var_redefine ?hide ?dump ?short_desc ?cli ?arg_help ?group name dflt = if Schema.mem schema name then begin (* TODO: look suspsicious, we want to memorize dflt not dflt () *) Schema.set schema env ~context:ODefault name (dflt ()); fun () -> var_get name end else begin var_define ?hide ?dump ?short_desc ?cli ?arg_help ?group name dflt end let var_ignore (_: unit -> string) = () let print_hidden = var_define ~hide:true ~dump:false ~cli:CLIAuto ~arg_help:"Print even non-printable variable. (debug)" "print_hidden" (fun () -> "false") let var_all () = List.rev (Schema.fold (fun acc nm def _ -> if not def.hide || bool_of_string (print_hidden ()) then nm :: acc else acc) [] schema) let default_filename = in_srcdir "setup.data" let load ~ctxt ?(allow_empty=false) ?(filename=default_filename) () = let open OASISFileSystem in env_from_file := let repr_filename = ctxt.srcfs#string_of_filename filename in if ctxt.srcfs#file_exists filename then begin let buf = Buffer.create 13 in defer_close (ctxt.srcfs#open_in ~mode:binary_in filename) (read_all buf); defer_close (ctxt.srcfs#open_in ~mode:binary_in filename) (fun rdr -> OASISMessage.info ~ctxt "Loading environment from %S." repr_filename; BaseEnvLight.load ~allow_empty ~filename:(repr_filename) ~stream:(stream_of_reader rdr) ()) end else if allow_empty then begin BaseEnvLight.MapString.empty end else begin failwith (Printf.sprintf (f_ "Unable to load environment, the file '%s' doesn't exist.") repr_filename) end let unload () = env_from_file := MapString.empty; Data.clear env let dump ~ctxt ?(filename=default_filename) () = let open OASISFileSystem in defer_close (ctxt.OASISContext.srcfs#open_out ~mode:binary_out filename) (fun wrtr -> let buf = Buffer.create 63 in let output nm value = Buffer.add_string buf (Printf.sprintf "%s=%S\n" nm value) in let mp_todo = (* Dump data from schema *) Schema.fold (fun mp_todo nm def _ -> if def.dump then begin try output nm (Schema.get schema env nm) with Not_set _ -> () end; MapString.remove nm mp_todo) !env_from_file schema in (* Dump data defined outside of schema *) MapString.iter output mp_todo; wrtr#output buf) let print () = let printable_vars = Schema.fold (fun acc nm def short_descr_opt -> if not def.hide || bool_of_string (print_hidden ()) then begin try let value = Schema.get schema env nm in let txt = match short_descr_opt with | Some s -> s () | None -> nm in (txt, value) :: acc with Not_set _ -> acc end else acc) [] schema in let max_length = List.fold_left max 0 (List.rev_map String.length (List.rev_map fst printable_vars)) in let dot_pad str = String.make ((max_length - (String.length str)) + 3) '.' in Printf.printf "\nConfiguration:\n"; List.iter (fun (name, value) -> Printf.printf "%s: %s" name (dot_pad name); if value = "" then Printf.printf "\n" else Printf.printf " %s\n" value) (List.rev printable_vars); Printf.printf "\n%!" let args () = let arg_concat = OASISUtils.varname_concat ~hyphen:'-' in [ "--override", Arg.Tuple ( let rvr = ref "" in let rvl = ref "" in [ Arg.Set_string rvr; Arg.Set_string rvl; Arg.Unit (fun () -> Schema.set schema env ~context:OCommandLine !rvr !rvl) ] ), "var+val Override any configuration variable."; ] @ List.flatten (Schema.fold (fun acc name def short_descr_opt -> let var_set s = Schema.set schema env ~context:OCommandLine name s in let arg_name = OASISUtils.varname_of_string ~hyphen:'-' name in let hlp = match short_descr_opt with | Some txt -> txt () | None -> "" in let arg_hlp = match def.arg_help with | Some s -> s | None -> "str" in let default_value = try Printf.sprintf (f_ " [%s]") (Schema.get schema env name) with Not_set _ -> "" in let args = match def.cli with | CLINone -> [] | CLIAuto -> [ arg_concat "--" arg_name, Arg.String var_set, Printf.sprintf (f_ "%s %s%s") arg_hlp hlp default_value ] | CLIWith -> [ arg_concat "--with-" arg_name, Arg.String var_set, Printf.sprintf (f_ "%s %s%s") arg_hlp hlp default_value ] | CLIEnable -> let dflt = if default_value = " [true]" then s_ " [default: enabled]" else s_ " [default: disabled]" in [ arg_concat "--enable-" arg_name, Arg.Unit (fun () -> var_set "true"), Printf.sprintf (f_ " %s%s") hlp dflt; arg_concat "--disable-" arg_name, Arg.Unit (fun () -> var_set "false"), Printf.sprintf (f_ " %s%s") hlp dflt ] | CLIUser lst -> lst in args :: acc) [] schema) end module BaseArgExt = struct # 22 "src/base/BaseArgExt.ml" open OASISUtils open OASISGettext let parse argv args = (* Simulate command line for Arg *) let current = ref 0 in try Arg.parse_argv ~current:current (Array.concat [[|"none"|]; argv]) (Arg.align args) (failwithf (f_ "Don't know what to do with arguments: '%s'")) (s_ "configure options:") with | Arg.Help txt -> print_endline txt; exit 0 | Arg.Bad txt -> prerr_endline txt; exit 1 end module BaseCheck = struct # 22 "src/base/BaseCheck.ml" open BaseEnv open BaseMessage open OASISUtils open OASISGettext let prog_best prg prg_lst = var_redefine prg (fun () -> let alternate = List.fold_left (fun res e -> match res with | Some _ -> res | None -> try Some (OASISFileUtil.which ~ctxt:!BaseContext.default e) with Not_found -> None) None prg_lst in match alternate with | Some prg -> prg | None -> raise Not_found) let prog prg = prog_best prg [prg] let prog_opt prg = prog_best prg [prg^".opt"; prg] let ocamlfind = prog "ocamlfind" let version var_prefix cmp fversion () = (* Really compare version provided *) let var = var_prefix^"_version_"^(OASISVersion.varname_of_comparator cmp) in var_redefine ~hide:true var (fun () -> let version_str = match fversion () with | "[Distributed with OCaml]" -> begin try (var_get "ocaml_version") with Not_found -> warning (f_ "Variable ocaml_version not defined, fallback \ to default"); Sys.ocaml_version end | res -> res in let version = OASISVersion.version_of_string version_str in if OASISVersion.comparator_apply version cmp then version_str else failwithf (f_ "Cannot satisfy version constraint on %s: %s (version: %s)") var_prefix (OASISVersion.string_of_comparator cmp) version_str) () let package_version pkg = OASISExec.run_read_one_line ~ctxt:!BaseContext.default (ocamlfind ()) ["query"; "-format"; "%v"; pkg] let package ?version_comparator pkg () = let var = OASISUtils.varname_concat "pkg_" (OASISUtils.varname_of_string pkg) in let findlib_dir pkg = let dir = OASISExec.run_read_one_line ~ctxt:!BaseContext.default (ocamlfind ()) ["query"; "-format"; "%d"; pkg] in if Sys.file_exists dir && Sys.is_directory dir then dir else failwithf (f_ "When looking for findlib package %s, \ directory %s return doesn't exist") pkg dir in let vl = var_redefine var (fun () -> findlib_dir pkg) () in ( match version_comparator with | Some ver_cmp -> ignore (version var ver_cmp (fun _ -> package_version pkg) ()) | None -> () ); vl end module BaseOCamlcConfig = struct # 22 "src/base/BaseOCamlcConfig.ml" open BaseEnv open OASISUtils open OASISGettext module SMap = Map.Make(String) let ocamlc = BaseCheck.prog_opt "ocamlc" let ocamlc_config_map = (* Map name to value for ocamlc -config output (name ^": "^value) *) let rec split_field mp lst = match lst with | line :: tl -> let mp = try let pos_semicolon = String.index line ':' in if pos_semicolon > 1 then ( let name = String.sub line 0 pos_semicolon in let linelen = String.length line in let value = if linelen > pos_semicolon + 2 then String.sub line (pos_semicolon + 2) (linelen - pos_semicolon - 2) else "" in SMap.add name value mp ) else ( mp ) with Not_found -> ( mp ) in split_field mp tl | [] -> mp in let cache = lazy (var_protect (Marshal.to_string (split_field SMap.empty (OASISExec.run_read_output ~ctxt:!BaseContext.default (ocamlc ()) ["-config"])) [])) in var_redefine "ocamlc_config_map" ~hide:true ~dump:false (fun () -> (* TODO: update if ocamlc change !!! *) Lazy.force cache) let var_define nm = (* Extract data from ocamlc -config *) let avlbl_config_get () = Marshal.from_string (ocamlc_config_map ()) 0 in let chop_version_suffix s = try String.sub s 0 (String.index s '+') with _ -> s in let nm_config, value_config = match nm with | "ocaml_version" -> "version", chop_version_suffix | _ -> nm, (fun x -> x) in var_redefine nm (fun () -> try let map = avlbl_config_get () in let value = SMap.find nm_config map in value_config value with Not_found -> failwithf (f_ "Cannot find field '%s' in '%s -config' output") nm (ocamlc ())) end module BaseStandardVar = struct # 22 "src/base/BaseStandardVar.ml" open OASISGettext open OASISTypes open BaseCheck open BaseEnv let ocamlfind = BaseCheck.ocamlfind let ocamlc = BaseOCamlcConfig.ocamlc let ocamlopt = prog_opt "ocamlopt" let ocamlbuild = prog "ocamlbuild" (**/**) let rpkg = ref None let pkg_get () = match !rpkg with | Some pkg -> pkg | None -> failwith (s_ "OASIS Package is not set") let var_cond = ref [] let var_define_cond ~since_version f dflt = let holder = ref (fun () -> dflt) in let since_version = OASISVersion.VGreaterEqual (OASISVersion.version_of_string since_version) in var_cond := (fun ver -> if OASISVersion.comparator_apply ver since_version then holder := f ()) :: !var_cond; fun () -> !holder () (**/**) let pkg_name = var_define ~short_desc:(fun () -> s_ "Package name") "pkg_name" (fun () -> (pkg_get ()).name) let pkg_version = var_define ~short_desc:(fun () -> s_ "Package version") "pkg_version" (fun () -> (OASISVersion.string_of_version (pkg_get ()).version)) let c = BaseOCamlcConfig.var_define let os_type = c "os_type" let system = c "system" let architecture = c "architecture" let ccomp_type = c "ccomp_type" let ocaml_version = c "ocaml_version" (* TODO: Check standard variable presence at runtime *) let standard_library_default = c "standard_library_default" let standard_library = c "standard_library" let standard_runtime = c "standard_runtime" let bytecomp_c_compiler = c "bytecomp_c_compiler" let native_c_compiler = c "native_c_compiler" let model = c "model" let ext_obj = c "ext_obj" let ext_asm = c "ext_asm" let ext_lib = c "ext_lib" let ext_dll = c "ext_dll" let default_executable_name = c "default_executable_name" let systhread_supported = c "systhread_supported" let flexlink = BaseCheck.prog "flexlink" let flexdll_version = var_define ~short_desc:(fun () -> "FlexDLL version (Win32)") "flexdll_version" (fun () -> let lst = OASISExec.run_read_output ~ctxt:!BaseContext.default (flexlink ()) ["-help"] in match lst with | line :: _ -> Scanf.sscanf line "FlexDLL version %s" (fun ver -> ver) | [] -> raise Not_found) (**/**) let p name hlp dflt = var_define ~short_desc:hlp ~cli:CLIAuto ~arg_help:"dir" name dflt let (/) a b = if os_type () = Sys.os_type then Filename.concat a b else if os_type () = "Unix" || os_type () = "Cygwin" then OASISUnixPath.concat a b else OASISUtils.failwithf (f_ "Cannot handle os_type %s filename concat") (os_type ()) (**/**) let prefix = p "prefix" (fun () -> s_ "Install architecture-independent files dir") (fun () -> match os_type () with | "Win32" -> let program_files = Sys.getenv "PROGRAMFILES" in program_files/(pkg_name ()) | _ -> "/usr/local") let exec_prefix = p "exec_prefix" (fun () -> s_ "Install architecture-dependent files in dir") (fun () -> "$prefix") let bindir = p "bindir" (fun () -> s_ "User executables") (fun () -> "$exec_prefix"/"bin") let sbindir = p "sbindir" (fun () -> s_ "System admin executables") (fun () -> "$exec_prefix"/"sbin") let libexecdir = p "libexecdir" (fun () -> s_ "Program executables") (fun () -> "$exec_prefix"/"libexec") let sysconfdir = p "sysconfdir" (fun () -> s_ "Read-only single-machine data") (fun () -> "$prefix"/"etc") let sharedstatedir = p "sharedstatedir" (fun () -> s_ "Modifiable architecture-independent data") (fun () -> "$prefix"/"com") let localstatedir = p "localstatedir" (fun () -> s_ "Modifiable single-machine data") (fun () -> "$prefix"/"var") let libdir = p "libdir" (fun () -> s_ "Object code libraries") (fun () -> "$exec_prefix"/"lib") let datarootdir = p "datarootdir" (fun () -> s_ "Read-only arch-independent data root") (fun () -> "$prefix"/"share") let datadir = p "datadir" (fun () -> s_ "Read-only architecture-independent data") (fun () -> "$datarootdir") let infodir = p "infodir" (fun () -> s_ "Info documentation") (fun () -> "$datarootdir"/"info") let localedir = p "localedir" (fun () -> s_ "Locale-dependent data") (fun () -> "$datarootdir"/"locale") let mandir = p "mandir" (fun () -> s_ "Man documentation") (fun () -> "$datarootdir"/"man") let docdir = p "docdir" (fun () -> s_ "Documentation root") (fun () -> "$datarootdir"/"doc"/"$pkg_name") let htmldir = p "htmldir" (fun () -> s_ "HTML documentation") (fun () -> "$docdir") let dvidir = p "dvidir" (fun () -> s_ "DVI documentation") (fun () -> "$docdir") let pdfdir = p "pdfdir" (fun () -> s_ "PDF documentation") (fun () -> "$docdir") let psdir = p "psdir" (fun () -> s_ "PS documentation") (fun () -> "$docdir") let destdir = p "destdir" (fun () -> s_ "Prepend a path when installing package") (fun () -> raise (PropList.Not_set ("destdir", Some (s_ "undefined by construct")))) let findlib_version = var_define "findlib_version" (fun () -> BaseCheck.package_version "findlib") let is_native = var_define "is_native" (fun () -> try let _s: string = ocamlopt () in "true" with PropList.Not_set _ -> let _s: string = ocamlc () in "false") let ext_program = var_define "suffix_program" (fun () -> match os_type () with | "Win32" | "Cygwin" -> ".exe" | _ -> "") let rm = var_define ~short_desc:(fun () -> s_ "Remove a file.") "rm" (fun () -> match os_type () with | "Win32" -> "del" | _ -> "rm -f") let rmdir = var_define ~short_desc:(fun () -> s_ "Remove a directory.") "rmdir" (fun () -> match os_type () with | "Win32" -> "rd" | _ -> "rm -rf") let debug = var_define ~short_desc:(fun () -> s_ "Turn ocaml debug flag on") ~cli:CLIEnable "debug" (fun () -> "true") let profile = var_define ~short_desc:(fun () -> s_ "Turn ocaml profile flag on") ~cli:CLIEnable "profile" (fun () -> "false") let tests = var_define_cond ~since_version:"0.3" (fun () -> var_define ~short_desc:(fun () -> s_ "Compile tests executable and library and run them") ~cli:CLIEnable "tests" (fun () -> "false")) "true" let docs = var_define_cond ~since_version:"0.3" (fun () -> var_define ~short_desc:(fun () -> s_ "Create documentations") ~cli:CLIEnable "docs" (fun () -> "true")) "true" let native_dynlink = var_define ~short_desc:(fun () -> s_ "Compiler support generation of .cmxs.") ~cli:CLINone "native_dynlink" (fun () -> let res = let ocaml_lt_312 () = OASISVersion.comparator_apply (OASISVersion.version_of_string (ocaml_version ())) (OASISVersion.VLesser (OASISVersion.version_of_string "3.12.0")) in let flexdll_lt_030 () = OASISVersion.comparator_apply (OASISVersion.version_of_string (flexdll_version ())) (OASISVersion.VLesser (OASISVersion.version_of_string "0.30")) in let has_native_dynlink = let ocamlfind = ocamlfind () in try let fn = OASISExec.run_read_one_line ~ctxt:!BaseContext.default ocamlfind ["query"; "-predicates"; "native"; "dynlink"; "-format"; "%d/%a"] in Sys.file_exists fn with _ -> false in if not has_native_dynlink then false else if ocaml_lt_312 () then false else if (os_type () = "Win32" || os_type () = "Cygwin") && flexdll_lt_030 () then begin BaseMessage.warning (f_ ".cmxs generation disabled because FlexDLL needs to be \ at least 0.30. Please upgrade FlexDLL from %s to 0.30.") (flexdll_version ()); false end else true in string_of_bool res) let init pkg = rpkg := Some pkg; List.iter (fun f -> f pkg.oasis_version) !var_cond end module BaseFileAB = struct # 22 "src/base/BaseFileAB.ml" open BaseEnv open OASISGettext open BaseMessage open OASISContext let to_filename fn = if not (Filename.check_suffix fn ".ab") then warning (f_ "File '%s' doesn't have '.ab' extension") fn; OASISFileSystem.of_unix_filename (Filename.chop_extension fn) let replace ~ctxt fn_lst = let open OASISFileSystem in let ibuf, obuf = Buffer.create 13, Buffer.create 13 in List.iter (fun fn -> Buffer.clear ibuf; Buffer.clear obuf; defer_close (ctxt.srcfs#open_in (of_unix_filename fn)) (read_all ibuf); Buffer.add_string obuf (var_expand (Buffer.contents ibuf)); defer_close (ctxt.srcfs#open_out (to_filename fn)) (fun wrtr -> wrtr#output obuf)) fn_lst end module BaseLog = struct # 22 "src/base/BaseLog.ml" open OASISUtils open OASISContext open OASISGettext open OASISFileSystem let default_filename = in_srcdir "setup.log" let load ~ctxt () = let module SetTupleString = Set.Make (struct type t = string * string let compare (s11, s12) (s21, s22) = match String.compare s11 s21 with | 0 -> String.compare s12 s22 | n -> n end) in if ctxt.srcfs#file_exists default_filename then begin defer_close (ctxt.srcfs#open_in default_filename) (fun rdr -> let line = ref 1 in let lxr = Genlex.make_lexer [] (stream_of_reader rdr) in let rec read_aux (st, lst) = match Stream.npeek 2 lxr with | [Genlex.String e; Genlex.String d] -> let t = e, d in Stream.junk lxr; Stream.junk lxr; if SetTupleString.mem t st then read_aux (st, lst) else read_aux (SetTupleString.add t st, t :: lst) | [] -> List.rev lst | _ -> failwithf (f_ "Malformed log file '%s' at line %d") (ctxt.srcfs#string_of_filename default_filename) !line in read_aux (SetTupleString.empty, [])) end else begin [] end let register ~ctxt event data = defer_close (ctxt.srcfs#open_out ~mode:[Open_append; Open_creat; Open_text] ~perm:0o644 default_filename) (fun wrtr -> let buf = Buffer.create 13 in Printf.bprintf buf "%S %S\n" event data; wrtr#output buf) let unregister ~ctxt event data = let lst = load ~ctxt () in let buf = Buffer.create 13 in List.iter (fun (e, d) -> if e <> event || d <> data then Printf.bprintf buf "%S %S\n" e d) lst; if Buffer.length buf > 0 then defer_close (ctxt.srcfs#open_out default_filename) (fun wrtr -> wrtr#output buf) else ctxt.srcfs#remove default_filename let filter ~ctxt events = let st_events = SetString.of_list events in List.filter (fun (e, _) -> SetString.mem e st_events) (load ~ctxt ()) let exists ~ctxt event data = List.exists (fun v -> (event, data) = v) (load ~ctxt ()) end module BaseBuilt = struct # 22 "src/base/BaseBuilt.ml" open OASISTypes open OASISGettext open BaseStandardVar open BaseMessage type t = | BExec (* Executable *) | BExecLib (* Library coming with executable *) | BLib (* Library *) | BObj (* Library *) | BDoc (* Document *) let to_log_event_file t nm = "built_"^ (match t with | BExec -> "exec" | BExecLib -> "exec_lib" | BLib -> "lib" | BObj -> "obj" | BDoc -> "doc")^ "_"^nm let to_log_event_done t nm = "is_"^(to_log_event_file t nm) let register ~ctxt t nm lst = BaseLog.register ~ctxt (to_log_event_done t nm) "true"; List.iter (fun alt -> let registered = List.fold_left (fun registered fn -> if OASISFileUtil.file_exists_case fn then begin BaseLog.register ~ctxt (to_log_event_file t nm) (if Filename.is_relative fn then Filename.concat (Sys.getcwd ()) fn else fn); true end else begin registered end) false alt in if not registered then warning (f_ "Cannot find an existing alternative files among: %s") (String.concat (s_ ", ") alt)) lst let unregister ~ctxt t nm = List.iter (fun (e, d) -> BaseLog.unregister ~ctxt e d) (BaseLog.filter ~ctxt [to_log_event_file t nm; to_log_event_done t nm]) let fold ~ctxt t nm f acc = List.fold_left (fun acc (_, fn) -> if OASISFileUtil.file_exists_case fn then begin f acc fn end else begin warning (f_ "File '%s' has been marked as built \ for %s but doesn't exist") fn (Printf.sprintf (match t with | BExec | BExecLib -> (f_ "executable %s") | BLib -> (f_ "library %s") | BObj -> (f_ "object %s") | BDoc -> (f_ "documentation %s")) nm); acc end) acc (BaseLog.filter ~ctxt [to_log_event_file t nm]) let is_built ~ctxt t nm = List.fold_left (fun _ (_, d) -> try bool_of_string d with _ -> false) false (BaseLog.filter ~ctxt [to_log_event_done t nm]) let of_executable ffn (cs, bs, exec) = let unix_exec_is, unix_dll_opt = OASISExecutable.unix_exec_is (cs, bs, exec) (fun () -> bool_of_string (is_native ())) ext_dll ext_program in let evs = (BExec, cs.cs_name, [[ffn unix_exec_is]]) :: (match unix_dll_opt with | Some fn -> [BExecLib, cs.cs_name, [[ffn fn]]] | None -> []) in evs, unix_exec_is, unix_dll_opt let of_library ffn (cs, bs, lib) = let unix_lst = OASISLibrary.generated_unix_files ~ctxt:!BaseContext.default ~source_file_exists:(fun fn -> OASISFileUtil.file_exists_case (OASISHostPath.of_unix fn)) ~is_native:(bool_of_string (is_native ())) ~has_native_dynlink:(bool_of_string (native_dynlink ())) ~ext_lib:(ext_lib ()) ~ext_dll:(ext_dll ()) (cs, bs, lib) in let evs = [BLib, cs.cs_name, List.map (List.map ffn) unix_lst] in evs, unix_lst let of_object ffn (cs, bs, obj) = let unix_lst = OASISObject.generated_unix_files ~ctxt:!BaseContext.default ~source_file_exists:(fun fn -> OASISFileUtil.file_exists_case (OASISHostPath.of_unix fn)) ~is_native:(bool_of_string (is_native ())) (cs, bs, obj) in let evs = [BObj, cs.cs_name, List.map (List.map ffn) unix_lst] in evs, unix_lst end module BaseCustom = struct # 22 "src/base/BaseCustom.ml" open BaseEnv open BaseMessage open OASISTypes open OASISGettext let run cmd args extra_args = OASISExec.run ~ctxt:!BaseContext.default ~quote:false (var_expand cmd) (List.map var_expand (args @ (Array.to_list extra_args))) let hook ?(failsafe=false) cstm f e = let optional_command lst = let printer = function | Some (cmd, args) -> String.concat " " (cmd :: args) | None -> s_ "No command" in match var_choose ~name:(s_ "Pre/Post Command") ~printer lst with | Some (cmd, args) -> begin try run cmd args [||] with e when failsafe -> warning (f_ "Command '%s' fail with error: %s") (String.concat " " (cmd :: args)) (match e with | Failure msg -> msg | e -> Printexc.to_string e) end | None -> () in let res = optional_command cstm.pre_command; f e in optional_command cstm.post_command; res end module BaseDynVar = struct # 22 "src/base/BaseDynVar.ml" open OASISTypes open OASISGettext open BaseEnv open BaseBuilt let init ~ctxt pkg = (* TODO: disambiguate exec vs other variable by adding exec_VARNAME. *) (* TODO: provide compile option for library libary_byte_args_VARNAME... *) List.iter (function | Executable (cs, bs, _) -> if var_choose bs.bs_build then var_ignore (var_redefine (* We don't save this variable *) ~dump:false ~short_desc:(fun () -> Printf.sprintf (f_ "Filename of executable '%s'") cs.cs_name) (OASISUtils.varname_of_string cs.cs_name) (fun () -> let fn_opt = fold ~ctxt BExec cs.cs_name (fun _ fn -> Some fn) None in match fn_opt with | Some fn -> fn | None -> raise (PropList.Not_set (cs.cs_name, Some (Printf.sprintf (f_ "Executable '%s' not yet built.") cs.cs_name))))) | Library _ | Object _ | Flag _ | Test _ | SrcRepo _ | Doc _ -> ()) pkg.sections end module BaseTest = struct # 22 "src/base/BaseTest.ml" open BaseEnv open BaseMessage open OASISTypes open OASISGettext let test ~ctxt lst pkg extra_args = let one_test (failure, n) (test_plugin, cs, test) = if var_choose ~name:(Printf.sprintf (f_ "test %s run") cs.cs_name) ~printer:string_of_bool test.test_run then begin let () = info (f_ "Running test '%s'") cs.cs_name in let back_cwd = match test.test_working_directory with | Some dir -> let cwd = Sys.getcwd () in let chdir d = info (f_ "Changing directory to '%s'") d; Sys.chdir d in chdir dir; fun () -> chdir cwd | None -> fun () -> () in try let failure_percent = BaseCustom.hook test.test_custom (test_plugin ~ctxt pkg (cs, test)) extra_args in back_cwd (); (failure_percent +. failure, n + 1) with e -> begin back_cwd (); raise e end end else begin info (f_ "Skipping test '%s'") cs.cs_name; (failure, n) end in let failed, n = List.fold_left one_test (0.0, 0) lst in let failure_percent = if n = 0 then 0.0 else failed /. (float_of_int n) in let msg = Printf.sprintf (f_ "Tests had a %.2f%% failure rate") (100. *. failure_percent) in if failure_percent > 0.0 then failwith msg else info "%s" msg; (* Possible explanation why the tests where not run. *) if OASISFeatures.package_test OASISFeatures.flag_tests pkg && not (bool_of_string (BaseStandardVar.tests ())) && lst <> [] then BaseMessage.warning "Tests are turned off, consider enabling with \ 'ocaml setup.ml -configure --enable-tests'" end module BaseDoc = struct # 22 "src/base/BaseDoc.ml" open BaseEnv open BaseMessage open OASISTypes open OASISGettext let doc ~ctxt lst pkg extra_args = let one_doc (doc_plugin, cs, doc) = if var_choose ~name:(Printf.sprintf (f_ "documentation %s build") cs.cs_name) ~printer:string_of_bool doc.doc_build then begin info (f_ "Building documentation '%s'") cs.cs_name; BaseCustom.hook doc.doc_custom (doc_plugin ~ctxt pkg (cs, doc)) extra_args end in List.iter one_doc lst; if OASISFeatures.package_test OASISFeatures.flag_docs pkg && not (bool_of_string (BaseStandardVar.docs ())) && lst <> [] then BaseMessage.warning "Docs are turned off, consider enabling with \ 'ocaml setup.ml -configure --enable-docs'" end module BaseSetup = struct # 22 "src/base/BaseSetup.ml" open OASISContext open BaseEnv open BaseMessage open OASISTypes open OASISGettext open OASISUtils type std_args_fun = ctxt:OASISContext.t -> package -> string array -> unit type ('a, 'b) section_args_fun = name * (ctxt:OASISContext.t -> package -> (common_section * 'a) -> string array -> 'b) type t = { configure: std_args_fun; build: std_args_fun; doc: ((doc, unit) section_args_fun) list; test: ((test, float) section_args_fun) list; install: std_args_fun; uninstall: std_args_fun; clean: std_args_fun list; clean_doc: (doc, unit) section_args_fun list; clean_test: (test, unit) section_args_fun list; distclean: std_args_fun list; distclean_doc: (doc, unit) section_args_fun list; distclean_test: (test, unit) section_args_fun list; package: package; oasis_fn: string option; oasis_version: string; oasis_digest: Digest.t option; oasis_exec: string option; oasis_setup_args: string list; setup_update: bool; } (* Associate a plugin function with data from package *) let join_plugin_sections filter_map lst = List.rev (List.fold_left (fun acc sct -> match filter_map sct with | Some e -> e :: acc | None -> acc) [] lst) (* Search for plugin data associated with a section name *) let lookup_plugin_section plugin action nm lst = try List.assoc nm lst with Not_found -> failwithf (f_ "Cannot find plugin %s matching section %s for %s action") plugin nm action let configure ~ctxt t args = (* Run configure *) BaseCustom.hook t.package.conf_custom (fun () -> (* Reload if preconf has changed it *) begin try unload (); load ~ctxt (); with _ -> () end; (* Run plugin's configure *) t.configure ~ctxt t.package args; (* Dump to allow postconf to change it *) dump ~ctxt ()) (); (* Reload environment *) unload (); load ~ctxt (); (* Save environment *) print (); (* Replace data in file *) BaseFileAB.replace ~ctxt t.package.files_ab let build ~ctxt t args = BaseCustom.hook t.package.build_custom (t.build ~ctxt t.package) args let doc ~ctxt t args = BaseDoc.doc ~ctxt (join_plugin_sections (function | Doc (cs, e) -> Some (lookup_plugin_section "documentation" (s_ "build") cs.cs_name t.doc, cs, e) | _ -> None) t.package.sections) t.package args let test ~ctxt t args = BaseTest.test ~ctxt (join_plugin_sections (function | Test (cs, e) -> Some (lookup_plugin_section "test" (s_ "run") cs.cs_name t.test, cs, e) | _ -> None) t.package.sections) t.package args let all ~ctxt t args = let rno_doc = ref false in let rno_test = ref false in let arg_rest = ref [] in Arg.parse_argv ~current:(ref 0) (Array.of_list ((Sys.executable_name^" all") :: (Array.to_list args))) [ "-no-doc", Arg.Set rno_doc, s_ "Don't run doc target"; "-no-test", Arg.Set rno_test, s_ "Don't run test target"; "--", Arg.Rest (fun arg -> arg_rest := arg :: !arg_rest), s_ "All arguments for configure."; ] (failwithf (f_ "Don't know what to do with '%s'")) ""; info "Running configure step"; configure ~ctxt t (Array.of_list (List.rev !arg_rest)); info "Running build step"; build ~ctxt t [||]; (* Load setup.log dynamic variables *) BaseDynVar.init ~ctxt t.package; if not !rno_doc then begin info "Running doc step"; doc ~ctxt t [||] end else begin info "Skipping doc step" end; if not !rno_test then begin info "Running test step"; test ~ctxt t [||] end else begin info "Skipping test step" end let install ~ctxt t args = BaseCustom.hook t.package.install_custom (t.install ~ctxt t.package) args let uninstall ~ctxt t args = BaseCustom.hook t.package.uninstall_custom (t.uninstall ~ctxt t.package) args let reinstall ~ctxt t args = uninstall ~ctxt t args; install ~ctxt t args let clean, distclean = let failsafe f a = try f a with e -> warning (f_ "Action fail with error: %s") (match e with | Failure msg -> msg | e -> Printexc.to_string e) in let generic_clean ~ctxt t cstm mains docs tests args = BaseCustom.hook ~failsafe:true cstm (fun () -> (* Clean section *) List.iter (function | Test (cs, test) -> let f = try List.assoc cs.cs_name tests with Not_found -> fun ~ctxt:_ _ _ _ -> () in failsafe (f ~ctxt t.package (cs, test)) args | Doc (cs, doc) -> let f = try List.assoc cs.cs_name docs with Not_found -> fun ~ctxt:_ _ _ _ -> () in failsafe (f ~ctxt t.package (cs, doc)) args | Library _ | Object _ | Executable _ | Flag _ | SrcRepo _ -> ()) t.package.sections; (* Clean whole package *) List.iter (fun f -> failsafe (f ~ctxt t.package) args) mains) () in let clean ~ctxt t args = generic_clean ~ctxt t t.package.clean_custom t.clean t.clean_doc t.clean_test args in let distclean ~ctxt t args = (* Call clean *) clean ~ctxt t args; (* Call distclean code *) generic_clean ~ctxt t t.package.distclean_custom t.distclean t.distclean_doc t.distclean_test args; (* Remove generated source files. *) List.iter (fun fn -> if ctxt.srcfs#file_exists fn then begin info (f_ "Remove '%s'") (ctxt.srcfs#string_of_filename fn); ctxt.srcfs#remove fn end) ([BaseEnv.default_filename; BaseLog.default_filename] @ (List.rev_map BaseFileAB.to_filename t.package.files_ab)) in clean, distclean let version ~ctxt:_ (t: t) _ = print_endline t.oasis_version let update_setup_ml, no_update_setup_ml_cli = let b = ref true in b, ("-no-update-setup-ml", Arg.Clear b, s_ " Don't try to update setup.ml, even if _oasis has changed.") (* TODO: srcfs *) let default_oasis_fn = "_oasis" let update_setup_ml t = let oasis_fn = match t.oasis_fn with | Some fn -> fn | None -> default_oasis_fn in let oasis_exec = match t.oasis_exec with | Some fn -> fn | None -> "oasis" in let ocaml = Sys.executable_name in let setup_ml, args = match Array.to_list Sys.argv with | setup_ml :: args -> setup_ml, args | [] -> failwith (s_ "Expecting non-empty command line arguments.") in let ocaml, setup_ml = if Sys.executable_name = Sys.argv.(0) then (* We are not running in standard mode, probably the script * is precompiled. *) "ocaml", "setup.ml" else ocaml, setup_ml in let no_update_setup_ml_cli, _, _ = no_update_setup_ml_cli in let do_update () = let oasis_exec_version = OASISExec.run_read_one_line ~ctxt:!BaseContext.default ~f_exit_code: (function | 0 -> () | 1 -> failwithf (f_ "Executable '%s' is probably an old version \ of oasis (< 0.3.0), please update to version \ v%s.") oasis_exec t.oasis_version | 127 -> failwithf (f_ "Cannot find executable '%s', please install \ oasis v%s.") oasis_exec t.oasis_version | n -> failwithf (f_ "Command '%s version' exited with code %d.") oasis_exec n) oasis_exec ["version"] in if OASISVersion.comparator_apply (OASISVersion.version_of_string oasis_exec_version) (OASISVersion.VGreaterEqual (OASISVersion.version_of_string t.oasis_version)) then begin (* We have a version >= for the executable oasis, proceed with * update. *) (* TODO: delegate this check to 'oasis setup'. *) if Sys.os_type = "Win32" then failwithf (f_ "It is not possible to update the running script \ setup.ml on Windows. Please update setup.ml by \ running '%s'.") (String.concat " " (oasis_exec :: "setup" :: t.oasis_setup_args)) else begin OASISExec.run ~ctxt:!BaseContext.default ~f_exit_code: (fun n -> if n <> 0 then failwithf (f_ "Unable to update setup.ml using '%s', \ please fix the problem and retry.") oasis_exec) oasis_exec ("setup" :: t.oasis_setup_args); OASISExec.run ~ctxt:!BaseContext.default ocaml (setup_ml :: args) end end else failwithf (f_ "The version of '%s' (v%s) doesn't match the version of \ oasis used to generate the %s file. Please install at \ least oasis v%s.") oasis_exec oasis_exec_version setup_ml t.oasis_version in if !update_setup_ml then begin try match t.oasis_digest with | Some dgst -> if Sys.file_exists oasis_fn && dgst <> Digest.file default_oasis_fn then begin do_update (); true end else false | None -> false with e -> error (f_ "Error when updating setup.ml. If you want to avoid this error, \ you can bypass the update of %s by running '%s %s %s %s'") setup_ml ocaml setup_ml no_update_setup_ml_cli (String.concat " " args); raise e end else false let setup t = let catch_exn = ref true in let act_ref = ref (fun ~ctxt:_ _ -> failwithf (f_ "No action defined, run '%s %s -help'") Sys.executable_name Sys.argv.(0)) in let extra_args_ref = ref [] in let allow_empty_env_ref = ref false in let arg_handle ?(allow_empty_env=false) act = Arg.Tuple [ Arg.Rest (fun str -> extra_args_ref := str :: !extra_args_ref); Arg.Unit (fun () -> allow_empty_env_ref := allow_empty_env; act_ref := act); ] in try let () = Arg.parse (Arg.align ([ "-configure", arg_handle ~allow_empty_env:true configure, s_ "[options*] Configure the whole build process."; "-build", arg_handle build, s_ "[options*] Build executables and libraries."; "-doc", arg_handle doc, s_ "[options*] Build documents."; "-test", arg_handle test, s_ "[options*] Run tests."; "-all", arg_handle ~allow_empty_env:true all, s_ "[options*] Run configure, build, doc and test targets."; "-install", arg_handle install, s_ "[options*] Install libraries, data, executables \ and documents."; "-uninstall", arg_handle uninstall, s_ "[options*] Uninstall libraries, data, executables \ and documents."; "-reinstall", arg_handle reinstall, s_ "[options*] Uninstall and install libraries, data, \ executables and documents."; "-clean", arg_handle ~allow_empty_env:true clean, s_ "[options*] Clean files generated by a build."; "-distclean", arg_handle ~allow_empty_env:true distclean, s_ "[options*] Clean files generated by a build and configure."; "-version", arg_handle ~allow_empty_env:true version, s_ " Display version of OASIS used to generate this setup.ml."; "-no-catch-exn", Arg.Clear catch_exn, s_ " Don't catch exception, useful for debugging."; ] @ (if t.setup_update then [no_update_setup_ml_cli] else []) @ (BaseContext.args ()))) (failwithf (f_ "Don't know what to do with '%s'")) (s_ "Setup and run build process current package\n") in (* Instantiate the context. *) let ctxt = !BaseContext.default in (* Build initial environment *) load ~ctxt ~allow_empty:!allow_empty_env_ref (); (** Initialize flags *) List.iter (function | Flag (cs, {flag_description = hlp; flag_default = choices}) -> begin let apply ?short_desc () = var_ignore (var_define ~cli:CLIEnable ?short_desc (OASISUtils.varname_of_string cs.cs_name) (fun () -> string_of_bool (var_choose ~name:(Printf.sprintf (f_ "default value of flag %s") cs.cs_name) ~printer:string_of_bool choices))) in match hlp with | Some hlp -> apply ~short_desc:(fun () -> hlp) () | None -> apply () end | _ -> ()) t.package.sections; BaseStandardVar.init t.package; BaseDynVar.init ~ctxt t.package; if not (t.setup_update && update_setup_ml t) then !act_ref ~ctxt t (Array.of_list (List.rev !extra_args_ref)) with e when !catch_exn -> error "%s" (Printexc.to_string e); exit 1 end module BaseCompat = struct # 22 "src/base/BaseCompat.ml" (** Compatibility layer to provide a stable API inside setup.ml. This layer allows OASIS to change in between minor versions (e.g. 0.4.6 -> 0.4.7) but still provides a stable API inside setup.ml. This enables to write functions that manipulate setup_t inside setup.ml. See deps.ml for an example. The module opened by default will depend on the version of the _oasis. E.g. if we have "OASISFormat: 0.3", the module Compat_0_3 will be opened and the function Compat_0_3 will be called. If setup.ml is generated with the -nocompat, no module will be opened. @author Sylvain Le Gall *) module Compat_0_4 = struct let rctxt = ref !BaseContext.default module BaseSetup = struct module Original = BaseSetup open OASISTypes type std_args_fun = package -> string array -> unit type ('a, 'b) section_args_fun = name * (package -> (common_section * 'a) -> string array -> 'b) type t = { configure: std_args_fun; build: std_args_fun; doc: ((doc, unit) section_args_fun) list; test: ((test, float) section_args_fun) list; install: std_args_fun; uninstall: std_args_fun; clean: std_args_fun list; clean_doc: (doc, unit) section_args_fun list; clean_test: (test, unit) section_args_fun list; distclean: std_args_fun list; distclean_doc: (doc, unit) section_args_fun list; distclean_test: (test, unit) section_args_fun list; package: package; oasis_fn: string option; oasis_version: string; oasis_digest: Digest.t option; oasis_exec: string option; oasis_setup_args: string list; setup_update: bool; } let setup t = let mk_std_args_fun f = fun ~ctxt pkg args -> rctxt := ctxt; f pkg args in let mk_section_args_fun l = List.map (fun (nm, f) -> nm, (fun ~ctxt pkg sct args -> rctxt := ctxt; f pkg sct args)) l in let t' = { Original. configure = mk_std_args_fun t.configure; build = mk_std_args_fun t.build; doc = mk_section_args_fun t.doc; test = mk_section_args_fun t.test; install = mk_std_args_fun t.install; uninstall = mk_std_args_fun t.uninstall; clean = List.map mk_std_args_fun t.clean; clean_doc = mk_section_args_fun t.clean_doc; clean_test = mk_section_args_fun t.clean_test; distclean = List.map mk_std_args_fun t.distclean; distclean_doc = mk_section_args_fun t.distclean_doc; distclean_test = mk_section_args_fun t.distclean_test; package = t.package; oasis_fn = t.oasis_fn; oasis_version = t.oasis_version; oasis_digest = t.oasis_digest; oasis_exec = t.oasis_exec; oasis_setup_args = t.oasis_setup_args; setup_update = t.setup_update; } in Original.setup t' end let adapt_setup_t setup_t = let module O = BaseSetup.Original in let mk_std_args_fun f = fun pkg args -> f ~ctxt:!rctxt pkg args in let mk_section_args_fun l = List.map (fun (nm, f) -> nm, (fun pkg sct args -> f ~ctxt:!rctxt pkg sct args)) l in { BaseSetup. configure = mk_std_args_fun setup_t.O.configure; build = mk_std_args_fun setup_t.O.build; doc = mk_section_args_fun setup_t.O.doc; test = mk_section_args_fun setup_t.O.test; install = mk_std_args_fun setup_t.O.install; uninstall = mk_std_args_fun setup_t.O.uninstall; clean = List.map mk_std_args_fun setup_t.O.clean; clean_doc = mk_section_args_fun setup_t.O.clean_doc; clean_test = mk_section_args_fun setup_t.O.clean_test; distclean = List.map mk_std_args_fun setup_t.O.distclean; distclean_doc = mk_section_args_fun setup_t.O.distclean_doc; distclean_test = mk_section_args_fun setup_t.O.distclean_test; package = setup_t.O.package; oasis_fn = setup_t.O.oasis_fn; oasis_version = setup_t.O.oasis_version; oasis_digest = setup_t.O.oasis_digest; oasis_exec = setup_t.O.oasis_exec; oasis_setup_args = setup_t.O.oasis_setup_args; setup_update = setup_t.O.setup_update; } end module Compat_0_3 = struct include Compat_0_4 end end # 5662 "setup.ml" module InternalConfigurePlugin = struct # 22 "src/plugins/internal/InternalConfigurePlugin.ml" (** Configure using internal scheme @author Sylvain Le Gall *) open BaseEnv open OASISTypes open OASISUtils open OASISGettext open BaseMessage (** Configure build using provided series of check to be done and then output corresponding file. *) let configure ~ctxt:_ pkg argv = let var_ignore_eval var = let _s: string = var () in () in let errors = ref SetString.empty in let buff = Buffer.create 13 in let add_errors fmt = Printf.kbprintf (fun b -> errors := SetString.add (Buffer.contents b) !errors; Buffer.clear b) buff fmt in let warn_exception e = warning "%s" (Printexc.to_string e) in (* Check tools *) let check_tools lst = List.iter (function | ExternalTool tool -> begin try var_ignore_eval (BaseCheck.prog tool) with e -> warn_exception e; add_errors (f_ "Cannot find external tool '%s'") tool end | InternalExecutable nm1 -> (* Check that matching tool is built *) List.iter (function | Executable ({cs_name = nm2; _}, {bs_build = build; _}, _) when nm1 = nm2 -> if not (var_choose build) then add_errors (f_ "Cannot find buildable internal executable \ '%s' when checking build depends") nm1 | _ -> ()) pkg.sections) lst in let build_checks sct bs = if var_choose bs.bs_build then begin if bs.bs_compiled_object = Native then begin try var_ignore_eval BaseStandardVar.ocamlopt with e -> warn_exception e; add_errors (f_ "Section %s requires native compilation") (OASISSection.string_of_section sct) end; (* Check tools *) check_tools bs.bs_build_tools; (* Check depends *) List.iter (function | FindlibPackage (findlib_pkg, version_comparator) -> begin try var_ignore_eval (BaseCheck.package ?version_comparator findlib_pkg) with e -> warn_exception e; match version_comparator with | None -> add_errors (f_ "Cannot find findlib package %s") findlib_pkg | Some ver_cmp -> add_errors (f_ "Cannot find findlib package %s (%s)") findlib_pkg (OASISVersion.string_of_comparator ver_cmp) end | InternalLibrary nm1 -> (* Check that matching library is built *) List.iter (function | Library ({cs_name = nm2; _}, {bs_build = build; _}, _) when nm1 = nm2 -> if not (var_choose build) then add_errors (f_ "Cannot find buildable internal library \ '%s' when checking build depends") nm1 | _ -> ()) pkg.sections) bs.bs_build_depends end in (* Parse command line *) BaseArgExt.parse argv (BaseEnv.args ()); (* OCaml version *) begin match pkg.ocaml_version with | Some ver_cmp -> begin try var_ignore_eval (BaseCheck.version "ocaml" ver_cmp BaseStandardVar.ocaml_version) with e -> warn_exception e; add_errors (f_ "OCaml version %s doesn't match version constraint %s") (BaseStandardVar.ocaml_version ()) (OASISVersion.string_of_comparator ver_cmp) end | None -> () end; (* Findlib version *) begin match pkg.findlib_version with | Some ver_cmp -> begin try var_ignore_eval (BaseCheck.version "findlib" ver_cmp BaseStandardVar.findlib_version) with e -> warn_exception e; add_errors (f_ "Findlib version %s doesn't match version constraint %s") (BaseStandardVar.findlib_version ()) (OASISVersion.string_of_comparator ver_cmp) end | None -> () end; (* Make sure the findlib version is fine for the OCaml compiler. *) begin let ocaml_ge4 = OASISVersion.version_compare (OASISVersion.version_of_string (BaseStandardVar.ocaml_version ())) (OASISVersion.version_of_string "4.0.0") >= 0 in if ocaml_ge4 then let findlib_lt132 = OASISVersion.version_compare (OASISVersion.version_of_string (BaseStandardVar.findlib_version())) (OASISVersion.version_of_string "1.3.2") < 0 in if findlib_lt132 then add_errors "OCaml >= 4.0.0 requires Findlib version >= 1.3.2" end; (* FlexDLL *) if BaseStandardVar.os_type () = "Win32" || BaseStandardVar.os_type () = "Cygwin" then begin try var_ignore_eval BaseStandardVar.flexlink with e -> warn_exception e; add_errors (f_ "Cannot find 'flexlink'") end; (* Check build depends *) List.iter (function | Executable (_, bs, _) | Library (_, bs, _) as sct -> build_checks sct bs | Doc (_, doc) -> if var_choose doc.doc_build then check_tools doc.doc_build_tools | Test (_, test) -> if var_choose test.test_run then check_tools test.test_tools | _ -> ()) pkg.sections; (* Check if we need native dynlink (presence of libraries that compile to native) *) begin let has_cmxa = List.exists (function | Library (_, bs, _) -> var_choose bs.bs_build && (bs.bs_compiled_object = Native || (bs.bs_compiled_object = Best && bool_of_string (BaseStandardVar.is_native ()))) | _ -> false) pkg.sections in if has_cmxa then var_ignore_eval BaseStandardVar.native_dynlink end; (* Check errors *) if SetString.empty != !errors then begin List.iter (fun e -> error "%s" e) (SetString.elements !errors); failwithf (fn_ "%d configuration error" "%d configuration errors" (SetString.cardinal !errors)) (SetString.cardinal !errors) end end module InternalInstallPlugin = struct # 22 "src/plugins/internal/InternalInstallPlugin.ml" (** Install using internal scheme @author Sylvain Le Gall *) (* TODO: rewrite this module with OASISFileSystem. *) open BaseEnv open BaseStandardVar open BaseMessage open OASISTypes open OASISFindlib open OASISGettext open OASISUtils let exec_hook = ref (fun (cs, bs, exec) -> cs, bs, exec) let lib_hook = ref (fun (cs, bs, dn, lib) -> cs, bs, dn, lib, []) let obj_hook = ref (fun (cs, bs, dn, obj) -> cs, bs, dn, obj, []) let doc_hook = ref (fun (cs, doc) -> cs, doc) let install_file_ev = "install-file" let install_dir_ev = "install-dir" let install_findlib_ev = "install-findlib" (* TODO: this can be more generic and used elsewhere. *) let win32_max_command_line_length = 8000 let split_install_command ocamlfind findlib_name meta files = if Sys.os_type = "Win32" then (* Arguments for the first command: *) let first_args = ["install"; findlib_name; meta] in (* Arguments for remaining commands: *) let other_args = ["install"; findlib_name; "-add"] in (* Extract as much files as possible from [files], [len] is the current command line length: *) let rec get_files len acc files = match files with | [] -> (List.rev acc, []) | file :: rest -> let len = len + 1 + String.length file in if len > win32_max_command_line_length then (List.rev acc, files) else get_files len (file :: acc) rest in (* Split the command into several commands. *) let rec split args files = match files with | [] -> [] | _ -> (* Length of "ocamlfind install [META|-add]" *) let len = List.fold_left (fun len arg -> len + 1 (* for the space *) + String.length arg) (String.length ocamlfind) args in match get_files len [] files with | ([], _) -> failwith (s_ "Command line too long.") | (firsts, others) -> let cmd = args @ firsts in (* Use -add for remaining commands: *) let () = let findlib_ge_132 = OASISVersion.comparator_apply (OASISVersion.version_of_string (BaseStandardVar.findlib_version ())) (OASISVersion.VGreaterEqual (OASISVersion.version_of_string "1.3.2")) in if not findlib_ge_132 then failwithf (f_ "Installing the library %s require to use the \ flag '-add' of ocamlfind because the command \ line is too long. This flag is only available \ for findlib 1.3.2. Please upgrade findlib from \ %s to 1.3.2") findlib_name (BaseStandardVar.findlib_version ()) in let cmds = split other_args others in cmd :: cmds in (* The first command does not use -add: *) split first_args files else ["install" :: findlib_name :: meta :: files] let install = let in_destdir fn = try (* Practically speaking destdir is prepended at the beginning of the target filename *) (destdir ())^fn with PropList.Not_set _ -> fn in let install_file ~ctxt ?(prepend_destdir=true) ?tgt_fn src_file envdir = let tgt_dir = if prepend_destdir then in_destdir (envdir ()) else envdir () in let tgt_file = Filename.concat tgt_dir (match tgt_fn with | Some fn -> fn | None -> Filename.basename src_file) in (* Create target directory if needed *) OASISFileUtil.mkdir_parent ~ctxt (fun dn -> info (f_ "Creating directory '%s'") dn; BaseLog.register ~ctxt install_dir_ev dn) (Filename.dirname tgt_file); (* Really install files *) info (f_ "Copying file '%s' to '%s'") src_file tgt_file; OASISFileUtil.cp ~ctxt src_file tgt_file; BaseLog.register ~ctxt install_file_ev tgt_file in (* Install the files for a library. *) let install_lib_files ~ctxt findlib_name files = let findlib_dir = let dn = let findlib_destdir = OASISExec.run_read_one_line ~ctxt (ocamlfind ()) ["printconf" ; "destdir"] in Filename.concat findlib_destdir findlib_name in fun () -> dn in let () = if not (OASISFileUtil.file_exists_case (findlib_dir ())) then failwithf (f_ "Directory '%s' doesn't exist for findlib library %s") (findlib_dir ()) findlib_name in let f dir file = let basename = Filename.basename file in let tgt_fn = Filename.concat dir basename in (* Destdir is already include in printconf. *) install_file ~ctxt ~prepend_destdir:false ~tgt_fn file findlib_dir in List.iter (fun (dir, files) -> List.iter (f dir) files) files ; in (* Install data into defined directory *) let install_data ~ctxt srcdir lst tgtdir = let tgtdir = OASISHostPath.of_unix (var_expand tgtdir) in List.iter (fun (src, tgt_opt) -> let real_srcs = OASISFileUtil.glob ~ctxt:!BaseContext.default (Filename.concat srcdir src) in if real_srcs = [] then failwithf (f_ "Wildcard '%s' doesn't match any files") src; List.iter (fun fn -> install_file ~ctxt fn (fun () -> match tgt_opt with | Some s -> OASISHostPath.of_unix (var_expand s) | None -> tgtdir)) real_srcs) lst in let make_fnames modul sufx = List.fold_right begin fun sufx accu -> (OASISString.capitalize_ascii modul ^ sufx) :: (OASISString.uncapitalize_ascii modul ^ sufx) :: accu end sufx [] in (** Install all libraries *) let install_libs ~ctxt pkg = let find_first_existing_files_in_path bs lst = let path = OASISHostPath.of_unix bs.bs_path in List.find OASISFileUtil.file_exists_case (List.map (Filename.concat path) lst) in let files_of_modules new_files typ cs bs modules = List.fold_left (fun acc modul -> begin try (* Add uncompiled header from the source tree *) [find_first_existing_files_in_path bs (make_fnames modul [".mli"; ".ml"])] with Not_found -> warning (f_ "Cannot find source header for module %s \ in %s %s") typ modul cs.cs_name; [] end @ List.fold_left (fun acc fn -> try find_first_existing_files_in_path bs [fn] :: acc with Not_found -> acc) acc (make_fnames modul [".annot";".cmti";".cmt"])) new_files modules in let files_of_build_section (f_data, new_files) typ cs bs = let extra_files = List.map (fun fn -> try find_first_existing_files_in_path bs [fn] with Not_found -> failwithf (f_ "Cannot find extra findlib file %S in %s %s ") fn typ cs.cs_name) bs.bs_findlib_extra_files in let f_data () = (* Install data associated with the library *) install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name); f_data () in f_data, new_files @ extra_files in let files_of_library (f_data, acc) data_lib = let cs, bs, lib, dn, lib_extra = !lib_hook data_lib in if var_choose bs.bs_install && BaseBuilt.is_built ~ctxt BaseBuilt.BLib cs.cs_name then begin (* Start with lib_extra *) let new_files = lib_extra in let new_files = files_of_modules new_files "library" cs bs lib.lib_modules in let f_data, new_files = files_of_build_section (f_data, new_files) "library" cs bs in let new_files = (* Get generated files *) BaseBuilt.fold ~ctxt BaseBuilt.BLib cs.cs_name (fun acc fn -> fn :: acc) new_files in let acc = (dn, new_files) :: acc in let f_data () = (* Install data associated with the library *) install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name); f_data () in (f_data, acc) end else begin (f_data, acc) end and files_of_object (f_data, acc) data_obj = let cs, bs, obj, dn, obj_extra = !obj_hook data_obj in if var_choose bs.bs_install && BaseBuilt.is_built ~ctxt BaseBuilt.BObj cs.cs_name then begin (* Start with obj_extra *) let new_files = obj_extra in let new_files = files_of_modules new_files "object" cs bs obj.obj_modules in let f_data, new_files = files_of_build_section (f_data, new_files) "object" cs bs in let new_files = (* Get generated files *) BaseBuilt.fold ~ctxt BaseBuilt.BObj cs.cs_name (fun acc fn -> fn :: acc) new_files in let acc = (dn, new_files) :: acc in let f_data () = (* Install data associated with the object *) install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name); f_data () in (f_data, acc) end else begin (f_data, acc) end in (* Install one group of library *) let install_group_lib grp = (* Iterate through all group nodes *) let rec install_group_lib_aux data_and_files grp = let data_and_files, children = match grp with | Container (_, children) -> data_and_files, children | Package (_, cs, bs, `Library lib, dn, children) -> files_of_library data_and_files (cs, bs, lib, dn), children | Package (_, cs, bs, `Object obj, dn, children) -> files_of_object data_and_files (cs, bs, obj, dn), children in List.fold_left install_group_lib_aux data_and_files children in (* Findlib name of the root library *) let findlib_name = findlib_of_group grp in (* Determine root library *) let root_lib = root_of_group grp in (* All files to install for this library *) let f_data, files = install_group_lib_aux (ignore, []) grp in (* Really install, if there is something to install *) if files = [] then begin warning (f_ "Nothing to install for findlib library '%s'") findlib_name end else begin let meta = (* Search META file *) let _, bs, _ = root_lib in let res = Filename.concat bs.bs_path "META" in if not (OASISFileUtil.file_exists_case res) then failwithf (f_ "Cannot find file '%s' for findlib library %s") res findlib_name; res in let files = (* Make filename shorter to avoid hitting command max line length * too early, esp. on Windows. *) (* TODO: move to OASISHostPath as make_relative. *) let remove_prefix p n = let plen = String.length p in let nlen = String.length n in if plen <= nlen && String.sub n 0 plen = p then begin let fn_sep = if Sys.os_type = "Win32" then '\\' else '/' in let cutpoint = plen + (if plen < nlen && n.[plen] = fn_sep then 1 else 0) in String.sub n cutpoint (nlen - cutpoint) end else begin n end in List.map (fun (dir, fn) -> (dir, List.map (remove_prefix (Sys.getcwd ())) fn)) files in let ocamlfind = ocamlfind () in let nodir_files, dir_files = List.fold_left (fun (nodir, dir) (dn, lst) -> match dn with | Some dn -> nodir, (dn, lst) :: dir | None -> lst @ nodir, dir) ([], []) (List.rev files) in info (f_ "Installing findlib library '%s'") findlib_name; List.iter (OASISExec.run ~ctxt ocamlfind) (split_install_command ocamlfind findlib_name meta nodir_files); install_lib_files ~ctxt findlib_name dir_files; BaseLog.register ~ctxt install_findlib_ev findlib_name end; (* Install data files *) f_data (); in let group_libs, _, _ = findlib_mapping pkg in (* We install libraries in groups *) List.iter install_group_lib group_libs in let install_execs ~ctxt pkg = let install_exec data_exec = let cs, bs, _ = !exec_hook data_exec in if var_choose bs.bs_install && BaseBuilt.is_built ~ctxt BaseBuilt.BExec cs.cs_name then begin let exec_libdir () = Filename.concat (libdir ()) pkg.name in BaseBuilt.fold ~ctxt BaseBuilt.BExec cs.cs_name (fun () fn -> install_file ~ctxt ~tgt_fn:(cs.cs_name ^ ext_program ()) fn bindir) (); BaseBuilt.fold ~ctxt BaseBuilt.BExecLib cs.cs_name (fun () fn -> install_file ~ctxt fn exec_libdir) (); install_data ~ctxt bs.bs_path bs.bs_data_files (Filename.concat (datarootdir ()) pkg.name) end in List.iter (function | Executable (cs, bs, exec)-> install_exec (cs, bs, exec) | _ -> ()) pkg.sections in let install_docs ~ctxt pkg = let install_doc data = let cs, doc = !doc_hook data in if var_choose doc.doc_install && BaseBuilt.is_built ~ctxt BaseBuilt.BDoc cs.cs_name then begin let tgt_dir = OASISHostPath.of_unix (var_expand doc.doc_install_dir) in BaseBuilt.fold ~ctxt BaseBuilt.BDoc cs.cs_name (fun () fn -> install_file ~ctxt fn (fun () -> tgt_dir)) (); install_data ~ctxt Filename.current_dir_name doc.doc_data_files doc.doc_install_dir end in List.iter (function | Doc (cs, doc) -> install_doc (cs, doc) | _ -> ()) pkg.sections in fun ~ctxt pkg _ -> install_libs ~ctxt pkg; install_execs ~ctxt pkg; install_docs ~ctxt pkg (* Uninstall already installed data *) let uninstall ~ctxt _ _ = let uninstall_aux (ev, data) = if ev = install_file_ev then begin if OASISFileUtil.file_exists_case data then begin info (f_ "Removing file '%s'") data; Sys.remove data end else begin warning (f_ "File '%s' doesn't exist anymore") data end end else if ev = install_dir_ev then begin if Sys.file_exists data && Sys.is_directory data then begin if Sys.readdir data = [||] then begin info (f_ "Removing directory '%s'") data; OASISFileUtil.rmdir ~ctxt data end else begin warning (f_ "Directory '%s' is not empty (%s)") data (String.concat ", " (Array.to_list (Sys.readdir data))) end end else begin warning (f_ "Directory '%s' doesn't exist anymore") data end end else if ev = install_findlib_ev then begin info (f_ "Removing findlib library '%s'") data; OASISExec.run ~ctxt (ocamlfind ()) ["remove"; data] end else begin failwithf (f_ "Unknown log event '%s'") ev; end; BaseLog.unregister ~ctxt ev data in (* We process event in reverse order *) List.iter uninstall_aux (List.rev (BaseLog.filter ~ctxt [install_file_ev; install_dir_ev])); List.iter uninstall_aux (List.rev (BaseLog.filter ~ctxt [install_findlib_ev])) end # 6465 "setup.ml" module OCamlbuildCommon = struct # 22 "src/plugins/ocamlbuild/OCamlbuildCommon.ml" (** Functions common to OCamlbuild build and doc plugin *) open OASISGettext open BaseEnv open BaseStandardVar open OASISTypes type args = { plugin_tags: string option; extra: string list; } let ocamlbuild_clean_ev = "ocamlbuild-clean" let ocamlbuildflags = var_define ~short_desc:(fun () -> "OCamlbuild additional flags") "ocamlbuildflags" (fun () -> "") (** Fix special arguments depending on environment *) let fix_args args extra_argv = List.flatten [ if (os_type ()) = "Win32" then [ "-classic-display"; "-no-log"; "-no-links"; ] else []; if OASISVersion.comparator_apply (OASISVersion.version_of_string (ocaml_version ())) (OASISVersion.VLesser (OASISVersion.version_of_string "3.11.1")) then [ "-install-lib-dir"; (Filename.concat (standard_library ()) "ocamlbuild") ] else []; if not (bool_of_string (is_native ())) || (os_type ()) = "Win32" then [ "-byte-plugin" ] else []; args.extra; begin match args.plugin_tags with | Some t -> ["-plugin-tag"; Filename.quote t] | None -> [] end; if bool_of_string (debug ()) then ["-tag"; "debug"] else []; if bool_of_string (tests ()) then ["-tag"; "tests"] else []; if bool_of_string (profile ()) then ["-tag"; "profile"] else []; OASISString.nsplit (ocamlbuildflags ()) ' '; Array.to_list extra_argv; ] (** Run 'ocamlbuild -clean' if not already done *) let run_clean ~ctxt extra_argv = let extra_cli = String.concat " " (Array.to_list extra_argv) in (* Run if never called with these args *) if not (BaseLog.exists ~ctxt ocamlbuild_clean_ev extra_cli) then begin OASISExec.run ~ctxt (ocamlbuild ()) (fix_args {extra = ["-clean"]; plugin_tags = None} extra_argv); BaseLog.register ~ctxt ocamlbuild_clean_ev extra_cli; at_exit (fun () -> try BaseLog.unregister ~ctxt ocamlbuild_clean_ev extra_cli with _ -> ()) end (** Run ocamlbuild, unregister all clean events *) let run_ocamlbuild ~ctxt args extra_argv = (* TODO: enforce that target in args must be UNIX encoded i.e. toto/index.html *) OASISExec.run ~ctxt (ocamlbuild ()) (fix_args args extra_argv); (* Remove any clean event, we must run it again *) List.iter (fun (e, d) -> BaseLog.unregister ~ctxt e d) (BaseLog.filter ~ctxt [ocamlbuild_clean_ev]) (** Determine real build directory *) let build_dir extra_argv = let rec search_args dir = function | "-build-dir" :: dir :: tl -> search_args dir tl | _ :: tl -> search_args dir tl | [] -> dir in search_args "_build" (fix_args {extra = []; plugin_tags = None} extra_argv) end module OCamlbuildPlugin = struct # 22 "src/plugins/ocamlbuild/OCamlbuildPlugin.ml" (** Build using ocamlbuild @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OASISUtils open OASISString open BaseEnv open OCamlbuildCommon open BaseStandardVar let cond_targets_hook = ref (fun lst -> lst) let build ~ctxt args pkg argv = (* Return the filename in build directory *) let in_build_dir fn = Filename.concat (build_dir argv) fn in (* Return the unix filename in host build directory *) let in_build_dir_of_unix fn = in_build_dir (OASISHostPath.of_unix fn) in let cond_targets = List.fold_left (fun acc -> function | Library (cs, bs, lib) when var_choose bs.bs_build -> begin let evs, unix_files = BaseBuilt.of_library in_build_dir_of_unix (cs, bs, lib) in let tgts = List.flatten (List.filter (fun l -> l <> []) (List.map (List.filter (fun fn -> ends_with ~what:".cma" fn || ends_with ~what:".cmxs" fn || ends_with ~what:".cmxa" fn || ends_with ~what:(ext_lib ()) fn || ends_with ~what:(ext_dll ()) fn)) unix_files)) in match tgts with | _ :: _ -> (evs, tgts) :: acc | [] -> failwithf (f_ "No possible ocamlbuild targets for library %s") cs.cs_name end | Object (cs, bs, obj) when var_choose bs.bs_build -> begin let evs, unix_files = BaseBuilt.of_object in_build_dir_of_unix (cs, bs, obj) in let tgts = List.flatten (List.filter (fun l -> l <> []) (List.map (List.filter (fun fn -> ends_with ~what:".cmo" fn || ends_with ~what:".cmx" fn)) unix_files)) in match tgts with | _ :: _ -> (evs, tgts) :: acc | [] -> failwithf (f_ "No possible ocamlbuild targets for object %s") cs.cs_name end | Executable (cs, bs, exec) when var_choose bs.bs_build -> begin let evs, _, _ = BaseBuilt.of_executable in_build_dir_of_unix (cs, bs, exec) in let target ext = let unix_tgt = (OASISUnixPath.concat bs.bs_path (OASISUnixPath.chop_extension exec.exec_main_is))^ext in let evs = (* Fix evs, we want to use the unix_tgt, without copying *) List.map (function | BaseBuilt.BExec, nm, _ when nm = cs.cs_name -> BaseBuilt.BExec, nm, [[in_build_dir_of_unix unix_tgt]] | ev -> ev) evs in evs, [unix_tgt] in (* Add executable *) let acc = match bs.bs_compiled_object with | Native -> (target ".native") :: acc | Best when bool_of_string (is_native ()) -> (target ".native") :: acc | Byte | Best -> (target ".byte") :: acc in acc end | Library _ | Object _ | Executable _ | Test _ | SrcRepo _ | Flag _ | Doc _ -> acc) [] (* Keep the pkg.sections ordered *) (List.rev pkg.sections); in (* Check and register built files *) let check_and_register (bt, bnm, lst) = List.iter (fun fns -> if not (List.exists OASISFileUtil.file_exists_case fns) then failwithf (fn_ "Expected built file %s doesn't exist." "None of expected built files %s exists." (List.length fns)) (String.concat (s_ " or ") (List.map (Printf.sprintf "'%s'") fns))) lst; (BaseBuilt.register ~ctxt bt bnm lst) in (* Run the hook *) let cond_targets = !cond_targets_hook cond_targets in (* Run a list of target... *) run_ocamlbuild ~ctxt {args with extra = List.flatten (List.map snd cond_targets) @ args.extra} argv; (* ... and register events *) List.iter check_and_register (List.flatten (List.map fst cond_targets)) let clean ~ctxt pkg args = run_clean ~ctxt args; List.iter (function | Library (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister ~ctxt BaseBuilt.BExecLib cs.cs_name | _ -> ()) pkg.sections end module OCamlbuildDocPlugin = struct # 22 "src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml" (* Create documentation using ocamlbuild .odocl files @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OCamlbuildCommon type run_t = { args: args; run_path: unix_filename; } let doc_build ~ctxt run _ (cs, _) argv = let index_html = OASISUnixPath.make [ run.run_path; cs.cs_name^".docdir"; "index.html"; ] in let tgt_dir = OASISHostPath.make [ build_dir argv; OASISHostPath.of_unix run.run_path; cs.cs_name^".docdir"; ] in run_ocamlbuild ~ctxt {run.args with extra = index_html :: run.args.extra} argv; List.iter (fun glb -> match OASISFileUtil.glob ~ctxt (Filename.concat tgt_dir glb) with | (_ :: _) as filenames -> BaseBuilt.register ~ctxt BaseBuilt.BDoc cs.cs_name [filenames] | [] -> ()) ["*.html"; "*.css"] let doc_clean ~ctxt _ _ (cs, _) argv = run_clean ~ctxt argv; BaseBuilt.unregister ~ctxt BaseBuilt.BDoc cs.cs_name end # 6851 "setup.ml" module CustomPlugin = struct # 22 "src/plugins/custom/CustomPlugin.ml" (** Generate custom configure/build/doc/test/install system @author *) open BaseEnv open OASISGettext open OASISTypes type t = { cmd_main: command_line conditional; cmd_clean: (command_line option) conditional; cmd_distclean: (command_line option) conditional; } let run = BaseCustom.run let main ~ctxt:_ t _ extra_args = let cmd, args = var_choose ~name:(s_ "main command") t.cmd_main in run cmd args extra_args let clean ~ctxt:_ t _ extra_args = match var_choose t.cmd_clean with | Some (cmd, args) -> run cmd args extra_args | _ -> () let distclean ~ctxt:_ t _ extra_args = match var_choose t.cmd_distclean with | Some (cmd, args) -> run cmd args extra_args | _ -> () module Build = struct let main ~ctxt t pkg extra_args = main ~ctxt t pkg extra_args; List.iter (fun sct -> let evs = match sct with | Library (cs, bs, lib) when var_choose bs.bs_build -> begin let evs, _ = BaseBuilt.of_library OASISHostPath.of_unix (cs, bs, lib) in evs end | Executable (cs, bs, exec) when var_choose bs.bs_build -> begin let evs, _, _ = BaseBuilt.of_executable OASISHostPath.of_unix (cs, bs, exec) in evs end | _ -> [] in List.iter (fun (bt, bnm, lst) -> BaseBuilt.register ~ctxt bt bnm lst) evs) pkg.sections let clean ~ctxt t pkg extra_args = clean ~ctxt t pkg extra_args; (* TODO: this seems to be pretty generic (at least wrt to ocamlbuild * considering moving this to BaseSetup? *) List.iter (function | Library (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister ~ctxt BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister ~ctxt BaseBuilt.BExecLib cs.cs_name | _ -> ()) pkg.sections let distclean ~ctxt t pkg extra_args = distclean ~ctxt t pkg extra_args end module Test = struct let main ~ctxt t pkg (cs, _) extra_args = try main ~ctxt t pkg extra_args; 0.0 with Failure s -> BaseMessage.warning (f_ "Test '%s' fails: %s") cs.cs_name s; 1.0 let clean ~ctxt t pkg _ extra_args = clean ~ctxt t pkg extra_args let distclean ~ctxt t pkg _ extra_args = distclean ~ctxt t pkg extra_args end module Doc = struct let main ~ctxt t pkg (cs, _) extra_args = main ~ctxt t pkg extra_args; BaseBuilt.register ~ctxt BaseBuilt.BDoc cs.cs_name [] let clean ~ctxt t pkg (cs, _) extra_args = clean ~ctxt t pkg extra_args; BaseBuilt.unregister ~ctxt BaseBuilt.BDoc cs.cs_name let distclean ~ctxt t pkg _ extra_args = distclean ~ctxt t pkg extra_args end end # 6983 "setup.ml" open OASISTypes;; let setup_t = { BaseSetup.configure = InternalConfigurePlugin.configure; build = OCamlbuildPlugin.build {OCamlbuildCommon.plugin_tags = None; extra = ["-use-ocamlfind"]}; test = [ ("devel", CustomPlugin.Test.main { CustomPlugin.cmd_main = [(OASISExpr.EBool true, ("$test_devel", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("quickstart", CustomPlugin.Test.main { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_quickstart", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("omake", CustomPlugin.Test.main { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_omake", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("main", CustomPlugin.Test.main { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_main", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("main_loader", CustomPlugin.Test.main { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_loader", ["-pluginloader"; "$pluginloader"])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; doc = [ ("manual", CustomPlugin.Doc.main { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$oasis", [ "-ignore-plugins"; "manual"; "-o"; "doc/MANUAL.mkd" ])) ]; cmd_clean = [ (OASISExpr.EBool true, Some (("$rm", ["doc/MANUAL.mkd"]))) ]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("api-oasis", OCamlbuildDocPlugin.doc_build { OCamlbuildDocPlugin.args = { OCamlbuildCommon.plugin_tags = None; extra = ["-use-ocamlfind"] }; run_path = "src/" }) ]; install = InternalInstallPlugin.install; uninstall = InternalInstallPlugin.uninstall; clean = [OCamlbuildPlugin.clean]; clean_test = [ ("devel", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [(OASISExpr.EBool true, ("$test_devel", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("quickstart", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_quickstart", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("omake", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_omake", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("main", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_main", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("main_loader", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_loader", ["-pluginloader"; "$pluginloader"])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; clean_doc = [ ("manual", CustomPlugin.Doc.clean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$oasis", [ "-ignore-plugins"; "manual"; "-o"; "doc/MANUAL.mkd" ])) ]; cmd_clean = [ (OASISExpr.EBool true, Some (("$rm", ["doc/MANUAL.mkd"]))) ]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("api-oasis", OCamlbuildDocPlugin.doc_clean { OCamlbuildDocPlugin.args = { OCamlbuildCommon.plugin_tags = None; extra = ["-use-ocamlfind"] }; run_path = "src/" }) ]; distclean = []; distclean_test = [ ("devel", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [(OASISExpr.EBool true, ("$test_devel", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("quickstart", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_quickstart", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("omake", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_omake", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("main", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_main", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }); ("main_loader", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test_loader", ["-pluginloader"; "$pluginloader"])) ]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; distclean_doc = [ ("manual", CustomPlugin.Doc.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$oasis", [ "-ignore-plugins"; "manual"; "-o"; "doc/MANUAL.mkd" ])) ]; cmd_clean = [ (OASISExpr.EBool true, Some (("$rm", ["doc/MANUAL.mkd"]))) ]; cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; package = { oasis_version = "0.4"; ocaml_version = Some (OASISVersion.VGreaterEqual "3.12.1"); version = "0.4.11"; license = OASISLicense.DEP5License (OASISLicense.DEP5Unit { OASISLicense.license = "LGPL"; excption = Some "OCaml linking"; version = OASISLicense.Version "2.1" }); findlib_version = Some (OASISVersion.VGreaterEqual "1.3.1"); alpha_features = ["source_patterns"; "stdfiles_markdown"]; beta_features = []; name = "oasis"; license_file = Some "COPYING.txt"; copyrights = ["(C) 2011-2016 Sylvain Le Gall\n(C) 2008-2010 OCamlCore SARL"]; maintainers = ["Sylvain Le Gall "]; authors = ["Sylvain Le Gall"]; homepage = Some "http://oasis.forge.ocamlcore.org/"; bugreports = Some "https://github.com/ocaml/oasis/issues"; synopsis = "Tooling for building OCaml libraries and applications"; description = Some [ OASISText.Para "OASIS generates a full configure, build and install system for your application. It starts with a simple `_oasis` file at the toplevel of your project and creates everything required."; OASISText.Para "OASIS leverages existing OCaml tooling to perform most of it's work. In fact, it might be more appropriate to think of it as simply the glue that binds these other subsystems together and coordinates the work that they do. It should support the following tools:"; OASISText.BlankLine; OASISText.Verbatim "* OCamlbuild"; OASISText.Verbatim "* OMake"; OASISText.Verbatim "* OCamlMakefile (todo),"; OASISText.Verbatim "* ocaml-autoconf (todo)"; OASISText.BlankLine; OASISText.Para "It also features a do-it-yourself command line invocation and an internal configure/install scheme. Libraries are managed through findlib. It has been tested on GNU Linux and Windows."; OASISText.Para "It also allows to have standard entry points and description. It helps to integrates your libraries and software with third parties tools like OPAM." ]; tags = []; categories = []; files_ab = ["src/oasis/OASISConf.ml.ab"]; sections = [ Flag ({ cs_name = "libraries"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { flag_description = Some "Install OASIS and base libraries, for plugins development"; flag_default = [(OASISExpr.EBool true, true)] }); Flag ({ cs_name = "devel"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { flag_description = Some "Build OASIS tools for development"; flag_default = [(OASISExpr.EBool true, false)] }); Flag ({ cs_name = "quickstart_tests"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { flag_description = Some "Build test-quickstart"; flag_default = [(OASISExpr.EBool true, true)] }); Flag ({ cs_name = "omake_tests"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { flag_description = Some "Build test-omake"; flag_default = [(OASISExpr.EBool true, false)] }); Flag ({ cs_name = "devel_tests"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { flag_description = Some "Build test-devel"; flag_default = [(OASISExpr.EBool true, false)] }); Library ({ cs_name = "oasis"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "libraries", true) ]; bs_path = "src/oasis"; bs_compiled_object = Best; bs_build_depends = [FindlibPackage ("unix", None)]; bs_build_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; ExternalTool "ocamlmod"; ExternalTool "ocamlyacc"; ExternalTool "ocamllex"; ExternalTool "ocamlify" ]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = [ "FormatExt"; "PropList"; "OASISUtils"; "OASISUnixPath"; "OASISFileSystem"; "OASISContext"; "OASISSourcePatterns"; "OASISGettext"; "OASISMessage"; "OASISText"; "OASISTypes"; "OASISParse"; "OASISValues"; "OASISExpr"; "OASISVersion"; "OASISLicense"; "OASISFileTemplate"; "OASISBuildSection"; "OASISDocument"; "OASISExecutable"; "OASISFlag"; "OASISSetupUpdate"; "OASISLibrary"; "OASISObject"; "OASISPackage"; "OASISSourceRepository"; "OASISTest"; "OASISPlugin"; "OASISFindlib"; "OASISSchema"; "OASISSection"; "OASISData"; "OASISString"; "OASISExec"; "OASISFileUtil"; "OASISHostPath"; "OASISGraph"; "OASISFeatures"; "OASISDataNotation" ]; lib_pack = false; lib_internal_modules = [ "OASISMutex"; "OASISVersion_types"; "OASISVersion_lexer"; "OASISVersion_parser"; "OASISLicense_types"; "OASISLicense_lexer"; "OASISLicense_parser"; "OASISValues_lexer"; "OASISConf"; "OASISAst_types"; "OASISAst_lexer"; "OASISAst_parser"; "OASISAst"; "OASISCheck"; "OASISCustom"; "OASISQuickstart"; "OASISHelp"; "OASISFormat"; "OASISSection_intern"; "OASISBuildSection_intern"; "OASISDocument_intern"; "OASISExecutable_intern"; "OASISFlag_intern"; "OASISLibrary_intern"; "OASISObject_intern"; "OASISPackage_intern"; "OASISSourceRepository_intern"; "OASISTest_intern"; "OASISSchema_intern"; "OASISPath_intern" ]; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Library ({ cs_name = "base"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "libraries", true) ]; bs_path = "src/base"; bs_compiled_object = Best; bs_build_depends = [InternalLibrary "oasis"]; bs_build_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; ExternalTool "ocamlmod"; ExternalTool "ocamlify" ]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = [ "BaseArgExt"; "BaseBuilt"; "BaseCheck"; "BaseCustom"; "BaseData"; "BaseDoc"; "BaseEnvLight"; "BaseEnv"; "BaseFileAB"; "BaseGenerate"; "BaseLog"; "BaseOCamlcConfig"; "BaseSetup"; "BaseStandardVar"; "BaseTest"; "BaseDynVar"; "BaseMessage"; "BaseContext"; "BaseCompat" ]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = Some "oasis"; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Library ({ cs_name = "builtin-plugins"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [(OASISExpr.EBool true, true)]; bs_path = "src"; bs_compiled_object = Best; bs_build_depends = [ InternalLibrary "oasis"; InternalLibrary "base"; FindlibPackage ("ocamlbuild", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = [ "OASISBuiltinPlugins"; "plugins/extra/META/METAPlugin"; "plugins/internal/InternalConfigurePlugin"; "plugins/internal/InternalInstallPlugin"; "plugins/none/NonePlugin"; "plugins/ocamlbuild/OCamlbuildPlugin"; "plugins/ocamlbuild/OCamlbuildDocPlugin"; "plugins/ocamlbuild/OCamlbuildCommon"; "plugins/custom/CustomPlugin"; "plugins/extra/devfiles/DevFilesPlugin"; "plugins/extra/stdfiles/StdFilesPlugin"; "plugins/omake/OMakePlugin" ]; lib_pack = false; lib_internal_modules = [ "plugins/none/NoneData"; "plugins/internal/InternalData"; "plugins/internal/InternalId"; "plugins/ocamlbuild/OCamlbuildData"; "plugins/ocamlbuild/OCamlbuildId"; "plugins/ocamlbuild/MyOCamlbuildBase"; "plugins/ocamlbuild/MyOCamlbuildFindlib"; "plugins/custom/CustomData"; "plugins/extra/META/METAData"; "plugins/extra/devfiles/DevFilesData"; "plugins/extra/stdfiles/StdFilesData"; "plugins/omake/OMakeData"; "plugins/omake/OMakeFields"; "plugins/omake/OMakeEquip"; "plugins/omake/OMakeFormat" ]; lib_findlib_parent = Some "oasis"; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Library ({ cs_name = "dynrun"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [(OASISExpr.EBool true, true)]; bs_path = "src/dynrun"; bs_compiled_object = Best; bs_build_depends = [ InternalLibrary "base"; InternalLibrary "builtin-plugins" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = ["OASISDynRun"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = Some "oasis"; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Doc ({ cs_name = "manual"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { doc_type = (`Doc, "custom", Some "0.4"); doc_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; doc_build = [ (OASISExpr.ENot (OASISExpr.EFlag "docs"), false); (OASISExpr.EFlag "docs", true) ]; doc_install = [(OASISExpr.EBool true, true)]; doc_install_dir = "$docdir"; doc_title = "OASIS User Manual"; doc_authors = []; doc_abstract = None; doc_format = OtherDoc; doc_data_files = [("doc/MANUAL.mkd", None)]; doc_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"] }); Doc ({ cs_name = "api-oasis"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { doc_type = (`Doc, "OCamlbuild", Some "0.4"); doc_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; doc_build = [ (OASISExpr.ENot (OASISExpr.EFlag "docs"), false); (OASISExpr.EFlag "docs", true) ]; doc_install = [(OASISExpr.EBool true, true)]; doc_install_dir = "$htmldir/oasis"; doc_title = "API reference for OASIS"; doc_authors = []; doc_abstract = None; doc_format = OtherDoc; doc_data_files = []; doc_build_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; ExternalTool "ocamldoc" ] }); SrcRepo ({ cs_name = "head"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { src_repo_type = Git; src_repo_location = "git://github.com/ocaml/oasis.git"; src_repo_browser = Some "https://github.com/ocaml/oasis"; src_repo_module = None; src_repo_branch = None; src_repo_tag = None; src_repo_subdir = None }); SrcRepo ({ cs_name = "opam-pin"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { src_repo_type = Git; src_repo_location = "git://github.com/ocaml/oasis.git"; src_repo_browser = None; src_repo_module = None; src_repo_branch = Some "opam/testing"; src_repo_tag = None; src_repo_subdir = None }); Library ({ cs_name = "test-common"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "test/test-common"; bs_compiled_object = Best; bs_build_depends = [ FindlibPackage ("oUnit", Some (OASISVersion.VGreaterEqual "2.0.0")); InternalLibrary "base"; FindlibPackage ("fileutils", None); FindlibPackage ("pcre", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = ["TestCommon"; "TestFullUtils"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Executable ({ cs_name = "fake-ocamlfind"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "test/fake-ocamlfind"; bs_compiled_object = Best; bs_build_depends = [FindlibPackage ("unix", None)]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "FakeOCamlfind.ml"}); Executable ({ cs_name = "test-main"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "test/test-main"; bs_compiled_object = Best; bs_build_depends = [ FindlibPackage ("oUnit", Some (OASISVersion.VGreaterEqual "2.0.0")); FindlibPackage ("findlib", None); FindlibPackage ("fileutils", Some (OASISVersion.VGreaterEqual "0.4.2")); InternalLibrary "oasis"; InternalLibrary "base"; InternalLibrary "builtin-plugins"; InternalLibrary "test-common" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "Test.ml"}); Executable ({ cs_name = "test-omake"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EAnd (OASISExpr.EFlag "tests", OASISExpr.EFlag "omake_tests"), true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "test/test-omake"; bs_compiled_object = Best; bs_build_depends = [ FindlibPackage ("oUnit", Some (OASISVersion.VGreaterEqual "2.0.0")); FindlibPackage ("findlib", None); FindlibPackage ("fileutils", Some (OASISVersion.VGreaterEqual "0.4.2")); InternalLibrary "oasis"; InternalLibrary "base"; InternalLibrary "builtin-plugins"; InternalLibrary "test-common" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "TestOMake.ml"}); Executable ({ cs_name = "test-quickstart"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EAnd (OASISExpr.EFlag "tests", OASISExpr.EFlag "quickstart_tests"), true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "test/test-quickstart"; bs_compiled_object = Best; bs_build_depends = [ FindlibPackage ("oUnit", Some (OASISVersion.VGreaterEqual "2.0.0")); FindlibPackage ("findlib", None); FindlibPackage ("fileutils", Some (OASISVersion.VGreaterEqual "0.4.2")); FindlibPackage ("expect.pcre", Some (OASISVersion.VGreaterEqual "0.0.4")); InternalLibrary "oasis"; InternalLibrary "builtin-plugins"; InternalLibrary "test-common" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "TestQuickstart.ml"}); Executable ({ cs_name = "test-devel"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EAnd (OASISExpr.EFlag "tests", OASISExpr.EFlag "devel_tests"), true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "test/test-devel"; bs_compiled_object = Best; bs_build_depends = [ FindlibPackage ("oUnit", Some (OASISVersion.VGreaterEqual "2.0.0")); InternalLibrary "oasis"; InternalLibrary "test-common" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "TestDevel.ml"}); Executable ({ cs_name = "dist"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "devel", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/tools/dist"; bs_compiled_object = Byte; bs_build_depends = [ FindlibPackage ("unix", None); FindlibPackage ("fileutils", None); InternalLibrary "oasis"; InternalLibrary "builtin-plugins" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "Dist.ml"}); Executable ({ cs_name = "guess-cmx"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "devel", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/tools/guess-cmx"; bs_compiled_object = Byte; bs_build_depends = [ FindlibPackage ("pcre", None); FindlibPackage ("unix", None); InternalLibrary "oasis" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "GuessCMX.ml"}); Executable ({ cs_name = "oasis-announce"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "devel", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/tools/oasis-announce"; bs_compiled_object = Byte; bs_build_depends = [ InternalLibrary "oasis"; InternalLibrary "base"; FindlibPackage ("pcre", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "OASISAnnounce.ml"}); Executable ({ cs_name = "oasis-dist"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "devel", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/tools/oasis-dist"; bs_compiled_object = Byte; bs_build_depends = [ InternalLibrary "oasis"; InternalLibrary "base"; FindlibPackage ("fileutils", None); InternalLibrary "builtin-plugins" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "OASISDist.ml"}); Executable ({ cs_name = "bench"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "devel", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/tools/bench"; bs_compiled_object = Best; bs_build_depends = [ FindlibPackage ("benchmark", Some (OASISVersion.VGreaterEqual "1.2")); InternalLibrary "oasis"; InternalLibrary "base"; InternalLibrary "builtin-plugins" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "Bench.ml"}); Library ({ cs_name = "plugin-loader"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [(OASISExpr.EBool true, true)]; bs_path = "src/ext/plugin-loader/src"; bs_compiled_object = Best; bs_build_depends = [ FindlibPackage ("dynlink", None); FindlibPackage ("findlib", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = ["PluginLoader"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Library ({ cs_name = "cli"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "libraries", true) ]; bs_path = "src/cli"; bs_compiled_object = Byte; bs_build_depends = [ InternalLibrary "oasis"; InternalLibrary "base"; InternalLibrary "plugin-loader" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = [ "CLISubCommand"; "CLIArgExt"; "CLICommon"; "CLIPager" ]; lib_pack = false; lib_internal_modules = ["CLIData"; "CLIPluginsLoaded"; "CLIPluginLoader"]; lib_findlib_parent = Some "oasis"; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Executable ({ cs_name = "oasis"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [(OASISExpr.EBool true, true)]; bs_path = "src/cli"; bs_compiled_object = Best; bs_build_depends = [ InternalLibrary "oasis"; InternalLibrary "base"; InternalLibrary "cli"; InternalLibrary "builtin-plugins" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "Main.ml"}); Test ({ cs_name = "devel"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { test_type = (`Test, "custom", Some "0.4"); test_command = [(OASISExpr.EBool true, ("$test_devel", []))]; test_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; test_working_directory = Some "test"; test_run = [ (OASISExpr.ENot (OASISExpr.EFlag "tests"), false); (OASISExpr.EFlag "tests", false); (OASISExpr.EAnd (OASISExpr.EFlag "tests", OASISExpr.EFlag "devel_tests"), true) ]; test_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; InternalExecutable "oasis"; InternalExecutable "test-devel" ] }); Test ({ cs_name = "quickstart"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { test_type = (`Test, "custom", Some "0.4"); test_command = [ (OASISExpr.EBool true, ("$test_quickstart", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; test_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; test_working_directory = Some "test"; test_run = [ (OASISExpr.ENot (OASISExpr.EFlag "tests"), false); (OASISExpr.EFlag "tests", false); (OASISExpr.EAnd (OASISExpr.EFlag "tests", OASISExpr.EFlag "quickstart_tests"), true) ]; test_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; InternalExecutable "oasis"; InternalExecutable "test-quickstart" ] }); Test ({ cs_name = "omake"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { test_type = (`Test, "custom", Some "0.4"); test_command = [ (OASISExpr.EBool true, ("$test_omake", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; test_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; test_working_directory = Some "test"; test_run = [ (OASISExpr.ENot (OASISExpr.EFlag "tests"), false); (OASISExpr.EFlag "tests", false); (OASISExpr.EAnd (OASISExpr.EFlag "tests", OASISExpr.EFlag "omake_tests"), true) ]; test_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; InternalExecutable "oasis"; InternalExecutable "test-omake"; ExternalTool "ocamlmod"; InternalExecutable "fake-ocamlfind"; ExternalTool "omake"; ExternalTool "camlp4" ] }); Test ({ cs_name = "main"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { test_type = (`Test, "custom", Some "0.4"); test_command = [ (OASISExpr.EBool true, ("$test_main", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "\\\n-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "\\\n-fake-ocamlfind"; "$fake_ocamlfind" ])) ]; test_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; test_working_directory = Some "test"; test_run = [ (OASISExpr.ENot (OASISExpr.EFlag "tests"), false); (OASISExpr.EFlag "tests", true) ]; test_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; InternalExecutable "oasis"; InternalExecutable "test-main"; ExternalTool "ocamlmod"; InternalExecutable "fake-ocamlfind"; ExternalTool "ocamlbuild"; ExternalTool "camlp4" ] }); Library ({ cs_name = "pluginloaderLib"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/ext/plugin-loader/test/data/findlib/pluginloaderLib"; bs_compiled_object = Best; bs_build_depends = []; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = ["PluginloaderLib"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Library ({ cs_name = "plugin1"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/ext/plugin-loader/test/data/findlib/plugin1"; bs_compiled_object = Best; bs_build_depends = [InternalLibrary "pluginloaderLib"]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = ["Plugin1"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Library ({ cs_name = "plugin2"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/ext/plugin-loader/test/data/findlib/plugin2"; bs_compiled_object = Best; bs_build_depends = [ InternalLibrary "pluginloaderLib"; InternalLibrary "plugin1" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = ["Plugin2"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Library ({ cs_name = "plugin3"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/ext/plugin-loader/test/data/findlib/plugin3"; bs_compiled_object = Best; bs_build_depends = [InternalLibrary "pluginloaderLib"]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, { lib_modules = ["Plugin3"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_directory = None; lib_findlib_containers = [] }); Executable ({ cs_name = "pluginloader"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/ext/plugin-loader/test/data"; bs_compiled_object = Byte; bs_build_depends = [ InternalLibrary "pluginloaderLib"; InternalLibrary "plugin-loader" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "PluginLoaderMain.ml" }); Executable ({ cs_name = "test_loader"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [ (OASISExpr.EBool true, false); (OASISExpr.EFlag "tests", true) ]; bs_install = [(OASISExpr.EBool true, false)]; bs_path = "src/ext/plugin-loader/test"; bs_compiled_object = Byte; bs_build_depends = [ InternalLibrary "plugin-loader"; FindlibPackage ("fileutils", None); FindlibPackage ("oUnit", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_interface_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${capitalize_file module}.mli" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mli" ]; origin = "${uncapitalize_file module}.mli" } ]; bs_implementation_patterns = [ { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Ident "module"); OASISSourcePatterns.Templater.Text ".mlify" ]; origin = "${module}.mlify" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${capitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".ml" ]; origin = "${uncapitalize_file module}.ml" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${capitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mll" ]; origin = "${uncapitalize_file module}.mll" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("capitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${capitalize_file module}.mly" }; { OASISSourcePatterns.Templater.atoms = [ OASISSourcePatterns.Templater.Text ""; OASISSourcePatterns.Templater.Expr (OASISSourcePatterns.Templater.Call ("uncapitalize_file", OASISSourcePatterns.Templater.Ident "module")); OASISSourcePatterns.Templater.Text ".mly" ]; origin = "${uncapitalize_file module}.mly" } ]; bs_c_sources = []; bs_data_files = []; bs_findlib_extra_files = []; bs_ccopt = [(OASISExpr.EBool true, [])]; bs_cclib = [(OASISExpr.EBool true, [])]; bs_dlllib = [(OASISExpr.EBool true, [])]; bs_dllpath = [(OASISExpr.EBool true, [])]; bs_byteopt = [(OASISExpr.EBool true, [])]; bs_nativeopt = [(OASISExpr.EBool true, [])] }, {exec_custom = false; exec_main_is = "TestLoader.ml"}); Test ({ cs_name = "main_loader"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { test_type = (`Test, "custom", Some "0.4"); test_command = [ (OASISExpr.EBool true, ("$test_loader", ["-pluginloader"; "$pluginloader"])) ]; test_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; test_working_directory = None; test_run = [ (OASISExpr.ENot (OASISExpr.EFlag "tests"), false); (OASISExpr.EFlag "tests", true) ]; test_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; InternalExecutable "test_loader"; InternalExecutable "pluginloader" ] }) ]; disable_oasis_section = []; conf_type = (`Configure, "internal", Some "0.4"); conf_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; build_type = (`Build, "ocamlbuild", Some "0.4"); build_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; install_type = (`Install, "internal", Some "0.4"); install_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; uninstall_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; clean_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; distclean_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; plugins = [ (`Extra, "DevFiles", Some "0.4"); (`Extra, "StdFiles", Some "0.4"); (`Extra, "META", Some "0.4") ]; schema_data = PropList.Data.create (); plugin_data = [] }; oasis_fn = None; oasis_version = "0.4.11~HEAD"; oasis_digest = None; oasis_exec = None; oasis_setup_args = []; setup_update = false };; let setup () = BaseSetup.setup setup_t;; # 11799 "setup.ml" let setup_t = BaseCompat.Compat_0_4.adapt_setup_t setup_t open BaseCompat.Compat_0_4 (* OASIS_STOP *) #use "deps.ml";; let () = setup ();; oasis-0.4.11/myocamlbuild.ml0000644000175000017500000011053713261073606015263 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open Ocamlbuild_plugin;; open Command;; let depends_from_file env build ?(fmod=fun x -> x) fn = let depends_lst = let deps = ref [] in let fd = open_in fn in begin try while true; do deps := (fmod (input_line fd)) :: !deps done with End_of_file -> close_in fd end; List.rev !deps in List.iter (fun fn -> List.iter (function | Outcome.Good _ -> () | Outcome.Bad exn -> prerr_endline (Printf.sprintf "Could not build '%s': %s" fn (Printexc.to_string exn)); raise exn ) (build [[fn]]) ) depends_lst ;; let ocamlmod_str = "ocamlmod";; let ocamlmod = A ocamlmod_str;; rule "ocamlmod: %.mod -> %.ml" ~prod:"%.ml" ~dep:"%.mod" begin fun env build -> let modfn = env "%.mod" in let dirname = Pathname.dirname modfn in depends_from_file env build ~fmod:(fun fn -> dirname/fn) modfn; Cmd(S[ocamlmod; P(modfn)]) end ;; let ocamlify = A"ocamlify";; rule "ocamlify: %.mlify -> %.mlify.depends" ~prod:"%.mlify.depends" ~dep:"%.mlify" begin fun env _ -> Cmd(S[ocamlify; T(tags_of_pathname (env "%.mlify")++"ocamlify"++"depends"); A"--depends"; A"--output"; P(env "%.mlify.depends"); P(env "%.mlify");]) end ;; rule "ocamlify: %.mlify & %.mlify.depends -> %.ml" ~prod:"%.ml" ~deps:["%.mlify"; "%.mlify.depends"] begin fun env build -> depends_from_file env build (env "%.mlify.depends"); Cmd(S[ocamlify; A"--output"; P(env "%.ml"); P(env "%.mlify")]) end ;; (* OASIS_START *) (* DO NOT EDIT (digest: abd4c3624ec7c742aae7dbd96c89cd14) *) module OASISGettext = struct # 22 "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 OASISString = struct # 22 "src/oasis/OASISString.ml" (** Various string utilities. Mostly inspired by extlib and batteries ExtString and BatString libraries. @author Sylvain Le Gall *) let nsplitf str f = if str = "" then [] else let buf = Buffer.create 13 in let lst = ref [] in let push () = lst := Buffer.contents buf :: !lst; Buffer.clear buf in let str_len = String.length str in for i = 0 to str_len - 1 do if f str.[i] then push () else Buffer.add_char buf str.[i] done; push (); List.rev !lst (** [nsplit c s] Split the string [s] at char [c]. It doesn't include the separator. *) let nsplit str c = nsplitf str ((=) c) let find ~what ?(offset=0) str = let what_idx = ref 0 in let str_idx = ref offset in while !str_idx < String.length str && !what_idx < String.length what do if str.[!str_idx] = what.[!what_idx] then incr what_idx else what_idx := 0; incr str_idx done; if !what_idx <> String.length what then raise Not_found else !str_idx - !what_idx let sub_start str len = let str_len = String.length str in if len >= str_len then "" else String.sub str len (str_len - len) let sub_end ?(offset=0) str len = let str_len = String.length str in if len >= str_len then "" else String.sub str 0 (str_len - len) let starts_with ~what ?(offset=0) str = let what_idx = ref 0 in let str_idx = ref offset in let ok = ref true in while !ok && !str_idx < String.length str && !what_idx < String.length what do if str.[!str_idx] = what.[!what_idx] then incr what_idx else ok := false; incr str_idx done; !what_idx = String.length what let strip_starts_with ~what str = if starts_with ~what str then sub_start str (String.length what) else raise Not_found let ends_with ~what ?(offset=0) str = let what_idx = ref ((String.length what) - 1) in let str_idx = ref ((String.length str) - 1) in let ok = ref true in while !ok && offset <= !str_idx && 0 <= !what_idx do if str.[!str_idx] = what.[!what_idx] then decr what_idx else ok := false; decr str_idx done; !what_idx = -1 let strip_ends_with ~what str = if ends_with ~what str then sub_end str (String.length what) else raise Not_found let replace_chars f s = let buf = Buffer.create (String.length s) in String.iter (fun c -> Buffer.add_char buf (f c)) s; Buffer.contents buf let lowercase_ascii = replace_chars (fun c -> if (c >= 'A' && c <= 'Z') then Char.chr (Char.code c + 32) else c) let uncapitalize_ascii s = if s <> "" then (lowercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1)) else s let uppercase_ascii = replace_chars (fun c -> if (c >= 'a' && c <= 'z') then Char.chr (Char.code c - 32) else c) let capitalize_ascii s = if s <> "" then (uppercase_ascii (String.sub s 0 1)) ^ (String.sub s 1 ((String.length s) - 1)) else s end module OASISUtils = struct # 22 "src/oasis/OASISUtils.ml" open OASISGettext module MapExt = struct module type S = sig include Map.S val add_list: 'a t -> (key * 'a) list -> 'a t val of_list: (key * 'a) list -> 'a t val to_list: 'a t -> (key * 'a) list end module Make (Ord: Map.OrderedType) = struct include Map.Make(Ord) let rec add_list t = function | (k, v) :: tl -> add_list (add k v t) tl | [] -> t let of_list lst = add_list empty lst let to_list t = fold (fun k v acc -> (k, v) :: acc) t [] end end module MapString = MapExt.Make(String) module SetExt = struct module type S = sig include Set.S val add_list: t -> elt list -> t val of_list: elt list -> t val to_list: t -> elt list end module Make (Ord: Set.OrderedType) = struct include Set.Make(Ord) let rec add_list t = function | e :: tl -> add_list (add e t) tl | [] -> t let of_list lst = add_list empty lst let to_list = elements end end module SetString = SetExt.Make(String) let compare_csl s1 s2 = String.compare (OASISString.lowercase_ascii s1) (OASISString.lowercase_ascii s2) module HashStringCsl = Hashtbl.Make (struct type t = string let equal s1 s2 = (compare_csl s1 s2) = 0 let hash s = Hashtbl.hash (OASISString.lowercase_ascii s) end) module SetStringCsl = SetExt.Make (struct type t = string let compare = compare_csl end) let varname_of_string ?(hyphen='_') s = if String.length s = 0 then begin invalid_arg "varname_of_string" end else begin let buf = OASISString.replace_chars (fun c -> if ('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') then c else hyphen) s; in let buf = (* Start with a _ if digit *) if '0' <= s.[0] && s.[0] <= '9' then "_"^buf else buf in OASISString.lowercase_ascii buf end let varname_concat ?(hyphen='_') p s = let what = String.make 1 hyphen in let p = try OASISString.strip_ends_with ~what p with Not_found -> p in let s = try OASISString.strip_starts_with ~what s with Not_found -> s in p^what^s let is_varname str = str = varname_of_string str let failwithf fmt = Printf.ksprintf failwith fmt let rec file_location ?pos1 ?pos2 ?lexbuf () = match pos1, pos2, lexbuf with | Some p, None, _ | None, Some p, _ -> file_location ~pos1:p ~pos2:p ?lexbuf () | Some p1, Some p2, _ -> let open Lexing in let fn, lineno = p1.pos_fname, p1.pos_lnum in let c1 = p1.pos_cnum - p1.pos_bol in let c2 = c1 + (p2.pos_cnum - p1.pos_cnum) in Printf.sprintf (f_ "file %S, line %d, characters %d-%d") fn lineno c1 c2 | _, _, Some lexbuf -> file_location ~pos1:(Lexing.lexeme_start_p lexbuf) ~pos2:(Lexing.lexeme_end_p lexbuf) () | None, None, None -> s_ "" let failwithpf ?pos1 ?pos2 ?lexbuf fmt = let loc = file_location ?pos1 ?pos2 ?lexbuf () in Printf.ksprintf (fun s -> failwith (Printf.sprintf "%s: %s" loc s)) fmt end module OASISExpr = struct # 22 "src/oasis/OASISExpr.ml" open OASISGettext open OASISUtils type test = string type flag = string type t = | EBool of bool | ENot of t | EAnd of t * t | EOr of t * t | 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 in (v = vl) in eval' t let choose ?printer ?name var_get lst = let rec choose_aux = function | (cond, vl) :: tl -> if eval var_get cond then vl else choose_aux tl | [] -> let str_lst = if lst = [] then s_ "" else String.concat (s_ ", ") (List.map (fun (cond, vl) -> match printer with | Some p -> p vl | None -> s_ "") lst) in match name with | Some nm -> failwith (Printf.sprintf (f_ "No result for the choice list '%s': %s") nm str_lst) | None -> failwith (Printf.sprintf (f_ "No result for a choice list: %s") str_lst) in choose_aux (List.rev lst) end # 437 "myocamlbuild.ml" module BaseEnvLight = struct # 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) ?stream () = let line = ref 1 in let lexer st = let st_line = Stream.from (fun _ -> try match Stream.next st with | '\n' -> incr line; Some '\n' | c -> Some c with Stream.Failure -> None) in Genlex.make_lexer ["="] st_line in let rec read_file lxr mp = match Stream.npeek 3 lxr with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> Stream.junk lxr; Stream.junk lxr; Stream.junk lxr; read_file lxr (MapString.add nm value mp) | [] -> mp | _ -> failwith (Printf.sprintf "Malformed data file '%s' line %d" filename !line) in match stream with | Some st -> read_file (lexer st) MapString.empty | None -> if Sys.file_exists filename then begin let chn = open_in_bin filename in let st = Stream.of_channel chn in try let mp = read_file (lexer st) MapString.empty in close_in chn; mp with e -> close_in chn; raise e end else if allow_empty then begin MapString.empty end else begin failwith (Printf.sprintf "Unable to load environment, the file '%s' doesn't exist." filename) end let rec var_expand str env = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try var_expand (MapString.find var env) env with Not_found -> failwith (Printf.sprintf "No variable %s defined when trying to expand %S." var str)) str; Buffer.contents buff let var_get name env = var_expand (MapString.find name env) env let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst end # 517 "myocamlbuild.ml" module MyOCamlbuildFindlib = struct # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" (** OCamlbuild extension, copied from * https://ocaml.org/learn/tutorials/ocamlbuild/Using_ocamlfind_with_ocamlbuild.html * by N. Pouillard and others * * Updated on 2016-06-02 * * Modified by Sylvain Le Gall *) open Ocamlbuild_plugin type conf = {no_automatic_syntax: bool} let run_and_read = Ocamlbuild_pack.My_unix.run_and_read let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings let exec_from_conf exec = let exec = let env = BaseEnvLight.load ~allow_empty:true () in try BaseEnvLight.var_get exec env with Not_found -> Printf.eprintf "W: Cannot get variable %s\n" exec; exec in let fix_win32 str = if Sys.os_type = "Win32" then begin let buff = Buffer.create (String.length str) in (* Adapt for windowsi, ocamlbuild + win32 has a hard time to handle '\\'. *) String.iter (fun c -> Buffer.add_char buff (if c = '\\' then '/' else c)) str; Buffer.contents buff end else begin str end in fix_win32 exec let split s ch = let buf = Buffer.create 13 in let x = ref [] in let flush () = x := (Buffer.contents buf) :: !x; Buffer.clear buf in 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 (* ocamlfind command *) let ocamlfind x = S[Sh (exec_from_conf "ocamlfind"); x] (* This lists all supported packages. *) let find_packages () = List.map before_space (split_nl & run_and_read (exec_from_conf "ocamlfind" ^ " list")) (* Mock to list available syntaxes. *) let find_syntaxes () = ["camlp4o"; "camlp4r"] let well_known_syntax = [ "camlp4.quotations.o"; "camlp4.quotations.r"; "camlp4.exceptiontracer"; "camlp4.extend"; "camlp4.foldgenerator"; "camlp4.listcomprehension"; "camlp4.locationstripper"; "camlp4.macro"; "camlp4.mapgenerator"; "camlp4.metagenerator"; "camlp4.profiler"; "camlp4.tracer" ] let dispatch conf = function | After_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 *) 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.ocamlmklib := ocamlfind & A"ocamlmklib" | After_rules -> (* Avoid warnings for unused tag *) flag ["tests"] N; (* 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 begin fun pkg -> let base_args = [A"-package"; A pkg] in (* TODO: consider how to really choose camlp4o or camlp4r. *) let syn_args = [A"-syntax"; A "camlp4o"] in let (args, pargs) = (* Heuristic to identify syntax extensions: whether they end in ".syntax"; some might not. *) if not (conf.no_automatic_syntax) && (Filename.check_suffix pkg "syntax" || List.mem pkg well_known_syntax) then (syn_args @ base_args, syn_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; (* TODO: Check if this is allowed for OCaml < 3.12.1 *) flag ["ocaml"; "compile"; "package("^pkg^")"] & S pargs; flag ["ocaml"; "ocamldep"; "package("^pkg^")"] & S pargs; flag ["ocaml"; "doc"; "package("^pkg^")"] & S pargs; flag ["ocaml"; "infer_interface"; "package("^pkg^")"] & S pargs; end (find_packages ()); (* Like -package but for extensions syntax. Morover -syntax is useless * when linking. *) List.iter begin fun syntax -> 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]; 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 ["c"; "pkg_threads"; "compile"] (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"]); flag ["c"; "package(threads)"; "compile"] (S[A "-thread"]); | _ -> () end module MyOCamlbuildBase = struct # 22 "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 type t = { 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; } # 110 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" 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 ~allow_empty:true () in match e with | Before_options -> let no_trailing_dot s = if String.length s >= 1 && s.[0] = '.' then String.sub s 1 ((String.length s) - 1) else s in List.iter (fun (opt, var) -> try opt := no_trailing_dot (BaseEnvLight.var_get var env) with Not_found -> Printf.eprintf "W: Cannot get variable %s\n" var) [ Options.ext_obj, "ext_obj"; Options.ext_lib, "ext_lib"; Options.ext_dll, "ext_dll"; ] | After_rules -> (* Declare OCaml libraries *) List.iter (function | nm, [], intf_modules -> ocaml_lib nm; let cmis = List.map (fun m -> (OASISString.uncapitalize_ascii 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 str -> flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir])) ["compile"; "infer_interface"; "doc"]) tl; let cmis = List.map (fun m -> dir^"/"^(OASISString.uncapitalize_ascii 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 (fun (dir, include_dirs) -> Pathname.define_context dir include_dirs) t.includes; (* Declare C libraries *) List.iter (fun (lib, dir, headers) -> (* Handle C part of library *) 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))]); if bool_of_string (BaseEnvLight.var_get "native_dynlink" env) then 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. This holds both for programs and for libraries. *) dep ["link"; "ocaml"; tag_libstubs lib] [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; dep ["compile"; "ocaml"; 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) -> let spec = BaseEnvLight.var_choose cond_specs env in let rec eval_specs = function | S lst -> S (List.map eval_specs lst) | A str -> A (BaseEnvLight.var_expand str env) | spec -> spec in flag tags & (eval_specs spec)) t.flags | _ -> () let dispatch_default conf t = dispatch_combine [ dispatch t; MyOCamlbuildFindlib.dispatch conf; ] end # 878 "myocamlbuild.ml" open Ocamlbuild_plugin;; let package_default = { MyOCamlbuildBase.lib_ocaml = [ ("oasis", ["src/oasis"], []); ("base", ["src/base"], []); ("builtin-plugins", [ "src"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ], []); ("dynrun", ["src/dynrun"], []); ("test-common", ["test/test-common"], []); ("plugin-loader", ["src/ext/plugin-loader/src"], []); ("cli", ["src/cli"], []); ("pluginloaderLib", ["src/ext/plugin-loader/test/data/findlib/pluginloaderLib"], []); ("plugin1", ["src/ext/plugin-loader/test/data/findlib/plugin1"], []); ("plugin2", ["src/ext/plugin-loader/test/data/findlib/plugin2"], []); ("plugin3", ["src/ext/plugin-loader/test/data/findlib/plugin3"], []) ]; lib_c = []; flags = []; includes = [ ("test/test-quickstart", [ "src"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake"; "test/test-common" ]); ("test/test-omake", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake"; "test/test-common" ]); ("test/test-main", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake"; "test/test-common" ]); ("test/test-devel", ["src/oasis"; "test/test-common"]); ("test/test-common", ["src/base"]); ("src/tools/oasis-dist", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/tools/oasis-announce", ["src/base"; "src/oasis"]); ("src/tools/guess-cmx", ["src/oasis"]); ("src/tools/dist", [ "src"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/tools/bench", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/plugins/omake", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild" ]); ("src/plugins/ocamlbuild", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/omake" ]); ("src/plugins/none", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/plugins/internal", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/plugins/extra/stdfiles", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/plugins/extra/devfiles", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/plugins/extra/META", [ "src"; "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/plugins/custom", [ "src"; "src/base"; "src/oasis"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/ext/plugin-loader/test/data/findlib/plugin3", ["src/ext/plugin-loader/test/data/findlib/pluginloaderLib"]); ("src/ext/plugin-loader/test/data/findlib/plugin2", [ "src/ext/plugin-loader/test/data/findlib/plugin1"; "src/ext/plugin-loader/test/data/findlib/pluginloaderLib" ]); ("src/ext/plugin-loader/test/data/findlib/plugin1", ["src/ext/plugin-loader/test/data/findlib/pluginloaderLib"]); ("src/ext/plugin-loader/test/data", [ "src/ext/plugin-loader/src"; "src/ext/plugin-loader/test/data/findlib/pluginloaderLib" ]); ("src/ext/plugin-loader/test", ["src/ext/plugin-loader/src"]); ("src/dynrun", [ "src"; "src/base"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/cli", [ "src"; "src/base"; "src/ext/plugin-loader/src"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]); ("src/base", ["src/oasis"]); ("src", [ "src/base"; "src/oasis"; "src/plugins/custom"; "src/plugins/extra/META"; "src/plugins/extra/devfiles"; "src/plugins/extra/stdfiles"; "src/plugins/internal"; "src/plugins/none"; "src/plugins/ocamlbuild"; "src/plugins/omake" ]) ] } ;; let conf = {MyOCamlbuildFindlib.no_automatic_syntax = false} let dispatch_default = MyOCamlbuildBase.dispatch_default conf package_default;; # 1179 "myocamlbuild.ml" (* OASIS_STOP *) open Ocamlbuild_plugin;; dispatch dispatch_default;; oasis-0.4.11/examples/0000755000175000017500000000000013261073606014057 5ustar gildorgildoroasis-0.4.11/examples/with-test/0000755000175000017500000000000013261073606016007 5ustar gildorgildoroasis-0.4.11/examples/with-test/src/0000755000175000017500000000000013261073606016576 5ustar gildorgildoroasis-0.4.11/examples/with-test/src/test.mli0000644000175000017500000000332713261073606020265 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) val myrun: OUnit.test -> OUnit.test_result list oasis-0.4.11/examples/with-test/src/test.ml0000644000175000017500000000343613261073606020115 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OUnit let myrun t = let lst = run_test_tt_main t in lst let _ = myrun ("main" >:: (fun () -> ())) oasis-0.4.11/examples/with-test/_oasis0000644000175000017500000000054513261073606017213 0ustar gildorgildorOASISFormat: 0.4 Name: with-data Version: 0.1 License: GPL LicenseFile: LICENSE.txt Authors: Sylvain Le Gall Synopsis: Library and executable with test Plugins: META (0.0.1) BuildTools: ocamlbuild Executable test Install: false Path: src MainIs: test.ml BuildDepends: oUnit Test "main" Type: Custom (0.0.1) Command: $test oasis-0.4.11/examples/with-test/LICENSE.txt0000644000175000017500000000312513261073606017633 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2008-2010, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/examples/with-subpackage/0000755000175000017500000000000013261073606017135 5ustar gildorgildoroasis-0.4.11/examples/with-subpackage/src/0000755000175000017500000000000013261073606017724 5ustar gildorgildoroasis-0.4.11/examples/with-subpackage/src/syntax/0000755000175000017500000000000013261073606021252 5ustar gildorgildoroasis-0.4.11/examples/with-subpackage/src/syntax/pa_test.ml0000644000175000017500000000324613261073606023250 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/with-subpackage/src/main.ml0000644000175000017500000000324613261073606021207 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/with-subpackage/src/B.ml0000644000175000017500000000324613261073606020444 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/with-subpackage/src/A.ml0000644000175000017500000000324613261073606020443 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/with-subpackage/_oasis0000644000175000017500000000166013261073606020340 0ustar gildorgildorOASISFormat: 0.4 Name: with-subpackage Version: 0.0 Synopsis: Simple library package with a sub library Authors: Sylvain Le Gall License: LGPL with OCaml linking exception Plugins: META (0.0.1) BuildTools: ocamlbuild Library test Path: src Modules: A, B Document test Title: API reference for test Type: ocamlbuild (0.1.0) InstallDir: $htmldir/test BuildTools+: ocamldoc XOCamlbuildPath: src XOCamlbuildLibraries: test # This library will be installed with library 'test' above # and will be named 'test.syntax'. Library pa_test Path: src/syntax Modules: Pa_test FindlibName: syntax FindlibParent: test CompiledObject: byte Executable mytest Path: src MainIs: main.ml # We need to use the findlib name to build depend on # pa_test library. BuildDepends: test.syntax, test Install: false oasis-0.4.11/examples/with-interface-module/0000755000175000017500000000000013261073606020253 5ustar gildorgildoroasis-0.4.11/examples/with-interface-module/src/0000755000175000017500000000000013261073606021042 5ustar gildorgildoroasis-0.4.11/examples/with-interface-module/src/pim_types.mli0000644000175000017500000000350613261073606023562 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* This module is not referred by the library itself. The mli and cmi files * should still be installed. *) type ('a, 'b) either = This of 'a | That of 'b oasis-0.4.11/examples/with-interface-module/src/pim_intf.mli0000644000175000017500000000337313261073606023360 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) module type S = sig type t val create: string -> t val value: t -> string end oasis-0.4.11/examples/with-interface-module/src/pim_impl.mli0000644000175000017500000000327213261073606023357 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) include Pim_intf.S oasis-0.4.11/examples/with-interface-module/src/pim_impl.ml0000644000175000017500000000333013261073606023201 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.11/examples/with-interface-module/_oasis0000644000175000017500000000050413261073606021452 0ustar gildorgildorOASISFormat: 0.4 Name: pimlib Version: 0.1 Synopsis: Library with pure interface modules in subdirectory Authors: Petter A. Urkedal License: GPL Plugins: META (0.3) AlphaFeatures: pure_interface Library pimlib Path: src BuildTools: ocamlbuild Modules: Pim_intf, Pim_impl, Pim_types oasis-0.4.11/examples/with-data/0000755000175000017500000000000013261073606015741 5ustar gildorgildoroasis-0.4.11/examples/with-data/src/0000755000175000017500000000000013261073606016530 5ustar gildorgildoroasis-0.4.11/examples/with-data/src/test.txt0000644000175000017500000000000013261073606020236 0ustar gildorgildoroasis-0.4.11/examples/with-data/src/test.ml0000644000175000017500000000324613261073606020046 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/with-data/src/test.html0000644000175000017500000000000013261073606020363 0ustar gildorgildoroasis-0.4.11/examples/with-data/_oasis0000644000175000017500000000123513261073606017142 0ustar gildorgildorOASISFormat: 0.4 Name: with-data Version: 0.1 License: GPL LicenseFile: LICENSE.txt Authors: Sylvain Le Gall Synopsis: Library and executable with extra data BuildTools: ocamlbuild Plugins: META (0.0.1) Executable test Path: src MainIs: test.ml DataFiles: *.txt, test.html ($htmldir) Library test CompiledObject: Byte Path: src Modules: Test DataFiles: test.txt ($datarootdir/$pkg_name-$pkg_version) Document test Title: API reference for test Type: ocamlbuild (0.1.0) InstallDir: $htmldir/test BuildTools+: ocamldoc XOCamlbuildPath: src XOCamlbuildLibraries: test oasis-0.4.11/examples/with-data/LICENSE.txt0000644000175000017500000000000013261073606017552 0ustar gildorgildoroasis-0.4.11/examples/with-c/0000755000175000017500000000000013261073606015252 5ustar gildorgildoroasis-0.4.11/examples/with-c/src/0000755000175000017500000000000013261073606016041 5ustar gildorgildoroasis-0.4.11/examples/with-c/src/main_stub.c0000644000175000017500000000356313261073606020175 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include #ifndef OPTION_PASSED #error "CCOpt doesn't work" #endif CAMLprim value caml_reident (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.4.11/examples/with-c/src/main_native_stub.c0000644000175000017500000000350013261073606021532 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include CAMLprim value caml_reident_native (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.4.11/examples/with-c/src/main_native.ml0000644000175000017500000000342613261073606020672 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) external reident: 'a -> 'a = "caml_reident_native" let () = print_endline (reident (A.ident "hello world!")) oasis-0.4.11/examples/with-c/src/main_custom_stub.c0000644000175000017500000000350013261073606021556 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include CAMLprim value caml_reident_custom (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.4.11/examples/with-c/src/main_custom.ml0000644000175000017500000000342613261073606020716 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) external reident: 'a -> 'a = "caml_reident_custom" let () = print_endline (reident (A.ident "hello world!")) oasis-0.4.11/examples/with-c/src/main.ml0000644000175000017500000000341713261073606017324 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) external reident: 'a -> 'a = "caml_reident" let () = print_endline (reident (A.ident "hello world!")) oasis-0.4.11/examples/with-c/src/A_stub.c0000644000175000017500000000361013261073606017422 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ #include #include "A_header.h" #ifndef OPTION_PASSED #error "CCOpt doesn't work" #endif CAMLprim value caml_ident (value vs) { CAMLparam1(vs); CAMLreturn(vs); }; oasis-0.4.11/examples/with-c/src/A_header.h0000644000175000017500000000334313261073606017705 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ /* Header for A */ oasis-0.4.11/examples/with-c/src/A.ml0000644000175000017500000000332013261073606016551 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) external ident: 'a -> 'a = "caml_ident" oasis-0.4.11/examples/with-c/_oasis0000644000175000017500000000206713261073606016457 0ustar gildorgildorOASISFormat: 0.4 Name: with-c Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal project with C file. Plugins: META (0.0.1) BuildTools: ocamlbuild Library "with-c" Path: src Modules: A CSources: A_stub.c, A_header.h CCOpt: -D OPTION_PASSED Document "with-c" Title: API reference for with-c Type: ocamlbuild (0.1.0) InstallDir: $htmldir/with-c BuildTools+: ocamldoc XOCamlbuildPath: src XOCamlbuildLibraries: with-c Executable "test-with-c" Path: src MainIs: main.ml CompiledObject: byte BuildDepends: with-c CSources: main_stub.c CCOpt: -D OPTION_PASSED Executable "test-with-c-custom" Path: src MainIs: main_custom.ml CompiledObject: byte Custom: true BuildDepends: with-c CSources: main_custom_stub.c Executable "test-with-c-native" Build$: flag(is_native) Path: src MainIs: main_native.ml CompiledObject: native BuildDepends: with-c CSources: main_native_stub.c oasis-0.4.11/examples/with-c/LICENSE0000644000175000017500000000324613261073606016264 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/examples/syntax-camlp4/0000755000175000017500000000000013261073606016563 5ustar gildorgildoroasis-0.4.11/examples/syntax-camlp4/test/0000755000175000017500000000000013261073606017542 5ustar gildorgildoroasis-0.4.11/examples/syntax-camlp4/test/data/0000755000175000017500000000000013261073606020453 5ustar gildorgildoroasis-0.4.11/examples/syntax-camlp4/test/data/foo.ml.exp0000644000175000017500000000327013261073606022365 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let pi = 3.14159 oasis-0.4.11/examples/syntax-camlp4/test/data/foo.ml0000644000175000017500000000326313261073606021574 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let pi = PI oasis-0.4.11/examples/syntax-camlp4/src/0000755000175000017500000000000013261073606017352 5ustar gildorgildoroasis-0.4.11/examples/syntax-camlp4/src/pi.ml0000644000175000017500000000344413261073606020321 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open Camlp4.PreCast open Syntax EXTEND Gram GLOBAL: expr; expr: LEVEL "simple" [[ "PI" -> <:expr< 3.1415926 >> ]]; END oasis-0.4.11/examples/syntax-camlp4/_oasis0000644000175000017500000000063313261073606017765 0ustar gildorgildorOASISFormat: 0.4 Name: syntax-camlp4 Version: 0.1 Synopsis: Camlp4 syntax extension example. Authors: Sylvain Le Gall License: LGPL-2.1 with OCaml linking exception Plugins: META (0.4) Library pi Path: src BuildTools: ocamlbuild Modules: Pi XMETAType: syntax FindlibContainers: syntax-camlp4 FindlibName: syntax BuildDepends: camlp4.extend, camlp4.quotations.o oasis-0.4.11/examples/simplelib/0000755000175000017500000000000013261073606016037 5ustar gildorgildoroasis-0.4.11/examples/simplelib/src/0000755000175000017500000000000013261073606016626 5ustar gildorgildoroasis-0.4.11/examples/simplelib/src/foo.mli0000644000175000017500000000332713261073606020121 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: int -> t val value: t -> int oasis-0.4.11/examples/simplelib/src/foo.ml0000644000175000017500000000332713261073606017750 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.4.11/examples/simplelib/src/bar.mli0000644000175000017500000000333513261073606020101 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.11/examples/simplelib/src/bar.ml0000644000175000017500000000333213261073606017725 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.11/examples/simplelib/src/META0000644000175000017500000000324613261073606017304 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ oasis-0.4.11/examples/simplelib/_oasis0000644000175000017500000000137513261073606017245 0ustar gildorgildorOASISFormat: 0.4 Name: simplelib Version: 0.0.1 Authors: Mauricio Fernandez Maintainers: Mauricio Fernandez Copyrights: (C) 2008 Mauricio Fernandez LicenseFile: LICENSE License: LGPL with OCaml linking exception BuildTools: ocamlbuild Synopsis: Minimal ADT just to illustrate how libs work. Description: Minimal ADT just to illustrate how libs work. . Not much more to say Homepage: http://example.com BuildDepends: bigarray Library simplelib Path: src Modules: Foo, Bar Document simplelib Title: API reference for simplelib Type: ocamlbuild (0.1.0) InstallDir: $htmldir/simplelib BuildTools+: ocamldoc XOCamlbuildPath: src XOCamlbuildLibraries: simplelib oasis-0.4.11/examples/simplelib/LICENSE0000644000175000017500000000324613261073606017051 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/examples/plugins/0000755000175000017500000000000013261073606015540 5ustar gildorgildoroasis-0.4.11/examples/plugins/with-plugin-versionfile/0000755000175000017500000000000013261073606022332 5ustar gildorgildoroasis-0.4.11/examples/plugins/with-plugin-versionfile/_oasis0000644000175000017500000000052313261073606023532 0ustar gildorgildorOASISFormat: 0.4 Name: with-versionfile-plugin Version: 0.1.0 License: LGPL-2.1 with OCaml linking exception Authors: Sylvain Le Gall Plugins: VersionFile (0.1) XVersionFileFilename: myversion.ml Synopsis: Example of using an _oasis plugin (oasis-versionfile). oasis-0.4.11/examples/plugins/oasis-plugin-versionfile/0000755000175000017500000000000013261073606022475 5ustar gildorgildoroasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/0000755000175000017500000000000013261073606023264 5ustar gildorgildoroasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/0000755000175000017500000000000013261073606024032 5ustar gildorgildoroasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/0000755000175000017500000000000013261073606030767 5ustar gildorgildor././@LongLink0000644000000000000000000000017100000000000011602 Lustar rootrootoasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginVersionFileGettext.mloasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginV0000644000175000017500000000326313261073606033101 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let s_ x = x ././@LongLink0000644000000000000000000000017100000000000011602 Lustar rootrootoasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginVersionFileData.mlifyoasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginV0000644000175000017500000000007013261073606033072 0ustar gildorgildorVarStringList readme_template_mkd "MANUAL-template.mkd" ././@LongLink0000644000000000000000000000017100000000000011602 Lustar rootrootoasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginVersionFileConf.ml.aboasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginV0000644000175000017500000000334413261073606033101 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let version = OASISVersion.version_of_string "$(pkg_version)" ././@LongLink0000644000000000000000000000016200000000000011602 Lustar rootrootoasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginVersionFile.mloasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/OASISPluginV0000644000175000017500000000623113261073606033077 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open OASISPlugin open OASISPluginVersionFileGettext open OASISValues open OASISSchema open OASISTypes type t = { filename: string; } let version_short = OASISVersion.chop OASISPluginVersionFileConf.version let plugin = `Extra, "VersionFile", Some version_short let self_id, all_id = Extra.create plugin let feature_name = OASISFeatures.create "filename" ~plugin (OASISFeatures.since_version "0.1") (fun () -> s_ "Allow to choose which file to generate.") let pivot_data = data_new_property plugin let generator = let new_field nm = new_field OASISPackage.schema all_id nm in let filename = new_field "Filename" ~default:"version.ml" ~feature:feature_name string (fun () -> s_ "File to generate where the version will be stored") pivot_data (fun _ t -> t.filename) in fun data -> { filename = filename data; } let main ctxt pkg = let t = generator pkg.schema_data in let content = Printf.sprintf "let version = %S" (OASISVersion.string_of_version pkg.version) in let open OASISFileTemplate in OASISPlugin.add_file (template_of_mlfile t.filename [] (* header *) [content] (* body *) [] (* footer *)) ctxt let init () = Extra.register_act self_id main; register_help plugin {(help_default OASISPluginVersionFileData.readme_template_mkd) with help_order = 40}; register_generator_package all_id pivot_data generator let () = init () ././@LongLink0000644000000000000000000000015400000000000011603 Lustar rootrootoasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/MANUAL-template.mkdoasis-0.4.11/examples/plugins/oasis-plugin-versionfile/src/lib/oasis-plugin-versionfile/MANUAL-templ0000644000175000017500000000027413261073606033011 0ustar gildorgildorThis plugin helps to generate a file `version.ml` which contains the version of the package, as defined in `_oasis` > `Version` field. Package fields: $ListVersionFileExtraPackageFields oasis-0.4.11/examples/plugins/oasis-plugin-versionfile/myocamlbuild.ml0000644000175000017500000000630313261073606025512 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open Ocamlbuild_plugin;; open Command;; (* TODO: use an ocamlbuild plugin for ocamlify. *) let depends_from_file env build ?(fmod=fun x -> x) fn = let depends_lst = let deps = ref [] in let fd = open_in fn in begin try while true; do deps := (fmod (input_line fd)) :: !deps done with End_of_file -> close_in fd end; List.rev !deps in List.iter (fun fn -> List.iter (function | Outcome.Good _ -> () | Outcome.Bad exn -> prerr_endline (Printf.sprintf "Could not build '%s': %s" fn (Printexc.to_string exn)); raise exn ) (build [[fn]]) ) depends_lst ;; let ocamlify = A"ocamlify";; rule "ocamlify: %.mlify -> %.mlify.depends" ~prod:"%.mlify.depends" ~dep:"%.mlify" begin fun env _ -> Cmd(S[ocamlify; T(tags_of_pathname (env "%.mlify")++"ocamlify"++"depends"); A"--depends"; A"--output"; P(env "%.mlify.depends"); P(env "%.mlify");]) end ;; rule "ocamlify: %.mlify & %.mlify.depends -> %.ml" ~prod:"%.ml" ~deps:["%.mlify"; "%.mlify.depends"] begin fun env build -> depends_from_file env build (env "%.mlify.depends"); Cmd(S[ocamlify; A"--output"; P(env "%.ml"); P(env "%.mlify")]) end ;; (* OASIS_START *) (* OASIS_STOP *) open Ocamlbuild_plugin;; dispatch dispatch_default;; oasis-0.4.11/examples/plugins/oasis-plugin-versionfile/_oasis0000644000175000017500000000156413261073606023703 0ustar gildorgildorOASISFormat: 0.4 Name: oasis-versionfile Version: 0.1.0 License: LGPL-2.1 with OCaml linking exception BuildType: ocamlbuild (0.4) Authors: Sylvain Le Gall Plugins: META (0.4) BuildTools: ocamlbuild, ocamlify FilesAB: src/lib/oasis-plugin-versionfile/OASISPluginVersionFileConf.ml.ab Synopsis: Example for _oasis plugin, that creates a file with version Library "oasis-plugin-versionfile" Path: src/lib/oasis-plugin-versionfile Modules: OASISPluginVersionFile InternalModules: OASISPluginVersionFileGettext, OASISPluginVersionFileConf, OASISPluginVersionFileData CompiledObject: Best BuildDepends: oasis XMETAExtraLines: plugin_system = "oasis" plugin_name = "VersionFile" plugin_synopsis = "Create a file containing the version." oasis-0.4.11/examples/plugins/oasis-plugin-print-hello/0000755000175000017500000000000013261073606022405 5ustar gildorgildoroasis-0.4.11/examples/plugins/oasis-plugin-print-hello/src/0000755000175000017500000000000013261073606023174 5ustar gildorgildoroasis-0.4.11/examples/plugins/oasis-plugin-print-hello/src/lib/0000755000175000017500000000000013261073606023742 5ustar gildorgildoroasis-0.4.11/examples/plugins/oasis-plugin-print-hello/src/lib/oasis-plugin-print-hello/0000755000175000017500000000000013261073606030607 5ustar gildorgildor././@LongLink0000644000000000000000000000016100000000000011601 Lustar rootrootoasis-0.4.11/examples/plugins/oasis-plugin-print-hello/src/lib/oasis-plugin-print-hello/OASISPluginPrintHello.mloasis-0.4.11/examples/plugins/oasis-plugin-print-hello/src/lib/oasis-plugin-print-hello/OASISPluginP0000644000175000017500000000352613261073606032715 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) open CLISubCommand let () = register "print-hello" ~synopsis:"" ~help:"" (make_run default_fspecs (fun ~ctxt:_ () -> print_endline "Hello!")) oasis-0.4.11/examples/plugins/oasis-plugin-print-hello/_oasis0000644000175000017500000000121113261073606023600 0ustar gildorgildorOASISFormat: 0.4 Name: oasis-plugin-print-hello Version: 0.1.0 License: LGPL-2.1 with OCaml linking exception BuildType: ocamlbuild (0.4) Authors: Sylvain Le Gall Plugins: META (0.4) BuildTools: ocamlbuild Synopsis: Example for command line plugin, that prints "Hello world!" Library "oasis-plugin-print-hello" Path: src/lib/oasis-plugin-print-hello Modules: OASISPluginPrintHello CompiledObject: Best BuildDepends: oasis.cli XMETAExtraLines: plugin_system = "oasis-cli" plugin_name = "print-hello" plugin_synopsis = "Print Hello with OASIS." oasis-0.4.11/examples/packedlib/0000755000175000017500000000000013261073606015775 5ustar gildorgildoroasis-0.4.11/examples/packedlib/test/0000755000175000017500000000000013261073606016754 5ustar gildorgildoroasis-0.4.11/examples/packedlib/test/main.ml0000644000175000017500000000330613261073606020234 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = Packedlib.Foo.dump () oasis-0.4.11/examples/packedlib/src/0000755000175000017500000000000013261073606016564 5ustar gildorgildoroasis-0.4.11/examples/packedlib/src/foo.mli0000644000175000017500000000335613261073606020061 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: int -> t val value: t -> int val dump: unit -> unit oasis-0.4.11/examples/packedlib/src/foo.ml0000644000175000017500000000340613261073606017704 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = int let create n = n let value n = n let dump () = prerr_endline "In Packedlib.Foo" oasis-0.4.11/examples/packedlib/src/bar.mli0000644000175000017500000000333513261073606020037 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.11/examples/packedlib/src/bar.ml0000644000175000017500000000333213261073606017663 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.11/examples/packedlib/src/Baz.ml0000644000175000017500000000324613261073606017637 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/packedlib/_oasis0000644000175000017500000000073713261073606017204 0ustar gildorgildorOASISFormat: 0.4 Name: packedlib Version: 0.1 Authors: Till Varoquaux Maintainers: Till Varoquaux Copyrights: (C) 2011 Till Varoquaux License: LGPL with OCaml linking exception BuildTools: ocamlbuild Plugins: META (0.4) Synopsis: Testing packed libraries work fine in oasis Library packedlib Pack: true Path: src Modules: Foo, Bar, Baz Executable test Path: test MainIs: main.ml BuildDepends: packedlib Install: false oasis-0.4.11/examples/packedlib/LICENSE0000644000175000017500000000324613261073606017007 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/examples/order-matter/0000755000175000017500000000000013261073606016464 5ustar gildorgildoroasis-0.4.11/examples/order-matter/src/0000755000175000017500000000000013261073606017253 5ustar gildorgildoroasis-0.4.11/examples/order-matter/src/foo/0000755000175000017500000000000013261073606020036 5ustar gildorgildoroasis-0.4.11/examples/order-matter/src/foo/Foo.ml0000644000175000017500000000327313261073606021120 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit = Baz.doit oasis-0.4.11/examples/order-matter/src/baz/0000755000175000017500000000000013261073606020027 5ustar gildorgildoroasis-0.4.11/examples/order-matter/src/baz/Baz.ml0000644000175000017500000000327313261073606021102 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit = Bar.doit oasis-0.4.11/examples/order-matter/src/bar/0000755000175000017500000000000013261073606020017 5ustar gildorgildoroasis-0.4.11/examples/order-matter/src/bar/Bar.ml0000644000175000017500000000331013261073606021052 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit () = prerr_endline "" oasis-0.4.11/examples/order-matter/_oasis0000644000175000017500000000134313261073606017665 0ustar gildorgildorOASISFormat: 0.4 Name: order-matter Version: 0.1 Synopsis: Reorder _oasis section for building Authors: Sylvain Le Gall License: LGPL with OCaml linking exception BuildTools: ocamlbuild Library foo Path: src/foo Modules: Foo Install: false BuildDepends: baz Library bar Path: src/bar Install: false Modules: Bar Library baz Path: src/baz Modules: Baz Install: false BuildDepends: bar Document "order-matter" Title: API reference for order-matter Type: ocamlbuild (0.1.0) InstallDir: $htmldir/order-matter Install: false BuildTools+: ocamldoc XOCamlbuildPath: src XOCamlbuildLibraries: foo, bar, baz oasis-0.4.11/examples/ocamlbuild/0000755000175000017500000000000013261073606016172 5ustar gildorgildoroasis-0.4.11/examples/ocamlbuild/src/0000755000175000017500000000000013261073606016761 5ustar gildorgildoroasis-0.4.11/examples/ocamlbuild/src/test.ml0000644000175000017500000000324613261073606020277 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/ocamlbuild/myocamlbuild.ml0000644000175000017500000000336513261073606021214 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) (* OASIS_START *) (* OASIS_STOP *) Ocamlbuild_plugin.dispatch dispatch_default oasis-0.4.11/examples/ocamlbuild/_oasis0000644000175000017500000000057213261073606017376 0ustar gildorgildorOASISFormat: 0.4 Name: object Version: 0.0.1 AlphaFeatures: ocamlbuild_more_args Authors: Jacques-Pascal Deplaix License: LGPL with OCaml linking exception Synopsis: Example for ocamlbuild fields BuildTools: ocamlbuild XOCamlbuildPluginTags: package(unix) XOCamlbuildExtraArgs: -j 4 -verbose 0 OCamlVersion: >= 4.01 Plugins: META (0.4) Library test Path: src Modules: Test oasis-0.4.11/examples/object/0000755000175000017500000000000013261073606015325 5ustar gildorgildoroasis-0.4.11/examples/object/src2/0000755000175000017500000000000013261073606016176 5ustar gildorgildoroasis-0.4.11/examples/object/src2/m2.mli0000644000175000017500000000324613261073606017224 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/object/src2/m2.ml0000644000175000017500000000324613261073606017053 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/object/src2/m1.ml0000644000175000017500000000324613261073606017052 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/object/src1/0000755000175000017500000000000013261073606016175 5ustar gildorgildoroasis-0.4.11/examples/object/src1/single.mli0000644000175000017500000000324613261073606020166 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/object/src1/single.ml0000644000175000017500000000324613261073606020015 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/object/_oasis0000644000175000017500000000064513261073606016532 0ustar gildorgildorOASISFormat: 0.4 BetaFeatures: section_object Name: object Version: 0.0.1 Authors: Philippe Veber Homepage: http://example.com License: LGPL with OCaml linking exception Synopsis: Example for object sections BuildTools: ocamlbuild BuildDepends: oUnit (>= 0.1.1) Plugins: META (0.3) Object single_module Path: src1 Modules: Single Install: true Object packed_modules Path: src2 Modules: M1, M2 Install: true oasis-0.4.11/examples/oasis/0000755000175000017500000000000013261073606015175 5ustar gildorgildoroasis-0.4.11/examples/oasis/uuidm.oasis0000644000175000017500000000135313261073606017362 0ustar gildorgildorOASISFormat: 0.3 Name: uuidm Version: 0.9.3 Authors: Daniel Buenzli LicenseFile: LICENSE License: BSD3 Plugins: META (0.0.1), StdFiles (0.1.0), DevFiles (0.1.0) Synopsis: Universally unique identifiers (UUIDs) for OCaml BuildTools: ocamlbuild Library uuidm Path: src Modules: Uuidm Executable perf Path: test MainIs: perf.ml Install: false BuildDepends: uuidm Test perf Type: Custom (0.0.1) Command: $(utoh "_build/test/perf") Executable test Path: test MainIs: test.ml Install: false BuildDepends: uuidm Test test Type: Custom (0.0.1) Command: $(utoh "_build/test/test") Executable uuid Path: test MainIs: uuid.ml Install: false BuildDepends: uuidm Test uuid Command: $uuid oasis-0.4.11/examples/oasis/cryptokit.oasis0000644000175000017500000000606513261073606020274 0ustar gildorgildorOASISFormat: 0.3 Name: cryptokit Version: 1.4 Authors: Xavier Leroy License: LGPL-2 with OCaml linking exception BuildTools: ocamlbuild, ocamldoc Plugins: META (0.2.0~alpha1), DevFiles (0.2.0~alpha1), StdFiles (0.2.0~alpha1) Synopsis: Cryptographic primitives Description: This library provides a variety of cryptographic primitives that can be used to implement cryptographic protocols in security-sensitive applications. The primitives provided include: . - Symmetric-key ciphers: AES, DES, Triple-DES, ARCfour, in ECB, CBC, CFB and OFB modes. - Public-key cryptography: RSA encryption, Diffie-Hellman key agreement. - Hash functions and MACs: SHA-1, MD5, and MACs based on AES and DES. - Random number generation. - Encodings and compression: base 64, hexadecimal, Zlib compression. . Additional ciphers and hashes can easily be used in conjunction with the library. In particular, basic mechanisms such as chaining modes, output buffering, and padding are provided by generic classes that can easily be composed with user-provided ciphers. More generally, the library promotes a "Lego"-like style of constructing and composing transformations over character streams. Flag zlib Description: Enable ZLib Default$: !os_type(Win32) Library cryptokit Path: src Modules: Cryptokit CSources: arcfour.c, arcfour.h, stubs-arcfour.c, blowfish.c, blowfish.h, stubs-blowfish.c, d3des.c, d3des.h, stubs-des.c, rijndael-alg-fst.c, rijndael-alg-fst.h, ripemd160.c, ripemd160.h, stubs-ripemd160.c, sha1.c, sha1.h, stubs-sha1.c, sha256.c, sha256.h, stubs-sha256.c, stubs-aes.c, stubs-md5.c, stubs-misc.c, stubs-rng.c, stubs-zlib.c BuildDepends: unix, num if flag(zlib) CCOpt: -O -DHAVE_ZLIB CCLib: -lz Executable test Path: test MainIs: test.ml Custom: true BuildDepends: cryptokit Install: false Test main Command: $test TestTools: test Executable speedtest Path: test MainIs: speedtest.ml CompiledObject: native BuildDepends: cryptokit Install: false Test bench Command: $speedtest TestTools: speedtest Document "api-cryptokit" Title: API reference for Cryptokit Type: ocamlbuild (0.2.0~alpha1) InstallDir: $htmldir/cryptokit BuildTools+: ocamldoc XOCamlBuildPath: src/ XOCamlbuildLibraries: cryptokit SourceRepository head Type: svn Location: svn://scm.ocamlcore.org/svnroot/cryptokit/trunk Browser: http://forge.ocamlcore.org/scm/viewvc.php/trunk/?root=cryptokit SourceRepository this Type: svn # TODO: we need to add version here Location: svn://scm.ocamlcore.org/svnroot/cryptokit/tags/release Browser: http://forge.ocamlcore.org/scm/viewvc.php/tags/release?root=cryptokit oasis-0.4.11/examples/interdepend-libraries/0000755000175000017500000000000013261073606020332 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/0000755000175000017500000000000013261073606021121 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/libe/0000755000175000017500000000000013261073606022034 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/libe/E.ml0000644000175000017500000000330113261073606022547 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit () = D.doit () oasis-0.4.11/examples/interdepend-libraries/src/libd/0000755000175000017500000000000013261073606022033 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/libd/D.ml0000644000175000017500000000331413261073606022551 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit () = prerr_endline "toto" oasis-0.4.11/examples/interdepend-libraries/src/libc/0000755000175000017500000000000013261073606022032 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/libc/C.ml0000644000175000017500000000333613261073606022553 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit () = B.doit (); ignore (Num.num_of_int 0) oasis-0.4.11/examples/interdepend-libraries/src/libb/0000755000175000017500000000000013261073606022031 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/libb/B.ml0000644000175000017500000000334213261073606022546 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit () = A.doit (); ignore (Unix.gettimeofday ()) oasis-0.4.11/examples/interdepend-libraries/src/liba/0000755000175000017500000000000013261073606022030 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/liba/intern/0000755000175000017500000000000013261073606023327 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/liba/intern/A_parser.mly0000644000175000017500000000443213261073606025611 0ustar gildorgildor/********************************************************************************/ /* OASIS: architecture for building OCaml libraries and applications */ /* */ /* Copyright (C) 2011-2016, Sylvain Le Gall */ /* Copyright (C) 2008-2011, OCamlCore SARL */ /* */ /* This library is free software; you can redistribute it and/or modify it */ /* under the terms of the GNU Lesser General Public License as published by */ /* the Free Software Foundation; either version 2.1 of the License, or (at */ /* your option) any later version, with the OCaml static compilation */ /* exception. */ /* */ /* This library is distributed in the hope that it will be useful, but */ /* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY */ /* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more */ /* details. */ /* */ /* You should have received a copy of the GNU Lesser General Public License */ /* along with this library; if not, write to the Free Software Foundation, */ /* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /********************************************************************************/ %token INT %token PLUS MINUS TIMES DIV %token LPAREN RPAREN %token EOL %left PLUS MINUS /* lowest precedence */ %left TIMES DIV /* medium precedence */ %nonassoc UMINUS /* highest precedence */ %start main /* the entry point */ %type main %% main: expr EOL { $1 } ; expr: INT { $1 } | LPAREN expr RPAREN { $2 } | expr PLUS expr { $1 + $3 } | expr MINUS expr { $1 - $3 } | expr TIMES expr { $1 * $3 } | expr DIV expr { $1 / $3 } | MINUS expr %prec UMINUS { - $2 } ; oasis-0.4.11/examples/interdepend-libraries/src/liba/intern/A_lexer.mll0000644000175000017500000000421413261073606025415 0ustar gildorgildor(********************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (********************************************************************************) (* File lexer.mll *) { open A_parser (* The type token is defined in parser.mli *) exception Eof } rule token = parse [' ' '\t'] { token lexbuf } (* skip blanks *) | ['\n' ] { EOL } | ['0'-'9']+ as lxm { INT(int_of_string lxm) } | '+' { PLUS } | '-' { MINUS } | '*' { TIMES } | '/' { DIV } | '(' { LPAREN } | ')' { RPAREN } | eof { raise Eof } oasis-0.4.11/examples/interdepend-libraries/src/liba/intern/A2.ml0000644000175000017500000000331613261073606024126 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit () = print_endline "Coucou" oasis-0.4.11/examples/interdepend-libraries/src/liba/A.ml0000644000175000017500000000334013261073606022542 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let doit () = A2.doit (); ignore (Str.regexp "abcd") oasis-0.4.11/examples/interdepend-libraries/src/execa/0000755000175000017500000000000013261073606022206 5ustar gildorgildoroasis-0.4.11/examples/interdepend-libraries/src/execa/Main.ml0000644000175000017500000000331113261073606023422 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let () = C.doit (); E.doit () oasis-0.4.11/examples/interdepend-libraries/_oasis0000644000175000017500000000234513261073606021536 0ustar gildorgildorOASISFormat: 0.4 Name: interdepend-libraries Version: 0.1 Synopsis: Executable and libraries with interdependencies Authors: Sylvain Le Gall License: LGPL with OCaml linking exception BuildTools: ocamlbuild Library liba Modules: A InternalModules: intern/A2, intern/A_parser, intern/A_lexer Path: src/liba BuildDepends: str Install: false Library libb Modules: B Path: src/libb BuildDepends: liba, unix Install: false Library libc Modules: C Path: src/libc BuildDepends: libb, num Install: false Library libd Modules: D Path: src/libd Install: false Library libe Modules: E Path: src/libe Install: false BuildDepends: libd Executable execa MainIs: Main.ml Path: src/execa BuildDepends: libc, libe Install: false Document interdepend Title: API reference for interdepend Type: ocamlbuild (0.1.0) InstallDir: $htmldir/interdepend Install: false BuildTools+: ocamldoc XOCamlbuildPath: src XOCamlbuildLibraries: liba, libb, libc, libd, libe oasis-0.4.11/examples/flags/0000755000175000017500000000000013261073606015153 5ustar gildorgildoroasis-0.4.11/examples/flags/src/0000755000175000017500000000000013261073606015742 5ustar gildorgildoroasis-0.4.11/examples/flags/src/simplelibext/0000755000175000017500000000000013261073606020443 5ustar gildorgildoroasis-0.4.11/examples/flags/src/simplelibext/META0000644000175000017500000000324613261073606021121 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ oasis-0.4.11/examples/flags/src/simplelibext/FooExt.ml0000644000175000017500000000324613261073606022206 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/flags/src/simplelibext/BarExt.ml0000644000175000017500000000324613261073606022167 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/flags/src/simplelib/0000755000175000017500000000000013261073606017722 5ustar gildorgildoroasis-0.4.11/examples/flags/src/simplelib/META0000644000175000017500000000324613261073606020400 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ oasis-0.4.11/examples/flags/src/simplelib/Foo.ml0000644000175000017500000000324613261073606021004 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/flags/src/simplelib/Conf.ml.ab0000644000175000017500000000330613261073606021524 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) let version = "$(pkg_version)" oasis-0.4.11/examples/flags/src/simplelib/Bar.ml0000644000175000017500000000324613261073606020765 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) oasis-0.4.11/examples/flags/_oasis0000644000175000017500000000205013261073606016350 0ustar gildorgildorOASISFormat: 0.4 Name: flags Version: 0.0.1 Authors: Sylvain Le Gall LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Demonstrate the use of Flag. BuildDepends: bigarray BuildTools: ocamlbuild FilesAB: src/simplelib/Conf.ml.ab Flag buildext Description: build simplelibext Library simplelib Path: src/simplelib Modules: Foo, Bar Document simplelib Title: API reference for simplelib Type: ocamlbuild (0.1.0) InstallDir: $htmldir/simplelib BuildTools+: ocamldoc XOCamlbuildPath: src/simplelib XOCamlbuildLibraries: simplelib Library simplelibext Build: false if flag(buildext) Build: true Path: src/simplelibext Modules: FooExt, BarExt Document simplelibext Title: API reference for simplelibext Type: ocamlbuild (0.1.0) InstallDir: $htmldir/simplelibext BuildTools+: ocamldoc XOCamlbuildPath: src/simplelibext XOCamlbuildLibraries: simplelibext oasis-0.4.11/examples/flags/LICENSE0000644000175000017500000000324613261073606016165 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/examples/findlib/0000755000175000017500000000000013261073606015466 5ustar gildorgildoroasis-0.4.11/examples/findlib/src/0000755000175000017500000000000013261073606016255 5ustar gildorgildoroasis-0.4.11/examples/findlib/src/foo.mli0000644000175000017500000000332713261073606017550 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: int -> t val value: t -> int oasis-0.4.11/examples/findlib/src/foo.ml0000644000175000017500000000332713261073606017377 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.4.11/examples/findlib/src/bar.mli0000644000175000017500000000333513261073606017530 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.11/examples/findlib/src/bar.ml0000644000175000017500000000333213261073606017354 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.11/examples/findlib/src/META0000644000175000017500000000324613261073606016733 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ oasis-0.4.11/examples/findlib/_oasis0000644000175000017500000000054313261073606016670 0ustar gildorgildorOASISFormat: 0.4 Name: findlib Version: 0.0.1 Authors: Sylvain Le Gall Copyrights: (C) 2008 Sylvain Le Gall Homepage: http://example.com BugReports: http://example.com/issues Tags: build, org:ocamlforge LicenseFile: LICENSE License: LGPL with OCaml linking exception Synopsis: Minimal ADT just to illustrate how libs work. BuildDepends: oUnit (>= 0.1.1) oasis-0.4.11/examples/findlib/LICENSE0000644000175000017500000000324613261073606016500 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/examples/custom/0000755000175000017500000000000013261073606015371 5ustar gildorgildoroasis-0.4.11/examples/custom/src/0000755000175000017500000000000013261073606016160 5ustar gildorgildoroasis-0.4.11/examples/custom/src/foo.mli0000644000175000017500000000332713261073606017453 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: int -> t val value: t -> int oasis-0.4.11/examples/custom/src/foo.ml0000644000175000017500000000332713261073606017302 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.4.11/examples/custom/src/bar.mli0000644000175000017500000000333513261073606017433 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.11/examples/custom/src/bar.ml0000644000175000017500000000333213261073606017257 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.11/examples/custom/src/META0000644000175000017500000000324613261073606016636 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ oasis-0.4.11/examples/custom/myconfigure.bat0000644000175000017500000000336213261073606020414 0ustar gildorgildorrem==============================================================================# rem OASIS: architecture for building OCaml libraries and applications # rem # rem Copyright (C) 2011-2016, Sylvain Le Gall # rem Copyright (C) 2008-2011, OCamlCore SARL # rem # rem This library is free software; you can redistribute it and/or modify it # rem under the terms of the GNU Lesser General Public License as published by # rem the Free Software Foundation; either version 2.1 of the License, or (at # rem your option) any later version, with the OCaml static compilation # rem exception. # rem # rem This library is distributed in the hope that it will be useful, but # rem WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # rem or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # rem details. # rem # rem You should have received a copy of the GNU Lesser General Public License # rem along with this library; if not, write to the Free Software Foundation, # rem Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # rem==============================================================================# echo ocamlc="ocamlc" > setup.data oasis-0.4.11/examples/custom/myconfigure0000755000175000017500000000332513261073606017651 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ #!/bin/sh echo 'ocamlc="ocamlc"' > setup.data oasis-0.4.11/examples/custom/_oasis0000644000175000017500000000156113261073606016574 0ustar gildorgildorOASISFormat: 0.4 Name: simplelib Version: 0.0.1 Authors: Mauricio Fernandez Maintainers: Mauricio Fernandez Copyrights: (C) 2008 Mauricio Fernandez LicenseFile: LICENSE License: LGPL with OCaml linking exception ConfType: custom (0.0.1) if os_type(Win32) XCustomConf: myconfigure.bat XCustomBuild: make -f TopMakefile all 'OCAMLC=${ocamlc}' WIN32=true else XCustomConf: ./myconfigure XCustomBuild: make -f TopMakefile all 'OCAMLC=${ocamlc}' BuildType: custom (0.0.1) XCustomBuildClean: make -f TopMakefile clean XCustomBuildDistclean: make -f TopMakefile distclean Synopsis: Minimal ADT just to illustrate how libs work. Description: Minimal ADT just to illustrate how libs work. . Not much more to say Homepage: http://example.com BuildDepends: extlib Library simplelib Path: src Modules: Foo, Bar oasis-0.4.11/examples/custom/TopMakefile0000644000175000017500000000365113261073606017521 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ REAL_OCAMLC=$(if $(WIN32),$(shell cygpath '$(OCAMLC)'),$(OCAMLC)) all: cd src && '$(REAL_OCAMLC)' -c foo.mli bar.mli && '$(REAL_OCAMLC)' -a -o simplelib.cma foo.mli foo.ml bar.ml clean: $(RM) src/foo.cm[xoi] src/bar.cm[xoi] src/simplelib.cma distclean: oasis-0.4.11/examples/custom/LICENSE0000644000175000017500000000324613261073606016403 0ustar gildorgildor******************************************************************************** * OASIS: architecture for building OCaml libraries and applications * * * * Copyright (C) 2011-2016, Sylvain Le Gall * * Copyright (C) 2008-2011, OCamlCore SARL * * * * This library is free software; you can redistribute it and/or modify it * * under the terms of the GNU Lesser General Public License as published by * * the Free Software Foundation; either version 2.1 of the License, or (at * * your option) any later version, with the OCaml static compilation * * exception. * * * * This library is distributed in the hope that it will be useful, but * * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * * or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more * * details. * * * * You should have received a copy of the GNU Lesser General Public License * * along with this library; if not, write to the Free Software Foundation, * * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * ******************************************************************************** oasis-0.4.11/doc/0000755000175000017500000000000013261073606013006 5ustar gildorgildoroasis-0.4.11/doc/ext/0000755000175000017500000000000013261073606013606 5ustar gildorgildoroasis-0.4.11/doc/ext/fetch-doc.sh0000644000175000017500000000334013261073606015776 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ wget -N "http://www.haskell.org/cabal/proposal/x611.html" oasis-0.4.11/doc/ext/README.txt0000644000175000017500000000021713261073606015304 0ustar gildorgildorBecause of licensing issues, no external documentation can be included. You can run "sh fetch-doc.sh" to get required external documentation. oasis-0.4.11/doc/FAQ.mkd0000644000175000017500000000022713261073606014113 0ustar gildorgildor # FAQ ### I don't want a full build system, is it possible to just write `\_oasis` to provides as metadata for my software? ### Is OASIS flexible? oasis-0.4.11/doc/ANALYSIS.mkd0000644000175000017500000000623013261073606014727 0ustar gildorgildorArchitecture ============ The first goal is to be able to generate most of the required files for ocamlbuild. The default build tool for OASIS will be ocamlbuild. Other build tools like OCamlMakefile and OMake should also be usable, but supporting these tools is a secondary goal. The minimum requirements for using OASIS are `findlib` and `ocaml`. They are used to detect available packages and install packages. If there are no external dependencies, findlib dependencies can be ignored. A full build system should be capable of configuring, building and installing a software package. configure --------- The configure phase provides a way to set various options of the build system depending on software/hardware configurations and user choices. A project has requirements regarding third party software; these are its "build dependencies". The user's choices can also change the build scheme: don't build one module, use an alternate implementation for another. We call these the "user choices". The configure step tries to auto detect various parameters and see if they match with the "build dependencies" and "user choices". At the end, the configure scheme should create files which summarize the choices that were made. Files are created through replacement of variable in files `(%.ab -> %)`. We rely on `_oasis` file to describe "user choices" (Flag) and "build dependencies" (BuildDepends and BuildTools). OASIS should provide 2 choices for configure: - internal (default): an OCaml module is embedded in the project that perform all these checks, use translated `_oasis` in setup.ml structure. - ocaml-autoconf: use translated `_oasis` in configure.ac, output setup.data. build ----- The build phase should build all the project objects. It should take care of building native or bytecode objects depending on the target system. OASIS provides 3 choices for build: - ocamlbuild (default): use translated `_oasis` files (.mllib, .itarget...) and ocamlbuild shipped with ocaml, add ocamlbuild detection to configure - OCamlMakefile: use translated `_oasis` files (Makefile) and OCamlMakefile shipped externally, add OCamlMakefile user choice and detection - OMake: use translated `_oasis` files (TODO) The build phase uses the result of the configure phase by reading a generated file that lists important variables regarding the build process. test ---- The test phase is optional. TODO doc --- The doc phase is optional. TODO install ------- The install phase installs all generated objects into the target system. OASIS provides 1 choice for install: - internal (default): - use ocamlfind to install library - use FileUtils to install data and executable. The install phase uses the result of the configure phase by reading a generated file that lists important variables regarding the build process. OASIS files ----------- TODO Generating project skeleton --------------------------- TODO External tools ============== ocamlconf --------- yam --- ocamlbuild ---------- OCamlMakefile ------------- OMake ----- godiva ------ ocaml-autoconf -------------- ocamake ------- Target system ============= GODI ---- Debian ------ Fedora ------ Developer ---------- oasis-0.4.11/doc-dist.sh0000755000175000017500000000436113261073606014312 0ustar gildorgildor#!/bin/sh ################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ set -e OASIS_VERSION=$(./Main.native query version) CURDIR=$(pwd) TMPDIR=$(mktemp -d) clean_exit () { if [ -n "$TMPDIR" ] && [ -e "$TMPDIR" ]; then rm -rf "$TMPDIR" fi } trap clean_exit EXIT mk_tarball () { TOPDIR="$1" DSTDIR="$2" mkdir -p "$TMPDIR/$TOPDIR/doc" cp doc/*.mkd "$TMPDIR/$TOPDIR/doc" mkdir -p "$TMPDIR/$TOPDIR/api-oasis" cp -R _build/src/api-oasis.docdir/* "$TMPDIR/$TOPDIR/api-oasis" tar czf "$DSTDIR/$TOPDIR.tar.gz" -C $TMPDIR $TOPDIR } mk_tarball "oasis-doc-dev" "$CURDIR/dist" mk_tarball "oasis-doc-$OASIS_VERSION" "$CURDIR/dist" oasis-0.4.11/deps.ml0000644000175000017500000001433213261073606013531 0ustar gildorgildor(******************************************************************************) (* OASIS: architecture for building OCaml libraries and applications *) (* *) (* Copyright (C) 2011-2016, Sylvain Le Gall *) (* Copyright (C) 2008-2011, OCamlCore SARL *) (* *) (* This library is free software; you can redistribute it and/or modify it *) (* under the terms of the GNU Lesser General Public License as published by *) (* the Free Software Foundation; either version 2.1 of the License, or (at *) (* your option) any later version, with the OCaml static compilation *) (* exception. *) (* *) (* This library is distributed in the hope that it will be useful, but *) (* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY *) (* or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more *) (* details. *) (* *) (* You should have received a copy of the GNU Lesser General Public License *) (* along with this library; if not, write to the Free Software Foundation, *) (* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *) (******************************************************************************) module MapString = Map.Make(String) module SetString = Set.Make(String) open OASISTypes open BaseEnv let generated_fn = OASISHostPath.of_unix "src/cli/CLIPluginsLoaded.ml" let post_configure pkg = (* Compute build depends *) let _, findlib_of_name, _ = OASISFindlib.findlib_mapping pkg in let mp_int, set_ext = (* Collect dependencies and external dependencies from the package. *) List.fold_left (fun (mp_int, set_ext) -> function | Library (cs, bs, _) when var_choose bs.bs_build -> begin let deps, set_ext = List.fold_left (fun (deps, set_ext) sct -> let deps = match sct with | InternalLibrary nm -> SetString.add (findlib_of_name nm) deps | FindlibPackage (fndlb_pkg, _) -> SetString.add fndlb_pkg deps in let set_ext = match sct with | InternalLibrary _ -> set_ext | FindlibPackage (fndlb_pkg, _) -> SetString.add fndlb_pkg set_ext in deps, set_ext) (SetString.empty, set_ext) bs.bs_build_depends in MapString.add (findlib_of_name cs.cs_name) deps mp_int, set_ext end | Executable (_, bs, _) when var_choose bs.bs_build -> let set_ext = List.fold_left (fun set_ext -> function | InternalLibrary _ -> set_ext | FindlibPackage (fndlb_pkg, _) -> SetString.add fndlb_pkg set_ext) set_ext bs.bs_build_depends in mp_int, set_ext | _ -> mp_int, set_ext) (MapString.empty, SetString.empty) pkg.sections in let mp = (* Expand external dependencies. *) SetString.fold (fun fndlb_nm mp -> let lst = OASISExec.run_read_output ~ctxt:!BaseContext.default "ocamlfind" ["query"; fndlb_nm; "-recursive"; "-p-format"] in let set_deps = List.fold_right SetString.add lst SetString.empty in MapString.add fndlb_nm set_deps mp) set_ext mp_int in let rec transitive_closure nm visited = if not (SetString.mem nm visited) then begin let visited = SetString.add nm visited in let set = try MapString.find nm mp with Not_found -> SetString.empty in SetString.fold transitive_closure set visited end else visited in let chn = open_out generated_fn in let fmt = Format.formatter_of_out_channel chn in Format.fprintf fmt "@["; List.iter (function | Executable (cs, bs, _) -> let st = List.fold_left (fun st -> function | InternalLibrary nm -> transitive_closure (findlib_of_name nm) st | FindlibPackage (fndlb_nm, _) -> transitive_closure fndlb_nm st) SetString.empty bs.bs_build_depends in let first = ref true in Format.fprintf fmt "let exec_%s_build_depends_rec = [@[" (OASISUtils.varname_of_string cs.cs_name); List.iter (fun str -> if !first then begin Format.fprintf fmt "%S" str; first := false end else begin Format.fprintf fmt ";@ %S" str end) (List.rev (SetString.elements st)); Format.fprintf fmt "@]]@," | _ -> ()) pkg.sections; Format.fprintf fmt "@]@?"; close_out chn let setup_t = {setup_t with BaseSetup.configure = (fun pkg args -> setup_t.BaseSetup.configure pkg args; post_configure pkg); BaseSetup.distclean = (fun pkg args -> Sys.remove generated_fn) :: setup_t.BaseSetup.distclean} let setup () = BaseSetup.setup setup_t oasis-0.4.11/configure0000755000175000017500000000055313261073606014153 0ustar gildorgildor#!/bin/sh # OASIS_START # DO NOT EDIT (digest: dc86c2ad450f91ca10c931b6045d0499) set -e FST=true for i in "$@"; do if $FST; then set -- FST=false fi case $i in --*=*) ARG=${i%%=*} VAL=${i##*=} set -- "$@" "$ARG" "$VAL" ;; *) set -- "$@" "$i" ;; esac done ocaml setup.ml -configure "$@" # OASIS_STOP oasis-0.4.11/ardivink.lua0000644000175000017500000000116013261073606014551 0ustar gildorgildorci = require("ci") dist = require("dist") oasis = require("oasis") ci.init() dist.init() oasis.init() ci.prependenv("PATH", "/usr/opt/godi/bin") ci.prependenv("PATH", "/usr/opt/godi/sbin") ci.putenv("OUNIT_OUTPUT_HTML_DIR", dist.make_filename("ounit-log-$(suite_name).html")) ci.putenv("OUNIT_OUTPUT_JUNIT_FILE", dist.make_filename("junit-$(suite_name).xml")) ci.putenv("OUNIT_OUTPUT_FILE", dist.make_filename("ounit-log-$(suite_name)-$(shard_id).txt")) oasis.std_process("--enable-tests", "--enable-devel") -- Create documentation package. ci.exec("make", "doc-dist") -- Create dev tarball. ci.exec("make", "dist-dev") oasis-0.4.11/appveyor_build.sh0000644000175000017500000000546313261073606015631 0ustar gildorgildor#!/bin/bash ################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ set -e function run { NAME=$1 shift echo "$NAME ... " $@ CODE=$? if [ $CODE -ne 0 ]; then echo "... $NAME failed!" return $CODE else echo "... $NAME OK" fi } cd "$APPVEYOR_BUILD_FOLDER" run "OPAM Initialization" opam init --use-internal-solver -y -a run "OPAM Install packages" opam install --use-internal-solver -y \ ocamlfind ocamlmod ocamlify fileutils ounit eval $(opam config env) export OCAML_TOPLEVEL_PATH=$(opam config var toplevel) run "OASIS Uninstall previously installed version" ocaml setup.ml -uninstall || true run "OASIS Distclean" ocaml setup.ml -distclean || true for i in oasis plugin-loader ; do run "ocamlfind remove $i" ocamlfind remove "$i" || true done run "OASIS Configure" ocaml setup.ml -configure \ --override ocamlbuildflags -classic-display run "OASIS Build" ocaml setup.ml -build run "OASIS Install" ocaml setup.ml -install echo "------------------------------------------------------------" echo "Rebuild with dynamic mode" run "Setup" ./Main.native setup -setup-update dynamic run "Configure" ocaml setup.ml -configure run "Build" ocaml setup.ml -build oasis-0.4.11/appveyor.yml0000644000175000017500000000226313261073606014634 0ustar gildorgildor# http://www.appveyor.com/docs/appveyor-yml branches: only: - master except: - gh-pages environment: global: CYG_ROOT: C:/cygwin install: # - appveyor DownloadFile "http://cygwin.com/setup-%CYG_ARCH%.exe" -FileName "%CYG_ROOT%\setup-x86.exe" - ps: '(new-object net.webclient).DownloadString("https://aantron.github.io/binaries/cygwin/x86/ocaml/4.02/install.ps1") | PowerShell -Command -' - ps: '(new-object net.webclient).DownloadString("https://aantron.github.io/binaries/cygwin/x86/camlp4/4.02/install.ps1") | PowerShell -Command -' - ps: '(new-object net.webclient).DownloadString("https://aantron.github.io/binaries/cygwin/x86/opam/1.2/install.ps1") | PowerShell -Command -' - '%CYG_ROOT%\bin\bash -lc "cygcheck -dc cygwin"' - '%CYG_ROOT%\bin\bash -lc "echo \"OCaml version `ocamlc -version`\""' build_script: - 'echo Build in "%APPVEYOR_BUILD_FOLDER%"' - '%CYG_ROOT%/bin/bash -l "%APPVEYOR_BUILD_FOLDER%/appveyor_build.sh"' notifications: - provider: Webhook url: https://webhooks.gitter.im/e/7ff53153d7d00ed61e3d on_build_success: true on_build_failure: true on_build_status_changed: true artifacts: - path: setup.log name: setup.log oasis-0.4.11/_tags0000644000175000017500000003534313261073606013271 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 50d5b282df951d7b7894c2cef0ba5076) # 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 true: annot, bin_annot <**/.svn>: -traverse <**/.svn>: not_hygienic ".bzr": -traverse ".bzr": not_hygienic ".hg": -traverse ".hg": not_hygienic ".git": -traverse ".git": not_hygienic "_darcs": -traverse "_darcs": not_hygienic # Library oasis "src/oasis/oasis.cmxs": use_oasis : package(unix) # Library base "src/base/base.cmxs": use_base : package(unix) : use_oasis # Library builtin-plugins "src/builtin-plugins.cmxs": use_builtin-plugins : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis : package(ocamlbuild) : package(unix) : use_base : use_oasis # Library dynrun "src/dynrun/dynrun.cmxs": use_dynrun : package(ocamlbuild) : package(unix) : use_base : use_builtin-plugins : use_oasis # Library test-common "test/test-common/test-common.cmxs": use_test-common : package(fileutils) : package(oUnit) : package(pcre) : package(unix) : use_base : use_oasis # Executable fake-ocamlfind : package(unix) : package(unix) # Executable test-main : package(fileutils) : package(findlib) : package(oUnit) : package(ocamlbuild) : package(pcre) : package(unix) : use_base : use_builtin-plugins : use_oasis : use_test-common : package(fileutils) : package(findlib) : package(oUnit) : package(ocamlbuild) : package(pcre) : package(unix) : use_base : use_builtin-plugins : use_oasis : use_test-common # Executable test-omake : package(fileutils) : package(findlib) : package(oUnit) : package(ocamlbuild) : package(pcre) : package(unix) : use_base : use_builtin-plugins : use_oasis : use_test-common : package(fileutils) : package(findlib) : package(oUnit) : package(ocamlbuild) : package(pcre) : package(unix) : use_base : use_builtin-plugins : use_oasis : use_test-common # Executable test-quickstart : package(expect.pcre) : package(fileutils) : package(findlib) : package(oUnit) : package(ocamlbuild) : package(pcre) : package(unix) : use_base : use_builtin-plugins : use_oasis : use_test-common : package(expect.pcre) : package(fileutils) : package(findlib) : package(oUnit) : package(ocamlbuild) : package(pcre) : package(unix) : use_base : use_builtin-plugins : use_oasis : use_test-common # Executable test-devel : package(fileutils) : package(oUnit) : package(pcre) : package(unix) : use_base : use_oasis : use_test-common : package(fileutils) : package(oUnit) : package(pcre) : package(unix) : use_base : use_oasis : use_test-common # Executable dist "src/tools/dist/Dist.byte": package(fileutils) "src/tools/dist/Dist.byte": package(ocamlbuild) "src/tools/dist/Dist.byte": package(unix) "src/tools/dist/Dist.byte": use_base "src/tools/dist/Dist.byte": use_builtin-plugins "src/tools/dist/Dist.byte": use_oasis : package(fileutils) : package(ocamlbuild) : package(unix) : use_base : use_builtin-plugins : use_oasis # Executable guess-cmx "src/tools/guess-cmx/GuessCMX.byte": package(pcre) "src/tools/guess-cmx/GuessCMX.byte": package(unix) "src/tools/guess-cmx/GuessCMX.byte": use_oasis : package(pcre) : package(unix) : use_oasis # Executable oasis-announce "src/tools/oasis-announce/OASISAnnounce.byte": package(pcre) "src/tools/oasis-announce/OASISAnnounce.byte": package(unix) "src/tools/oasis-announce/OASISAnnounce.byte": use_base "src/tools/oasis-announce/OASISAnnounce.byte": use_oasis : package(pcre) : package(unix) : use_base : use_oasis # Executable oasis-dist "src/tools/oasis-dist/OASISDist.byte": package(fileutils) "src/tools/oasis-dist/OASISDist.byte": package(ocamlbuild) "src/tools/oasis-dist/OASISDist.byte": package(unix) "src/tools/oasis-dist/OASISDist.byte": use_base "src/tools/oasis-dist/OASISDist.byte": use_builtin-plugins "src/tools/oasis-dist/OASISDist.byte": use_oasis : package(fileutils) : package(ocamlbuild) : package(unix) : use_base : use_builtin-plugins : use_oasis # Executable bench : package(benchmark) : package(ocamlbuild) : package(unix) : use_base : use_builtin-plugins : use_oasis : package(benchmark) : package(ocamlbuild) : package(unix) : use_base : use_builtin-plugins : use_oasis # Library plugin-loader "src/ext/plugin-loader/src/plugin-loader.cmxs": use_plugin-loader : package(dynlink) : package(findlib) # Library cli "src/cli/cli.cmxs": use_cli # Executable oasis : package(dynlink) : package(findlib) : package(ocamlbuild) : package(unix) : use_base : use_builtin-plugins : use_cli : use_oasis : use_plugin-loader : package(dynlink) : package(findlib) : package(ocamlbuild) : package(unix) : use_base : use_builtin-plugins : use_cli : use_oasis : use_plugin-loader # 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 : use_pluginloaderLib # Library plugin2 "src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.cmxs": use_plugin2 : use_plugin1 : use_pluginloaderLib # Library plugin3 "src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.cmxs": use_plugin3 : use_pluginloaderLib # Executable pluginloader "src/ext/plugin-loader/test/data/PluginLoaderMain.byte": package(dynlink) "src/ext/plugin-loader/test/data/PluginLoaderMain.byte": package(findlib) "src/ext/plugin-loader/test/data/PluginLoaderMain.byte": use_plugin-loader "src/ext/plugin-loader/test/data/PluginLoaderMain.byte": use_pluginloaderLib : package(dynlink) : package(findlib) : use_plugin-loader : use_pluginloaderLib # Executable test_loader "src/ext/plugin-loader/test/TestLoader.byte": package(dynlink) "src/ext/plugin-loader/test/TestLoader.byte": package(fileutils) "src/ext/plugin-loader/test/TestLoader.byte": package(findlib) "src/ext/plugin-loader/test/TestLoader.byte": package(oUnit) "src/ext/plugin-loader/test/TestLoader.byte": use_plugin-loader : package(dynlink) : package(fileutils) : package(findlib) : package(oUnit) : use_plugin-loader # OASIS_STOP # Plugins "src/plugins/ocamlbuild/MyOCamlbuildBase.ml": use_ocamlbuild "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml": use_ocamlbuild "src/plugins/ocamlbuild/OCamlbuildPlugin.ml": use_ocamlbuild # TODO: The fact that we need to remove these tags is maybe a bug : -use_base : -use_oasis : -use_base : -use_oasis <**/*.ml>: annot true: safe_string "build": -traverse "build": not_hygienic ".opam": -traverse ".opam": not_hygienic true: explain oasis-0.4.11/_oasis0000644000175000017500000003200413261073606013440 0ustar gildorgildorOASISFormat: 0.4 Name: oasis Version: 0.4.11 OCamlVersion: >= 3.12.1 FindlibVersion: >= 1.3.1 LicenseFile: COPYING.txt License: LGPL-2.1 with OCaml linking exception BuildType: ocamlbuild (0.4) Authors: Sylvain Le Gall Maintainers: Sylvain Le Gall Copyrights: (C) 2011-2016 Sylvain Le Gall (C) 2008-2010 OCamlCore SARL Homepage: http://oasis.forge.ocamlcore.org/ Plugins: DevFiles (0.4), StdFiles (0.4), META (0.4) FilesAB: src/oasis/OASISConf.ml.ab BuildTools: ocamlbuild, make AlphaFeatures: source_patterns, stdfiles_markdown BugReports: https://github.com/ocaml/oasis/issues ImplementationPatterns+: ${module}.mlify Synopsis: Tooling for building OCaml libraries and applications Description: OASIS generates a full configure, build and install system for your application. It starts with a simple `_oasis` file at the toplevel of your project and creates everything required. . OASIS leverages existing OCaml tooling to perform most of it's work. In fact, it might be more appropriate to think of it as simply the glue that binds these other subsystems together and coordinates the work that they do. It should support the following tools: . * OCamlbuild * OMake * OCamlMakefile (todo), * ocaml-autoconf (todo) . It also features a do-it-yourself command line invocation and an internal configure/install scheme. Libraries are managed through findlib. It has been tested on GNU Linux and Windows. . It also allows to have standard entry points and description. It helps to integrates your libraries and software with third parties tools like OPAM. Flag libraries Description: Install OASIS and base libraries, for plugins development Flag devel Description: Build OASIS tools for development Default: false Flag quickstart_tests Description: Build test-quickstart Default: true Flag omake_tests Description: Build test-omake Default: false Flag devel_tests Description: Build test-devel Default: false Library oasis Path: src/oasis Modules: FormatExt, PropList, OASISUtils, OASISUnixPath, OASISFileSystem, OASISContext, OASISSourcePatterns, OASISGettext, OASISMessage, OASISText, OASISTypes, OASISParse, OASISValues, OASISExpr, OASISVersion, OASISLicense, OASISFileTemplate, OASISBuildSection, OASISDocument, OASISExecutable, OASISFlag, OASISSetupUpdate, OASISLibrary, OASISObject, OASISPackage, OASISSourceRepository, OASISTest, OASISPlugin, OASISFindlib, OASISSchema, OASISSection, OASISData, OASISString, OASISExec, OASISFileUtil, OASISHostPath, OASISGraph, OASISFeatures, OASISDataNotation InternalModules: OASISMutex, OASISVersion_types, OASISVersion_lexer, OASISVersion_parser, OASISLicense_types, OASISLicense_lexer, OASISLicense_parser, OASISValues_lexer, OASISConf, OASISAst_types, OASISAst_lexer, OASISAst_parser, OASISAst, OASISCheck, OASISCustom, OASISQuickstart, OASISHelp, OASISFormat, OASISSection_intern, OASISBuildSection_intern, OASISDocument_intern, OASISExecutable_intern, OASISFlag_intern, OASISLibrary_intern, OASISObject_intern, OASISPackage_intern, OASISSourceRepository_intern, OASISTest_intern, OASISSchema_intern, OASISPath_intern CompiledObject: Best BuildDepends: unix BuildTools+: ocamlmod, ocamlyacc, ocamllex, ocamlify XMETADescription: _oasis file functions Install$: flag(libraries) Library base Path: src/base Modules: BaseArgExt, BaseBuilt, BaseCheck, BaseCustom, BaseData, BaseDoc, BaseEnvLight, BaseEnv, BaseFileAB, BaseGenerate, BaseLog, BaseOCamlcConfig, BaseSetup, BaseStandardVar, BaseTest, BaseDynVar, BaseMessage, BaseContext, BaseCompat CompiledObject: Best BuildDepends: oasis BuildTools+: ocamlmod, ocamlify FindlibParent: oasis XMETADescription: 'setup.ml' modules for OASIS Install$: flag(libraries) Library "builtin-plugins" Path: src Modules: OASISBuiltinPlugins, plugins/extra/META/METAPlugin, plugins/internal/InternalConfigurePlugin, plugins/internal/InternalInstallPlugin, plugins/none/NonePlugin, plugins/ocamlbuild/OCamlbuildPlugin, plugins/ocamlbuild/OCamlbuildDocPlugin, plugins/ocamlbuild/OCamlbuildCommon, plugins/custom/CustomPlugin, plugins/extra/devfiles/DevFilesPlugin, plugins/extra/stdfiles/StdFilesPlugin, plugins/omake/OMakePlugin InternalModules: plugins/none/NoneData, plugins/internal/InternalData, plugins/internal/InternalId, plugins/ocamlbuild/OCamlbuildData, plugins/ocamlbuild/OCamlbuildId, plugins/ocamlbuild/MyOCamlbuildBase, plugins/ocamlbuild/MyOCamlbuildFindlib, plugins/custom/CustomData, plugins/extra/META/METAData, plugins/extra/devfiles/DevFilesData, plugins/extra/stdfiles/StdFilesData, plugins/omake/OMakeData, plugins/omake/OMakeFields, plugins/omake/OMakeEquip, plugins/omake/OMakeFormat CompiledObject: Best BuildDepends: oasis, oasis.base, ocamlbuild FindlibParent: oasis Library cli Path: src/cli Modules: CLISubCommand, CLIArgExt, CLICommon, CLIPager InternalModules: CLIData, CLIPluginsLoaded, CLIPluginLoader CompiledObject: byte BuildDepends: oasis, oasis.base, plugin-loader FindlibParent: oasis XMETADescription: 'setup.ml' modules for OASIS Install$: flag(libraries) Library dynrun Path: src/dynrun Modules: OASISDynRun CompiledObject: best BuildDepends: oasis.base, oasis.builtin-plugins FindlibParent: oasis Executable oasis Path: src/cli MainIs: Main.ml BuildDepends: oasis, oasis.base, oasis.cli, oasis.builtin-plugins CompiledObject: best Document manual Type: custom (0.4) Title: OASIS User Manual XCustom: $oasis -ignore-plugins manual -o doc/MANUAL.mkd XCustomClean: $rm doc/MANUAL.mkd DataFiles: doc/MANUAL.mkd Document "api-oasis" Title: API reference for OASIS Type: OCamlbuild (0.4) InstallDir: $htmldir/oasis BuildTools+: ocamldoc XOCamlbuildPath: src/ XOCamlbuildLibraries: oasis, oasis.base, oasis.cli SourceRepository head Type: git Location: git://github.com/ocaml/oasis.git Browser: https://github.com/ocaml/oasis SourceRepository "opam-pin" Type: git Location: git://github.com/ocaml/oasis.git Branch: opam/testing # # Tests. # Library "test-common" Path: test/test-common Modules: TestCommon, TestFullUtils Install: false CompiledObject: best Build$: flag(tests) BuildDepends: oUnit (>= 2.0.0), oasis.base, fileutils, pcre Executable "fake-ocamlfind" Path: test/fake-ocamlfind MainIs: FakeOCamlfind.ml Install: false CompiledObject: best Build$: flag(tests) BuildDepends: unix Executable "test-main" Path: test/test-main MainIs: Test.ml Install: false CompiledObject: best Build$: flag(tests) BuildDepends: oUnit (>= 2.0.0), findlib, fileutils (>= 0.4.2), oasis, oasis.base, oasis.builtin-plugins, test-common Test main Type: custom (0.4) Command: $test_main -oasis $oasis -is-native $is_native \ -native-dynlink $native_dynlink -ocamlmod $ocamlmod \ -fake-ocamlfind $fake_ocamlfind WorkingDirectory: test TestTools: oasis, test-main, ocamlmod, fake-ocamlfind, ocamlbuild, camlp4 Executable "test-omake" Path: test/test-omake MainIs: TestOMake.ml Install: false CompiledObject: best Build$: flag(tests) && flag(omake_tests) BuildDepends: oUnit (>= 2.0.0), findlib, fileutils (>= 0.4.2), oasis, oasis.base, oasis.builtin-plugins, test-common Test omake Type: custom (0.4) Command: $test_omake -oasis $oasis -is-native $is_native \ -native-dynlink $native_dynlink -ocamlmod $ocamlmod \ -fake-ocamlfind $fake_ocamlfind WorkingDirectory: test Run$: flag(omake_tests) TestTools: oasis, test-omake, ocamlmod, fake-ocamlfind, omake, camlp4 Executable "test-quickstart" Path: test/test-quickstart MainIs: TestQuickstart.ml Install: false CompiledObject: best Build$: flag(tests) && flag(quickstart_tests) BuildDepends: oUnit (>= 2.0.0), findlib, fileutils (>= 0.4.2), expect.pcre (>= 0.0.4), oasis, oasis.builtin-plugins, test-common Test quickstart Type: custom (0.4) Command: $test_quickstart -oasis $oasis -is-native $is_native \ -native-dynlink $native_dynlink -ocamlmod $ocamlmod \ -fake-ocamlfind $fake_ocamlfind WorkingDirectory: test Run$: flag(quickstart_tests) TestTools: oasis, test-quickstart Executable "test-devel" Path: test/test-devel MainIs: TestDevel.ml Install: false CompiledObject: best Build$: flag(tests) && flag(devel_tests) BuildDepends: oUnit (>= 2.0.0), oasis, test-common Test devel Type: custom (0.4) Command: $test_devel WorkingDirectory: test Run$: flag(devel_tests) TestTools: oasis, test-devel # # Tools. # Executable dist Path: src/tools/dist MainIs: Dist.ml Install: false CompiledObject: byte Build$: flag(devel) BuildDepends: unix, fileutils, oasis, oasis.builtin-plugins Executable "guess-cmx" Path: src/tools/guess-cmx MainIs: GuessCMX.ml Install: false CompiledObject: byte Build$: flag(devel) BuildDepends: pcre, unix, oasis Executable "oasis-announce" Path: src/tools/oasis-announce MainIs: OASISAnnounce.ml Install: false CompiledObject: byte Build$: flag(devel) BuildDepends: oasis, oasis.base, pcre Executable "oasis-dist" Path: src/tools/oasis-dist MainIs: OASISDist.ml Install: false CompiledObject: byte Build$: flag(devel) BuildDepends: oasis, oasis.base, fileutils, oasis.builtin-plugins Executable bench Path: src/tools/bench MainIs: Bench.ml Install: false CompiledObject: best Build$: flag(devel) BuildDepends: benchmark (>= 1.2), oasis, oasis.base, oasis.builtin-plugins # # Third party: plugin-loader. # Library "plugin-loader" Path: src/ext/plugin-loader/src Modules: PluginLoader BuildDepends: dynlink, findlib XMETADescription: OCaml plugin management using findlib Library "pluginloaderLib" Path: src/ext/plugin-loader/test/data/findlib/pluginloaderLib Modules: PluginloaderLib Build$: flag(tests) Install: false XMETADescription: test library loader Library "plugin1" Path: src/ext/plugin-loader/test/data/findlib/plugin1 Modules: Plugin1 Install: false Build$: flag(tests) BuildDepends: pluginloaderLib XMETADescription: test library number 1 XMETAExtraLines: plugin_system = "pluginloader" plugin_name = "plugin1" plugin_synopsis = "first plugin" Library "plugin2" Path: src/ext/plugin-loader/test/data/findlib/plugin2 Modules: Plugin2 Install: false Build$: flag(tests) BuildDepends: pluginloaderLib, plugin1 XMETADescription: test library number 2 XMETAExtraLines: plugin_system = "pluginloader" plugin_name = "plugin2" plugin_synopsis = "second plugin" Library "plugin3" Path: src/ext/plugin-loader/test/data/findlib/plugin3 Modules: Plugin3 Install: false Build$: flag(tests) BuildDepends: pluginloaderLib XMETADescription: test library number 3 XMETAExtraLines: plugin_system = "pluginloader" plugin_name = "plugin3" plugin_synopsis = "third plugin" Executable "pluginloader" Path: src/ext/plugin-loader/test/data MainIs: PluginLoaderMain.ml Install: false Build$: flag(tests) BuildDepends: pluginloaderLib, plugin-loader Executable "test_loader" Path: src/ext/plugin-loader/test MainIs: TestLoader.ml BuildDepends: plugin-loader, fileutils, oUnit Build$: flag(tests) Install: false Test main_loader Type: custom (0.4) Command: $test_loader -pluginloader $pluginloader TestTools: test_loader, pluginloader oasis-0.4.11/_header0000644000175000017500000000154713261073606013562 0ustar gildorgildorOASIS: architecture for building OCaml libraries and applications Copyright (C) 2011-2016, Sylvain Le Gall Copyright (C) 2008-2011, OCamlCore SARL This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version, with the OCaml static compilation exception. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA oasis-0.4.11/_headache.config0000644000175000017500000001115013261073606015307 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ | ".*\\.txt" -> no | ".*\\.txt.fst" -> no | ".*\\.txt.snd" -> no | ".*\\.txt-exp" -> no | ".*\\.md.exp" -> no | ".*\\.html" -> no | ".*\\.patch" -> no | ".*\\.mkd" -> no | ".*\\.mod" -> no | ".*\\.mlify" -> no | "configure" -> no | ".*\\.sh" -> skip match:"#!.*" | ".*\\.sh" -> frame open:"#" line:"#" close:"#" | ".*\\.bash" -> skip match:"#!.*" | ".*\\.bash" -> frame open:"#" line:"#" close:"#" | ".*\\.ml\\.ab" -> frame open:"(*" line:"*" close:"*)" margin:" " | ".*\\.ml" -> skip match:"#!.*" | ".*\\.mli?" -> skip match:"(\\*pp .* \\*)" | ".*\\.mli?" -> frame open:"(*" line:"*" close:"*)" margin:" " | ".*\\.ml.exp" -> skip match:"#!.*" | ".*\\.mli?.exp" -> skip match:"(\\*pp .* \\*)" | ".*\\.mli?.exp" -> frame open:"(*" line:"*" close:"*)" margin:" " | "_headache\\.config" -> frame open:"#" line:"#" close:"#" | "_announce" -> no | "_header" -> no | ".*\\.swp" -> no | ".*\\.po" -> no | ".*\\.po.bak" -> no | ".*\\.mo" -> no | "META" -> frame open:"#" line:"#" close:"#" | "POTFILES" -> no | "LINGUAS" -> no | ".*\\.pot" -> no | ".*\\.png" -> no | ".*\\.mllib" -> frame open:"#" line:"#" close:"#" | ".*\\.mldylib" -> frame open:"#" line:"#" close:"#" | ".*\\.itarget" -> frame open:"#" line:"#" close:"#" | ".*\\.itarget.in" -> frame open:"#" line:"#" close:"#" | ".*\\.odocl" -> frame open:"#" line:"#" close:"#" | "_tags" -> frame open:"#" line:"#" close:"#" | "_tags_manual" -> frame open:"#" line:"#" close:"#" | "installbuilder-license.xml" -> no | ".*\\.oasis" -> no | "_oasis.*" -> no | "myconfigure" -> skip match:"#!.*" | "myconfigure" -> frame open:"#" line:"#" close:"#" | "myconfigure.bat" -> frame open:"rem" line:"=" close:"#" | "\\.boring" -> no | ".*\\.pdf" -> no | ".*\\.expect" -> frame open:"#" line:"#" close:"#" | "setup\\.log" -> no | "setup\\.data" -> no | ".*\\.data" -> no | ".*\\.bat" -> frame open:"rem" line:"#" close:"#" | "oasis\\.xml" -> no | "oasis" -> frame open:"#" line:"#" close:"#" | "foo\.bar" -> no | ".*\\.tar\\.gz" -> no | ".*\\.tar\\.gz\\.asc" -> no | "\\.gitignore" -> no | ".*\\.lua" -> no | ".*\\.awk" -> no | ".*\\.md" -> no | "ounit.conf" -> no | ".ocp-indent.conf" -> no | ".merlin" -> no | ".*\\.om" -> no | ".*\\.yml" -> no | ".*\\.eliom" -> no | ".*\\.eliomi" -> no | "appveyor_install.cmd" -> no | ".*src/tools/oasis" -> skip match:"#!.*" oasis-0.4.11/TODO.txt0000644000175000017500000000124413261073606013550 0ustar gildorgildor* Finish guess-cmx to install all files for libraries, integrate it in buildsys * "..." in freeform doesn't work * recompilation of .cmxs, must have a pb in detecting update * Feature protect big changes like the section Object. * fix +x for configure in oasis-dist IDEAS: * oasis-autogenerate: automatically file Modules and ModulesInternal using a field XAutoGenModulesExpression: src/*.mli XAutoGenModulesInternal: src/*.ml, -src/*.mli * oasis-spandeps: create a directory ext/ containing depends and compile/install them in the project. Bonus point: use a link/file to include project checkout elsewhere on the FS Bonus point: also include rev-dependencies oasis-0.4.11/README.md0000644000175000017500000000523113261073606013521 0ustar gildorgildor[![Travis-CI Build Status](https://travis-ci.org/ocaml/oasis.svg?branch=master)](https://travis-ci.org/ocaml/oasis) [![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/42gumiqt5le643t2?svg=true)](https://ci.appveyor.com/project/gildor478/oasis) [![Join the chat at https://gitter.im/ocaml/oasis](https://badges.gitter.im/ocaml/oasis.svg)](https://gitter.im/ocaml/oasis?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) oasis - Tooling for building OCaml libraries and applications ============================================================= OASIS generates a full configure, build and install system for your application. It starts with a simple `_oasis` file at the toplevel of your project and creates everything required. OASIS leverages existing OCaml tooling to perform most of it's work. In fact, it might be more appropriate to think of it as simply the glue that binds these other subsystems together and coordinates the work that they do. It should support the following tools: * OCamlbuild * OMake * OCamlMakefile (todo), * ocaml-autoconf (todo) It also features a do-it-yourself command line invocation and an internal configure/install scheme. Libraries are managed through findlib. It has been tested on GNU Linux and Windows. It also allows to have standard entry points and description. It helps to integrates your libraries and software with third parties tools like OPAM. See the file [INSTALL.md](INSTALL.md) for building and installation instructions. [Home page](http://oasis.forge.ocamlcore.org/) [Bug reports](https://github.com/ocaml/oasis/issues) Copyright and license --------------------- (C) 2011-2016 Sylvain Le Gall (C) 2008-2010 OCamlCore SARL oasis is distributed under the terms of the GNU Lesser General Public License version 2.1 with OCaml linking exception. See [COPYING.txt](COPYING.txt) for more information. Related documentation --------------------- [OMake README](src/plugins/omake/README.md) OPAM pin -------- There is no `opam` directory in the master branch of this repository. All the OPAM files are autogenerated and tested by automatic processes in different branches. To pin this repository with testing OPAM (recommended): ``` $> opam pin add oasis git://github.com/ocaml/oasis.git#opam/testing ``` To pin this repository with unstable OPAM (__not recommended__): ``` $> opam pin add oasis git://github.com/ocaml/oasis.git#opam/unstable ``` To generate an opam/ directory and pin your own local version: ``` $> cd inside_the_top_source_dir $> make opam $> opam pin add oasis . ``` oasis-0.4.11/Makefile0000644000175000017500000001152513261073606013705 0ustar gildorgildor################################################################################ # OASIS: architecture for building OCaml libraries and applications # # # # Copyright (C) 2011-2016, Sylvain Le Gall # # Copyright (C) 2008-2011, OCamlCore SARL # # # # This library is free software; you can redistribute it and/or modify it # # under the terms of the GNU Lesser General Public License as published by # # the Free Software Foundation; either version 2.1 of the License, or (at # # your option) any later version, with the OCaml static compilation # # exception. # # # # This library is distributed in the hope that it will be useful, but # # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY # # or FITNESS FOR A PARTICULAR PURPOSE. See the file COPYING for more # # details. # # # # You should have received a copy of the GNU Lesser General Public License # # along with this library; if not, write to the Free Software Foundation, # # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # ################################################################################ OMAKEFLAGS:=$(shell (command -v omake > /dev/null) && echo --enable-omake-tests) CONFIGUREFLAGS += --override ocamlbuildflags -classic-display \ --enable-tests \ --enable-devel \ --enable-devel-tests \ $(OMAKEFLAGS) default: test #TESTFLAGS=-only-test "OASIS:1:OASIS:2:File:12:test-freeform.oasis" TIMINGS=1 # OASIS_START # DO NOT EDIT (digest: a3c674b4239234cbbe53afe090018954) SETUP = ocaml setup.ml build: setup.data $(SETUP) -build $(BUILDFLAGS) doc: setup.data build $(SETUP) -doc $(DOCFLAGS) test: setup.data build $(SETUP) -test $(TESTFLAGS) all: $(SETUP) -all $(ALLFLAGS) install: setup.data $(SETUP) -install $(INSTALLFLAGS) uninstall: setup.data $(SETUP) -uninstall $(UNINSTALLFLAGS) reinstall: setup.data $(SETUP) -reinstall $(REINSTALLFLAGS) clean: $(SETUP) -clean $(CLEANFLAGS) distclean: $(SETUP) -distclean $(DISTCLEANFLAGS) setup.data: $(SETUP) -configure $(CONFIGUREFLAGS) configure: $(SETUP) -configure $(CONFIGUREFLAGS) .PHONY: build doc test all install uninstall reinstall clean distclean configure # OASIS_STOP # Count number of lines # wc: find src/ -name "*.ml" | xargs wc -l wc-setup: awk -f src/tools/setup-wc.awk setup.ml .PHONY: wc wc-setup # Headache target # Fix license header of file. headache: # TODO: reactivate when headache in opam will be ready. #find ./ \ # -name _darcs -prune -false \ # -o -name .git -prune -false \ # -o -name .svn -prune -false \ # -o -name _build -prune -false \ # -o -name dist -prune -false \ # -o -name '*[^~]' -type f \ # | xargs /usr/bin/headache -h _header -c _headache.config .PHONY: headache # Doc targets # Build documentation and pack them in a tarball. doc-dist: doc ./doc-dist.sh .PHONY: doc-dist # Precommit target # Check style of code. PRECOMMIT_ARGS= \ --exclude myocamlbuild.ml \ --exclude setup.ml \ --exclude README.txt \ --exclude INSTALL.txt \ --exclude Makefile \ --exclude configure \ --exclude _tags precommit: -@if command -v OCamlPrecommit > /dev/null; then \ OCamlPrecommit $(PRECOMMIT_ARGS); \ else \ echo "Skipping precommit checks.";\ fi precommit-full: OCamlPrecommit --full $(PRECOMMIT_ARGS) test: precommit .PHONY: precommit # Deploy target # Deploy/release the software. deploy: headache doc-dist # TODO: create a plugin to create documentation. # oasis doc-dist mkdir dist || true exec_oasis_dist_ml=$$(readlink -m ./OASISDist.byte) \ admin-gallu-deploy --verbose \ --forge_upload --forge_group oasis \ --forge_extra_file "dist/oasis-doc-$(shell oasis query version).tar.gz" # TODO: create a plugin to send announcement. # oasis announce admin-gallu-oasis-increment ./Main.native setup $(MAKE) distclean $(MAKE) test git commit -am "Update OASIS version." .PHONY: deploy # Create dev tarball. # Create a tarball for rebuilding the current version dist-dev: build ./Dist.byte -dev .PHONY: dist-dev # Create opam/ directory. # Create files for OPAM. opam/opam opam/desc: _oasis env LOCAL=true bash -e ./src/tools/ci/oasis2opam.bash opam: opam/opam opam/desc opam-clean: $(RM) _oasis_remove_.ml oasis.install $(RM) -r opam .PHONY: opam opam-clean oasis-0.4.11/INSTALL.md0000644000175000017500000000341213261073606013671 0ustar gildorgildor This is the INSTALL file for the oasis distribution. This package uses OASIS to generate its build system. See section OASIS for full information. Dependencies ============ In order to compile this package, you will need: * ocaml (>= 3.12.1) for all, test devel, test main, test main_loader, test omake, test quickstart, doc api-oasis, doc manual * findlib (>= 1.3.1) * make for all, test devel, test main, test main_loader, test omake, test quickstart, doc api-oasis, doc manual * ocamlmod for library base, library oasis, test main, test omake * ocamlify for library base, library oasis * ocamlbuild for library builtin-plugins * oUnit (>= 2.0.0) for library test-common, executable test-devel, executable test-main, executable test-omake, executable test-quickstart, executable test_loader * fileutils (>= 0.4.2) for library test-common, executable dist, executable oasis-dist, executable test-main, executable test-omake, executable test-quickstart, executable test_loader * pcre for library test-common, executable guess-cmx, executable oasis-announce * expect (>= 0.0.4) for executable test-quickstart * benchmark (>= 1.2) for executable bench * omake for test omake Installing ========== 1. Uncompress the source archive and go to the root of the package 2. Run 'ocaml setup.ml -configure' 3. Run 'ocaml setup.ml -build' 4. Run 'ocaml setup.ml -install' Uninstalling ============ 1. Go to the root of the package 2. Run 'ocaml setup.ml -uninstall' OASIS ===== OASIS is a program that generates a setup.ml file using a simple '_oasis' configuration file. The generated setup only depends on the standard OCaml installation: no additional library is required. oasis-0.4.11/HACKING.md0000644000175000017500000001356113261073606013635 0ustar gildorgildor Guidelines for developing OASIS =============================== ## Updates in the file `_oasis` for the project OASIS itself `_oasis` and `setup.ml` of the OASIS project need to be updated with the previously __released version__ of OASIS or the very same version being released. __You should never use the version of OASIS under development to update the setup.ml of the project__ The reason for that decision is that if you generate a new version of `setup.ml` using the version under development, each commit will include a change in `setup.ml` and it will be mostly a repetition of something you wrote elsewhere in your commit. Moreover, it can lead to conflict and it is never good to have to worry about conflicts (it has generated irreconcilable changes when the project was using darcs). Creating plugins ================ There are two kind of plugin: * oasis command line plugins (oasis-cli): they create subcommand for the command line interface of `oasis`. For example, the subcommand `oasis print-hello` is provided by the plugin `print-hello`. [Example](examples/plugins/oasis-plugin-print-hello) * oasis plugins (oasis): they are used in `_oasis`: these plugins help to process the content of an `_oasis` file and generates additional content in the target package. [Example](examples/plugins/oasis-plugin-versionfile), [Example usage](examples/plugins/with-plugin-versionfile) `oasis`'s plugin system uses findlib to detect plugins, so you must install plugins as a standard OCaml library with a META file. OASIS detects plugins when they have a field `plugin_system = "oasis"` or `plugin_system = "oasis-cli"` in their META file. Plugins are loaded as needed. You can ignore plugins with the command line options `-ignore-plugins`. 'oasis' plugins are loaded if they appears in a plugin field of an `_oasis` file. 'oasis-cli' plugins iare loaded when you invoke their name on the command line. Cut a release ============= * Check status on Jenkins([1][jenkins1], [2][jenkins2]), [Travis][travis] and [AppVeyor][appveyor]. * Run headache. * Update CHANGES.txt: * git log 0.4.2..HEAD >> CHANGES.txt * Date, first entry must be "Version X.Y.Z". * Major/Minor changes. * Features section. * Thanks section. * Create a [blog post][blog-post]. * See the [blog post example][blog-post-example] for content * Create a [news on the forge][forge-post]. * Subject: OASIS v0.4.2 release * Details: Read the full blog post here: URL of the blog post. * Change version in `_oasis`, drop the ~HEAD, rerun `oasis setup` and commit. * `make deploy` * Make sure the new version is X.Y.Z~HEAD and maybe rerun update. * Update Change Log in the Files section of forge: * Copy-paste last entry of CHANGES.txt, not including the first line (date...). * Don''t Merge lines of para. * Check 'Preserve my pre-formatted text.' * Check the result. * Add new version to trackers ([Bugs][bugs-version]/[Pull request][pull-version]). * Create an OPAM package using [oasis2opam][oasis2opam]. * Use the URL of the uploaded tarball. * Close all bugs in the CHANGES.txt on trackers ([1][bugs]). * Publish blog post with updated download links. * G+ announce as OASIS. * Reshare G+ post on OCaml community. * Send mail to caml-list, oasis-devel. [jenkins1]: https://deci.ovh.le-gall.net/job/oasis/ [jenkins2]: https://deci.ovh.le-gall.net/job/oasis-opam-build-revdeps/ [travis]: https://travis-ci.org/ocaml/oasis [appveyor]: https://ci.appveyor.com/project/gildor478/oasis [blog-post]: https://le-gall.net/sylvain+violaine/blog/admin/posts.php [blog-post-example]: http://le-gall.net/sylvain+violaine/blog/index.php?post/2014/10/23/Release-of-OASIS-0.4.5 [forge-post]: https://forge.ocamlcore.org/news/submit.php?group_id=54 [bugs-version]: https://github.com/ocaml/oasis/issues/new [pull-version]: https://github.com/ocaml/oasis/pulls [bugs]: https://github.com/ocaml/oasis/issues [oasis2opam]: https://github.com/ocaml/oasis2opam Versions support policy ======================= To help keep OASIS as widely usable as possible, we should be conservative about the minimum required version of our dependencies. Here are some policies, to determine what version of a dependency we should require: * For generated setup.ml: * No deps (standalone) except OCaml * OCaml version must be at least the one in Debian stable. * For generated files (e.g. myocamlbuild.ml): * Version of the target in Debian stable or that matches the constraint expressed in `_oasis`. E.g. if OCamlVersion: >= 4.01, we can generate myocamlbuild.ml for this specific version because the constraint will be checked at configure time. * For the OASIS sources: * OCaml version in Debian stable. * All deps must be in Debian stable. * Exception for related projects: ocamlmod, ocamlify, ocaml-data-notation * For the OASIS tests: * Version published, no strong requirement since tests can be disabled. Backwards compatibility ======================= OASIS supports the former version of OASISFormat. Most of the important things have been backported to former version. However in the long term we might decide to drop support of old OASISFormat. We will support a version of OASISFormat for as long as possible. However, we may drop support for any OASISFormat version older than the version of OASIS in Debian stable. For example: * Debian stable is released with OASIS `0.2.0` * We will continue to support OASISFormat: `0.1` as long as possible but, at some point we will enforce using at least OASISFormat: `0.2`. A list of supported OASISFormat can be found in OASISPackage_intern.ml. Debian relationship =================== We often use Debian, especially for version reference. OCaml support in Debian has a long history and we need to pick one reference. Since one of the upstream author is related to Debian, we made the decision to synchronize on Debian stable release. oasis-0.4.11/COPYING.txt0000644000175000017500000006546013261073606014125 0ustar gildorgildor As a special exception to the GNU Library General Public License, you may link, statically or dynamically, a "work that uses the Library" with a publicly distributed version of the Library to produce an executable file containing portions of the Library, and distribute that executable file under terms of your choice, without any of the additional requirements listed in clause 6 of the GNU Library General Public License. By "a publicly distributed version of the Library", we mean either the unmodified Library as distributed by upstream author, or a modified version of the Library that is distributed under the conditions defined in clause 3 of the GNU Library General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU Library General Public License. ----------------------------------------------------------------------- GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999 Copyright (C) 1991, 1999 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA of this license document, but changing it is not allowed. [This is the first released version of the Lesser GPL. It also counts as the successor of the GNU Library Public License, version 2, hence the version number 2.1.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Lesser General Public License, applies to some specially designated software packages--typically libraries--of the Free Software Foundation and other authors who decide to use it. You can use it too, but we suggest you first think carefully about whether this license or the ordinary General Public License is the better strategy to use in any particular case, based on the explanations below. When we speak of free software, we are referring to freedom of use, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish); that you receive source code or can get it if you want it; that you can change the software and use pieces of it in new free programs; and that you are informed that you can do these things. To protect your rights, we need to make restrictions that forbid distributors to deny you these rights or to ask you to surrender these rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link other code with the library, you must provide complete object files to the recipients, so that they can relink them with the library after making changes to the library and recompiling it. And you must show them these terms so they know their rights. We protect your rights with a two-step method: (1) we copyright the library, and (2) we offer you this license, which gives you legal permission to copy, distribute and/or modify the library. To protect each distributor, we want to make it very clear that there is no warranty for the free library. Also, if the library is modified by someone else and passed on, the recipients should know that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. ^L Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a restrictive license from a patent holder. Therefore, we insist that any patent license obtained for a version of the library must be consistent with the full freedom of use specified in this license. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License. This license, the GNU Lesser General Public License, applies to certain designated libraries, and is quite different from the ordinary General Public License. We use this license for certain libraries in order to permit linking those libraries into non-free programs. When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ordinary General Public License therefore permits such linking only if the entire combination fits its criteria of freedom. The Lesser General Public License permits more lax criteria for linking other code with the library. We call this license the "Lesser" General Public License because it does Less to protect the user's freedom than the ordinary General Public License. It also provides other free software developers Less of an advantage over competing non-free programs. These disadvantages are the reason we use the ordinary General Public License for many libraries. However, the Lesser license provides advantages in certain special circumstances. For example, on rare occasions, there may be a special need to encourage the widest possible use of a certain library, so that it becomes a de-facto standard. To achieve this, non-free programs must be allowed to use the library. A more frequent case is that a free library does the same job as widely used non-free libraries. In this case, there is little to gain by limiting the free library to free software only, so we use the Lesser General Public License. In other cases, permission to use a particular library in non-free programs enables a greater number of people to use a large body of free software. For example, permission to use the GNU C Library in non-free programs enables many more people to use the whole GNU operating system, as well as its variant, the GNU/Linux operating system. Although the Lesser General Public License is Less protective of the users' freedom, it does ensure that the user of a program that is linked with the Library has the freedom and the wherewithal to run that program using a modified version of the Library. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. ^L GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library or other program which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Lesser General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. ^L Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. ^L 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (1) uses at run time a copy of the library already present on the user's computer system, rather than copying library functions into the executable, and (2) will operate properly with a modified version of the library, if the user installs one, as long as the modified version is interface-compatible with the version that the work was made with. c) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. d) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. e) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the materials to be distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. ^L 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. ^L 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. ^L 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS ^L How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! oasis-0.4.11/CHANGES.txt0000644000175000017500000011110013261073606014044 0ustar gildorgildor2018-04-04 Sylvain Le Gall * Version 0.4.11 * Minor changes: * Fix quoting of parametrized plugin tags for ocamlbuild on Windows. (Closes: #122) * Reporting an error full-findlib name is empty. (Closes: #123) 2017-05-22 Sylvain Le Gall * Version 0.4.10 * Quick followup release to use OASIS 0.4.10 to generate the setup.ml because the setup.ml of OASIS 0.4.9 was generated with 0.4.8 that contains a bug. * New releases will be generated using the version released to catch earlier the kind of bug with destdir that has appeared in 0.4.8. (See [issue 1007](https://github.com/ocaml/oasis/issues/107)) 2017-05-20 Sylvain Le Gall * Version 0.4.9 * Major changes: * Plugin "omake": * Use correctly sorted internal library deps for OCAML_LIBS (Closes: #1736) * Delay the interpretation of $(CMXS_ENABLED) for the install suffixes. Also, take the environment variable "destdir" into account when installing data files. * Do not install the component modules of a packed library, but the packed module. (Close: #1737) * Solve ocamlmklib instability, re-enable test "OMake/Complex". (Closes: #1739) * Only link those libraries into executables that are really needed. (Closes: #1747). * Fix problems with the automatic addition of deps when building executables on platforms with case-insensitive file system. * Make OMake tests optional since it is complex to install OMake 0.10.2 with OPAM. * Minor changes: * Make sure --destdir is really used when installing (Closes: #107). * Try to register only when a glob pattern matches at least one file (#102) * Clean up setup.cmt after compiling setup.exe * By default, use Github for bug reporting (Closes: #97) * Simplify conditional expressions (Close: #95) * Document CLISubCommand.register, CLISubCommand.default_fspecs Thanks to Gerd Stolpmann, Christophe Troestler and Deokhwan Kim. 2016-12-06 Sylvain Le Gall * Version 0.4.8 * Major changes: * Fix various problems of parsing present in OASIS 0.4.7: * Only issue a warning when extraneous blanks are present. (Closes: #1665) * Fixes ocamlbuild plugin argument handling bug. (Closes: #1659) * Re-add MyOCamlbuildBase.env_filename. * Script to test reverse build depends (Closes: #1672). * Enable creation of OASIS plugin and OASIS command line plugin: * Add examples/plugins to demonstrate how to build plugins. * Update HACKING.md. * Ensure they work, using a test. * Plugin "omake": * Workaround for a problem in omake-0.9.8.6: variables accumulated via foreach cannot be private. * Passing the title string down to ocamldoc * Fix compilation of pack-level mli's. * Move definition of some variables in subdirectories to use them correctly (OCAMLINCLUDES, OCAMLPACKS and a few others) Thanks to Gerd Stolpmann for these contributions. * Improve CI/tests: * Split quickstart tests out of the main tests, because it fails too often and often need to be disabled. * Reorganize test/ directories. * Use OCaml 4.04 for Travis-CI. * Reorganize my CI scripts in src/tools/ci. * Get rid of ardivink and switch to OPAM for travis and jenkins builders. * Create 2 branches (opam/unstable and opam/testing) to provide pinning capabilities to OPAM: * It allows OPAM to track the development version of OASIS * Update information in README.md * Add a makefile target to allow to create opam/ in a local copy for testing a locally hacked version of OASIS. * Setup auto-generation of opam/unstable branch and auto-promotion of opam/unstable to opam/testing when integration tests have succeeded. * Minor changes: * Quick hack to solve #1674 and allow to use flambda, upstream notified of the problem. (Closes: #1674) * Use OASISFormat 0.4 for OASIS itself: * Use source_patterns feature to precisely locate .mlify files. * Use markdown to generate standard files. * Add BugReports to generated README in StdFiles. Thanks to Edwin Török, Yuri D. Lensky and Gerd Stolpmann for their contributions. 2016-08-21 Sylvain Le Gall * Version 0.4.7 * Drop support for OASISFormat 0.2 and 0.1. As per the version policy in HACKING.md, this change syncs with OASIS version in Debian. Debian Jessie has OASIS v0.4.4, so it is possible to drop support for older version. * Provide stable API in setup.ml using BaseCompat. This change introduces BaseCompat and opens by default the version matching OASISFormat in setup.ml. This allows to make changes to OASIS and still provides a stable API in setup.ml. The only side effect is that it requires to update the setup.ml of DynRun at every major version updates. Unfortunately, providing compatibility for ALL changes is an hard task. Users are welcome to file bugs whenever their customized setup.ml breaks because of an incompatible change. * Plugin "omake": This new plugin provides build, doc and install capabilities using OMake. Some features are not supported, like Object sections. It requires 'OCamlVersion: >= 4.01'. Example: OASISFormat: 0.4 OCamlVersion: >= 4.01 [...] BuildTools: omake BuildType: omake (0.4) Library simplelib [...] Document simplelib BuildTools+: ocamldoc [...] Thanks to Gerd Stolpmann for this huge contribution. * Create OASIFileSystem and use it in OASISContext.t.srcfs. The new module OASISFileSystem is a filesystem abstraction layer that allows to better represents (through types) where the files are (e.g. source or build directory). The very first use of it is to add in OASISContext.t as srcfs. The filesystem object is itself limited to only use OASISContext.source_filename, which allows to use types to enforce location of files. The various default_filename across the code are now typed according to their location (e.g. "setup.log" and "setup.data" are OASISContext.source_filename). The only way to actually open, read and write the corresponding file is to apply methods provided in OASISFileSystem object. This change also delays enough the evaluation of the location of "setup.log" and "setup.data", which solves the bug 1473. (Closes: #1473) * Improve automatic tests: * Use OPAM to install dependencies. * Use Travis to test and compile with all major OCaml version since 3.12.1 on Linux. * Use AppVeyor to compile on Cygwin. * Test for dynamic mode mode compilation on Cygwin with AppVeyor. * Rename test files to reflect what files they are testing. * Split test/data/TestFull/* tests to reflect what plugins/files they are testing. * Add some badges for build status on Travis and AppVeyor in README.md. * Test the parsing of examples/oasis/*.oasis files. * Check all examples are tested, add examples/ocamlbuild tests. * Check that all examples use the latest version of OASIS. * Disable test 'external source rebuild' which tends to be flaky. * Refactor TestFull to remove boilerplates and make it more readable. * Create a test function to check all subdirectories are listed and tested, add tests for the missing ones. * Reduce the number of skipped tests. * Refine constraint to produce .cmt to >=4.01. * Trim down the dependencies: * Stop depending on ocaml-data-notation and type_conv. * Create a trim down, internval version of ocaml-data-notation. The conversion functions need to be manually written -- not perfect but a good way to drop the dependency and still be compatible with OCaml 3.12.1. * Stop depending on ocaml-gettext, this was never really used. * Get rid of camlp4: * Replace most genlex parser, by standard yacc/lex parsers. * Replace OASISRecDescParser by OASISAst_parser using ocamlyacc. (Closes: #298) * The "flag(...)" in expression is now case sensitive, to avoid conflict with the "Flag ..." section. * Some parts still use Genlex, but don't need camlp4 anymore. * Trimming down the dependencies allows to make it easier to port OASIS on other platforms (like Windows) where some former dependencies were tricky to compile (like camlp4). * Stop using -install-lib-dir on Windows. This change prevents the use of -install-lib-dir on Windows, for OCaml version greater than 3.11.1. The bug in ocamlbuild has been fixed in OCaml 3.11.1 [1]. This is a bit a shot in the dark, since testing on Windows is not setup. [1]: https://github.com/ocaml/ocamlbuild/commit/79cf4029b * Minor changes: * Consistently use choices type in OASISExpr module. * Make OCamlbuild plugin not assume that dynamic linking is supported. (Patch: #1536) (Closes: #1251) * Improve setup.log parsing, by using Genlex. * Enforce using a published version of OASIS to generate its own setup.ml, provide explanations in HACKING.md. * Fix problem reading files on Cygwin (esp. setup.log), reported size after an append doesn't reflect the real size of the file in some cases. * Always compile src/tools/* and move dist.ml there. * Refactor string version comparison into its own sub-module. * Fix missing rules for headache. * Remove unused userconf library. * Pass -thread to C files as well. * Don't use $< in explicit DevFiles build rule (BSD make compatibility). * Example to override cc when compiling C source files. * Remove the need for Bytes altogether. * Add fields "Tags" and "BugReports" to export them to OPAM. * Big documentation cleanup (`\_oasis` synopsis, doc/*). * Reformat source files using ocp-indent and start to use merlin. * Allow to use a string when testing values in `\_oasis`, for example it is now possible to use expression like 'ocaml_version("4.02.1")' * Improve OASISVersion.comparator_reduce. Now, it transforms the given comparator into its disjunctive form and order the version number. * Rename all executables so that their names match OCaml policy for module. * Move all executables into their own directories to prevent dependencies leak. * Transform tools into executables. * Always compile executables to check they still work. * Features: * no_automatic_syntax (alpha): don't disable the -package injection logic. * compiled_setup_ml (alpha): * Fix the configure file when using the compiled_setup_ml feature and improve the Makefile. * Recompile when needed while executing the configure script. * findlib_directory (beta, new): Findlib allows to specify a "directory" in a META file. This can be used to store some files of the library in sub-directories. This change allows to set and use this "directory" field. The InternalInstall plugin now handles installing files in sub-directories. However there is no flag to specify this when using `ocamlfind install`, so we use a standard file installation, with a best-guess computation of the target directory. The META plugin can now set the "directory" field according to what has been set in the `_oasis` file. Note that, for nested package the install directory is relative to the install directory of the parent package. Example: BetaFeatures: findlib_directory Plugins: META(0.4) Library library [...] FindlibDirectory: lib Thanks to Gabriel Radanne for this contribution. (Closes: #1305) * findlib_extra_files (beta, new): This change allows to use a new `_oasis` field 'FindlibExtraFiles' to install extra files along the matching library/object in findlib. Example: BetaFeatures: findlib_extra_files Library library [...] FindlibName: foobar FindlibExtraFiles: myfile.txt In this case `myfile.txt` will be installed in the same directory as the 'foobar' package. Thanks to Evgenii Lepikhin for the contribution. (Closes: #802) * source_patterns (alpha, new): This change allows to override the built-in source files search. It uses user-provided 'InterfacePatterns' and 'ImplementationPatterns' fields and a small DSL to define how to find a file matching a given module. The fields can be defined at the top level or in the Library section. The DSL is based on Genlex and Buffer.add_substitute. It has two functions `capitalize_file` and `uncapitalize_file` and one variable `module`. Example: AlphaFeatures: source_patterns Library library [...] Modules: FooBar InterfacePatterns+: ${module}.eliomi ImplementationPatterns+: ${module}.eliom It is particularly useful to get rid of the warnings like: W: Cannot find source file matching module [...] Thanks to Petter Urkedal for this contribution. Thanks to Spiros Eliopoulos, Paul Snively, Jeremie Dimino, Christopher Zimmermann, Christophe Troestler, Max Mouratov, Jacques-Pascal Deplaix, Geoff Shannon, Simon Cruanes, Vladimir Brankov, Gabriel Radanne, Evgenii Lepikhin, Petter Urkedal, Gerd Stolpmann and Anton Bachin for their contributions. 2016-04-29 Sylvain Le Gall * Version 0.4.6 * Hotfix release for OCaml 4.03.0 (Closes: #1519). * Major changes: * Create patch functions to mimic the new String.lowercase_ascii, String.uppercase_ascii, String.capitalize_ascii and String.uncapitalize_ascii found in OCaml 4.03.0 * Disable tests depending on not yet buildable units with OCaml 4.03.0 (e.g. expect which depends on batteries, which doesn't yet compile) * Minimal version of OCaml is now 3.12.1. (Debian Wheezy version) 2014-10-22 Jacques-Pascal Deplaix * Version 0.4.5 * Major changes: * Build and install annotation files. * Use builtin bin_annot and annot tags. * Tag .mly files on the same basis as .ml and .mli files (required by menhir). * Remove 'program' constraint from C-dependencies. Currently, when a library has C-sources and e.g. an executable depends on that library, then changing the C-sources and running '-build' does not yield a rebuild of the library. By adding these dependencies (rather removing the constraint), it seems to work fine. * Minor changes: * Add tests tag if --enable-tests. * Remove ocaml 4.02 warnings. * Fix the automatic use of -syntax for OCamlVersion >= 3.12.1. * Use the right ocamlfind binary to get all supported packages. The name of the ocamlfind binary should be read from the configuration. This is especially useful when cross-compiling. * Features: * no_automatic_syntax (alpha): Disable the automatic inclusion of -syntax camlp4o for packages that matches the internal heuristic (if a dependency ends with a .syntax or is a well known syntax). * compiled_setup_ml (alpha): Fix a bug using multiple arguments to the configure script. Thanks to Christopher Zimmermann, Jerome Vouillon, Tomohiro Matsuyama and Christoph Höger for their pull requests and to help release this version. 2014-03-26 Sylvain Le Gall * Version 0.4.4 * Quick bug fix release: * Don't skip some "\n\n" in Makefile/META/myocamlbuild.ml/setup.ml. This bug makes `oasis setup` think that these files have changed even if they have just been regenerated. (Closes: #1382). 2014-03-25 Sylvain Le Gall * Version 0.4.3 * Major changes: * Added -remove switch to the setup-clean subcommand designed to remove unaltered generated files completely, rather than simply emptying their OASIS section. * Translate path of ocamlfind on Windows to be bash/win32 friendly. * Description is now parsed in a more structured text (para/verbatim). * Minor changes: * Give a more precise message when module name are wrong (Closes: #1236). * Prevent loop in transitive_closure computation (Closes: #1253). * Update HACKING.md to define how to do a release and add some version and backward compatibility requirements. * No timeout for ocaml-expect, to prevent flaky tests on slow architecture. * Prevent warnings from confusing the terminal, add some extra \n. * Force to use the ocamlfind define in configure. (Closes: #1360) * Add more descriptive message when indentation is wrong (Closes: #1295) * Features: * stdfiles_markdown (alpha): set default extension of StdFiles (AUTHORS, INSTALL, README) tp be '.md'. Use markdown syntax for standard files. Use comments that hides OASIS section and digest. This feature should help direct publishing on GitHub. * disable_oasis_section (alpha): it allows DisableOASISSection to be specified in the package with a list of expandable filenames given. Any generated file specified in this list doesn't get an OASIS section digest or comment headers and footers and is therefore regenerated each time oasis setup is run (and any changes made are lost). This feature is mainly intended for use with StdFiles so that, for example, INSTALL.txt and AUTHORS.txt (which often won't be modified) can have the extra comment lines removed. * compiled_setup_ml (alpha): allow to precompile setup.ml to speedup. Thanks to David Allsopp, Martin Keegan and Jacques-Pascal Deplaix for their pull requests and to help release this version. 2014-02-23 Sylvain Le Gall * Version 0.4.2 * Major changes: * Change BSD3 and BSD4 to BSD-3-clause and BSD-4-clause to comply with DEP5, add BSD-2-clause. BSD3 and BSD4 are still valid but marked as deprecated. More information: http://dep.debian.net/deps/dep5/#license-specification * Enhance .cmxs supports through the generation of .mldylib files. When one of the modules of a library has the name of the library, ocamlbuild tends to just transform this module into a .cmxs. Now, the use of a .mldylib fix that problem and the .cmxs really contains all modules of the library. * Refactor oasis.cli to be able to create subcommand plugins. * Exported modules starts now with CLI. * Display plugins in the manual. * Design so that it is possible to be thread-safe. * Try to minimize the number of functions. * Make better choice of name and API. * A subcommand plugin 'dist' to create tarball is in preparation, as a separate project. * Remove plugin-list subcommand, this command was limited and probably not used. A better alternative will appear in next version. * Sub-command setup-dev is now hidden and will soon be removed. * Minor changes: * Refactor ocamlbuild build plugin to have some features in doc plugin. XOCamlbuilExtraArgs and XOCamlbuildPluginTags are now available for Document. The flag '-use-ocamlfind' is set for doc and build plugin. * Reorganize the test/data directory, each toplevel test has now its dedicated subdirectory in test/data. * Start to work on better support of syntax extension: * Remove archive(syntax,{byte,native}) from the META, this was causing an issue when trying to compile. * Add an example that creates a syntax extension. * Add support for auto-guessing syntax_camlp4o when one of the syntax extension shipped with camlp4 is in a build depends. * Allow to include $(X) in CCOpt/CClib. This patch helps to enable variable susbtitution for flags. This allow to write a PostConfCommand script to insert this data in setup.data and have them back when running OCamlbuild. * Raise error when "true" or "false" are not spelled correctly. * Fix some warnings about "Field X is set but matcing plugin Z is not enabled." Thanks to Andrew Ferguson, Florent Monnier and Jacques-Pascal Deplaix for their pull requests and to help release this version. 2013-12-19 Sylvain Le Gall * Version 0.4.1 * Major changes: * Fix broken compilation with threads and OCaml >= 4.01 (Closes: #1358) * Minor changes: * Refactor plugins for command line interface. * Get rid of message 'field is set but no matching plugin' (Closes: #795, #1043). * Features: * dynrun_for_release (alpha): * The goal of this plugin is to allow creating release with a minimal setup.ml that uses '-setup-update dynamic'. * Refactor setup.ml to perform early checks. like looking for findlib and oasis.dynrun library and warns the user in case they cannot be found (early configure script). * Along setup.ml, Makefile and configure, also keep INSTALL.txt if StdFiles plugins is used to provide a readable list of package to install. * Addendum to 0.4.0 release: * Since 0.4.0 OASIS has a limited support to syntax extension. If in the list of BuildDepends, one of the library ends with ".syntax", OASIS will add the tag "syntax_camlp4o" to all files of this library. This new feature already covers some common case of using syntax extensions. 2013-12-13 Sylvain Le Gall * Version 0.4.0 * Major changes: * Migrate the source repository to https://github.com/ocaml/oasis * Fix a lot of code style issues (e.g. blank at the end of the line) and create a test to check that the style of generated files is correct. Some related tools has been fixed asi well, for the best formatting use ocamlmod >= 0.0.7 and ocaml-data-notation >= 0.0.10. * Port all tests to OUnit 2.0, which allows to run all tests faster. * Run some tests with a fake bytecode only setup, so that we can always check that bytecode and nativecode tests are passing. (Closes: #1306) * Fix a missing dependency on ocamlbuild package and inclusion of ocambuildlib.cma in builtin-plugins.cma. * Introduce a framework to create features. * Add fields AlphaFeatures and BetaFeatures to list the experimental features you want to use in your _oasis * Using AlphaFeatures and BetaFeatures is only allowed if OASISFormat is set to the latest OASIS version. There is no backward compatiblity for experimental features. For example, if you are using OASIS 0.4.X, OASISFormat must be set to 0.4. * AlphaFeatures represents features not fully completed that maybe very unstable, quickly evolving and even removed in future release. * BetaFeatures represents features almost finished that needs to mature a bit before being published. * See 'Features' section in this changelog to have a list of what features are available. * Minor changes: * Self compile during tests. * Apply patches found in vouillon/opam-android-repository. * Fix bug when a directory with the right name appears in the PATH. * Fix OASISPath_intern.fn_reader on Cygwin. * Fix suffix_program on Cygwin. * Fix the META generation when XMETAType: syntax. * Fix for installing .cmx files with packed libraries as required for cross-module inlining. * Fix bad location of .cmx generated along .cmxs. * Add GNU Affero GPL license * Add the wtfpl license * Fix typos, thanks to Hendrik Tews. * Locate "topfind" when using opam "system" compiler. * Fix issue (Closes: #1239) * Assume camlp4o when packages end in .syntax. * Make sure the right Findlib version is used with OCaml 4.0.0. * Fix strange split function in myocamlbuild (Closes: #1186) * Features: * section_object (beta): * Implement 'Object' section, thanks to Philippe Veber * pure_interface (alpha): * Support pure interface modules in libraries. * ocamlbuild_more_args (alpha): * Add field XOCamlbuildPluginTags to pass -plugin-tags to OCamlbuild * Add field XOCamlbuildExtraArgs to pass more args to OCamlbuild 2012-06-28 Sylvain Le Gall * Version 0.3.0 * EXTREMLY IMPORTANT changes (read this): * Fix bug with scanf %S@\n for ocaml 4.00. We were unfortunetaly using an undocumented tolerance of Scanf in the previous version. You should consider making new release using this version that fixed this. PACKAGES uploaded to oasis-db will be automatically "derived" before OCaml 4.00 release (i.e. oUnit v1.1.1 will be regenerated with this new version as oUnit v1.1.1~oasis1). PACKAGES not uploaded to oasis-db need to be regenerated. In order not to break 3rd party tools that consider a tarball constant, I recommend to create a new version. Thanks to INRIA OCaml team for synchronizing with us on this point. * Major changes: * Handle the field "Pack: true" to be able to create packed libraries. It also installs .mli files for documentation into the target directory. The pack option is only supported for "OASISFormat: 0.3", you will need to update the version of your _oasis file to match it. * Introduce --[enable|disable]-[tests|docs] to disable tests and docs at oasis level. It seems a very common pattern to have a "Flag tests" to turn off by default the tests. This is now define as a standard var and you should remove you previous "Flag tests" but you can continue to use "flag(tests)" where needed. You can now have the following example: ... Executable test_exec Install: false Build$: flag(tests) MainIs: testExec.ml BuildDepends: oUnit Test main Command: $test_exec TestTools: test_exec ... The "Run$: flag(tests)" is implicit for the section "Test main". The default value is "false" for tests. If all the executable for test are flagged correctly (Build$: flag(tests)), you'll get rid of the dependency on oUnit. It works the same for documentation, however the default is "true". (Closes: #866) * Allow to define interdependent flags In order to allow interdependent flags, we transform back lazy values into 'unit -> string' functions. This allows to change a flag value on the command line and to update all the dependent values. (Closes: #827, #938) * Deprecate the subcommand 'oasis setup-dev' in favor of 'oasis setup -setup-update {none|weak|dynamic}' It defines different ways to manage the auto-update of setup.ml: * 'none': this is the default mode, and the one you should use when distributing tarballs. No update are performed at al. * 'weak': the update is only triggered when something change in `_oasis`, we keep all files generated * 'dynamic': the content of 'setup.ml' is ultra small (<2kB) and we only keep a small 'setup.ml', 'Makefile' and 'configure'. The choice between 'weak' and 'dynamic' depends on your need with regard to VCS and to the presence of `oasis'. The 'weak' allow to checkout the project from VCS and be able to work on it, without the need of installing 'oasis' as long as you don't change the file '_oasis'. But it clutter your VCS history with changes to the build system each time you change something in '_oasis'. The 'dynamic' mode gives you no VCS history pollution but makes mandatory to have installed oasis libraries. * Don't copy executable in ocamlbuild Avoid copying executable to their real name. It helps to call ocamlbuild a single time for the whole build rather than calling it n time (n = number of executable sections) and copying resulting exec. This speeds up the build process because ocamlbuild doesn't have to compute/scan dependencies each time. The drawback is that you have to use $foo when you want to call "Executable foo", because $foo will be _build/.../main.byte. * Change the way we parse command line like option (CCOpt, CCLib and the like). We have implemented a real POSIX command line parser, except that variables are processed by Buffer.add_substitute (except if correctly escaped, using Buffer.add_substitute escaping). Example: CCOpt: -DEXTERNAL_EXP10 -L/sw/lib "-framework vecLib" Will be parsed correctly and outputed according to target OS. * Externalize ocamlmod in its own project, which become a dependencies. * Minimize the dependencies of the project. In order to ease building oasis, we have minimize the number of dependencies. You only need to install ocamlmod, ocamlify and ocaml-data-notation for a standard build without tests. Dependencies on pcre, extlib and ocamlgraph has been dropped. The remaining dependencies are hidden behind a flag "tests". * Implement proposal for handling plugin in META, using "plugin" extra directives oasis now produces .cmxs file by default and add them to META. Now a META looks like: ... archive(byte) = "oasis.cma" archive(byte, plugin) = "oasis.cma" archive(native) = "oasis.cmxa" archive(native, plugin) = "oasis.cmxs" ... This will ultimately help to generate automatically .cmxs for all oasis enabled projects. We hope that this new feature will improve dynamic linking use in OCaml (esp. for project like Ocsigen). * Other changes: * Produce only subcommands specific helps when asked (Closes: #783) * Use pager for long textual output (Closes: #782) * Give the help summary directly when running just "oasis" (Closes: #781) * Remove `pwd` filename prefix to avoid too long command line on Windows (Closes: #1007) * Install required .cmx when installing libraries (Closes: #686, #885) * Retain blanks at the beginning of line in freeform (Closes: #811) * Allow PreConfCommand to create setup.data with any variables inside (Closes: #823) * Allow to use setup.data in shell script and Makefile (Closes: #982) * Fix execute permissions (Closes: #980) * Drop extra version in ocaml version (Closes: #964, #888) * Always output info messages on stderr (Closes: #785) * Fix interversion in version comparator lexer (Closes: #808) * Document the fact that setup.data is mandatory (Closes: #946) * configure translates getopt command line to Arg (Closes: #778, #804) * Generate valid META when there are line breaks in synopsis (Closes: #933) * Keep owner of generated files (Closes: #793) * Set -I +threads for ocamlfind ocamldoc in ocamlbuild (Closes: #949) * Exclude VCS directories by default (Closes: #847) * Print the configure summary in the "normal" order. * Merge findlib virtual containers with the same name * Synchronize plugin data for section * Improve documentation * Verify validity of input when parsing in quickstart (Closes: #797) * Fix stack overflow when there are twice the same library (Closes: #1130) * Parse license examples for DEP5 specification (Closes: #1102) * Be ultra-liberal regarding version syntax (allow '_' and ' ' in the version). * Allow to add extra content to META files (XMETAExtraLines) * Allow to use executable name that contains "-" as a variable (replacing "-" by "_"). Thanks to Anil Madhavapeddy, Pierre Chambart, Christophe Troestler, Jeremie Dimino, Ronan Le Hy, Yaron Minsky and Till Varoquaux for their help with this release. Also thanks to all the testers of the numerous release candidates. This was a long work and each time a tester has downloaded oasis has helped me to know that I was working for someone. 2010-10-16 Sylvain Le Gall * Version 0.2.0 * Split the project into 3 libraries and one executable: * oasis: the core library * oasis.base: the runtime library * oasis.builtin-plugins: various plugins (ocamlbuild, internal, none, custom) * the executable 'oasis' in lowercase which was 'OASIS' before (Closes: #769) * Publish .mli and improve ocamldoc generated documentation (Closes: #667) * oasis library: * Ignore plugins even when parsing field * Allow to redirect messages through a function and use a context to avoid global variables. This is an OASIS-DB website requirement, but we fallback to a global variable in oasis.base * Use the same policy as Debian for version comparison (copied from dpkg) (Closes: #584) * Add MIT, CeCILL licenses and make unknown license less fatal (Closes: #710, #557) * Allow https, ftp, mailto, svn, svn+ssh for URL (Closes: #753) * Replace Str by Pcre * Don't modify package data structure through plugins, we just issue warnings and error when something is missing. This is compensated by a better 'quickstart' that can automatically complete required fields (e.g. it adds 'ocamlbuild' as a BuildDependency for 'ocamlbuild' plugin). (Closes: #552, #566) * Set default for test type to 'custom' plugin (Closes: #562) * Use a more simple lexer for _oasis (Closes: #579) * Warn if the use of '\t' to indent lines is inconsistent in an _oasis file (e.g. mix of ' ' and '\t') * Allow to use 'flag' as environment variables in _oasis (e.g. flag test can be used as Command: echo $test) (Closes: #619) * ADVANCED USERS: Create a new scheme to synchronize data between the property list used to parse and print an _oasis file and the data structure representing it. This is a first step to avoid carrying property lists inside the data structure. It should also allow to dump plugin data directly inside the data structure rather than having to do it "by hand". This allows to have a more complete quickstart support also (i.e. handling plugins directly). It also allows to manipulate the datastructures in a single place: with the scheme before you have to update the property list and the rest of the datastructure. (Closes: #705, #733) * oasis.base library: * Exit with an error code when tests fail * Don't account skipped test (Closes: #624) * Delegate the "setup-dev" actions to the executable 'oasis' rather than embedding it into setup.ml * Add a '-version' to setup.ml to know what version has generated the file (Closes: #692) * Add a '-all' target that does "-configure", "-build", "-doc" and "-test" in one run (Closes: #551) * Add a '-reinstall' target that 'uninstall' and 'install' (Closes: #568) * Use the right command to delete file on Windows * executable 'oasis': * Use a subcommand scheme, like subversion. For example, it replaces the former "OASIS -setup" by "oasis setup". Each subcommand can be a small plugin * Add a "query" subcommand to extract data of _oasis from command line (Closes: #691) * Add a "setup-clean" subcommand that removes generated files and helps cleaning OASIS_START/STOP section of their content (Closes: #564, #623, #563) * Add a "check" subcommend that checks _oasis files * Greatly improve the "quickstart" subcommand: * Take into account plugins in quickstart * Allow to have multiple choices for field Plugins in quickstart mode * Don't display help text at each question (Closes: #586) * Allow to create a doc (Closes: #633) * Allow to run a pager, editor or "oasis setup-dev" at the end (Closes: #580, #582) * Don't accept '?' as an answer in quickstart (Closes: #587) * Add examples and all available licenses in the help of License field (Closes: #559) * Keep generated files when 'oasis setup-dev' is called (Closes: #743) * Plugin "ocamlbuild": * Handle "Path: ." in generated _tags correctly (Closes: #570, #588) * Quick fix to handle .h files directly in CSources field * Include .mli in _tags (Closes: #572) * Pass -cclib and -dllpath options to ocamlmklib (Closes: #629) * Don't pass -dlllib and -dllpath options to ocamlopt (Closes: #628) * Plugin "internal": * Create parent directories when installing with InternalInstall (Closes: #555) * Don't install data when section is not built (Closes: #554, #556) * Plugin "META": * Add an exists_if field to generated META file (Closes: #694) 2010-04-08 Sylvain Le Gall * Initial version 0.1.0 oasis-0.4.11/AUTHORS.md0000644000175000017500000000033613261073606013712 0ustar gildorgildor Authors of oasis: * Sylvain Le Gall Current maintainers of oasis: * Sylvain Le Gall oasis-0.4.11/.travis.yml0000644000175000017500000000120713261073606014352 0ustar gildorgildorlanguage: c sudo: false addons: apt: sources: - avsm packages: - ocaml - ocaml-native-compilers - opam - texlive-latex-recommended branches: except: - opam/unstable - opam/testing script: bash -ex ./src/tools/ci/travis.bash env: - OPAM_SWITCH=system - OPAM_SWITCH=3.12.1 - OPAM_SWITCH=4.01.0 - OPAM_SWITCH=4.02.2 - OPAM_SWITCH=4.03.0 - OPAM_SWITCH=4.04.0 - OPAM_SWITCH=4.04.0+flambda cache: directories: - $HOME/.opam notifications: webhooks: urls: - https://webhooks.gitter.im/e/f47ff4ebe702f6acd4e0 on_success: always on_failure: always on_start: never oasis-0.4.11/.ocp-indent.conf0000644000175000017500000000004713261073606015227 0ustar gildorgildormatch_clause=2 with=2 align_ops=false oasis-0.4.11/.merlin0000644000175000017500000000024113261073606013525 0ustar gildorgildorS src/** S test/** B _build/src/** B _build/test/** PKG unix PKG oUnit PKG fileutils PKG findlib PKG expect PKG pcre PKG benchmark PKG ocamlbuild FLG -w +a-4-44 oasis-0.4.11/.gitignore0000644000175000017500000000031013261073606014223 0ustar gildorgildor*.byte *.native *.mo /_build/ /api-oasis.docdir /doc/MANUAL.mkd /setup.data /setup.log /src/cli/CLIPluginsLoaded.ml /src/oasis/OASISConf.ml /bindist /patches-to-apply /tarballs /test/oUnit.log /dist/