oasis-0.4.5/0000755000175000017500000000000012422026741012160 5ustar gildorgildoroasis-0.4.5/test/0000755000175000017500000000000012422026741013137 5ustar gildorgildoroasis-0.4.5/test/utils/0000755000175000017500000000000012422026741014277 5ustar gildorgildoroasis-0.4.5/test/utils/fake_ocamlfind.ml0000644000175000017500000000370312422026741017556 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 *) (******************************************************************************) (* 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.5/test/test.ml0000644000175000017500000001050112422026741014445 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 *) (******************************************************************************) (** Run tests for OASIS @author Sylvain Le Gall *) open OUnit2 open TestCommon 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">::: [ TestPropList.tests; TestOASIS.tests; TestVersion.tests; TestFileTemplate.tests; TestBasic.tests; TestFull.tests; TestMETA.tests; TestLog.tests; TestLicense.tests; TestValues.tests; TestQuery.tests; TestQuickstart.tests; TestDevFiles.tests; TestOCamlbuild.tests; TestSelfCompile.tests; TestStdFiles.tests; TestOASISText.tests; TestOASISString.tests; ]); extract_timings () oasis-0.4.5/test/ounit.conf0000644000175000017500000000005612422026741015145 0ustar gildorgildor# Disable long test (dev only). #long = false oasis-0.4.5/test/data/0000755000175000017500000000000012422026741014050 5ustar gildorgildoroasis-0.4.5/test/data/TestStdFiles/0000755000175000017500000000000012422026741016425 5ustar gildorgildoroasis-0.4.5/test/data/TestStdFiles/remove/0000755000175000017500000000000012422026741017722 5ustar gildorgildoroasis-0.4.5/test/data/TestStdFiles/remove/_oasis0000644000175000017500000000023612422026741021123 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.5/test/data/TestStdFiles/remove/README.txt.snd0000644000175000017500000000015412422026741022203 0ustar gildorgildorHeader line (* OASIS_START *) (* DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) *) (* OASIS_STOP *) oasis-0.4.5/test/data/TestStdFiles/remove/README.txt.fst0000644000175000017500000000042412422026741022213 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.5/test/data/TestStdFiles/remove/INSTALL.txt.fst0000644000175000017500000000150612422026741022366 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.5/test/data/TestStdFiles/remove/AUTHORS.txt.fst0000644000175000017500000000020012422026741022373 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: c059f06033422d4d358b297c74f106ff) *) Authors of remove David Allsopp (* OASIS_STOP *) oasis-0.4.5/test/data/TestStdFiles/oasis/0000755000175000017500000000000012422026741017543 5ustar gildorgildoroasis-0.4.5/test/data/TestStdFiles/oasis/foo.ml0000644000175000017500000000324612422026741020665 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestStdFiles/oasis/_oasis0000644000175000017500000000276312422026741020753 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/ 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.5/test/data/TestStdFiles/oasis/README.md.exp0000644000175000017500000000255412422026741021623 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/) 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.5/test/data/TestStdFiles/oasis/INSTALL.md.exp0000644000175000017500000000163512422026741021773 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.5/test/data/TestStdFiles/oasis/AUTHORS.md.exp0000644000175000017500000000033712422026741022010 0ustar gildorgildor Authors of oasis: * Sylvain Le Gall Current maintainers of oasis: * Sylvain Le Gall oasis-0.4.5/test/data/TestQuery/0000755000175000017500000000000012422026741016015 5ustar gildorgildoroasis-0.4.5/test/data/TestQuery/test10.oasis0000644000175000017500000000052712422026741020201 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestQuery/test1.oasis0000644000175000017500000000222112422026741020112 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestOCamlbuild/0000755000175000017500000000000012422026741016723 5ustar gildorgildoroasis-0.4.5/test/data/TestOCamlbuild/use-ocamlfind/0000755000175000017500000000000012422026741021451 5ustar gildorgildoroasis-0.4.5/test/data/TestOCamlbuild/use-ocamlfind/_oasis0000644000175000017500000000074412422026741022656 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.5/test/data/TestOCamlbuild/use-ocamlfind/A.ml0000644000175000017500000000324612422026741022170 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOCamlbuild/set-ocamlfind/0000755000175000017500000000000012422026741021450 5ustar gildorgildoroasis-0.4.5/test/data/TestOCamlbuild/set-ocamlfind/main.ml0000644000175000017500000000324612422026741022733 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOCamlbuild/set-ocamlfind/_oasis0000644000175000017500000000045012422026741022647 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.5/test/data/TestOCamlbuild/missing-source/0000755000175000017500000000000012422026741021672 5ustar gildorgildoroasis-0.4.5/test/data/TestOCamlbuild/missing-source/_oasis0000644000175000017500000000027112422026741023072 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.5/test/data/TestOCamlbuild/missing-source/C.ml0000644000175000017500000000324612422026741022413 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOCamlbuild/missing-source/B.mli0000644000175000017500000000324612422026741022563 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOCamlbuild/missing-source/A.ml0000644000175000017500000000324612422026741022411 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOCamlbuild/external-c-rebuild/0000755000175000017500000000000012422026741022411 5ustar gildorgildoroasis-0.4.5/test/data/TestOCamlbuild/external-c-rebuild/header.h0000644000175000017500000000351412422026741024015 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 */ /********************************************************************************/ #include #include #include #include #include oasis-0.4.5/test/data/TestOCamlbuild/external-c-rebuild/c_source.c0000644000175000017500000000362712422026741024367 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 */ /********************************************************************************/ #include "header.h" CAMLprim value oasis_c_build_test_foo(value x) { CAMLparam1(x); CAMLreturn(Val_int(42)); } oasis-0.4.5/test/data/TestOCamlbuild/external-c-rebuild/_oasis0000644000175000017500000000063512422026741023615 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.5/test/data/TestOCamlbuild/external-c-rebuild/B.ml0000644000175000017500000000330512422026741023125 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 A let () = exit (foo 42) oasis-0.4.5/test/data/TestOCamlbuild/external-c-rebuild/A.ml0000644000175000017500000000333412422026741023126 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 *) (******************************************************************************) external foo : int -> int = "oasis_c_build_test_foo" oasis-0.4.5/test/data/TestOCamlbuild/env-tags/0000755000175000017500000000000012422026741020447 5ustar gildorgildoroasis-0.4.5/test/data/TestOCamlbuild/env-tags/myocamlbuild.ml0000644000175000017500000000371312422026741023466 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 *) (******************************************************************************) (* 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.5/test/data/TestOCamlbuild/env-tags/_oasis0000644000175000017500000000042012422026741021643 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.5/test/data/TestOCamlbuild/env-tags/A.ml0000644000175000017500000000324612422026741021166 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOASIS/0000755000175000017500000000000012422026741015566 5ustar gildorgildoroasis-0.4.5/test/data/TestOASIS/test9.oasis0000644000175000017500000000102012422026741017667 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/test8.oasis0000644000175000017500000000062512422026741017700 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/test7.oasis0000644000175000017500000000070112422026741017672 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/test6.oasis0000644000175000017500000000027512422026741017677 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Homepage: http://toto-acme.org oasis-0.4.5/test/data/TestOASIS/test5.oasis0000644000175000017500000000023212422026741017667 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall oasis-0.4.5/test/data/TestOASIS/test4.oasis0000644000175000017500000000101312422026741017664 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestOASIS/test3.oasis0000644000175000017500000000074512422026741017676 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestOASIS/test2.oasis0000644000175000017500000000073612422026741017675 0ustar gildorgildor Name: Stuff Version: 1.2.3.0 OASISFormat: 0.1 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.5/test/data/TestOASIS/test16.oasis0000644000175000017500000001142612422026741017760 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.5/test/data/TestOASIS/test15.oasis0000644000175000017500000000536112422026741017760 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/test14.oasis0000644000175000017500000000105212422026741017750 0ustar gildorgildorOASISFormat: 0.2 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.5/test/data/TestOASIS/test13.oasis0000644000175000017500000000034312422026741017751 0ustar gildorgildorOASISFormat: 0.2 Name: foo Version: 0.0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall Library test1 FindlibName: test Path: src/ Pack: true oasis-0.4.5/test/data/TestOASIS/test12.oasis0000644000175000017500000000071512422026741017753 0ustar gildorgildor# Bug 811 OASISFormat: 0.2 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.5/test/data/TestOASIS/test11.oasis0000644000175000017500000000050012422026741017742 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestOASIS/test10.oasis0000644000175000017500000000052712422026741017752 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestOASIS/test1.oasis0000644000175000017500000000222112422026741017663 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestOASIS/test-freeform.oasis0000644000175000017500000000040112422026741021403 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/src/0000755000175000017500000000000012422026741016355 5ustar gildorgildoroasis-0.4.5/test/data/TestOASIS/src/toto.ml0000644000175000017500000000324612422026741017701 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOASIS/src/stuff/0000755000175000017500000000000012422026741017504 5ustar gildorgildoroasis-0.4.5/test/data/TestOASIS/src/stuff/META0000644000175000017500000000324612422026741020162 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 # ################################################################################ oasis-0.4.5/test/data/TestOASIS/src/stuff/C.ml0000644000175000017500000000324612422026741020225 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOASIS/src/stuff/B.mli0000644000175000017500000000324612422026741020375 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOASIS/src/stuff/A.ml0000644000175000017500000000324612422026741020223 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestOASIS/comment-in-field.oasis0000644000175000017500000000034312422026741021755 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/bug571.oasis0000644000175000017500000000064612422026741017646 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/bug1295.oasis0000644000175000017500000000134412422026741017726 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestOASIS/bug1239.oasis0000644000175000017500000000073712422026741017731 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.5/test/data/TestOASIS/bug1236.oasis0000644000175000017500000000045412422026741017722 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.5/test/data/TestOASIS/LICENSE0000644000175000017500000000325312422026741016576 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 * ******************************************************************************** toto oasis-0.4.5/test/data/TestFull/0000755000175000017500000000000012422026741015612 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/with-cclib/0000755000175000017500000000000012422026741017637 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/with-cclib/src/0000755000175000017500000000000012422026741020426 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/with-cclib/src/test_compile.ml0000644000175000017500000000335312422026741023453 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 *) (******************************************************************************) let s = "test" let _ = Stringprep.caml_stringprep_xmpp_nodeprep s oasis-0.4.5/test/data/TestFull/with-cclib/src/stringprep_stubs.c0000644000175000017500000000414612422026741024214 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 */ /********************************************************************************/ #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.5/test/data/TestFull/with-cclib/src/stringprep.ml0000644000175000017500000000340112422026741023153 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 *) (******************************************************************************) external caml_stringprep_xmpp_nodeprep: string -> int = "caml_stringprep_xmpp_nodeprep" oasis-0.4.5/test/data/TestFull/with-cclib/_oasis0000644000175000017500000000077212422026741021045 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/ver0.3/0000755000175000017500000000000012422026741016627 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/ver0.3/touch.ml0000644000175000017500000000336412422026741020311 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 *) (******************************************************************************) let () = Arg.parse [] (fun fn -> close_out (open_out fn)) "foo" oasis-0.4.5/test/data/TestFull/ver0.3/_oasis0000644000175000017500000000047212422026741020032 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.5/test/data/TestFull/recurselib/0000755000175000017500000000000012422026741017751 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/recurselib/src/0000755000175000017500000000000012422026741020540 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/recurselib/src/binary.ml0000644000175000017500000000324612422026741022363 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/recurselib/_oasis0000644000175000017500000000032312422026741021147 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.5/test/data/TestFull/no-install-doc/0000755000175000017500000000000012422026741020435 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/no-install-doc/_oasis0000644000175000017500000000036412422026741021640 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/flag-ccopt/0000755000175000017500000000000012422026741017631 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/flag-ccopt/_oasis0000644000175000017500000000062512422026741021034 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/flag-ccopt/A.ml0000644000175000017500000000324612422026741020350 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/dynrun_for_release/0000755000175000017500000000000012422026741021477 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/dynrun_for_release/foo.ml0000644000175000017500000000330312422026741022613 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 *) (******************************************************************************) let () = prerr_endline "Foo" oasis-0.4.5/test/data/TestFull/dynrun_for_release/_oasis0000644000175000017500000000050712422026741022701 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.5/test/data/TestFull/dynlink/0000755000175000017500000000000012422026741017262 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/dynlink/main.ml0000644000175000017500000000370712422026741020547 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 *) (******************************************************************************) 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.5/test/data/TestFull/dynlink/entry_point.ml0000644000175000017500000000327212422026741022172 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 *) (******************************************************************************) let counter = ref 0 oasis-0.4.5/test/data/TestFull/dynlink/dyn_loaded_ext.ml0000644000175000017500000000331012422026741022573 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 *) (******************************************************************************) let () = incr Entry_point.counter oasis-0.4.5/test/data/TestFull/dynlink/dyn_loaded.ml0000644000175000017500000000331012422026741021713 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 *) (******************************************************************************) let () = incr Entry_point.counter oasis-0.4.5/test/data/TestFull/dynlink/_oasis0000644000175000017500000000132412422026741020462 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.5/test/data/TestFull/dev/0000755000175000017500000000000012422026741016370 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/dev/main.ml0000644000175000017500000000324612422026741017653 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/dev/_tags0000644000175000017500000000332512422026741017413 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 # ################################################################################ # OASIS_START # OASIS_STOP "A.ml": pkg_oUnit oasis-0.4.5/test/data/TestFull/dev/_oasis.v20000644000175000017500000000051012422026741020112 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/dev/_oasis.v10000644000175000017500000000044012422026741020113 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/dev/A.ml0000644000175000017500000000326312422026741017106 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 *) (******************************************************************************) let () = () oasis-0.4.5/test/data/TestFull/customdoc/0000755000175000017500000000000012422026741017612 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/customdoc/_oasis0000644000175000017500000000070112422026741021010 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/customdoc/Makefile0000644000175000017500000000335212422026741021255 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 # ################################################################################ all: doc: ocamldoc -html A.ml doc-clean: $(RM) *.html style.css oasis-0.4.5/test/data/TestFull/customdoc/A.ml0000644000175000017500000000324612422026741020331 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/create-parent-dir/0000755000175000017500000000000012422026741021120 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/create-parent-dir/_oasis0000644000175000017500000000045512422026741022324 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/bugClib/0000755000175000017500000000000012422026741017161 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bugClib/src/0000755000175000017500000000000012422026741017750 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bugClib/src/fooC.c0000644000175000017500000000332012422026741021000 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 */ /********************************************************************************/ oasis-0.4.5/test/data/TestFull/bugClib/src/bar.ml0000644000175000017500000000324612422026741021053 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/bugClib/foo.ml0000644000175000017500000000324612422026741020303 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/bugClib/_oasis0000644000175000017500000000076112422026741020365 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.5/test/data/TestFull/bug982/0000755000175000017500000000000012422026741016632 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug982/test-setup-data.sh0000755000175000017500000000340612422026741022220 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e . "./setup.data" set -x test "x$ocamlc" != "x" make -f Makefile.setup-data oasis-0.4.5/test/data/TestFull/bug982/_oasis0000644000175000017500000000037112422026741020033 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/bug982/Makefile.setup-data0000644000175000017500000000333112422026741022340 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 # ################################################################################ include setup.data all: test "x$(ocamlc)" != "x" oasis-0.4.5/test/data/TestFull/bug982/A.ml0000644000175000017500000000330712422026741017347 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 *) (******************************************************************************) let () = print_endline "coucou" oasis-0.4.5/test/data/TestFull/bug938/0000755000175000017500000000000012422026741016633 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug938/postconf.sh0000755000175000017500000000347312422026741021034 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ 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.5/test/data/TestFull/bug938/_oasis0000644000175000017500000000063312422026741020035 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/bug823/0000755000175000017500000000000012422026741016624 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug823/preconf.sh0000755000175000017500000000340512422026741020621 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e echo 'myvar="true"' >> setup.data echo 'ocamlopt="myocamlopt"' >> setup.data oasis-0.4.5/test/data/TestFull/bug823/postconf.sh0000755000175000017500000000346512422026741021026 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e . ./setup.data set -x echo "testing ocamlopt" test "$ocamlopt" = "myocamlopt" echo "testing myvar" test "$myvar" = "true" oasis-0.4.5/test/data/TestFull/bug823/_oasis0000644000175000017500000000027112422026741020024 0ustar gildorgildorOASISFormat: 0.1 Name: test Version: 0 Synopsis: test Authors: me License: GPL BuildTools: ocamlbuild PreConfCommand: ./preconf.sh PostConfCommand: ./postconf.sh oasis-0.4.5/test/data/TestFull/bug791/0000755000175000017500000000000012422026741016630 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug791/test/0000755000175000017500000000000012422026741017607 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug791/test/C.ml0000644000175000017500000000325512422026741020330 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 B oasis-0.4.5/test/data/TestFull/bug791/src/0000755000175000017500000000000012422026741017417 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug791/src/lib/0000755000175000017500000000000012422026741020165 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug791/src/lib/B.ml0000644000175000017500000000324612422026741020705 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/bug791/src/A.ml0000644000175000017500000000324612422026741020136 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/bug791/_oasis0000644000175000017500000000056512422026741020036 0ustar gildorgildorOASISFormat: 0.2 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.5/test/data/TestFull/bug738/0000755000175000017500000000000012422026741016631 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug738/src/0000755000175000017500000000000012422026741017420 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug738/src/foo.bar0000644000175000017500000000003612422026741020670 0ustar gildorgildorprint_endline "Hello, world!" oasis-0.4.5/test/data/TestFull/bug738/myocamlbuild.ml0000644000175000017500000000376212422026741021654 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 *) (******************************************************************************) (* 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.5/test/data/TestFull/bug738/_oasis0000644000175000017500000000036412422026741020034 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/bug623/0000755000175000017500000000000012422026741016622 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug623/_oasis0000644000175000017500000000021612422026741020021 0ustar gildorgildorOASISFormat: 0.1 Name: bug623 Version: 0 Synopsis: Test bug 623 Authors: Me License: GPL Test "false" Command: toto oasis-0.4.5/test/data/TestFull/bug619/0000755000175000017500000000000012422026741016627 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug619/_oasis0000644000175000017500000000026212422026741020027 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/bug588/0000755000175000017500000000000012422026741016634 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug588/test.ml0000644000175000017500000000327712422026741020156 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 *) (******************************************************************************) let () = Libtest.run () oasis-0.4.5/test/data/TestFull/bug588/libtest.ml0000644000175000017500000000335112422026741020636 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 *) (******************************************************************************) let run () = print_endline "hello" let q = BITSTRING { 1l: 32 } oasis-0.4.5/test/data/TestFull/bug588/_tags_manual0000644000175000017500000000333612422026741021216 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 # ################################################################################ # OASIS_START # OASIS_STOP "libtest.ml": syntax_camlp4o oasis-0.4.5/test/data/TestFull/bug588/_tags0000644000175000017500000000457112422026741017663 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 5b1ccfe1efab257ed52320784ce5b5da) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process <**/.svn>: -traverse <**/.svn>: not_hygienic ".bzr": -traverse ".bzr": not_hygienic ".hg": -traverse ".hg": not_hygienic ".git": -traverse ".git": not_hygienic "_darcs": -traverse "_darcs": not_hygienic # Library libtest "libtest.cmxs": use_libtest # Executable test "test.byte": use_libtest "test.byte": pkg_bitstring.syntax "test.byte": pkg_bitstring <*.ml{,i}>: use_libtest <*.ml{,i}>: pkg_bitstring.syntax <*.ml{,i}>: pkg_bitstring # OASIS_STOP "libtest.ml": syntax_camlp4o oasis-0.4.5/test/data/TestFull/bug588/_oasis0000644000175000017500000000114312422026741020033 0ustar gildorgildorOASISFormat: 0.1 Name: test Version: 0.0.1 Synopsis: test OASIS Authors: ygrek License: BSD3 BuildTools: ocamlbuild Library libtest Path: . Install: false Modules: Libtest BuildDepends: bitstring.syntax, bitstring 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.5/test/data/TestFull/bug571/0000755000175000017500000000000012422026741016624 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug571/_oasis0000644000175000017500000000064612422026741020032 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/bug571/A.ml0000644000175000017500000000340612422026741017341 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 OUnit2 open Big_int let () = let _ = Big_int.big_int_of_string "1234" in () oasis-0.4.5/test/data/TestFull/bug1358/0000755000175000017500000000000012422026741016710 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug1358/foo.ml0000644000175000017500000000326212422026741020030 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 Thread oasis-0.4.5/test/data/TestFull/bug1358/_oasis0000644000175000017500000000043412422026741020111 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.5/test/data/TestFull/bug1239/0000755000175000017500000000000012422026741016706 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/bug1239/_oasis0000644000175000017500000000073712422026741020115 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.5/test/data/TestFull/1level/0000755000175000017500000000000012422026741017002 5ustar gildorgildoroasis-0.4.5/test/data/TestFull/1level/main.ml0000644000175000017500000000324612422026741020265 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 *) (******************************************************************************) oasis-0.4.5/test/data/TestFull/1level/_oasis0000644000175000017500000000116512422026741020205 0ustar gildorgildorOASISFormat: 0.1 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.5/test/data/TestFull/1level/A.ml0000644000175000017500000000326312422026741017520 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 OUnit2 oasis-0.4.5/test/data/TestFileTemplate/0000755000175000017500000000000012422026741017263 5ustar gildorgildoroasis-0.4.5/test/data/TestFileTemplate/filetemplate5.txt-exp0000644000175000017500000000013612422026741023356 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: 49d02d55ad10973b7b9d0dc9eba7fdf0) tata # OASIS_STOP oasis-0.4.5/test/data/TestFileTemplate/filetemplate4.txt-exp0000644000175000017500000000013112422026741023350 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP oasis-0.4.5/test/data/TestFileTemplate/filetemplate3.txt-exp0000644000175000017500000000014112422026741023350 0ustar gildorgildor toto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP tata oasis-0.4.5/test/data/TestFileTemplate/filetemplate3.txt0000644000175000017500000000005012422026741022555 0ustar gildorgildor toto # OASIS_START # OASIS_STOP tata oasis-0.4.5/test/data/TestFileTemplate/filetemplate2.txt-exp0000644000175000017500000000013212422026741023347 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP oasis-0.4.5/test/data/TestFileTemplate/filetemplate2.txt0000644000175000017500000000002412422026741022555 0ustar gildorgildortoto # OASIS_START oasis-0.4.5/test/data/TestFileTemplate/filetemplate1.txt-exp0000644000175000017500000000001012422026741023341 0ustar gildorgildor toto oasis-0.4.5/test/data/TestFileTemplate/filetemplate1.txt0000644000175000017500000000001012422026741022547 0ustar gildorgildor toto oasis-0.4.5/test/data/TestDevFiles/0000755000175000017500000000000012422026741016411 5ustar gildorgildoroasis-0.4.5/test/data/TestDevFiles/test-devfiles1.oasis0000644000175000017500000000056112422026741022312 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 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.5/test/data/TestDevFiles/compiled_setup_ml/0000755000175000017500000000000012422026741022115 5ustar gildorgildoroasis-0.4.5/test/data/TestDevFiles/compiled_setup_ml/foo.ml0000644000175000017500000000330312422026741023231 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 *) (******************************************************************************) let () = prerr_endline "Foo" oasis-0.4.5/test/data/TestDevFiles/compiled_setup_ml/_oasis0000644000175000017500000000047212422026741023320 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.5/test/data/TestBasic/0000755000175000017500000000000012422026741015731 5ustar gildorgildoroasis-0.4.5/test/data/TestBasic/dir.data0000644000175000017500000000002012422026741017332 0ustar gildorgildorbindir = "toto" oasis-0.4.5/test/TestVersion.ml0000644000175000017500000001041312422026741015755 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 *) (******************************************************************************) (** 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; ]); "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; "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 -> let str = ">= 1.0 && <= 2.0 || = 3.0" in 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'); ] oasis-0.4.5/test/TestValues.ml0000644000175000017500000000775112422026741015602 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 *) (******************************************************************************) (** 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 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 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 test_ctxt -> 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.5/test/TestStdFiles.ml0000644000175000017500000001162612422026741016054 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 *) (******************************************************************************) (** 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 = "TestStdFiles" >::: [ "markdown" >:: (fun test_ctxt -> (* Parse string to get OASIS package *) let dn = in_testdata_dir test_ctxt ["TestStdFiles"; "oasis"] in let pkg = OASISParse.from_file ~ctxt:oasis_ctxt (Filename.concat dn OASISParse.default_oasis_fn) in let ctxt, _ = with_bracket_chdir test_ctxt dn (fun test_ctxt -> 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 ["TestStdFiles"; "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.5/test/TestSelfCompile.ml0000644000175000017500000001035112422026741016533 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 *) (******************************************************************************) (* 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 (* List all files that should be copied. *) let is_ignored = let ignore_dot_git fn' = OASISString.starts_with ~what:(in_src_dir ".git") fn' in let rlst = ref [ignore_dot_git] in let chn = open_in (in_src_dir ".gitignore") in let () = try while true do let fn = in_src_dir (input_line chn) in let test fn' = if Sys.file_exists fn && Sys.is_directory fn then OASISString.starts_with ~what:fn fn' else fn = fn' in rlst := test :: !rlst done; with End_of_file -> () in close_in chn; fun fn -> List.exists (fun test -> test fn) !rlst in 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.5/test/TestQuickstart.ml0000644000175000017500000003551412422026741016473 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 *) (******************************************************************************) (** 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 e -> failwith "'oasis setup' failed but 'oasis check' succeed" end; let pkg = OASISParse.from_file ~ctxt:oasis_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 "Quickstart" >::: (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 (cs, bs, 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", ""; "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", ""; "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]); ] oasis-0.4.5/test/TestQuery.ml0000644000175000017500000000665512422026741015452 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 *) (******************************************************************************) (** 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"]; "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\ \nTest(main).Run\ \nTest(main).Type\ \nTest(main).TestTools\ \nFlag(test).Description"] ]) oasis-0.4.5/test/TestPropList.ml0000644000175000017500000000462412422026741016113 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 *) (******************************************************************************) (** 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.5/test/TestOCamlbuild.ml0000644000175000017500000002027012422026741016345 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 FileUtil open OUnit2 open TestCommon open OASISPlugin open OASISFileTemplate open TestFullUtils let tests = "Plugin OCamlbuild" >::: [ "missing-source" >:: (fun test_ctxt -> let dn = in_testdata_dir test_ctxt ["TestOCamlbuild"; "missing-source"] in let fn = Filename.concat dn OASISParse.default_oasis_fn in let pkg = OASISParse.from_file ~ctxt:oasis_ctxt fn in let ctxt, _ = with_bracket_chdir test_ctxt dn (fun test_ctxt -> 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."); "set-ocamlfind" >:: (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 ["TestOCamlbuild"; "set-ocamlfind"]) in let () = skip_if (OASISVersion.version_compare_string 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 -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestOCamlbuild"; "use-ocamlfind"]) in 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 *) "external source rebuild" >:: (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 ["TestOCamlbuild"; "external-c-rebuild"]) (* contain c-source code here to avoid any problems with aborted evaluation *) and code_a = "#include \"header.h\" CAMLprim value oasis_c_build_test_foo(value x) { CAMLparam1(x); CAMLreturn(Val_int(42)); }" and code_b = "#include \"header.h\" CAMLprim value oasis_c_build_test_foo(value x) { CAMLparam1(x); CAMLreturn(Val_int(23)); }" in let c_source = (in_src_dir t "c_source.c") in oasis_setup test_ctxt t; ( let c = open_out c_source in Printf.fprintf c "%s\n" code_a ; close_out c ); 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 *) ( let c = open_out c_source in Printf.fprintf c "%s\n" code_b ; close_out c ) ; (* 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 -> let t = setup_test_directories test_ctxt ~is_native:(is_native test_ctxt) ~native_dynlink:(native_dynlink test_ctxt) (in_testdata_dir test_ctxt ["TestOCamlbuild"; "env-tags"]) in 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))) ] oasis-0.4.5/test/TestOASISText.ml0000644000175000017500000000631412422026741016060 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 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.5/test/TestOASISString.ml0000644000175000017500000000435212422026741016402 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 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.5/test/TestOASIS.ml0000644000175000017500000003713412422026741015217 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 *) (******************************************************************************) (** Tests for OASIS @author Sylvain Le Gall *) open OUnit2 open TestCommon open OASISTypes open OASISParse open OASISRecDescParser open OASISValues open OASISVersion open OASISExpr 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 (fn, test) = let pkg = from_file ~ctxt:oasis_ignore_plugin_ctxt fn in test pkg in let test_file_of_vector (fn, test) = fn >:: (fun test_ctxt -> check_one (in_testdata_dir test_ctxt ["TestOASIS"; fn], test)) in let test_value_parser_of_vector (str, value_parse, fail) = str >:: (fun test_ctxt -> try ( let _s: comparator = value_parse 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 -> 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 ~ctxt:oasis_ctxt, 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) ); ]) @ [ "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 (fn, ignore)) lst_examples); "SinceVersion" >:: (fun test_ctxt -> assert_raises ~msg:"Pack is supported only in 0.3" (Failure "Field Pack in Library test1 is only valid since \ OASIS v0.3, update OASISFormat field from \ '0.2' to '0.3' after checking OASIS changelog.") (fun () -> let _pkg = from_file ~ctxt:oasis_ignore_plugin_ctxt (in_testdata_dir test_ctxt ["TestOASIS"; "test13.oasis"]) in ())); "test15.oasis" >:: (fun test_ctxt -> try let _pkg: OASISTypes.package = from_file ~ctxt:oasis_ignore_plugin_ctxt (in_testdata_dir test_ctxt ["TestOASIS"; "test13.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_ignore_plugin_ctxt (in_testdata_dir test_ctxt ["TestOASIS"; "bug1236.oasis"]) in ())); "bug1295.oasis" >:: (fun test_ctxt -> assert_raises ~msg:"Unexpected indentation line 17." (Failure "Unexpected indentation line 17.") (fun () -> let _pkg = from_file ~ctxt:oasis_ignore_plugin_ctxt (in_testdata_dir test_ctxt ["TestOASIS"; "bug1295.oasis"]) in ())); ] ] oasis-0.4.5/test/TestMETA.ml0000644000175000017500000002007312422026741015061 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 *) (******************************************************************************) (** 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 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.1 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.1 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.1 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.1 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.5/test/TestLog.ml0000644000175000017500000000605612422026741015061 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 *) (******************************************************************************) (** BaseLog tests @author Sylvain Le Gall *) open OUnit2 open TestCommon open BaseLog let tests = let test_of_vector (nm, f) = nm >:: (* TODO: depends on chdir! *) (fun test_ctxt -> let () = bracket ignore (fun () test_ctxt -> FileUtil.rm [BaseLog.default_filename]) test_ctxt in f ()) in let assert_equal_log msg exp = assert_equal ~msg ~printer:(fun lst -> String.concat ", " (List.map (fun (e, d) -> Printf.sprintf "%S %S" e d) lst)) exp (load ()) in "BaseLog" >::: (List.map test_of_vector [ "normal", (fun () -> register "toto" "mytoto"; assert_bool "Event toto exists" (exists "toto" "mytoto"); unregister "toto" "mytoto"; assert_bool "Event toto doesn't exist" (not (exists "toto" "mytoto"))); "double", (fun () -> register "toto" "mytoto"; assert_equal_log "Log contains 1 element" ["toto", "mytoto"]; register "toto" "mytoto"; assert_equal_log "Log still contains 1 element" ["toto", "mytoto"]) ]) oasis-0.4.5/test/TestLicense.ml0000644000175000017500000001100512422026741015710 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 *) (******************************************************************************) (** 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 txt) | None -> try ignore (value.parse ~ctxt:oasis_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.5/test/TestFullUtils.ml0000644000175000017500000006770512422026741016273 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 *) (******************************************************************************) (** 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 *) (fun a b -> String.compare (String.lowercase a) (String.lowercase b)) 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 exp)) 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 test_ctxt -> let strlen = String.length line in if strlen > 0 && line.[strlen - 1] = ' ' 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.version_compare_string 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; 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 ~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; 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 (* 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 = (* 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 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 (* 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 assert_command ~ctxt:test_ctxt ?exit_code ?chdir ?check_output ~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) 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 = ("OCAMLFIND_DESTDIR", t.ocaml_lib_dir) :: ("OCAMLFIND_LDCONF", "ignore") :: ("OCAML_TOPLEVEL_PATH", toplevel_path) :: extra_env 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 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" ~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_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 test_ctxt 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.version_compare_string t.ocaml_version "3.11" < 0 -> acc | "cmt" | "cmti" when OASISVersion.version_compare_string t.ocaml_version "4.00" < 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 | _ -> 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 test_ctxt t id = SetFile.assert_equal ~msg:(Printf.sprintf "Installed files (%s)" id) ~root:t.build_dir t.installed_files (all_files t.build_dir) (* Check build_dir is empty. *) let check_nothing_installed test_ctxt t id = SetFile.assert_equal ~msg:(Printf.sprintf "Build directory is empty after uninstall (%s)" id) ~root:t.build_dir SetFile.empty (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) test_ctxt t = let () = let pkg = OASISParse.from_file ~ctxt:oasis_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 ("setup" :: (if dev then ["-real-oasis"; "-setup-update"; if dynamic then "dynamic" else "weak"] 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 \"odn\";;"; "#require \"ocamlbuild\";;"; (* TODO: problem with gettext when using --enable-gettext. *) "#require \"gettext.base\";;"; 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 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 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. *) oasis-0.4.5/test/TestFull.ml0000644000175000017500000010650012422026741015235 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 *) (******************************************************************************) (** Run full OASIS use cases @author Sylvain Le Gall *) open FileUtil open OUnit2 open TestCommon open TestFullUtils let gen_tests ~is_native () = let native_dynlink test_ctxt = if is_native then native_dynlink test_ctxt else false in 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 [ (* Use flags *) "examples/flags" >:: (fun test_ctxt -> let t = setup_test_directories test_ctxt in_example_dir ["flags"] in 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.cmti"; "Foo.cmt"; "Bar.cmi"; "Bar.ml"; "Bar.annot"; "Bar.cmti"; "Bar.cmt"; "META"; "simplelib.cmxa"; "simplelib.cmxs"; "Foo.cmx"; "Bar.cmx"; "simplelib.a"]); InstalledOCamlLibrary ("simplelibext", ["simplelibext.cma"; "FooExt.cmi"; "FooExt.ml"; "FooExt.annot"; "FooExt.cmti"; "FooExt.cmt"; "BarExt.cmi"; "BarExt.ml"; "BarExt.annot"; "BarExt.cmti"; "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 *) "examples/simplelib" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["simplelib"] in 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 *) "examples/packedlib" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["packedlib"] in 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"; "packedlib.cmt"]) ]; (* Run standard test. *) standard_test test_ctxt t; try_installed_library test_ctxt t "packedlib" ["Packedlib.Foo"]); (* Complete library with findlib package to check *) "examples/findlib" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["findlib"] in 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 *) "examples/custom" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["custom"] in 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 *) "examples/with-c" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["with-c"] in 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 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.version_compare_string 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 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 *) "examples/with-data" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["with-data"] in 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. *) "examples/with-interface-module" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["with-interface-module"] in 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 *) "examples/with-test" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["with-test"] in 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 *) "examples/with-subpackage" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["with-subpackage"] in 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 *) "examples/interdepend-libraries" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["interdepend-libraries"] in 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 *) "examples/order-matter" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["order-matter"] in 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); "examples/syntax-camlp4" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["syntax-camlp4"] in 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"))); (* Single level package *) "1level" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "1level"] in 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 -> (* TODO: check custom install as well. *) let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "customdoc"] in 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.cmti"; "with-a.cma"]); ]; (* Run standard test. *) standard_test test_ctxt t); (* Use cclib option *) "with-cclib" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt; skip_if (not (Sys.file_exists "/usr/include/stringprep.h")) "Cannot find 'stringprep.h'" in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "with-cclib"] in 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 -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "no-install-doc"] in 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 -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "create-parent-dir"] in 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); (* TODO: move full tests under their own directory. *) "bug588" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let () = let cmd = Printf.sprintf "ocamlfind query bitstring > %s 2>&1" (if Sys.os_type = "Win32" then "NUL" else "/dev/null") in skip_if (Sys.command cmd <> 0) "Cannot find package bitstring" in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug588"] in oasis_setup test_ctxt t; (* Setup expectation. *) register_generated_files t ((List.filter (( <> ) "_tags") oasis_ocamlbuild_files) @ ["libtest.mllib"; "libtest.mldylib"; "libtest.odocl"]); (* Run standard test. *) standard_test test_ctxt t); "bug619" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug619"] in 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 -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug571"] in 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 -> let () = skip_long_test test_ctxt; skip_if (not (Sys.file_exists "/usr/lib/libz.so.1")) "zlib not installed" in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "flag-ccopt"] 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 -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug738"] in 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 -> let () = skip_long_test test_ctxt; skip_if (Sys.os_type = "Win32") "UNIX only test" in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug982"] 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 -> let () = skip_long_test test_ctxt; skip_if (Sys.os_type = "Win32") "UNIX only test" in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug823"] 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 -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bugClib"] in 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"; "foo.cmti"; "bar.annot"; "bar.cmt"; "bar.cmti"; "mylib.cmxa"; "mylib.cmxs"; "mylib.cmx"; "mylib.a"; "libmylib_stubs.a"]) ]; (* 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 -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug791"] in 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); "examples/object" >:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_example_dir ["object"] in 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); "bug938">:: (fun test_ctxt -> let () = skip_if (Sys.os_type = "Win32") "UNIX test" in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug938"] 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"]); "TEMP=a b" >:: (fun test_ctxt -> let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug571"] in 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)">:: (fun test_ctxt -> let () = skip_if (Sys.os_type = "Win32") "UNIX test" in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "dev"] 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)">:: (fun test_ctxt -> let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "dev"] in (* 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">:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "dev"] in (* 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")))); "ver0.3">:: (fun test_ctxt -> let () = skip_long_test test_ctxt in let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "ver0.3"] in 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 -> let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "bug1358"] in let () = skip_if (OASISVersion.version_compare_string 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 -> let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "dynrun_for_release"] in 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 -> let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "dynlink"] in let has_native = 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 -> let t = setup_test_directories test_ctxt in_testdata_dir ["TestFull"; "recurselib"] in (* The test is that 'oasis setup' should not fail. *) oasis_setup test_ctxt t); ] let tests = "TestFull" >::: [ "best=native" >::: (skip_test_on_non_native_arch (gen_tests ~is_native:true ())); "best=byte" >::: (gen_tests ~is_native:false ()); ] oasis-0.4.5/test/TestFileTemplate.ml0000644000175000017500000001422712422026741016712 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 *) (******************************************************************************) (** 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 ~backup:true (template_of_string_list ~ctxt:oasis_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 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 ~backup:true (template_make fn comment_sh [] ["echo Hello"] []) in file_rollback ~ctxt:oasis_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 ~backup:false ghost_meta_template); assert_equal ~printer:printer_change NoChange (file_generate ~ctxt:oasis_ctxt ~backup:false ghost_meta_template); ()); ] oasis-0.4.5/test/TestDevFiles.ml0000644000175000017500000001561012422026741016035 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 *) (******************************************************************************) (** 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" (String.uppercase 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 t; assert_command ~ctxt:test_ctxt ~chdir:t.src_dir "make" ["setup.exe"]; register_generated_files t ["setup.exe"]; check_generated_files 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 ["TestDevFiles"; "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 ["TestDevFiles"; "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 = "TestDevFiles" >::: [ "best=native" >::: (skip_test_on_non_native_arch (gen_tests ~is_native:true)); "best=byte" >::: (gen_tests ~is_native:false); ] oasis-0.4.5/test/TestCommon.ml0000644000175000017500000001702712422026741015570 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 *) (******************************************************************************) (** Common utilities for testing @author Sylvain Le Gall *) IFDEF HAS_GETTEXT THEN module Gettext = Gettext.Program (struct let textdomain = "oasis" let codeset = None let dir = None let dependencies = Gettext.init @ OASISGettext.init end) (GettextStub.Native) ELSE module Gettext = struct let init = [], "" end ENDIF 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. *) let oasis_args ctxt = [] let oasis_ctxt = OASISContext.quiet let oasis_ignore_plugin_ctxt = {oasis_ctxt with OASISContext.ignore_plugins = true} 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) 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 ?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 warnings/errors. *) if check_output then List.iter (fun line -> non_fatal ctxt (fun test_ctxt -> 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 ?extra_env ?unorder args = (* TODO: transfert chdir to -C chdir. *) assert_command ~ctxt ?chdir ?exit_code ?output ?extra_env ?unorder (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 test_ctxt fn = (* TODO: re-enable when OUnit will discard it for JUnit.xml. 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 oasis-0.4.5/test/TestBasic.ml0000644000175000017500000000654412422026741015363 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 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"]); "Env dump/load" >:: (fun test_ctxt -> (* TODO: lock *) BaseEnv.unload (); BaseEnv.load ~filename:(in_testdata_dir test_ctxt ["TestBasic"; "dir.data"]) (); (* Reset lazy values ? *) assert_equal ~printer:(fun s -> s) "toto" (BaseStandardVar.bindir ())); "OCaml dev version" >:: (fun test_ctxt -> 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 test_ctxt -> assert_equal ~printer:(fun s -> s) OASISParse.default_oasis_fn BaseSetup.default_oasis_fn); ] oasis-0.4.5/src/0000755000175000017500000000000012422026741012747 5ustar gildorgildoroasis-0.4.5/src/tools/0000755000175000017500000000000012422026741014107 5ustar gildorgildoroasis-0.4.5/src/tools/setup-wc.awk0000644000175000017500000000067212422026741016367 0ustar gildorgildorBEGIN { in_module = ""; in_module_line = 0; line = 0; total_line = 0; } /^module/ { in_module = $2; in_module_line = 1; total_line = total_line + 1; } /^end/ { print in_module " " in_module_line; in_module = ""; } /.*/ { if (in_module != "") in_module_line = in_module_line + 1; else line = line + 1; total_line = total_line + 1; } END { print "not in module " line; print "total lines " total_line; } oasis-0.4.5/src/tools/oasis.bat0000644000175000017500000000332012422026741015713 0ustar gildorgildorrem############################################################################### rem OASIS: architecture for building OCaml libraries and applications # rem # rem Copyright (C) 2011-2013, 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############################################################################### oasis-0.4.5/src/tools/oasis-i18n.sh0000755000175000017500000000352312422026741016344 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ LOCDIR="$(dirname $(readlink -f $0))" BUILDDIR="$(readlink -f "$LOCDIR/../../_build")" export OASIS_GETTEXT_DIR="$BUILDDIR/po" exec "$BUILDDIR/src/cli/oasis" "$@" oasis-0.4.5/src/tools/oasis-dist.ml0000755000175000017500000002331212422026741016524 0ustar gildorgildor#!/usr/bin/ocamlrun ocaml (******************************************************************************) (* 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 *) (******************************************************************************) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;; #use "topfind" #require "oasis" #require "oasis.base" #require "fileutils" open OASISMessage open OASISTypes open OASISUtils let run ?f_exit_code prg args = OASISExec.run ~ctxt:!BaseContext.default ?f_exit_code prg args let with_tmpdir f = let res = Filename.temp_file "oasis-dist-" ".dir" in let clean () = OASISFileUtil.rmdir ~ctxt:!BaseContext.default res in Sys.remove res; OASISFileUtil.mkdir ~ctxt:!BaseContext.default res; try f res; clean () with e -> clean (); raise e let update_oasis_in_tarball fn topdir = with_tmpdir (fun dn -> run "tar" ["-C"; dn; "-xzf"; fn]; run "oasis" ["-C"; Filename.concat dn topdir; "setup"]; run "tar" ["-C"; dn; "-czf"; fn; topdir]) class virtual vcs = object method check_uncommited_changes = true method list_tags: string list = [] method virtual dist: string -> host_filename -> unit method virtual tag: string -> unit end class svn ~ctxt = object inherit vcs method check_uncommited_changes = match OASISExec.run_read_output ~ctxt:!BaseContext.default "svn" ["status"] with | [] -> true | lst -> false method dist topdir tarball = with_tmpdir (fun dir -> let tgt = Filename.concat dir topdir in let cur_pwd = Sys.getcwd () in run "svn" ["export"; cur_pwd; tgt]; run "tar" ["-C"; dir; "-czf"; tarball; topdir]) method tag ver = warning ~ctxt "No tag method" 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 ~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:!BaseContext.default "darcs" ["show"; "tags"] method dist topdir tarball = (* Create the tarball *) run "darcs" ["dist"; "--dist-name"; topdir]; Sys.rename (topdir^".tar.gz") tarball method tag ver = run "darcs" ["tag"; ver] end class git ~ctxt = object inherit vcs method check_uncommited_changes = match OASISExec.run_read_output ~ctxt:!BaseContext.default "git" ["status"; "--porcelain"] with | [] -> true | _ -> false method list_tags = OASISExec.run_read_output ~ctxt:!BaseContext.default "git" ["tag"] method dist topdir tarball = let tarfn = Filename.chop_extension tarball in run "git" ["archive"; "--prefix"; (Filename.concat topdir ""); "--format"; "tar"; "HEAD"; "-o"; tarfn]; run "gzip" [tarfn] method tag ver = run "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 "ocaml" ["setup.ml"; "-distclean"]; Sys.chdir dir; run "tar" ["czf"; tarball; topdir]; Sys.chdir cur_pwd; with e -> Sys.chdir cur_pwd; raise e end) method tag ver = warning ~ctxt "No tag method" end let () = let build = ref true in let tag = ref true in let sign = ref true 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."; ] (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, res) -> 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 vcs#check_uncommited_changes then begin error ~ctxt "Uncommited changes"; exit 1 end; (* Create the tarball *) vcs#dist topdir tarball; (* Run "oasis setup" *) update_oasis_in_tarball tarball topdir; (* Check that the tarball can build *) with_tmpdir (fun dir -> let pwd = Sys.getcwd () in (* Uncompress tarball in tmpdir *) run "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 "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 ~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.5/src/tools/oasis-announce.ml0000755000175000017500000001235212422026741017371 0ustar gildorgildor#!/usr/bin/ocamlrun ocaml (******************************************************************************) (* 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 *) (******************************************************************************) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () #use "topfind" #require "oasis" #require "oasis.base" #require "pcre" 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 -> 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 (cs, 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.5/src/tools/oasis0000755000175000017500000000363312422026741015160 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e ROOTDIR="$(dirname $(readlink -m "$0"))/.." # Environment variables for OASIS if [ "x$ROOTDIR" = "x" ]; then echo "ROOTDIR not set"; fi export OASIS_GETTEXT_DIR="$ROOTDIR/share/locale" exec "$ROOTDIR/libexec/oasis" "$@" oasis-0.4.5/src/tools/guess-cmx.ml0000644000175000017500000001337712422026741016367 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 *) (******************************************************************************) (* Work in progress, only for testing purpose Try to guess file to install depending on archive (.cma) and published interface (.cmi) *) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () #use "topfind" #require "unix" #require "pcre" 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; (String.uncapitalize 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.5/src/plugins/0000755000175000017500000000000012422026741014430 5ustar gildorgildoroasis-0.4.5/src/plugins/ocamlbuild/0000755000175000017500000000000012422026741016543 5ustar gildorgildoroasis-0.4.5/src/plugins/ocamlbuild/OCamlbuildSys.mod0000644000175000017500000000007712422026741021762 0ustar gildorgildorOCamlbuildCommon.ml OCamlbuildPlugin.ml OCamlbuildDocPlugin.ml oasis-0.4.5/src/plugins/ocamlbuild/OCamlbuildPlugin.ml0000644000175000017500000010645312422026741022300 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 *) (******************************************************************************) (** Build using ocamlbuild @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OASISUtils open OASISString open BaseEnv open OCamlbuildCommon open BaseStandardVar open BaseMessage TYPE_CONV_PATH "OCamlbuildPlugin" let cond_targets_hook = ref (fun lst -> lst) let build extra_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 ".cmo" fn || ends_with ".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, unix_exec_is, unix_dll_opt = 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, lst 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 bt bnm lst) in (* Run the hook *) let cond_targets = !cond_targets_hook cond_targets in (* Run a list of target... *) run_ocamlbuild (List.flatten (List.map snd cond_targets) @ extra_args) argv; (* ... and register events *) List.iter check_and_register (List.flatten (List.map fst cond_targets)) let clean pkg extra_args = run_clean extra_args; List.iter (function | Library (cs, _, _) -> BaseBuilt.unregister BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister BaseBuilt.BExecLib cs.cs_name | _ -> ()) pkg.sections (* END EXPORT *) open OASISFileTemplate open OASISUtils open OASISMessage open OASISGettext open ODN open OASISPlugin open OASISTypes open OASISSchema 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, _) = String.capitalize (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("^String.capitalize 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 [ String.capitalize 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("^String.capitalize 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 | [ m ] -> 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@,@];;" (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 extra_args = extra_args_ocamlbuild_common ~ctxt:ctxt.ctxt pkg (generator pkg.schema_data) in let ctxt = add_ocamlbuild_files ctxt pkg in ctxt, { chng_moduls = [OCamlbuildData.ocamlbuildsys_ml]; chng_main = ODNFunc.func_with_arg build "OCamlbuildPlugin.build" extra_args odn_of_extra_args; chng_clean = Some (ODNFunc.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.5/src/plugins/ocamlbuild/OCamlbuildId.ml0000644000175000017500000000374312422026741021374 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 *) (******************************************************************************) (* 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.5/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml0000644000175000017500000002020712422026741022716 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 *) (******************************************************************************) (* Create documentation using ocamlbuild .odocl files @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OASISMessage open OCamlbuildCommon open BaseStandardVar TYPE_CONV_PATH "OCamlbuildDocPlugin" type run_t = { extra_args: string list; run_path: unix_filename; } with odn let doc_build run pkg (cs, doc) 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 (index_html :: run.extra_args) argv; List.iter (fun glb -> BaseBuilt.register BaseBuilt.BDoc cs.cs_name [OASISFileUtil.glob ~ctxt:!BaseContext.default (Filename.concat tgt_dir glb)]) ["*.html"; "*.css"] let doc_clean run pkg (cs, doc) argv = run_clean argv; BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name (* END EXPORT *) open OASISFileTemplate open OASISPlugin 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; common: ocamlbuild_common; } 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 = []; common = 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 run = { run_path = t.path; extra_args = extra_args_ocamlbuild_common ~ctxt:ctxt.ctxt pkg t.common; } in ctxt, { chng_moduls = [OCamlbuildData.ocamlbuildsys_ml]; chng_main = ODNFunc.func_with_arg doc_build "OCamlbuildDocPlugin.doc_build" run odn_of_run_t; chng_clean = Some (ODNFunc.func_with_arg 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.5/src/plugins/ocamlbuild/OCamlbuildData.mlify0000644000175000017500000000024412422026741022412 0ustar gildorgildorVarString myocamlbuild_ml "MyOCamlbuildSys.ml" VarString ocamlbuildsys_ml "OCamlbuildSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.5/src/plugins/ocamlbuild/OCamlbuildCommon.ml0000644000175000017500000001703012422026741022262 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 *) (******************************************************************************) (** Functions common to OCamlbuild build and doc plugin *) open OASISGettext open BaseEnv open BaseStandardVar open OASISTypes TYPE_CONV_PATH "OCamlbuildCommon" type extra_args = string list with odn 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"; "-install-lib-dir"; (Filename.concat (standard_library ()) "ocamlbuild") ] else []; if not (bool_of_string (is_native ())) || (os_type ()) = "Win32" then [ "-byte-plugin" ] else []; args; 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 extra_argv = let extra_cli = String.concat " " (Array.to_list extra_argv) in (* Run if never called with these args *) if not (BaseLog.exists ocamlbuild_clean_ev extra_cli) then begin OASISExec.run ~ctxt:!BaseContext.default (ocamlbuild ()) (fix_args ["-clean"] extra_argv); BaseLog.register ocamlbuild_clean_ev extra_cli; at_exit (fun () -> try BaseLog.unregister ocamlbuild_clean_ev extra_cli with _ -> ()) end (** Run ocamlbuild, unregister all clean events *) let run_ocamlbuild args extra_argv = (* TODO: enforce that target in args must be UNIX encoded i.e. toto/index.html *) OASISExec.run ~ctxt:!BaseContext.default (ocamlbuild ()) (fix_args args extra_argv); (* Remove any clean event, we must run it again *) List.iter (fun (e, d) -> BaseLog.unregister e d) (BaseLog.filter [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_argv) (* END EXPORT *) open OASISValues let fix_build_tools tool pkg = let fix_build_tools' sct 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 = match pkg.ocaml_version with | Some ocaml_version -> let min_ocaml_version = OASISVersion.version_of_string version in OASISVersion.comparator_ge min_ocaml_version ocaml_version | None -> false 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" type ocamlbuild_common = { plugin_tags: string option; extra_args: string list; } with odn 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 _ t -> t.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 _ t -> t.extra_args) in fun data -> { extra_args = extra_args data; plugin_tags = plugin_tags data; } let extra_args_ocamlbuild_common ~ctxt pkg t = let extra_args = if t.plugin_tags <> None && not (ocamlbuild_supports_plugin_tags pkg) then begin OASISMessage.error ~ctxt:ctxt (f_ "'XOCamlbuildPluginTags' in only available for OCaml >= 4.01. \ Please restrict your requirements with 'OCamlVersion: >= 4.01'"); t.extra_args end else begin match t.plugin_tags with | Some tags -> "-plugin-tags" :: ("'" ^ tags ^ "'") :: t.extra_args | None -> t.extra_args end in let extra_args = if ocamlbuild_supports_ocamlfind pkg then "-use-ocamlfind" :: extra_args else extra_args in extra_args oasis-0.4.5/src/plugins/ocamlbuild/MyOCamlbuildSys.mod0000644000175000017500000000005312422026741022262 0ustar gildorgildorMyOCamlbuildFindlib.ml MyOCamlbuildBase.ml oasis-0.4.5/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml0000644000175000017500000001750712422026741022720 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 *) (******************************************************************************) (** OCamlbuild extension, copied from * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild * by N. Pouillard and others * * Updated on 2009/02/28 * * Modified by Sylvain Le Gall *) open Ocamlbuild_plugin type conf = { no_automatic_syntax: bool; } (* these functions are not really officially exported *) let run_and_read = Ocamlbuild_pack.My_unix.run_and_read let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings let exec_from_conf exec = let exec = let env_filename = Pathname.basename BaseEnvLight.default_filename in let env = BaseEnvLight.load ~filename:env_filename ~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 -> (* When one link an OCaml library/binary/package, one should use * -linkpkg *) flag ["ocaml"; "link"; "program"] & A"-linkpkg"; if not (conf.no_automatic_syntax) then begin (* 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 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 ()); end; (* 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 ["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"]); | _ -> () oasis-0.4.5/src/plugins/ocamlbuild/MyOCamlbuildBase.ml0000644000175000017500000001614312422026741022216 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 *) (******************************************************************************) (** Base functions for writing myocamlbuild.ml @author Sylvain Le Gall *) TYPE_CONV_PATH "MyOCamlbuildBase" open Ocamlbuild_plugin module OC = Ocamlbuild_pack.Ocaml_compiler type dir = string with odn type file = string with odn type name = string with odn type tag = string with odn (* END EXPORT *) let rec odn_of_spec = let vrt nm lst = ODN.VRT ("Ocamlbuild_plugin."^nm, lst) in let vrt_str nm str = vrt nm [ODN.STR str] in function | N -> vrt "N" [] | S lst -> vrt "S" [ODN.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 (* START EXPORT *) 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; } with odn 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 ~filename:env_filename ~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 -> (String.uncapitalize m) ^ ".cmi") intf_modules in dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis | nm, dir :: tl, intf_modules -> ocaml_lib ~dir:dir (dir^"/"^nm); List.iter (fun dir -> List.iter (fun str -> flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir])) ["compile"; "infer_interface"; "doc"]) tl; let cmis = List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi") intf_modules in dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"] cmis) t.lib_ocaml; (* Declare directories dependencies, replace "include" in _tags. *) List.iter (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))]); 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.5/src/plugins/ocamlbuild/MANUAL-template.mkd0000644000175000017500000000053512422026741022031 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`. In this case, OCamlbuild will also be involved in the generation of a particular document. Package fields: $ListOCamlbuildBuildPackageFields Document fields: $ListOCamlbuildDocDocumentFields oasis-0.4.5/src/plugins/none/0000755000175000017500000000000012422026741015367 5ustar gildorgildoroasis-0.4.5/src/plugins/none/NoneSys.mod0000644000175000017500000000001612422026741017463 0ustar gildorgildorNonePlugin.ml oasis-0.4.5/src/plugins/none/NonePlugin.ml0000644000175000017500000000660312422026741020004 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 *) (******************************************************************************) (** Plugin to handle "none" generation @author Sylvain Le Gall *) open OASISGettext open OASISUtils let not_implemented str _ _ = failwithf (f_ "No implementation for %s") str let section_not_implemented str pkg _ _ extra_args = not_implemented str pkg extra_args (* END EXPORT *) open OASISTypes open OASISPlugin let std_no_generate str ctxt pkg = ctxt, { chng_moduls = [NoneData.nonesys_ml]; chng_clean = None; chng_distclean = None; chng_main = (ODNFunc.func_with_arg not_implemented "NonePlugin.not_implemented" str ODN.of_string); } let section_no_generate str ctxt pkg (cs, section) = std_no_generate (str^" of section "^cs.cs_name) 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.5/src/plugins/none/NoneData.mlify0000644000175000017500000000015112422026741020117 0ustar gildorgildorVarString nonesys_ml "NoneSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.5/src/plugins/none/MANUAL-template.mkd0000644000175000017500000000012312422026741020646 0ustar gildorgildorThis plugin basically does nothing. It helps to replace mandatory step by nothing. oasis-0.4.5/src/plugins/internal/0000755000175000017500000000000012422026741016244 5ustar gildorgildoroasis-0.4.5/src/plugins/internal/MANUAL-template.mkd0000644000175000017500000000065612422026741021536 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.5/src/plugins/internal/InternalSys.mod0000644000175000017500000000006412422026741021220 0ustar gildorgildorInternalConfigurePlugin.ml InternalInstallPlugin.ml oasis-0.4.5/src/plugins/internal/InternalInstallPlugin.ml0000644000175000017500000004731012422026741023065 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 *) (******************************************************************************) (** Install using internal scheme @author Sylvain Le Gall *) 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, lib) -> cs, bs, lib, []) let obj_hook = ref (fun (cs, bs, obj) -> cs, bs, 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" 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 pkg argv = let in_destdir = try let destdir = destdir () in (* Practically speaking destdir is prepended * at the beginning of the target filename *) fun fn -> destdir^fn with PropList.Not_set _ -> fun fn -> fn in let install_file ?tgt_fn src_file envdir = let tgt_dir = in_destdir (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:!BaseContext.default (fun dn -> info (f_ "Creating directory '%s'") dn; BaseLog.register install_dir_ev dn) tgt_dir; (* Really install files *) info (f_ "Copying file '%s' to '%s'") src_file tgt_file; OASISFileUtil.cp ~ctxt:!BaseContext.default src_file tgt_file; BaseLog.register install_file_ev tgt_file in (* Install data into defined directory *) let install_data 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 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 -> (String.capitalize modul ^ sufx) :: (String.uncapitalize modul ^ sufx) :: accu end sufx [] in (** Install all libraries *) let install_libs pkg = let files_of_library (f_data, acc) data_lib = let cs, bs, lib, lib_extra = !lib_hook data_lib in if var_choose bs.bs_install && BaseBuilt.is_built BaseBuilt.BLib cs.cs_name then begin let acc = (* Start with acc + lib_extra *) List.rev_append lib_extra acc in let acc = (* Add uncompiled header from the source tree *) let path = OASISHostPath.of_unix bs.bs_path in List.fold_left begin fun acc modul -> begin try [List.find OASISFileUtil.file_exists_case (List.map (Filename.concat path) (make_fnames modul [".mli"; ".ml"]))] with Not_found -> warning (f_ "Cannot find source header for module %s \ in library %s") modul cs.cs_name; [] end @ List.filter OASISFileUtil.file_exists_case (List.map (Filename.concat path) (make_fnames modul [".annot";".cmti";".cmt"])) @ acc end acc lib.lib_modules in let acc = (* Get generated files *) BaseBuilt.fold BaseBuilt.BLib cs.cs_name (fun acc fn -> fn :: acc) acc in let f_data () = (* Install data associated with the library *) install_data 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, obj_extra = !obj_hook data_obj in if var_choose bs.bs_install && BaseBuilt.is_built BaseBuilt.BObj cs.cs_name then begin let acc = (* Start with acc + obj_extra *) List.rev_append obj_extra acc in let acc = (* Add uncompiled header from the source tree *) let path = OASISHostPath.of_unix bs.bs_path in List.fold_left begin fun acc modul -> begin try [List.find OASISFileUtil.file_exists_case (List.map (Filename.concat path) (make_fnames modul [".mli"; ".ml"]))] with Not_found -> warning (f_ "Cannot find source header for module %s \ in object %s") modul cs.cs_name; [] end @ List.filter OASISFileUtil.file_exists_case (List.map (Filename.concat path) (make_fnames modul [".annot";".cmti";".cmt"])) @ acc end acc obj.obj_modules in let acc = (* Get generated files *) BaseBuilt.fold BaseBuilt.BObj cs.cs_name (fun acc fn -> fn :: acc) acc in let f_data () = (* Install data associated with the object *) install_data 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, children) -> files_of_library data_and_files (cs, bs, lib), children | Package (_, cs, bs, `Object obj, children) -> files_of_object data_and_files (cs, bs, obj), 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. *) 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 n in List.map (remove_prefix (Sys.getcwd ())) files in info (f_ "Installing findlib library '%s'") findlib_name; let ocamlfind = ocamlfind () in let commands = split_install_command ocamlfind findlib_name meta files in List.iter (OASISExec.run ~ctxt:!BaseContext.default ocamlfind) commands; BaseLog.register 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 pkg = let install_exec data_exec = let cs, bs, exec = !exec_hook data_exec in if var_choose bs.bs_install && BaseBuilt.is_built BaseBuilt.BExec cs.cs_name then begin let exec_libdir () = Filename.concat (libdir ()) pkg.name in BaseBuilt.fold BaseBuilt.BExec cs.cs_name (fun () fn -> install_file ~tgt_fn:(cs.cs_name ^ ext_program ()) fn bindir) (); BaseBuilt.fold BaseBuilt.BExecLib cs.cs_name (fun () fn -> install_file fn exec_libdir) (); install_data 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 pkg = let install_doc data = let cs, doc = !doc_hook data in if var_choose doc.doc_install && BaseBuilt.is_built BaseBuilt.BDoc cs.cs_name then begin let tgt_dir = OASISHostPath.of_unix (var_expand doc.doc_install_dir) in BaseBuilt.fold BaseBuilt.BDoc cs.cs_name (fun () fn -> install_file fn (fun () -> tgt_dir)) (); install_data 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 install_libs pkg; install_execs pkg; install_docs pkg (* Uninstall already installed data *) let uninstall _ argv = List.iter (fun (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:!BaseContext.default 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:!BaseContext.default (ocamlfind ()) ["remove"; data] end else failwithf (f_ "Unknown log event '%s'") ev; BaseLog.unregister ev data) (* We process event in reverse order *) (List.rev (BaseLog.filter [install_file_ev; install_dir_ev; 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 ctxt pkg = ctxt, { chng_moduls = [InternalData.internalsys_ml]; chng_main = ODNFunc.func install "InternalInstallPlugin.install"; chng_clean = None; chng_distclean = None; } in (* Uninstall *) let doit_uninstall ctxt pkg = ctxt, { chng_moduls = [InternalData.internalsys_ml]; chng_main = ODNFunc.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.5/src/plugins/internal/InternalId.ml0000644000175000017500000000374012422026741020633 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 *) (******************************************************************************) (** 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.5/src/plugins/internal/InternalData.mlify0000644000175000017500000000015512422026741021655 0ustar gildorgildorVarString internalsys_ml "InternalSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.5/src/plugins/internal/InternalConfigurePlugin.ml0000644000175000017500000002234612422026741023402 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 *) (******************************************************************************) (** 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 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 ctxt pkg = ctxt, { chng_moduls = [InternalData.internalsys_ml]; chng_clean = None; chng_distclean = None; chng_main = (ODNFunc.func configure "InternalConfigurePlugin.configure"); } in InternalId.init (); Configure.register_act self_id doit oasis-0.4.5/src/plugins/extra/0000755000175000017500000000000012422026741015553 5ustar gildorgildoroasis-0.4.5/src/plugins/extra/stdfiles/0000755000175000017500000000000012422026741017370 5ustar gildorgildoroasis-0.4.5/src/plugins/extra/stdfiles/StdFilesPlugin.ml0000644000175000017500000004362412422026741022627 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 *) (******************************************************************************) (** Generate standard text files: INSTALL.txt, README.txt @author Sylvain Le Gall *) open OASISFileTemplate open OASISPlugin 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; 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.5/src/plugins/extra/stdfiles/StdFilesData.mlify0000644000175000017500000000015212422026741022737 0ustar gildorgildorVarString install "INSTALL.txt" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.5/src/plugins/extra/stdfiles/MANUAL-template.mkd0000644000175000017500000000052312422026741022653 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.5/src/plugins/extra/stdfiles/INSTALL.txt0000644000175000017500000000076212422026741021244 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.5/src/plugins/extra/docbook.ml0000644000175000017500000000356112422026741017532 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 *) (******************************************************************************) (** 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.5/src/plugins/extra/devfiles/0000755000175000017500000000000012422026741017354 5ustar gildorgildoroasis-0.4.5/src/plugins/extra/devfiles/configure0000755000175000017500000000040512422026741021262 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.5/src/plugins/extra/devfiles/MANUAL-template.mkd0000644000175000017500000000027312422026741022641 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.5/src/plugins/extra/devfiles/DevFilesPlugin.ml0000644000175000017500000001747412422026741022603 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 *) (******************************************************************************) (** 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 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 (String.uppercase 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 let packages = if ctxt.update = OASISSetupUpdate.Dynamic then " -linkpkg -package oasis.dynrun" else "" in Printf.bprintf buff "setup.exe: setup.ml\n\ \tocamlfind ocamlopt -o $@%s $< || ocamlfind ocamlc -o $@%s $< || true\n\ \t$(RM) setup.cmi setup.cmo setup.cmx setup.o\n\n" 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 "make configure CONFIGUREFLAGS=\"$*\"" 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.5/src/plugins/extra/devfiles/DevFilesData.mlify0000644000175000017500000000015012422026741022705 0ustar gildorgildorVarStringList configure "configure" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.5/src/plugins/extra/camlidl.ml0000644000175000017500000000351212422026741017513 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 *) (******************************************************************************) (** Camlidl package *) module Camlidl = struct module Env = Environment module Chk = Check module Msg = Message let camlidl = Chk.prog "camlidl" end oasis-0.4.5/src/plugins/extra/META/0000755000175000017500000000000012422026741016301 5ustar gildorgildoroasis-0.4.5/src/plugins/extra/META/METAPlugin.ml0000644000175000017500000002612512422026741020546 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 *) (******************************************************************************) (** 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 (function | '\n' | '\t' | '\r' -> ' ' | c -> 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 = prerr_endline (Printf.sprintf "module: %s" m); List.find (fun m -> exists m ".mli" || exists m ".ml") [ String.uncapitalize m ; String.capitalize 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 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_lib = 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.5/src/plugins/extra/META/METAData.mlify0000644000175000017500000000007012422026741020660 0ustar gildorgildorVarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.5/src/plugins/extra/META/MANUAL-template.mkd0000644000175000017500000000036612422026741021571 0ustar gildorgildorThis plugin is an 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.5/src/plugins/custom/0000755000175000017500000000000012422026741015742 5ustar gildorgildoroasis-0.4.5/src/plugins/custom/MANUAL-template.mkd0000644000175000017500000000151412422026741021226 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.5/src/plugins/custom/CustomSys.mod0000644000175000017500000000002012422026741020404 0ustar gildorgildorCustomPlugin.ml oasis-0.4.5/src/plugins/custom/CustomPlugin.ml0000644000175000017500000003117712422026741020736 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 *) (******************************************************************************) (** Generate custom configure/build/doc/test/install system @author *) open BaseEnv open OASISGettext open OASISTypes TYPE_CONV_PATH "CustomPlugin" type t = { cmd_main: command_line conditional; cmd_clean: (command_line option) conditional; cmd_distclean: (command_line option) conditional; } with odn let run = BaseCustom.run let main t _ extra_args = let cmd, args = var_choose ~name:(s_ "main command") t.cmd_main in run cmd args extra_args let clean t pkg extra_args = match var_choose t.cmd_clean with | Some (cmd, args) -> run cmd args extra_args | _ -> () let distclean t pkg extra_args = match var_choose t.cmd_distclean with | Some (cmd, args) -> run cmd args extra_args | _ -> () module Build = struct let main t pkg extra_args = main 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 bt bnm lst) evs) pkg.sections let clean t pkg extra_args = clean 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 BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister BaseBuilt.BExecLib cs.cs_name | _ -> ()) pkg.sections let distclean t pkg extra_args = distclean t pkg extra_args end module Test = struct let main t pkg (cs, test) extra_args = try main t pkg extra_args; 0.0 with Failure s -> BaseMessage.warning (f_ "Test '%s' fails: %s") cs.cs_name s; 1.0 let clean t pkg (cs, test) extra_args = clean t pkg extra_args let distclean t pkg (cs, test) extra_args = distclean t pkg extra_args end module Doc = struct let main t pkg (cs, _) extra_args = main t pkg extra_args; BaseBuilt.register BaseBuilt.BDoc cs.cs_name [] let clean t pkg (cs, _) extra_args = clean t pkg extra_args; BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name let distclean t pkg (cs, _) extra_args = distclean t pkg extra_args end (* END EXPORT *) module BuildRuntime = Build module TestRuntime = Test module DocRuntime = Doc open OASISGettext open ODN 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 (** Standard custom handling *) let std id data nm hlp hlp_clean hlp_distclean = let cmd_main, cmd_clean, cmd_distclean, generator = add_fields ~schema:OASISPackage.schema id data nm hlp hlp_clean hlp_distclean in generator, fun ctxt pkg -> let t = generator pkg.schema_data in ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = ODNFunc.func_with_arg main ("CustomPlugin.main") t odn_of_t; chng_clean = Some (ODNFunc.func_with_arg clean ("CustomPlugin.clean") t odn_of_t); chng_distclean = Some (ODNFunc.func_with_arg 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 cmd_main, cmd_clean, cmd_distclean, 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 ctxt pkg = let t = generator pkg.schema_data in ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = ODNFunc.func_with_arg BuildRuntime.main ("CustomPlugin.Build.main") t odn_of_t; chng_clean = Some (ODNFunc.func_with_arg BuildRuntime.clean ("CustomPlugin.Build.clean") t odn_of_t); chng_distclean = Some (ODNFunc.func_with_arg 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 cmd_main, cmd_clean, cmd_distclean, 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 ctxt pkg (cs, doc) = let t = generator cs.cs_data in ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = ODNFunc.func_with_arg DocRuntime.main ("CustomPlugin.Doc.main") t odn_of_t; chng_clean = Some (ODNFunc.func_with_arg DocRuntime.clean ("CustomPlugin.Doc.clean") t odn_of_t); chng_distclean = Some (ODNFunc.func_with_arg 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 ctxt pkg (cs, test) = let t = {(generator cs.cs_data) with cmd_main = test.test_command} in ctxt, { OASISPlugin.chng_moduls = [CustomData.customsys_ml]; chng_main = ODNFunc.func_with_arg TestRuntime.main ("CustomPlugin.Test.main") t odn_of_t; chng_clean = Some (ODNFunc.func_with_arg TestRuntime.clean ("CustomPlugin.Test.clean") t odn_of_t); chng_distclean = Some (ODNFunc.func_with_arg 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.5/src/plugins/custom/CustomData.mlify0000644000175000017500000000015112422026741021045 0ustar gildorgildorVarString customsys_ml "CustomSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.4.5/src/oasis/0000755000175000017500000000000012422026741014065 5ustar gildorgildoroasis-0.4.5/src/oasis/oasis.mllib0000644000175000017500000000527312422026741016233 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 2f2e363a0a79c9d3786900691c785d64) FormatExt ODNFunc PropList OASISUtils OASISUnixPath OASISContext 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 OASISVersion_types OASISVersion_lexer OASISVersion_parser OASISLicense_types OASISLicense_lexer OASISLicense_parser OASISValues_lexer OASISSchema OASISConf OASISAst OASISCheck OASISRecDescParser 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.5/src/oasis/oasis.mldylib0000644000175000017500000000527312422026741016570 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 2f2e363a0a79c9d3786900691c785d64) FormatExt ODNFunc PropList OASISUtils OASISUnixPath OASISContext 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 OASISVersion_types OASISVersion_lexer OASISVersion_parser OASISLicense_types OASISLicense_lexer OASISLicense_parser OASISValues_lexer OASISSchema OASISConf OASISAst OASISCheck OASISRecDescParser 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.5/src/oasis/PropList.mli0000644000175000017500000001261112422026741016345 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 *) (******************************************************************************) (** 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 (** Dump Data.t to ODN, not exported. *) val odn_of_t: t -> ODN.t 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.5/src/oasis/PropList.ml0000644000175000017500000001662212422026741016202 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 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 let odn_of_t t = ODN.APP ("PropList.Data.create", [], [ODN.UNT]) (* 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 String.lowercase 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.5/src/oasis/ODNFunc.mli0000644000175000017500000000515312422026741016030 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 *) (******************************************************************************) (** Dump function calls with ODN The idea of this module is to store a function and its argument with the ODN data structure that should be dumped. This allows to type in a way the function to be dumped. This module is {b not exported}. @see OCaml Data Notation project @author Sylvain Le Gall *) (** Function that can be generated using ODN func_call = APP(func, [], [func_arg]). *) type 'a func = { func_call: 'a; func_name: string; func_arg: ODN.t option; } (** Return the OCaml function corresponding to a [func]. *) val func: 'a -> string -> 'a func (** Create a func with an argument *) val func_with_arg: ('a -> 'b) -> string -> 'a -> ('a -> ODN.t) -> 'b func (** Return the [ODN.t] code corresponding to a [func]. *) val odn_of_func: 'a func -> ODN.t (** Return the OCaml function corresponding to a [func]. *) val func_call: 'a func -> 'a oasis-0.4.5/src/oasis/ODNFunc.ml0000644000175000017500000000424712422026741015662 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 *) (******************************************************************************) type 'a func = { func_call: 'a; func_name: string; func_arg: ODN.t option; } let func f f_nm = { func_call = f; func_name = f_nm; func_arg = None; } 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 odn_of_func t = match t.func_arg with | Some arg -> ODN.APP (t.func_name, [], [arg]) | None -> ODN.VAR t.func_name let func_call t = t.func_call oasis-0.4.5/src/oasis/OASISVersion_types.ml0000644000175000017500000000360112422026741020067 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISVersion_parser.mly0000644000175000017500000000440612422026741020414 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 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.5/src/oasis/OASISVersion_lexer.mll0000644000175000017500000000410312422026741020214 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 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.5/src/oasis/OASISVersion.mli0000644000175000017500000000764712422026741017032 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 *) (******************************************************************************) (** 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 s = string type t (** Compare versions. *) val version_compare: t -> t -> int (** Convert and compare version strings. *) val version_compare_string: string -> string -> 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 [ODN.t]. {b Not exported}. *) val odn_of_t: t -> ODN.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 (** [comparator_ge version comparator] Check if [comparator] is compatible with all versions >= than [version] *) val comparator_ge: t -> comparator -> bool (** 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 [ODN.t]. {b Not exported}. *) val odn_of_comparator: comparator -> ODN.t oasis-0.4.5/src/oasis/OASISVersion.ml0000644000175000017500000001745512422026741016657 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 OASISGettext TYPE_CONV_PATH "OASISVersion" type s = string type t = string with odn 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 with odn (* 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 version_compare_string s1 s2 = version_compare (version_of_string s1) (version_of_string s2) 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) 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 (* END EXPORT *) open OASISUtils open OASISVersion_types 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) let rec comparator_reduce = function | VAnd (v1, v2) -> (* TODO: this can be improved to reduce more *) let v1 = comparator_reduce v1 in let v2 = comparator_reduce v2 in if v1 = v2 then v1 else VAnd (v1, v2) | cmp -> cmp 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; } oasis-0.4.5/src/oasis/OASISValues_lexer.mll0000644000175000017500000000431412422026741020032 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 *) (********************************************************************************) 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.5/src/oasis/OASISValues.mli0000644000175000017500000001220212422026741016623 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISValues.ml0000644000175000017500000002752612422026741016471 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 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 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 e -> match e with | Failure "lexing: empty token" -> if String.capitalize str <> str then failwithf (f_ "Module name '%s', must be capitalized ('%s').") str (String.capitalize 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 (String.lowercase str) (List.map (fun (k, v) -> String.lowercase 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 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.5/src/oasis/OASISUtils.mli0000644000175000017500000001162012422026741016467 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 *) (******************************************************************************) (** 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 raise the [Failure] exception just as [failwith] except that one specify 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 (** {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.5/src/oasis/OASISUtils.ml0000644000175000017500000002360512422026741016324 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 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 (String.lowercase s1) (String.lowercase s2) module HashStringCsl = Hashtbl.Make (struct type t = string let equal s1 s2 = (String.lowercase s1) = (String.lowercase s2) let hash s = Hashtbl.hash (String.lowercase 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 String.lowercase 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 (* 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 let is_space c = c = ' ' || c = '\t' || c = '\n' || c = '\r' (* [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 || is_space 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 is_space 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 is_space 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.5/src/oasis/OASISUnixPath.mli0000644000175000017500000001017712422026741017135 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISUnixPath.ml0000644000175000017500000001454412422026741016766 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 *) (******************************************************************************) 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 (String.capitalize base) let uncapitalize_file f = let dir = dirname f in let base = basename f in concat dir (String.uncapitalize 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.5/src/oasis/OASISTypes.mli0000644000175000017500000003743112422026741016503 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 *) (******************************************************************************) (** 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. *) 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_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_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_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. *) } (** 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. *) synopsis: string; (** Short description of the package. *) description: OASISText.t option; (** Long description of the package. *) 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} 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_name: name -> ODN.t val odn_of_package_name: package_name -> ODN.t val odn_of_url: url -> ODN.t val odn_of_unix_dirname: unix_dirname -> ODN.t val odn_of_unix_filename: unix_filename -> ODN.t val odn_of_prog: prog -> ODN.t val odn_of_arg: arg -> ODN.t val odn_of_args: args -> ODN.t val odn_of_command_line: prog * args -> ODN.t val odn_of_findlib_name: findlib_name -> ODN.t val odn_of_findlib_full: findlib_name -> ODN.t val odn_of_conditional: ('a -> ODN.t) -> 'a OASISExpr.choices -> ODN.t val odn_of_package: package -> ODN.t oasis-0.4.5/src/oasis/OASISTypes.ml0000644000175000017500000002032312422026741016322 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 *) (******************************************************************************) TYPE_CONV_PATH "OASISTypes" type name = string with odn type package_name = string with odn type url = string with odn type unix_dirname = string with odn type unix_filename = string with odn type host_dirname = string with odn type host_filename = string with odn type prog = string with odn type arg = string with odn type args = string list with odn type command_line = (prog * arg list) with odn type findlib_name = string with odn type findlib_full = string with odn type compiled_object = | Byte | Native | Best with odn type dependency = | FindlibPackage of findlib_full * OASISVersion.comparator option | InternalLibrary of name with odn type tool = | ExternalTool of name | InternalExecutable of name with odn type vcs = | Darcs | Git | Svn | Cvs | Hg | Bzr | Arch | Monotone | OtherVCS of url with odn 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 with odn type all_plugin = plugin_kind plugin type plugin_data = (all_plugin * plugin_data_purpose * (unit -> unit)) list (* END EXPORT *) (* TODO: really export this *) let odn_of_plugin_data _ = ODN.of_list (fun _ -> ODN.UNT) [] (* START EXPORT *) type 'a conditional = 'a OASISExpr.choices with odn type custom = { pre_command: (command_line option) conditional; post_command: (command_line option) conditional; } with odn type common_section = { cs_name: name; cs_data: PropList.Data.t; cs_plugin_data: plugin_data; } with odn 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_c_sources: unix_filename list; bs_data_files: (unix_filename * unix_filename option) 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; } with odn 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_containers: findlib_name list; } with odn type object_ = { obj_modules: string list; obj_findlib_fullname: findlib_name list option; } with odn type executable = { exec_custom: bool; exec_main_is: unix_filename; } with odn type flag = { flag_description: string option; flag_default: bool conditional; } with odn 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; } with odn 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; } with odn type doc_format = | HTML of unix_filename | DocText | PDF | PostScript | Info of unix_filename | DVI | OtherDoc with odn type doc = { doc_type: [`Doc] plugin; doc_custom: custom; doc_build: bool conditional; doc_install: bool conditional; doc_install_dir: unix_filename; doc_title: string; doc_authors: string list; doc_abstract: string option; doc_format: doc_format; doc_data_files: (unix_filename * unix_filename option) list; doc_build_tools: tool list; } with odn 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 with odn 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; copyrights: string list; maintainers: string list; authors: string list; homepage: url option; synopsis: string; description: OASISText.t option; 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; sections: section list; plugins: [`Extra] plugin list; disable_oasis_section: unix_filename list; schema_data: PropList.Data.t; plugin_data: plugin_data; } with odn (* 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 oasis-0.4.5/src/oasis/OASISText.ml0000644000175000017500000001116212422026741016143 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 *) (******************************************************************************) TYPE_CONV_PATH "OASISText" type elt = | Para of string | Verbatim of string | BlankLine with odn type t = elt list with odn (* 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.5/src/oasis/OASISTest_intern.ml0000644000175000017500000001100512422026741017511 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISTest.mli0000644000175000017500000000352212422026741016310 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISTest.ml0000644000175000017500000000333712422026741016143 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISTest_intern.schema oasis-0.4.5/src/oasis/OASISSysLight.mod0000644000175000017500000000003512422026741017131 0ustar gildorgildorOASISGettext.ml OASISExpr.ml oasis-0.4.5/src/oasis/OASISSysBundle.mod0000644000175000017500000000026612422026741017301 0ustar gildorgildorOASISGettext.ml OASISContext.ml OASISString.ml OASISUtils.ml PropList.ml OASISMessage.ml OASISVersion.ml OASISExpr.ml OASISUnixPath.ml OASISHostPath.ml OASISExec.ml OASISFileUtil.ml oasis-0.4.5/src/oasis/OASISSys.mod0000644000175000017500000000065512422026741016151 0ustar gildorgildorOASISGettext.ml OASISContext.ml OASISString.ml OASISUtils.ml PropList.ml OASISMessage.ml OASISVersion.ml OASISLicense.ml OASISExpr.ml OASISText.ml OASISTypes.ml OASISFeatures.ml OASISUnixPath.ml OASISHostPath.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.5/src/oasis/OASISString.ml0000644000175000017500000001647312422026741016477 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 *) (******************************************************************************) (** 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; if !what_idx = String.length what then true else false 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; if !what_idx = -1 then true else false 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 (* END EXPORT *) 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.5/src/oasis/OASISSourceRepository_intern.ml0000644000175000017500000001114212422026741022134 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISSourceRepository.mli0000644000175000017500000000355312422026741020735 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISSourceRepository.ml0000644000175000017500000000335312422026741020562 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISSourceRepository_intern.schema oasis-0.4.5/src/oasis/OASISSetupUpdate.ml0000644000175000017500000000331112422026741017457 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 *) (******************************************************************************) type t = NoUpdate | Weak | Dynamic oasis-0.4.5/src/oasis/OASISSection_intern.ml0000644000175000017500000000463612422026741020212 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 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.5/src/oasis/OASISSection.mli0000644000175000017500000000553012422026741016776 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 *) (******************************************************************************) (** Manipulate sections. @author Sylvain Le Gall *) open OASISTypes (** {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.5/src/oasis/OASISSection.ml0000644000175000017500000000651212422026741016626 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 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 sct = let k, nm = section_id sct in (match k with | `Library -> "library" | `Object -> "object" | `Executable -> "executable" | `Flag -> "flag" | `SrcRepo -> "src repository" | `Test -> "test" | `Doc -> "doc") ^" "^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.5/src/oasis/OASISSchema_intern.ml0000644000175000017500000002627612422026741020012 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 *) (******************************************************************************) (** Property list and schema checker @author Sylvain Le Gall *) open OASISTypes open OASISAstTypes 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 = { OASISAstTypes.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.5/src/oasis/OASISSchema.mli0000644000175000017500000000650412422026741016574 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 *) (******************************************************************************) (** 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 an 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.5/src/oasis/OASISSchema.ml0000644000175000017500000000604112422026741016417 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 OASISTypes 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.5/src/oasis/OASISRecDescParser.ml0000644000175000017500000005475012422026741017716 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 *) (******************************************************************************) (** Parse OASIS files using Genlex. @author Sylvain Le Gall *) open OASISTypes open OASISAstTypes open OASISGettext open OASISUtils open OASISExpr open OASISContext open OASISMessage open Genlex (** Configuration for parsing and checking *) type conf = { oasisfn: host_filename option; ctxt: OASISContext.t; } type line_pos = int type char_pos = int type t = | RealLine of line_pos * char_pos * string (* line, begin char, data *) | BlockBegin | BlockEnd | StringBegin | StringEnd let parse_stream conf st = let is_blank = function | ' ' | '\r' | '\t' -> true | _ -> false in let position lineno charno = Printf.sprintf (f_ "in file '%s' at line %d, char %d") (match conf.oasisfn with | Some fn -> fn | None -> "<>") lineno charno in (* Override OASISMessage functions *) let debug fmt = debug ~ctxt:conf.ctxt fmt in let warning fmt = warning ~ctxt:conf.ctxt fmt in let apply_transformations ops = List.fold_left (fun lines (msg, f) -> let new_lines = f lines in if conf.ctxt.debug && lines <> new_lines then begin let rec pp_lines mode = function | RealLine (lineno, charstart, str) :: tl -> debug "%s%04d:%s->%s<-" mode lineno (String.make charstart ' ') str; pp_lines mode tl | (BlockBegin as e) :: tl | (BlockEnd as e) :: tl -> pp_blocks mode 1 e tl | StringBegin :: tl -> pp_lines "s" tl | StringEnd :: tl -> pp_lines " " tl | [] -> () and pp_blocks mode lvl e = function | b :: tl when b = e -> pp_blocks mode (lvl + 1) e tl | lst -> debug "%s----:%s" mode (String.make lvl (match e with | BlockBegin -> '{' | BlockEnd -> '}' | RealLine _ | StringBegin | StringEnd -> assert(false))); pp_lines mode lst in debug "%s:" msg; pp_lines " " new_lines; debug (f_ "EOF") end else if conf.ctxt.debug then begin debug (f_ "Nothing changed for '%s'") msg end; new_lines) [] ops in let lines = apply_transformations [ "Extract all lines from the stream", (fun _ -> let lines = ref [] in let buff = Buffer.create 13 in let lineno = ref 1 in let add_line () = lines := (RealLine (!lineno, 0, Buffer.contents buff)) :: !lines; Buffer.clear buff; incr lineno in Stream.iter (function | '\n' -> add_line () | c -> Buffer.add_char buff c) st; add_line (); List.rev !lines); "Get rid of MS-DOS file format", List.map (function | RealLine (lineno, charstart, str) -> begin let len = String.length str in let str = if len > 0 && str.[len - 1] = '\r' then String.sub str 0 (len - 1) else str in RealLine (lineno, charstart, str) end | e -> e); "Remove comments", List.map (function | RealLine (lineno, charstart, str) -> begin try let idx = String.index str '#' in RealLine (lineno, charstart, String.sub str 0 idx) with Not_found -> RealLine(lineno, charstart, str) end | e -> e); "Remove trailing whitespaces", List.map (function | RealLine (lineno, charstart, str) -> begin let pos = ref ((String.length str) - 1) in while !pos > 0 && is_blank str.[!pos] do decr pos done; RealLine(lineno, charstart, String.sub str 0 (!pos + 1)) end | e -> e); "Remove empty lines", List.filter (function | RealLine (lineno, charstart, "") -> false | _ -> true); "Remove leading whitespaces and replace them with begin/end block", (fun lines -> let add_blocks n lst = List.rev_append (Array.to_list (Array.init (abs n) (if n < 0 then (fun _ -> BlockEnd) else (fun _ -> BlockBegin)))) lst in let lines, last_indent_level, _ = List.fold_left (fun (lines, prv_indent_level, only_tab) -> function | RealLine (lineno, charstart, str) -> begin let cur_indent_level, use_tab, use_space = let pos = ref 0 in let use_tab = ref false in let use_space = ref false in while !pos < String.length str && is_blank str.[!pos] do use_tab := str.[!pos] = '\t' || !use_tab; use_space := (not (str.[!pos] = '\t') || !use_space); incr pos done; !pos, !use_tab, !use_space in let only_tab = if use_space && use_tab then begin warning (f_ "Mixed use of '\\t' and ' ' to indent \ lines %s") (position lineno charstart); only_tab end else begin match only_tab with | Some use_tab_before -> if use_tab_before && not use_tab then warning (f_ "Use of ' ' but '\\t' was used \ before to indent lines %s") (position lineno charstart); if not use_tab_before && use_tab then warning (f_ "Use of '\\t' but ' ' was used \ before to indent lines %s") (position lineno charstart); only_tab | None -> Some use_tab end in let charstart = charstart + cur_indent_level in let str = String.sub str cur_indent_level ((String.length str) - cur_indent_level) in let diff_indent_level = cur_indent_level - prv_indent_level in let lines = RealLine (lineno, charstart, str) :: add_blocks diff_indent_level lines in lines, cur_indent_level, only_tab end | BlockBegin as e -> (e :: lines), prv_indent_level + 1, only_tab | BlockEnd as e -> (e :: lines), prv_indent_level - 1, only_tab | StringBegin | StringEnd as e -> (e :: lines), prv_indent_level, only_tab) ([], 0, None) lines in List.rev (add_blocks (* Return back to indent level 0 *) (~- last_indent_level) lines)); "Split values and detect multi-line values", (fun lines -> let rec find_field acc = function | RealLine (lineno, charstart, str) as e :: tl -> begin try let colon_pos = String.index str ':' in let pos = ref (colon_pos + 1) in let () = while !pos < String.length str && is_blank str.[!pos] do incr pos done in let line_begin = RealLine (lineno, charstart, String.sub str 0 (colon_pos + 1)) in let acc = if !pos < String.length str then begin (* Split end of line *) let line_end = RealLine (lineno, charstart + !pos, String.sub str !pos (String.length str - !pos)) in line_end :: StringBegin :: line_begin :: acc end else begin StringBegin :: line_begin :: acc end in fetch_multiline acc 0 tl with Not_found -> find_field (e :: acc) tl end | e :: tl -> find_field (e :: acc) tl | [] -> List.rev acc and fetch_multiline acc lvl lst = let lvl_ref = let rec count_block_begin lvl = function | BlockBegin :: tl -> (* Count the initial indentation (first line) *) count_block_begin (lvl + 1) tl | lst -> lvl in count_block_begin lvl lst in let rec fetch_multiline_nxt acc lvl = function | BlockBegin :: tl -> fetch_multiline_nxt acc (lvl + 1) tl | BlockEnd :: tl -> if lvl > 1 then fetch_multiline_nxt acc (lvl - 1) tl else if lvl = 1 then find_field (StringEnd :: acc) tl else find_field (StringEnd :: acc) (BlockEnd :: tl) | RealLine (lineno, charstart, str) as e :: tl -> if lvl > 0 then let diff = lvl - lvl_ref in if diff < 0 then failwithf (f_ "Unexpected indentation line %d.") lineno; fetch_multiline_nxt (RealLine (lineno, charstart - diff, String.make diff ' ' ^ str) :: acc) lvl tl else find_field (StringEnd :: acc) (e :: tl) | (StringBegin as e) :: tl | (StringEnd as e) :: tl -> if lvl > 0 then fetch_multiline_nxt acc lvl tl else find_field (StringEnd :: acc) (e :: tl) | [] -> find_field (StringEnd :: acc) [] in fetch_multiline_nxt acc lvl lst in find_field [] lines); "Replace line containing '.' only by blank line", (let rec replace_dot = function | (RealLine (l1, _, _) as e1) :: RealLine (l2, c, ".") :: (RealLine (l3, _, _) as e2) :: tl when l1 <> l2 && l2 <> l3 -> e1 :: RealLine (l2, c, "") :: replace_dot (e2 :: tl) | (RealLine (l1, _, _) as e1) :: RealLine (l2, c, ".") :: StringEnd :: tl when l1 <> l2 -> e1 :: RealLine (l2, c, "") :: StringEnd :: lookup_string tl | e :: tl -> e :: replace_dot tl | [] -> [] and lookup_string = function | StringBegin :: tl -> StringBegin :: replace_dot tl | e :: tl -> e :: lookup_string tl | [] -> [] in lookup_string); "Add EOL", (let rec concat_string = function | RealLine (l1, charstart, str) :: ((RealLine (l2, _, _) :: _) as tl) when l2 <> l1 -> RealLine (l1, charstart, str^"\n") :: concat_string tl | StringEnd :: tl -> StringEnd :: lookup_string tl | hd :: tl -> hd :: concat_string tl | [] -> [] and lookup_string = function | StringBegin :: tl -> StringBegin :: concat_string tl | e :: tl -> e :: lookup_string tl | [] -> [] in lookup_string) ] in let position, st = let lineno = ref 0 in let charno = ref 0 in let virtual_pos = ref None in let lines_q = let q = Queue.create () in List.iter (fun s -> Queue.add s q) lines; q in let chars_q = Queue.create () in let in_string = ref false in let rec getc () = try incr charno; Some (Queue.take chars_q) with Queue.Empty -> begin (* Refill the char queue *) try let () = match Queue.take lines_q with | RealLine (nlineno, ncharno, str) -> lineno := nlineno; charno := ncharno; String.iter (fun c -> Queue.add c chars_q) (if !in_string then String.escaped str else str); | BlockBegin -> virtual_pos := Some "block begin"; Queue.add '{'chars_q | BlockEnd -> virtual_pos := Some "block end"; Queue.add '}' chars_q | StringBegin | StringEnd -> virtual_pos := Some "string marker"; in_string := not !in_string; Queue.add '"' chars_q in getc () with Queue.Empty -> (* lines and char queue are empty -> nothing left *) None end in (fun fmt -> position !lineno !charno), Stream.from (fun _ -> getc ()) in (* Lexer for OASIS language *) let lexer = make_lexer [ (* Statement *) "+:"; "$:"; ":"; "if"; "{"; "}"; "else"; (* Section *) "Flag"; "Library"; "Object"; "Executable"; "SourceRepository"; "Test"; "Document"; (* Expression *) "!"; "&&"; "||"; "("; ")"; (* Boolean *) "true"; "True"; "TRUE"; "false"; "False"; "FALSE" ] in (* OASIS expression *) let rec parse_factor = parser | [< 'Kwd "true" >] -> EBool true | [< 'Kwd "True" >] -> raise (Failure "Boolean values must be lowercase.") | [< 'Kwd "TRUE" >] -> raise (Failure "Boolean values must be lowercase.") | [< 'Kwd "false" >] -> EBool false | [< 'Kwd "False" >] -> raise (Failure "Boolean values must be lowercase.") | [< 'Kwd "FALSE" >] -> raise (Failure "Boolean values must be lowercase.") | [< 'Kwd "!"; e = parse_factor >] -> ENot e | [< 'Kwd "("; e = parse_expr; 'Kwd ")" >] -> e | [< 'Ident nm; 'Kwd "("; 'Ident vl; 'Kwd ")" >] -> if nm = "flag" then EFlag vl else ETest (OASISExpr.test_of_string nm, vl) and parse_term_follow = parser | [< 'Kwd "&&"; e1 = parse_factor; e2 = parse_term_follow >] -> EAnd (e1, e2) | [< >] -> EBool true and parse_term = parser | [< e1 = parse_factor; e2 = parse_term_follow >] -> EAnd(e1, e2) and parse_expr_follow = parser | [< 'Kwd "||"; e1 = parse_term; e2 = parse_expr_follow >] -> EOr (e1, e2) | [< >] -> EBool false and parse_expr = parser | [< e1 = parse_term; e2 = parse_expr_follow >] -> EOr (e1, e2) in (* OASIS fields and flags *) let rec parse_else = parser | [< 'Kwd "else"; else_blk = parse_stmt>] -> else_blk | [< >] -> SBlock [] and parse_field_op = parser | [<'Kwd ":"; 'String str>] -> FSet str | [<'Kwd "+:"; 'String str>] -> FAdd str | [<'Kwd "$:"; 'String str>] -> let e = try parse_expr (lexer (Stream.of_string str)) with e -> failwithf (f_ "Error when parsing expression '%s' %t: %s") str position (Printexc.to_string e) in FEval e and parse_stmt = parser | [<'Ident nm; op = parse_field_op>] -> SField(nm, op) | [< 'Kwd "if"; e = parse_expr; if_blk = parse_stmt; else_blk = parse_else>] -> SIfThenElse(e, if_blk, else_blk) | [< 'Kwd "{"; lst = parse_stmt_list; 'Kwd "}">] -> SBlock lst and parse_stmt_list = parser | [< stmt = parse_stmt; tl = parse_stmt_list>] -> stmt :: tl | [< >] -> [] in let id_or_string = parser | [<'Ident nm>] -> nm | [<'String nm>] -> nm in let rec parse_top_stmt = parser | [<'Kwd "Flag"; nm = id_or_string; flag_blk = parse_stmt>] -> TSFlag(nm, flag_blk) | [<'Kwd "Library"; nm = id_or_string; library_blk = parse_stmt>] -> TSLibrary (nm, library_blk) | [<'Kwd "Object"; nm = id_or_string; object_blk = parse_stmt>] -> TSObject (nm, object_blk) | [< 'Kwd "Executable"; nm = id_or_string; exec_blk = parse_stmt>] -> TSExecutable (nm, exec_blk) | [< 'Kwd "SourceRepository"; nm = id_or_string; src_repo_blk = parse_stmt>] -> TSSourceRepository (nm, src_repo_blk) | [< 'Kwd "Test"; nm = id_or_string; test_blk = parse_stmt>] -> TSTest (nm, test_blk) | [< 'Kwd "Document"; nm = id_or_string; test_blk = parse_stmt>] -> TSDocument (nm, test_blk) | [< 'Kwd "{"; lst = parse_top_stmt_list; 'Kwd "}">] -> TSBlock lst | [< stmt = parse_stmt >] -> TSStmt stmt and parse_top_stmt_list = parser | [< top_stmt = parse_top_stmt; tl = parse_top_stmt_list>] -> top_stmt :: tl | [< >] -> [] in (* Main loop *) try let st_token = lexer st in let ast = TSBlock (parse_top_stmt_list st_token) in ast with | Stream.Error "" -> failwithf (f_ "Syntax error %t") position | Stream.Error str -> failwithf (f_ "Syntax error %s %t") str position oasis-0.4.5/src/oasis/OASISQuickstart.ml0000644000175000017500000006543412422026741017364 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 *) (******************************************************************************) (** 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 = String.lowercase pre in let ans_low = String.lowercase (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 = { OASISAstTypes.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 = String.lowercase 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.5/src/oasis/OASISPlugin.mli0000644000175000017500000002146512422026741016635 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 *) (******************************************************************************) (** 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 ODNFunc.func; (** Main function to be added to BaseSetup.t (i.e. the one that that really do something: configure, build, test...) *) chng_clean: 'b ODNFunc.func option; (** Function to be called when cleaning *) chng_distclean: 'b ODNFunc.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 *) (package -> (common_section * 'a) -> string array -> 'b), (* Clean & Distclean *) (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 *) (package -> string array -> unit), (* Clean & Distclean *) (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 available plugins. *) 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.5/src/oasis/OASISPlugin.ml0000644000175000017500000003426512422026741016466 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 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, String.lowercase 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 open ODNFunc type modul = string type ('a, 'b) setup_changes = { chng_moduls: modul list; chng_main: 'a func; chng_clean: ('b func) option; chng_distclean: ('b 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 * ((package -> (common_section * 'a) -> string array -> 'b), (package -> (common_section * 'a) -> string array -> unit) ) setup_changes type package_act = context_act -> package -> context_act * ((package -> string array -> unit), (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', ver) 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, vo) 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 [] (* * 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 -> () (** List all plugins *) let ls knd = HashPlugin.fold (fun ((knd', _, _) as id) _ lst -> if knd = knd' then (string_of_plugin id) :: lst else lst) all [] 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, vo) 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 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 ctxt oasis-0.4.5/src/oasis/OASISPath_intern.ml0000644000175000017500000000650612422026741017500 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 *) (******************************************************************************) 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.5/src/oasis/OASISParser.mly0000644000175000017500000000547112422026741016652 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 Oasis %} %token COLON %token IF ELSE %token RBRACE LBRACE %token FLAG %token LIBRARY %token EXECUTABLE %token NOT AND OR RPAREN LPAREN TRUE FALSE %token EOF %token IDENT %token VALUE %start main %type main %% main: | stmt_list EOF {ASTBlock (List.rev $1)} ; stmt_list: | stmt_list stmt {$2 :: $1} | {[]} ; stmt: | IDENT COLON VALUE {ASTField($1, $3)} | FLAG IDENT stmt {ASTFlag($2, $3)} | LIBRARY IDENT stmt {ASTLibrary($2, $3)} | EXECUTABLE IDENT stmt {ASTExecutable($2, $3)} | IF expr stmt ELSE stmt {ASTIfThenElse ((fun _ -> true), $3, $5)} | IF expr stmt {ASTIfThenElse ((fun _ -> true), $3, ASTBlock [])} | LBRACE stmt_list RBRACE {ASTBlock (List.rev $2)} ; expr: | TRUE {ETrue} | FALSE {EFalse} | LPAREN expr RPAREN {$2} | NOT expr {ENot $2} | expr AND expr {EAnd ($1, $3)} | expr OR expr {EOr ($1, $3)} | FLAG LPAREN IDENT RPAREN {EFlag ($3)} | IDENT LPAREN IDENT RPAREN {ETest ($1, $3)} ; %% oasis-0.4.5/src/oasis/OASISParse.mli0000644000175000017500000000456312422026741016451 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISParse.ml0000644000175000017500000000420612422026741016272 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 OASISRecDescParser let default_oasis_fn = "_oasis" let from_stream ~ctxt ?fn st = OASISAst.to_package {oasisfn = fn; ctxt = ctxt} st let from_file ~ctxt fn = let chn = open_in fn in let pkg = from_stream ~ctxt ~fn (Stream.of_channel chn) in close_in chn; pkg (** [from_string ~conf str] Parse the OASIS string [str] and check it using context [conf]. *) let from_string ~ctxt ?fn str = from_stream ~ctxt ?fn (Stream.of_string str) oasis-0.4.5/src/oasis/OASISPackage_intern.ml0000644000175000017500000004123012422026741020130 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 *) (******************************************************************************) (** Package schema and generator @author Sylvain Le Gall *) open OASISTypes (* END EXPORT *) open OASISValues open OASISUtils open OASISSchema_intern open OASISGettext open OASISExpr let mod_build_depends f pkg = {pkg with sections = List.map (function | Library (cs, bs, lib) -> Library (cs, f bs, lib) | Object (cs, bs, obj) -> Object (cs, f bs, obj) | Executable (cs, bs, exec) -> Executable (cs, f bs, exec) | Test _ | Flag _ | SrcRepo _ | Doc _ as sct -> sct) pkg.sections} let add_build_depend build_depend pkg = mod_build_depends (fun bs -> {bs with bs_build_depends = build_depend :: bs.bs_build_depends}) pkg let add_build_tool ?(no_test=false) ?(condition=[EBool true, true]) build_tool pkg = let pkg = mod_build_depends (fun bs -> {bs with bs_build_tools = build_tool :: bs.bs_build_tools}) pkg in if no_test then pkg else {pkg with sections = List.map (function | Test (cs, test) -> Test (cs, {test with test_tools = build_tool :: test.test_tools}) | Doc (cs, doc) -> Doc (cs, {doc with doc_build_tools = build_tool :: doc.doc_build_tools}) | Library _ | Object _ | Executable _ | 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"; "0.2"; "0.1"] 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 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 pkg -> []) in let build_tools = OASISBuildSection_intern.build_tools_field schm (fun pkg -> []) 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 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); List.fold_right add_build_depend (build_depends data) (List.fold_right add_build_tool (build_tools 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; synopsis = synopsis data; description = description 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.5/src/oasis/OASISPackage.mli0000644000175000017500000000347712422026741016735 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 *) (******************************************************************************) (** Package toplevel @author Sylvain Le Gall *) (** Schema for the section. {b Not exported}. *) val schema: OASISTypes.package OASISSchema.t oasis-0.4.5/src/oasis/OASISPackage.ml0000644000175000017500000000334212422026741016553 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISPackage_intern.schema oasis-0.4.5/src/oasis/OASISObject_intern.ml0000644000175000017500000000617512422026741020014 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 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 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; })) oasis-0.4.5/src/oasis/OASISObject.mli0000644000175000017500000000517212422026741016602 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 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 extenstion 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.5/src/oasis/OASISObject.ml0000644000175000017500000000667712422026741016444 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 OASISTypes open OASISGettext let source_unix_files ~ctxt (cs, bs, obj) source_file_exists = List.fold_left (fun acc modul -> match OASISLibrary.find_module source_file_exists bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in object %s") modul cs.cs_name; acc) [] obj.obj_modules let generated_unix_files ~ctxt ~is_native ~source_file_exists (cs, bs, obj) = let find_module ext modul = match OASISLibrary.find_module source_file_exists bs modul with | `Sources (base_fn, _) -> [base_fn ^ ext] | `No_sources lst -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in object %s") modul cs.cs_name ; 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.5/src/oasis/OASISMessage.mli0000644000175000017500000000503312422026741016754 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISMessage.ml0000644000175000017500000000441412422026741016605 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 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.5/src/oasis/OASISLicense_types.ml0000644000175000017500000000337112422026741020030 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 *) (******************************************************************************) type t = | Or of t * t | And of t * t | License of string * (string option) oasis-0.4.5/src/oasis/OASISLicense_parser.mly0000644000175000017500000000451612422026741020353 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 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.5/src/oasis/OASISLicense_lexer.mll0000644000175000017500000000374412422026741020163 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 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.5/src/oasis/OASISLicense.mli0000644000175000017500000001200212422026741016744 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 *) (******************************************************************************) (** 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 [ODN.t]. {b Not exported}. *) val odn_of_t: t -> ODN.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.5/src/oasis/OASISLicense.ml0000644000175000017500000004276512422026741016616 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 *) (******************************************************************************) (** License for _oasis fields @author Sylvain Le Gall *) TYPE_CONV_PATH "OASISLicense" type license = string with odn type license_exception = string with odn type license_version = | Version of OASISVersion.t | VersionOrLater of OASISVersion.t | NoVersion with odn type license_dep_5_unit = { license: license; excption: license_exception option; version: license_version; } with odn type license_dep_5 = | DEP5Unit of license_dep_5_unit | DEP5Or of license_dep_5 list | DEP5And of license_dep_5 list with odn type t = | DEP5License of license_dep_5 | OtherLicense of string (* URL *) with odn (* 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 oasis-0.4.5/src/oasis/OASISLibrary_intern.ml0000644000175000017500000001067512422026741020212 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 *) (******************************************************************************) (** 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_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_containers = findlib_containers data; })) oasis-0.4.5/src/oasis/OASISLibrary.mli0000644000175000017500000000600712422026741016776 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 *) (******************************************************************************) (** Library section @author Sylvain Le Gall *) open OASISTypes (** Looks for a module file, considering capitalization or not. *) val find_module: (string -> bool) -> build_section -> OASISUnixPath.unix_filename -> [ `No_sources of OASISUnixPath.unix_filename list | `Sources of OASISUnixPath.unix_filename * string list ] (** [source_unix_files (cs, bs, lib) source_file_exists] Source files for this library. The first part of the tuple is the file without extenstion 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.5/src/oasis/OASISLibrary.ml0000644000175000017500000001543412422026741016631 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 OASISTypes open OASISUtils open OASISGettext open OASISSection (* Look for a module file, considering capitalization or not. *) let find_module source_file_exists bs modul = let possible_base_fn = List.map (OASISUnixPath.concat bs.bs_path) [modul; OASISUnixPath.uncapitalize_file modul; OASISUnixPath.capitalize_file modul] in (* TODO: we should be able to be able to determine the source for every * files. Hence we should introduce a Module(source: fn) for the fields * Modules and InternalModules *) List.fold_left (fun acc base_fn -> match acc with | `No_sources _ -> begin let file_found = List.fold_left (fun acc ext -> if source_file_exists (base_fn^ext) then (base_fn^ext) :: acc else acc) [] [".ml"; ".mli"; ".mll"; ".mly"] in match file_found with | [] -> acc | lst -> `Sources (base_fn, lst) end | `Sources _ -> acc) (`No_sources possible_base_fn) possible_base_fn let source_unix_files ~ctxt (cs, bs, lib) source_file_exists = List.fold_left (fun acc modul -> match find_module source_file_exists bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in library %s") modul cs.cs_name; 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 source_file_exists bs modul with | `Sources (base_fn, [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 -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in library %s") modul cs.cs_name; 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 begin List.fold_left begin fun accu s -> let dot = String.rindex s '.' in let base = String.sub s 0 dot in List.map ((^) base) sufx @ accu end [] end (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] :: ["dll"^cs.cs_name^"_stubs"^ext_dll] :: acc_nopath end else acc_nopath 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.5/src/oasis/OASISLexer.mll0000644000175000017500000000442312422026741016454 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 OasisParser } rule token = parse [' ' '\t'] {token lexbuf} | '\n' {Lexing.new_line lexbuf; token lexbuf} | ":" {COLON} | "if" {IF} | "else" {ELSE} | "{" {RBRACE} | "}" {LBRACE} | "Library" {LIBRARY} | "Executable" {EXECUTABLE} | "Flag" {FLAG} | "||" {OR} | "&&" {AND} | '!' {NOT} | '(' {LPAREN} | ')' {RPAREN} | "true" {TRUE} | "false" {FALSE} | eof {EOF} | ['A'-'Z''a'-'z''0'-'9''-''_']+ as lxm {IDENT(lxm)} oasis-0.4.5/src/oasis/OASISHostPath.mli0000644000175000017500000000462112422026741017124 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISHostPath.ml0000644000175000017500000000725112422026741016755 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 Filename module Unix = OASISUnixPath let make = function | [] -> invalid_arg "OASISHostPath.make" | hd :: tl -> List.fold_left Filename.concat hd tl let of_unix ufn = if Sys.os_type = "Unix" then ufn else 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 '/')) (* 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 = if Sys.os_type = "Unix" then hfn else let rec to_unix_aux = function | `Root str :: _ | `RootRelative str :: _ -> OASISUtils.failwithf "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)) 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.5/src/oasis/OASISHelp.ml0000644000175000017500000004453112422026741016115 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 *) (******************************************************************************) (* 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) -> (String.capitalize nm)^ (String.capitalize (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.5/src/oasis/OASISGraph.ml0000644000175000017500000001104112422026741016254 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 *) (******************************************************************************) 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.5/src/oasis/OASISGettext.mli0000644000175000017500000000521112422026741017012 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 *) (******************************************************************************) (** i18n functions This module is really bind to ocaml-gettext library if gettext has been selected when compiling the project. All these functions {b are exported} but their are bound to {b dummy functions} in this case (i.e. not ocaml-gettext). @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.5/src/oasis/OASISGettext.ml0000644000175000017500000000410512422026741016642 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 *) (******************************************************************************) 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 EXPORT *) IFDEF HAS_GETTEXT THEN include Gettext.Library (struct let textdomain = "oasis" let codeset = None let dir = None let dependencies = Gettext.init end) ENDIF oasis-0.4.5/src/oasis/OASISFormat.ml0000644000175000017500000001260212422026741016447 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 OASISSchema_intern 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 extra _ -> 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 pp_open_vbox fmt 0; List.iter (fun (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 (); pp_print_cut fmt ()) key_value; 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; cs_data = data} = 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.5/src/oasis/OASISFlag_intern.ml0000644000175000017500000000527112422026741017453 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISFlag.mli0000644000175000017500000000352212422026741016242 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISFlag.ml0000644000175000017500000000333712422026741016075 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISFlag_intern.schema oasis-0.4.5/src/oasis/OASISFindlib.mli0000644000175000017500000000576012422026741016746 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 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_] * group_t list) (** 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.5/src/oasis/OASISFindlib.ml0000644000175000017500000002507312422026741016574 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 OASISTypes open OASISUtils open OASISGettext open OASISSection 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_] * 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 rec group_of_tree mp = MapString.fold (fun nm node acc -> let cur = match node with | Node (Some (cs, bs, lib), children) -> Package (nm, cs, bs, lib, group_of_tree children) | Node (None, children) -> Container (nm, group_of_tree children) | Leaf (cs, bs, lib) -> Package (nm, cs, bs, lib, []) 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 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.5/src/oasis/OASISFileUtil.mli0000644000175000017500000000556012422026741017112 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 *) (******************************************************************************) (** File operations @author Sylvain Le Gall *) 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.5/src/oasis/OASISFileUtil.ml0000644000175000017500000001374012422026741016740 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 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.5/src/oasis/OASISFileTemplate.mli0000644000175000017500000001437112422026741017750 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISFileTemplate.ml0000644000175000017500000004467412422026741017610 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 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.5/src/oasis/OASISFeatures.ml0000644000175000017500000003060612422026741017001 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 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.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.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.name features in if not has_feature then match 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 str -> 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_ "Building docs require '-docs' flag at configure.") let flag_tests = create "flag_tests" (since_version "0.3") (fun () -> s_ "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_ "It compiles the setup.ml and speed-up actions done with it.") let disable_oasis_section = create "disable_oasis_section" alpha (fun () -> s_ "Allows the OASIS section comments and digest 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).") oasis-0.4.5/src/oasis/OASISExpr.mli0000644000175000017500000000770712422026741016320 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 *) (******************************************************************************) (** 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: (t * 'a) list -> (t * 'a) list (** [if_then_else cond choices_if choices_else] Combine choices, if_then_else style. *) val if_then_else: t -> (t * 'a) list -> (t * 'a) list -> (t * 'a) list (** Dump ODN.t. {b Not exported}. *) val odn_of_t: t -> ODN.t val odn_of_choices: ('a -> ODN.t) -> 'a choices -> ODN.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.5/src/oasis/OASISExpr.ml0000644000175000017500000001561012422026741016137 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 *) (******************************************************************************) TYPE_CONV_PATH "OASISExpr" open OASISGettext type test = string with odn type flag = string with odn type t = | EBool of bool | ENot of t | EAnd of t * t | EOr of t * t | EFlag of flag | ETest of test * string with odn type 'a choices = (t * 'a) list with odn 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 *) open OASISUtils 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 lowercase_eq str1 str2 = (String.lowercase str1) = (String.lowercase str2) in 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 (lowercase_eq nm) 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 = function | EBool b -> string_of_bool b | EFlag nm -> "flag("^nm^")" | ETest (nm, vl) -> nm^"("^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))^"]" oasis-0.4.5/src/oasis/OASISExecutable_intern.ml0000644000175000017500000000672212422026741020665 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISExecutable.mli0000644000175000017500000000443012422026741017451 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISExecutable.ml0000644000175000017500000000445212422026741017304 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 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.5/src/oasis/OASISExec.mli0000644000175000017500000000467312422026741016265 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISExec.ml0000644000175000017500000000662012422026741016106 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 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.5/src/oasis/OASISDocument_intern.ml0000644000175000017500000001702712422026741020362 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 *) (******************************************************************************) (** 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 (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.5/src/oasis/OASISDocument.mli0000644000175000017500000000352512422026741017152 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISDocument.ml0000644000175000017500000000334312422026741016777 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISDocument_intern.schema oasis-0.4.5/src/oasis/OASISData.mlify0000644000175000017500000000027212422026741016600 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.5/src/oasis/OASISCustom.ml0000644000175000017500000000454112422026741016474 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISContext.mli0000644000175000017500000000453612422026741017023 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 *) (******************************************************************************) (** Global context for messages and i18n @author Sylvain Le Gall *) type level = [ `Debug | `Info | `Warning | `Error] 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 *) } (** 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.5/src/oasis/OASISContext.ml0000644000175000017500000000626612422026741016654 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 OASISGettext type level = [ `Debug | `Info | `Warning | `Error] 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; } 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; } 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", (* TODO: remove this chdir. *) Arg.String (fun str -> Sys.chdir str), s_ "dir Change directory before running."], fun () -> {!default with ignore_plugins = !ignore_plugins} oasis-0.4.5/src/oasis/OASISConf.ml.ab0000644000175000017500000000343512422026741016471 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 *) (******************************************************************************) let version_full = OASISVersion.version_of_string "$(pkg_version)" let version_short = OASISVersion.chop version_full oasis-0.4.5/src/oasis/OASISCheck.ml0000644000175000017500000001475512422026741016247 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 *) (******************************************************************************) (** 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.5/src/oasis/OASISBuildSection_intern.ml0000644000175000017500000001633412422026741021170 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 *) (******************************************************************************) (** Build section internal functions @author Sylvain Le Gall *) open OASISSchema_intern open OASISValues open OASISUtils 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 section_fields nm 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 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 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 nm 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_c_sources = c_sources data; bs_data_files = data_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.5/src/oasis/OASISBuildSection.mli0000644000175000017500000000420712422026741017756 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 *) (******************************************************************************) (** Build section @author Sylvain Le Gall *) (** 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.5/src/oasis/OASISBuildSection.ml0000644000175000017500000001417712422026741017614 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 *) (******************************************************************************) (* END EXPORT *) open OASISTypes open OASISUtils open OASISSection open OASISSection_intern 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 (cs, bs, _) | Object (cs, bs, _) | Executable (cs, bs, _) -> add_build_section vrtx bs | Test (cs, {test_tools = build_tools}) | Doc (cs, {doc_build_tools = build_tools}) -> add_build_tool vrtx build_tools | Flag _ | SrcRepo _ -> ()) sections; sct_of_vrtx, ext_of_vrtx, g let build_order pkg = 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 k lst -> List.rev_map (fun (_, dep) -> dep) (* Reverse order to match List.rev_map *) (List.sort (fun (o1, _) (o2, _) -> o2 - o1) lst)) map_deps oasis-0.4.5/src/oasis/OASISAstTypes.ml0000644000175000017500000000513412422026741016775 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 *) (******************************************************************************) (** AST types @author Sylvain Le Gall *) open OASISTypes (** 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 = | TSLibrary of name * stmt | TSObject of name * stmt | TSExecutable of name * stmt | TSFlag of name * stmt | TSSourceRepository of name * stmt | TSTest of name * stmt | TSDocument of name * stmt | TSStmt of stmt | TSBlock of top_stmt list oasis-0.4.5/src/oasis/OASISAst.ml0000644000175000017500000002747612422026741015765 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 *) (******************************************************************************) (** AST manipulation @author Sylvain Le Gall *) open OASISTypes open OASISUtils open OASISGettext open OASISRecDescParser open OASISAstTypes open OASISExpr (** Convert OASIS stream into package *) let to_package conf st = let ast = OASISRecDescParser.parse_stream conf st in (* 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 match op with | FSet s -> begin PropList.Schema.set schm data nm ~context:{ctxt with append = false} s end | FAdd s -> begin PropList.Schema.set schm data nm ~context:{ctxt with append = true} s end | FEval e -> begin PropList.Schema.set schm data nm ~context:{ctxt with append = false} (string_of_bool false); PropList.Schema.set schm data nm ~context:{(ctxt_add_expr ctxt e) with append = false} (string_of_bool true) end 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) -> begin (* 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 end | 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 nm schm (ctxt, scts) 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, scts as acc) = (* TODO: refactor all section into one common function call. *) function | TSLibrary (nm, stmt) -> schema_stmt OASISLibrary_intern.generator nm OASISLibrary.schema acc stmt | TSObject (nm, stmt) -> schema_stmt OASISObject_intern.generator nm OASISObject.schema acc stmt | TSExecutable (nm, stmt) -> schema_stmt OASISExecutable_intern.generator nm OASISExecutable.schema acc stmt | TSFlag (nm, stmt) -> let ctxt = {ctxt with valid_flags = nm :: ctxt.valid_flags} in schema_stmt OASISFlag_intern.generator nm OASISFlag.schema (ctxt, scts) stmt | TSSourceRepository (nm, stmt) -> schema_stmt OASISSourceRepository_intern.generator nm OASISSourceRepository.schema acc stmt | TSTest (nm, stmt) -> schema_stmt OASISTest_intern.generator nm OASISTest.schema acc stmt | TSDocument (nm, stmt) -> schema_stmt OASISDocument_intern.generator nm OASISDocument.schema acc stmt | TSStmt stmt' -> stmt OASISPackage.schema.OASISSchema_intern.schm pkg_data ctxt stmt'; acc | TSBlock blk -> List.fold_left (top_stmt pkg_data) acc blk 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 = conf.OASISRecDescParser.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 bd | (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 sct = List.map (function | ExternalTool lnm as bt -> begin if SetString.mem lnm internal_tools then InternalExecutable lnm else bt end | 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 OASISCheck.check_package ~ctxt:ctxt.ctxt pkg; pkg oasis-0.4.5/src/oasis/META0000644000175000017500000000610212422026741014535 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: f321b6a05b14d6d53aa42a7cc0134654) version = "0.4.5" description = "_oasis file functions" requires = "unix odn" 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.5" 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.5" 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.5" 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.5" 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.5/src/oasis/MANUAL-template.mkd0000644000175000017500000003630412422026741017356 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]: http://brion.inria.fr/gallium/index.php/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, an 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.5/src/oasis/FormatExt.mli0000644000175000017500000000615512422026741016510 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 *) (******************************************************************************) (** 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.5/src/oasis/FormatExt.ml0000644000175000017500000001047312422026741016335 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 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.5/src/ext/0000755000175000017500000000000012422026741013547 5ustar gildorgildoroasis-0.4.5/src/ext/userconf/0000755000175000017500000000000012422026741015373 5ustar gildorgildoroasis-0.4.5/src/ext/userconf/test/0000755000175000017500000000000012422026741016352 5ustar gildorgildoroasis-0.4.5/src/ext/userconf/test/TestUserConf.ml0000644000175000017500000000326112422026741021272 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 OUnit oasis-0.4.5/src/ext/userconf/src/0000755000175000017500000000000012422026741016162 5ustar gildorgildoroasis-0.4.5/src/ext/userconf/src/userconf.mllib0000644000175000017500000000340312422026741021027 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 789c8d67a5037deef77ae24368386fa7) UserConf # OASIS_STOP oasis-0.4.5/src/ext/userconf/src/userconf.mldylib0000644000175000017500000000340312422026741021364 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 789c8d67a5037deef77ae24368386fa7) UserConf # OASIS_STOP oasis-0.4.5/src/ext/userconf/src/UserConf.ml0000644000175000017500000000325012422026741020240 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 *) (******************************************************************************) oasis-0.4.5/src/ext/userconf/src/META0000644000175000017500000000400512422026741016632 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 04740f4a1ac7a7da88d1909313d74374) version = "0.4.5" description = "Architecture for building OCaml libraries and applications" archive(byte) = "userconf.cma" archive(byte, plugin) = "userconf.cma" archive(native) = "userconf.cmxa" archive(native, plugin) = "userconf.cmxs" exists_if = "userconf.cma" # OASIS_STOP oasis-0.4.5/src/ext/userconf/README.txt0000644000175000017500000000042312422026741017070 0ustar gildorgildorThis directory contains an implementation of a user configuration management system that helps to define a configurable key/value store that the user can set. Plan support: - environment variable - command line argument - .ini files - .lua files (for dynamic configuration) oasis-0.4.5/src/ext/plugin-loader/0000755000175000017500000000000012422026741016311 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/0000755000175000017500000000000012422026741017270 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/data/0000755000175000017500000000000012422026741020201 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/data/pluginloader.ml0000644000175000017500000000624212422026741023224 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 *) (******************************************************************************) 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.5/src/ext/plugin-loader/test/data/findlib/0000755000175000017500000000000012422026741021610 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/0000755000175000017500000000000012422026741024724 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.mllib0000644000175000017500000000341212422026741031061 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6358d6dd34f78bae610d82b2933c82f2) PluginloaderLib # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.mldylib0000644000175000017500000000341212422026741031416 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6358d6dd34f78bae610d82b2933c82f2) PluginloaderLib # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.ml0000644000175000017500000000333012422026741030371 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 *) (******************************************************************************) let registered_plugins: string list ref = ref [] oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/META0000644000175000017500000000405012422026741025374 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: de997dc5d834e4f4a6a2de2e93e75171) version = "0.4.5" description = "Architecture for building OCaml libraries and applications" 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.5/src/ext/plugin-loader/test/data/findlib/plugin3/0000755000175000017500000000000012422026741023171 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.mllib0000644000175000017500000000340212422026741025572 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 476f28492db73d8d3b435d24ae78858e) Plugin3 # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.mldylib0000644000175000017500000000340212422026741026127 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 476f28492db73d8d3b435d24ae78858e) Plugin3 # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.ml0000644000175000017500000000341212422026741025104 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 *) (******************************************************************************) let () = PluginloaderLib.registered_plugins := "plugin3" :: !PluginloaderLib.registered_plugins oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin3/META0000644000175000017500000000416412422026741023647 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 9b161f62d6930349aa6a2477200799c8) version = "0.4.5" description = "Architecture for building OCaml libraries and applications" 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.5/src/ext/plugin-loader/test/data/findlib/plugin2/0000755000175000017500000000000012422026741023170 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.mllib0000644000175000017500000000340212422026741025570 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 1f1aeaa6bfdb5dc87a2c122bd3ce5eb6) Plugin2 # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.mldylib0000644000175000017500000000340212422026741026125 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 1f1aeaa6bfdb5dc87a2c122bd3ce5eb6) Plugin2 # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.ml0000644000175000017500000000341212422026741025102 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 *) (******************************************************************************) let () = PluginloaderLib.registered_plugins := "plugin2" :: !PluginloaderLib.registered_plugins oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin2/META0000644000175000017500000000417512422026741023650 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 5149115adbcff5eaa4da307bb4cc087b) version = "0.4.5" description = "Architecture for building OCaml libraries and applications" 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.5/src/ext/plugin-loader/test/data/findlib/plugin1/0000755000175000017500000000000012422026741023167 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.mllib0000644000175000017500000000340212422026741025566 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: efc9da8b11268a70c1ab38946d979286) Plugin1 # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.mldylib0000644000175000017500000000340212422026741026123 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: efc9da8b11268a70c1ab38946d979286) Plugin1 # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.ml0000644000175000017500000000341212422026741025100 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 *) (******************************************************************************) let () = PluginloaderLib.registered_plugins := "plugin1" :: !PluginloaderLib.registered_plugins oasis-0.4.5/src/ext/plugin-loader/test/data/findlib/plugin1/META0000644000175000017500000000416412422026741023645 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 126772110dacd9129d6eafd643cdf41f) version = "0.4.5" description = "Architecture for building OCaml libraries and applications" 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.5/src/ext/plugin-loader/test/TestLoader.ml0000644000175000017500000001052412422026741021672 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 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.5/src/ext/plugin-loader/src/0000755000175000017500000000000012422026741017100 5ustar gildorgildoroasis-0.4.5/src/ext/plugin-loader/src/plugin-loader.mllib0000644000175000017500000000340712422026741022667 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6f92f061f99224a7d433dbc90f7586b7) PluginLoader # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/src/plugin-loader.mldylib0000644000175000017500000000340712422026741023224 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 6f92f061f99224a7d433dbc90f7586b7) PluginLoader # OASIS_STOP oasis-0.4.5/src/ext/plugin-loader/src/PluginLoader.ml0000644000175000017500000002212212422026741022016 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 *) (******************************************************************************) (* 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 rec aux = function | [] -> [] | a :: tl -> let mods = try let raw = Findlib.package_property ("plugin" :: preds) a "archive" in List.rev (rev_split_blank raw) with Not_found -> begin try let raw = Findlib.package_property preds a "archive" in List.rev_map (fun fn -> (* Replacing .cmx/.cmxa by .cmxs *) if Dynlink.is_native && (Filename.check_suffix fn "cmx" || Filename.check_suffix fn "cmxa") then (Filename.chop_extension fn) ^ ".cmxs" else fn) (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.5/src/ext/plugin-loader/src/META0000644000175000017500000000407312422026741017555 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 7e33f3dca61b930ced739aa5b047217d) version = "0.4.5" description = "Architecture for building OCaml libraries and applications" 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.5/src/ext/plugin-loader/README.txt0000644000175000017500000000041412422026741020006 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.5/src/ext/README.txt0000644000175000017500000000046612422026741015253 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.5/src/dynrun/0000755000175000017500000000000012422026741014266 5ustar gildorgildoroasis-0.4.5/src/dynrun/dynrun.mllib0000644000175000017500000000340612422026741016631 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 62eb0a8c35367ef6905fd8a62007fe9a) OASISDynRun # OASIS_STOP oasis-0.4.5/src/dynrun/dynrun.mldylib0000644000175000017500000000340612422026741017166 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 62eb0a8c35367ef6905fd8a62007fe9a) OASISDynRun # OASIS_STOP oasis-0.4.5/src/dynrun/OASISDynRun.ml0000644000175000017500000000640412422026741016642 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 *) (******************************************************************************) (* 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 open BaseSetup let setup_t = let pkg = OASISParse.from_file ~ctxt:!BaseContext.default OASISParse.default_oasis_fn in let _, setup_t = BaseSetup.of_package ~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 setup_t = let tmp_setup_fn = Filename.temp_file (setup_t.package.name^"-setup") ".ml" in let restored = ref false in let cleanup () = if not !restored then begin restored := true; BaseGenerate.restore (); if Sys.file_exists tmp_setup_fn then Sys.remove tmp_setup_fn end in try let _lst: 'a list = BaseGenerate.generate ~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; 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 _ _ -> cleanup ()]} in BaseSetup.setup setup_t; cleanup () with e -> cleanup (); raise e end let setup () = BaseSetup.setup setup_t oasis-0.4.5/src/cli/0000755000175000017500000000000012422026741013516 5ustar gildorgildoroasis-0.4.5/src/cli/cli.mllib0000644000175000017500000000347612422026741015320 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: c83c6561fe6aed4a2430378d0553619c) CLISubCommand CLIArgExt CLICommon CLIPager CLIData CLIPluginsLoaded # OASIS_STOP oasis-0.4.5/src/cli/cli.mldylib0000644000175000017500000000347612422026741015655 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: c83c6561fe6aed4a2430378d0553619c) CLISubCommand CLIArgExt CLICommon CLIPager CLIData CLIPluginsLoaded # OASIS_STOP oasis-0.4.5/src/cli/VersionHelp.mkd0000644000175000017500000000005112422026741016445 0ustar gildorgildorDisplay version of the oasis executable. oasis-0.4.5/src/cli/Version.ml0000644000175000017500000000406712422026741015504 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 *) (******************************************************************************) (** 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:"" (s_ "Display the version of the OASIS program running") CLIData.version_mkd (CLISubCommand.make_run CLISubCommand.default_fspecs main) oasis-0.4.5/src/cli/SetupHelp.mkd0000644000175000017500000000206512422026741016127 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.5/src/cli/SetupDevHelp.mkd0000644000175000017500000000023712422026741016565 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.5/src/cli/SetupDev.ml0000644000175000017500000000456412422026741015620 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 *) (******************************************************************************) (** Like Setup but in development mode (deprecated). @author Sylvain Le Gall *) open CLISubCommand open OASISGettext let () = CLISubCommand.register "setup-dev" ~deprecated:true (ns_ "Deprecated.") 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.5/src/cli/SetupCleanHelp.mkd0000644000175000017500000000041512422026741017067 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.5/src/cli/SetupClean.ml0000644000175000017500000000643712422026741016125 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 *) (******************************************************************************) (** Clean generated template files @author Sylvain Le Gall *) open CLISubCommand open OASISGettext open OASISFileTemplate open OASISPlugin let main ~ctxt (replace_sections, remove) oasis_fn pkg = BaseGenerate.restore (); 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.5/src/cli/Setup.ml0000644000175000017500000000714012422026741015152 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 *) (******************************************************************************) (** Create the configure, build and install system @author Sylvain Le Gall *) open OASISGettext open OASISUtils open CLISubCommand open OASISSetupUpdate let fspecs () = let roasis_exec = ref None in let rupdate = ref NoUpdate 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." ] in (specs, CLISubCommand.default_anon), (fun () -> !roasis_exec, !rupdate) let main ~ctxt (oasis_exec, update) 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 []; ] in let _chngs: OASISFileTemplate.file_generate_change list = BaseGenerate.generate ~backup:false ~setup_fn:BaseSetup.default_filename ~restore:false ~oasis_fn ?oasis_exec ~oasis_setup_args 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.5/src/cli/QuickstartHelp.mkd0000644000175000017500000000051412422026741017156 0ustar gildorgildorThis subcommand is an 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.5/src/cli/Quickstart.ml0000644000175000017500000000563712422026741016215 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 *) (******************************************************************************) (** 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 an helper to write `_oasis` file") CLIData.quickstart_mkd (CLICommon.define_oasis_fn (CLISubCommand.make_run fspecs main)) oasis-0.4.5/src/cli/QueryHelp.mkd0000644000175000017500000000102512422026741016127 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.5/src/cli/Query.ml0000644000175000017500000001502312422026741015156 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 *) (******************************************************************************) (** Load and query _oasis file @author Sylvain Le Gall *) open CLISubCommand open BaseMessage open Genlex open OASISGettext open OASISTypes open OASISSection open OASISUtils let lexer = make_lexer ["ListSections"; "ListFields"; "("; ")"; "."] 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 (str, (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 parse_id_or_string = parser | [< 'Ident str >] -> str | [< 'String str >] -> str in let parse_fld_or_section start_nm = parser | [< 'Kwd "("; nm = parse_id_or_string; 'Kwd ")"; 'Kwd "."; fld = parse_id_or_string >] -> begin let kind, schm = try List.assoc (String.lowercase start_nm) (List.map (fun (nm, e) -> String.lowercase nm, e) assoc_sections) with Not_found -> failwithf (f_ "Don't know section kind '%s' in query '%s'") start_nm str in let sct = OASISSection.section_find (kind, nm) pkg.sections in let data = (OASISSection.section_common sct).cs_data in schm, data, fld end | [< >] -> begin (* We have a single field *) (proplist_schema OASISPackage.schema), pkg.schema_data, start_nm end in let parse = parser | [< start_nm = parse_id_or_string; (schm, data, fld) = parse_fld_or_section start_nm >] -> begin PropList.Schema.get schm data fld end | [< 'Kwd "ListSections" >] -> begin String.concat separator (List.map (fun sct -> fst (mk_section sct)) pkg.sections) end | [< 'Kwd "ListFields" >] -> 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 e -> 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 in parse (lexer (Stream.of_string str)) 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*") (ns_ "Query an _oasis file") 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.5/src/cli/ManualHelp.mkd0000644000175000017500000000055712422026741016250 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.5/src/cli/Manual.ml0000644000175000017500000000554312422026741015274 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 *) (******************************************************************************) (** 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.5/src/cli/MainHelp.mkd0000644000175000017500000000046712422026741015717 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.5/src/cli/MainGettext.ml0000644000175000017500000000420312422026741016300 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 *) (******************************************************************************) (** Main gettext interfaces *) let s_ s = s let f_ fmt = fmt^^"" IFDEF HAS_GETTEXT THEN include Gettext.Program (struct let textdomain = "oasis" let codeset = None let dependencies = Gettext.init @ OASISGettext.init let dir = try Some (Sys.getenv "OASIS_GETTEXT_DIR") with Not_found -> None end) (GettextStub.Native) (* Auto initialization of gettext *) let _ = init ENDIF oasis-0.4.5/src/cli/Main.ml0000644000175000017500000000510212422026741014732 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 *) (******************************************************************************) (** Main for OASIS *) open MainGettext 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.5/src/cli/HelpHelp.mkd0000644000175000017500000000011112422026741015705 0ustar gildorgildorThis subcommand display help of other subcommands or of all subcommands. oasis-0.4.5/src/cli/Help.ml0000644000175000017500000000465612422026741014753 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 *) (******************************************************************************) (** 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" (ns_ "Display help for a subcommand") 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.5/src/cli/CheckHelp.mkd0000644000175000017500000000010112422026741016031 0ustar gildorgildorThis subcommand load an `_oasis` file and apply standard checks. oasis-0.4.5/src/cli/Check.ml0000644000175000017500000000410312422026741015063 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 *) (******************************************************************************) (** 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.5/src/cli/CLISubCommand.mli0000644000175000017500000001015312422026741016601 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 *) (******************************************************************************) (** 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) (** [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 -> string -> 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.5/src/cli/CLISubCommand.ml0000644000175000017500000001377612422026741016446 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 OASISTypes open OASISUtils open OASISGettext (** 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) } 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 () = PluginLoader.init CLIPluginsLoaded.exec_oasis_build_depends_rec; List.iter (fun e -> Hashtbl.add all e.PluginLoader.name (Plugin(e, None))) (PluginLoader.list (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 (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(e, _) -> acc) all [] in lst oasis-0.4.5/src/cli/CLIPager.ml0000644000175000017500000000574012422026741015444 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 *) (******************************************************************************) (** 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.5/src/cli/CLIData.mlify0000644000175000017500000000060612422026741015763 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.5/src/cli/CLICommon.mli0000644000175000017500000000371312422026741016005 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 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.5/src/cli/CLICommon.ml0000644000175000017500000000437012422026741015634 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 *) (******************************************************************************) (** 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.5/src/cli/CLIArgExt.ml0000644000175000017500000002662712422026741015607 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 *) (******************************************************************************) (** 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 ns = String.make sz ' ' in String.blit str 0 ns 0 (String.length str); pp_print_string fmt ns 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, c) -> 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 (* 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.5/src/builtin-plugins.mllib0000644000175000017500000000470612422026741017124 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: b76a68b267a842b59e42cef93099bca4) 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/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 # OASIS_STOP oasis-0.4.5/src/builtin-plugins.mldylib0000644000175000017500000000470612422026741017461 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: b76a68b267a842b59e42cef93099bca4) 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/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 # OASIS_STOP oasis-0.4.5/src/base/0000755000175000017500000000000012422026741013661 5ustar gildorgildoroasis-0.4.5/src/base/dynrun_for_release.ml0000644000175000017500000000566312422026741020112 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 *) (******************************************************************************) (* 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.5/src/base/dynrun.ml0000644000175000017500000000351212422026741015533 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 *) (******************************************************************************) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;; #use "topfind";; #require "oasis.dynrun";; open OASISDynRun;; oasis-0.4.5/src/base/compiled_setup_ml.ml0000644000175000017500000000326712422026741017727 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 OASISDynRun oasis-0.4.5/src/base/base.mllib0000644000175000017500000000370112422026741015615 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 38bcdd84664fbd35fc8a144c159dbedf) BaseArgExt BaseBuilt BaseCheck BaseCustom BaseData BaseDoc BaseEnvLight BaseEnv BaseFileAB BaseGenerate BaseLog BaseOCamlcConfig BaseSetup BaseStandardVar BaseTest BaseDynVar BaseMessage BaseContext # OASIS_STOP oasis-0.4.5/src/base/base.mldylib0000644000175000017500000000370112422026741016152 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 38bcdd84664fbd35fc8a144c159dbedf) BaseArgExt BaseBuilt BaseCheck BaseCustom BaseData BaseDoc BaseEnvLight BaseEnv BaseFileAB BaseGenerate BaseLog BaseOCamlcConfig BaseSetup BaseStandardVar BaseTest BaseDynVar BaseMessage BaseContext # OASIS_STOP oasis-0.4.5/src/base/BaseTest.mli0000644000175000017500000000416112422026741016100 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 *) (******************************************************************************) (** 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: ((package -> common_section * test -> arg array -> float) * common_section * test) list -> package -> arg array -> unit oasis-0.4.5/src/base/BaseTest.ml0000644000175000017500000000732412422026741015733 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 BaseEnv open BaseMessage open OASISTypes open OASISExpr open OASISGettext let test 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 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.5/src/base/BaseSysEnvironment.mod0000644000175000017500000000002012422026741020150 0ustar gildorgildorBaseEnvLight.ml oasis-0.4.5/src/base/BaseSysBundle.mod0000644000175000017500000000012412422026741017062 0ustar gildorgildorBaseContext.ml BaseMessage.ml BaseEnvLight.ml BaseEnv.ml BaseArgExt.ml BaseCheck.ml oasis-0.4.5/src/base/BaseSys.mod0000644000175000017500000000032112422026741015727 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 oasis-0.4.5/src/base/BaseStandardVar.mli0000644000175000017500000001126212422026741017372 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 *) (******************************************************************************) (** 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.s (** {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.s (** 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.5/src/base/BaseStandardVar.ml0000644000175000017500000002447312422026741017231 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 OASISGettext open OASISTypes open OASISExpr 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" 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.5/src/base/BaseSetup.mli0000644000175000017500000001125512422026741016263 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 *) (******************************************************************************) (** Entry points for 'setup.ml' @author Sylvain Le Gall *) open OASISTypes type std_args_fun = package -> arg array -> unit type ('a, 'b) section_args_fun = name * (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: t -> arg array -> unit (** Run the build step. *) val build: t -> arg array -> unit (** Run the doc step: build all documents. *) val doc: t -> arg array -> unit (** Run the test step: run all tests. *) val test: t -> arg array -> unit (** Run the install step. *) val install: t -> arg array -> unit (** Run the uninstall step. *) val uninstall: t -> arg array -> unit (** Run the clean step. *) val clean: t -> arg array -> unit (** Run the distclean step. *) val distclean: t -> arg array -> unit (** Run the reinstall step: deinstall and install. *) val reinstall: t -> arg array -> unit (** Run all steps: configure, build, doc, test and install. *) val all: t -> arg array -> unit (** Display OASIS version used to generate this setup.ml *) val version: 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: ?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.5/src/base/BaseSetup.ml0000644000175000017500000006314412422026741016116 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 BaseEnv open BaseMessage open OASISTypes open OASISSection open OASISGettext open OASISUtils 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; } (* 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 t args = (* Run configure *) BaseCustom.hook t.package.conf_custom (fun () -> (* Reload if preconf has changed it *) begin try unload (); load (); with _ -> () end; (* Run plugin's configure *) t.configure t.package args; (* Dump to allow postconf to change it *) dump ()) (); (* Reload environment *) unload (); load (); (* Save environment *) print (); (* Replace data in file *) BaseFileAB.replace t.package.files_ab let build t args = BaseCustom.hook t.package.build_custom (t.build t.package) args let doc t args = BaseDoc.doc (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 t args = BaseTest.test (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 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 t (Array.of_list (List.rev !arg_rest)); info "Running build step"; build t [||]; (* Load setup.log dynamic variables *) BaseDynVar.init t.package; if not !rno_doc then begin info "Running doc step"; doc t [||]; end else begin info "Skipping doc step" end; if not !rno_test then begin info "Running test step"; test t [||] end else begin info "Skipping test step" end let install t args = BaseCustom.hook t.package.install_custom (t.install t.package) args let uninstall t args = BaseCustom.hook t.package.uninstall_custom (t.uninstall t.package) args let reinstall t args = uninstall t args; install 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 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 _ _ _ -> () in failsafe (f t.package (cs, test)) args | Doc (cs, doc) -> let f = try List.assoc cs.cs_name docs with Not_found -> fun _ _ _ -> () in failsafe (f t.package (cs, doc)) args | Library _ | Object _ | Executable _ | Flag _ | SrcRepo _ -> ()) t.package.sections; (* Clean whole package *) List.iter (fun f -> failsafe (f t.package) args) mains) () in let clean t args = generic_clean t t.package.clean_custom t.clean t.clean_doc t.clean_test args in let distclean t args = (* Call clean *) clean t args; (* Call distclean code *) generic_clean t t.package.distclean_custom t.distclean t.distclean_doc t.distclean_test args; (* Remove generated file *) List.iter (fun fn -> if Sys.file_exists fn then begin info (f_ "Remove '%s'") fn; Sys.remove fn end) (BaseEnv.default_filename :: BaseLog.default_filename :: (List.rev_map BaseFileAB.to_filename t.package.files_ab)) in clean, distclean let version 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.") 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: (function | 0 -> () | n -> 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 try let act_ref = ref (fun _ -> 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 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"); (* Build initial environment *) load ~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 t.package; if t.setup_update && update_setup_ml t then () else !act_ref 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 ?oasis_fn ?oasis_exec ?(oasis_setup_args=[]) ~setup_update update pkg = let ctxt = (* Initial context *) { error = false; other_actions = []; ctxt = !BaseContext.default; update = update; files = OASISFileTemplate.create ~disable_oasis_section:pkg.disable_oasis_section (); } 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, (ODN.TPL [ODN.STR cs.cs_name; ODNFunc.odn_of_func chng.chng_main] :: test_odns), (cs.cs_name, chng) :: test_changes end | sct -> acc) (ctxt, [], []) pkg.sections in ctxt, ODN.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, (ODN.TPL [ODN.STR cs.cs_name; ODNFunc.odn_of_func chng.chng_main] :: doc_odns), (cs.cs_name, chng) :: doc_changes end | sct -> acc) (ctxt, [], []) pkg.sections in ctxt, ODN.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, ODNFunc.func_call chng.chng_main) lst in let func_calls lst = List.map (fun (nm, func) -> nm, ODNFunc.func_call func) lst in let odn_of_funcs lst = ODN.LST (List.map ODNFunc.odn_of_func lst) in let odn_of_assocs lst = ODN.LST (List.map (fun (nm, func) -> ODN.TPL[ODN.STR nm; ODNFunc.odn_of_func func]) lst) in ODN.REC ("BaseSetup", [ "configure", ODNFunc.odn_of_func configure_changes.chng_main; "build", ODNFunc.odn_of_func build_changes.chng_main; "test", test_odn; "doc", doc_odn; "install", ODNFunc.odn_of_func install_changes.chng_main; "uninstall", ODNFunc.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", ODN.of_option ODN.of_string oasis_fn; "oasis_version", OASISVersion.odn_of_t OASISConf.version_full; "oasis_digest", ODN.of_option ODN.of_string oasis_digest; "oasis_exec", ODN.of_option ODN.of_string oasis_exec; "oasis_setup_args", ODN.of_list ODN.of_string oasis_setup_args; "setup_update", ODN.of_bool setup_update; ]), { configure = ODNFunc.func_call configure_changes.chng_main; build = ODNFunc.func_call build_changes.chng_main; doc = setup_func_calls doc_changes; test = setup_func_calls test_changes; install = ODNFunc.func_call install_changes.chng_main; uninstall = ODNFunc.func_call uninstall_changes.chng_main; clean = List.map ODNFunc.func_call clean_funcs; clean_test = func_calls clean_test_funcs; clean_doc = func_calls clean_doc_funcs; distclean = List.map ODNFunc.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;;@]" (ODN.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.5/src/base/BaseOCamlcConfig.mli0000644000175000017500000000417212422026741017447 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 *) (******************************************************************************) (** 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.5/src/base/BaseOCamlcConfig.ml0000644000175000017500000001030012422026741017264 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 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.5/src/base/BaseMessage.mli0000644000175000017500000000424612422026741016551 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 *) (******************************************************************************) (** 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.5/src/base/BaseMessage.ml0000644000175000017500000000370512422026741016377 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 *) (******************************************************************************) (** 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.5/src/base/BaseLog.mli0000644000175000017500000000434612422026741015707 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 *) (******************************************************************************) (** Maintain a log of actions done @author Sylvain Le Gall *) open OASISTypes (** Default file for registering log. *) val default_filename: host_filename (** Load the log file. *) val load: unit -> (name * string) list (** Add an event to the log file. *) val register: name -> string -> unit (** Remove an event from the log file. *) val unregister: name -> string -> unit (** Filter events of the log file. *) val filter: name list -> (name * string) list (** Check if an event exists in the log file. *) val exists: name -> string -> bool oasis-0.4.5/src/base/BaseLog.ml0000644000175000017500000001056012422026741015531 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 let default_filename = Filename.concat (Filename.dirname BaseEnv.default_filename) "setup.log" 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) let load () = if Sys.file_exists default_filename then begin let chn = open_in default_filename in let scbuf = Scanf.Scanning.from_file default_filename in let rec read_aux (st, lst) = if not (Scanf.Scanning.end_of_input scbuf) then begin let acc = try Scanf.bscanf scbuf "%S %S\n" (fun e d -> let t = e, d in if SetTupleString.mem t st then st, lst else SetTupleString.add t st, t :: lst) with Scanf.Scan_failure _ -> failwith (Scanf.bscanf scbuf "%l" (fun line -> Printf.sprintf "Malformed log file '%s' at line %d" default_filename line)) in read_aux acc end else begin close_in chn; List.rev lst end in read_aux (SetTupleString.empty, []) end else begin [] end let register event data = let chn_out = open_out_gen [Open_append; Open_creat; Open_text] 0o644 default_filename in Printf.fprintf chn_out "%S %S\n" event data; close_out chn_out let unregister event data = if Sys.file_exists default_filename then begin let lst = load () in let chn_out = open_out default_filename in let write_something = ref false in List.iter (fun (e, d) -> if e <> event || d <> data then begin write_something := true; Printf.fprintf chn_out "%S %S\n" e d end) lst; close_out chn_out; if not !write_something then Sys.remove default_filename end let filter events = let st_events = List.fold_left (fun st e -> SetString.add e st) SetString.empty events in List.filter (fun (e, _) -> SetString.mem e st_events) (load ()) let exists event data = List.exists (fun v -> (event, data) = v) (load ()) oasis-0.4.5/src/base/BaseGenerate.mli0000644000175000017500000000442712422026741016720 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 *) (******************************************************************************) (** 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: ?msg:OASISContext.t -> unit -> unit (** Generate 'setup.ml' file and the rest of the build system. {b Not exported}. *) val generate: ?msg:OASISContext.t -> restore:bool -> backup:bool -> setup_fn:host_filename -> ?oasis_exec:host_filename -> ?oasis_fn:host_filename -> ?oasis_setup_args:string list -> OASISSetupUpdate.t -> package -> OASISFileTemplate.file_generate_change list oasis-0.4.5/src/base/BaseGenerate.ml0000644000175000017500000001600312422026741016540 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 Format open OASISTypes open OASISUtils open OASISFileTemplate open ODN 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 = function | Create fn -> f ev_create fn | Change (fn, Some bak) -> f 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 | NoChange -> () (**/**) (** Register a generated file *) let register = log_change BaseLog.register (** Unregister a generated file *) let unregister = log_change BaseLog.unregister let restore ?msg () = let msg = match msg with | Some e -> e | None -> !BaseContext.default in 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:msg chng; BaseLog.unregister ev d) (BaseLog.filter [ev_create; ev_backup]) let generate ?msg ~restore ~backup ~setup_fn ?oasis_exec ?oasis_fn ?oasis_setup_args update pkg = let ctxt, _ = BaseSetup.of_package ?oasis_fn ?oasis_exec ?oasis_setup_args ~setup_update:(update = Weak) update pkg in let msg = match msg with | Some e -> e | None -> !BaseContext.default in let change_setup_fn = (* Do we need to change setup filename *) setup_fn <> BaseSetup.default_filename in let 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 ctxt in if Sys.file_exists default_fn then OASISFileUtil.cp ~ctxt:msg default_fn setup_fn; {ctxt with files = OASISFileTemplate.add {setup_tmpl with fn = setup_fn} (OASISFileTemplate.remove setup_tmpl.fn ctxt.files)} end else ctxt in let 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) ctxt.files (OASISFileTemplate.create ~disable_oasis_section:pkg.OASISTypes.disable_oasis_section ()) in {ctxt with files = files} end else ctxt in let () = if 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:msg ~backup tmpl with e -> List.iter (file_rollback ~ctxt:msg) acc; raise e in if restore then register chng; chng :: acc) ctxt.files [] in (* Do other actions *) List.iter (fun act -> act ()) 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 chng; begin match bak with | Some fn -> Sys.remove fn | None -> () end in let chng = Create fn in if restore then register chng; chng end | e -> e) chngs else chngs oasis-0.4.5/src/base/BaseFileAB.mli0000644000175000017500000000437412422026741016251 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 *) (******************************************************************************) (** 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 -> host_filename (** Replace variable in file %.ab to generate %. *) val replace: unix_filename list -> unit oasis-0.4.5/src/base/BaseFileAB.ml0000644000175000017500000000516012422026741016072 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 BaseEnv open OASISGettext open BaseMessage let to_filename fn = let fn = OASISHostPath.of_unix fn in if not (Filename.check_suffix fn ".ab") then warning (f_ "File '%s' doesn't have '.ab' extension") fn; Filename.chop_extension fn let replace fn_lst = let buff = Buffer.create 13 in List.iter (fun fn -> let fn = OASISHostPath.of_unix fn in let chn_in = open_in fn in let chn_out = open_out (to_filename fn) in ( try while true do Buffer.add_string buff (var_expand (input_line chn_in)); Buffer.add_char buff '\n' done with End_of_file -> () ); Buffer.output_buffer chn_out buff; Buffer.clear buff; close_in chn_in; close_out chn_out) fn_lst oasis-0.4.5/src/base/BaseEnvLight.mli0000644000175000017500000000477512422026741016714 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 *) (******************************************************************************) (** 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. @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 -> 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.5/src/base/BaseEnvLight.ml0000644000175000017500000000736112422026741016535 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 *) (******************************************************************************) module MapString = Map.Make(String) type t = string MapString.t let default_filename = Filename.concat (Sys.getcwd ()) "setup.data" let load ?(allow_empty=false) ?(filename=default_filename) () = if Sys.file_exists filename then begin let chn = open_in_bin filename in let st = Stream.of_channel chn in let line = ref 1 in 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 let lexer = Genlex.make_lexer ["="] st_line in let rec read_file mp = match Stream.npeek 3 lexer with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> Stream.junk lexer; Stream.junk lexer; Stream.junk lexer; read_file (MapString.add nm value mp) | [] -> mp | _ -> failwith (Printf.sprintf "Malformed data file '%s' line %d" filename !line) in let mp = read_file MapString.empty in close_in chn; mp 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.5/src/base/BaseEnv.mli0000644000175000017500000001114512422026741015711 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 *) (******************************************************************************) (** 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: host_filename (** Initialize environment. *) val load: ?allow_empty:bool -> ?filename:host_filename -> unit -> unit (** Uninitialize environment. *) val unload: unit -> unit (** Save environment on disk. *) val dump: ?filename:host_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.5/src/base/BaseEnv.ml0000644000175000017500000003053612422026741015545 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 OASISGettext open OASISUtils 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) (o, 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 (e: 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 = BaseEnvLight.default_filename let load ?allow_empty ?filename () = env_from_file := BaseEnvLight.load ?allow_empty ?filename () let unload () = env_from_file := MapString.empty; Data.clear env let dump ?(filename=default_filename) () = let chn = open_out_bin filename in let output nm value = Printf.fprintf chn "%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 let value = Schema.get schema env nm in output nm value 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; (* End of the dump *) close_out chn 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 %s\n" name (dot_pad name) 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.5/src/base/BaseDynVar.mli0000644000175000017500000000403412422026741016363 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 *) (******************************************************************************) (** 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: OASISTypes.package -> unit oasis-0.4.5/src/base/BaseDynVar.ml0000644000175000017500000000622612422026741016217 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 OASISTypes open OASISGettext open BaseEnv open BaseBuilt let init 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, exec) -> 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 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.5/src/base/BaseDoc.mli0000644000175000017500000000404312422026741015665 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 *) (******************************************************************************) (** 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: ((package -> common_section * doc -> arg array -> unit) * common_section * doc) list -> package -> arg array -> unit oasis-0.4.5/src/base/BaseDoc.ml0000644000175000017500000000473212422026741015521 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 BaseEnv open BaseMessage open OASISTypes open OASISGettext let doc 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 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.5/src/base/BaseData.mlify0000644000175000017500000000046312422026741016372 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.5/src/base/BaseData.mli0000644000175000017500000000465612422026741016043 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 *) (******************************************************************************) (** 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.5/src/base/BaseCustom.mli0000644000175000017500000000404412422026741016433 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 *) (******************************************************************************) (** 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.5/src/base/BaseCustom.ml0000644000175000017500000000541412422026741016264 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 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.5/src/base/BaseContext.mli0000644000175000017500000000372712422026741016614 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 *) (******************************************************************************) (** 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.5/src/base/BaseContext.ml0000644000175000017500000000342512422026741016436 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 *) (******************************************************************************) (* TODO: get rid of this module. *) open OASISContext let args () = fst (fspecs ()) let default = default oasis-0.4.5/src/base/BaseCheck.mli0000644000175000017500000000561312422026741016201 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 *) (******************************************************************************) (** 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.s) -> unit -> OASISVersion.s (** Get findlib package version . *) val package_version: findlib_full -> OASISVersion.s (** Check for findlib package and version. Return install directory. *) val package: ?version_comparator:OASISVersion.comparator -> findlib_full -> unit -> host_dirname oasis-0.4.5/src/base/BaseCheck.ml0000644000175000017500000001105712422026741016027 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 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.5/src/base/BaseBuilt.mli0000644000175000017500000000703212422026741016240 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 *) (******************************************************************************) (** Register files built to be installed @author Sylvain Le Gall *) 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: t -> name -> host_filename list list -> unit (** Unregister all files built. *) val unregister: t -> name -> unit (** Fold-left files built, filter existing and non-existing files. *) val fold: t -> name -> ('a -> host_filename -> 'a) -> 'a -> 'a (** Check if a library/object/doc/exec has been built. *) val is_built: 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.5/src/base/BaseBuilt.ml0000644000175000017500000001273612422026741016076 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 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 t nm lst = BaseLog.register (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 (to_log_event_file t nm) (if Filename.is_relative fn then Filename.concat (Sys.getcwd ()) fn else fn); true end else registered) false alt in if not registered then warning (f_ "Cannot find an existing alternative files among: %s") (String.concat (s_ ", ") alt)) lst let unregister t nm = List.iter (fun (e, d) -> BaseLog.unregister e d) (BaseLog.filter [to_log_event_file t nm; to_log_event_done t nm]) let fold 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 [to_log_event_file t nm]) let is_built t nm = List.fold_left (fun is_built (_, d) -> (try bool_of_string d with _ -> false)) false (BaseLog.filter [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.5/src/base/BaseArgExt.mli0000644000175000017500000000362312422026741016355 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 *) (******************************************************************************) (** 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.5/src/base/BaseArgExt.ml0000644000175000017500000000430012422026741016175 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 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.5/src/api-oasis.odocl0000644000175000017500000000541112422026741015657 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: 1f72f17551ed9241b5c309db1dbad600) oasis/FormatExt oasis/ODNFunc oasis/PropList oasis/OASISUtils oasis/OASISUnixPath oasis/OASISContext 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 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 cli/CLISubCommand cli/CLIArgExt cli/CLICommon cli/CLIPager # OASIS_STOP oasis-0.4.5/src/OASISBuiltinPlugins.ml0000644000175000017500000000371312422026741017054 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 *) (******************************************************************************) (** Load builtin plugins *) let init () = NonePlugin.init (); InternalInstallPlugin.init (); InternalConfigurePlugin.init (); OCamlbuildPlugin.init (); OCamlbuildDocPlugin.init (); CustomPlugin.init (); METAPlugin.init (); DevFilesPlugin.init (); StdFilesPlugin.init () oasis-0.4.5/setup.ml0000644000175000017500000070134412422027105013656 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 *) (******************************************************************************) (* OASIS_START *) (* DO NOT EDIT (digest: efb6f5b06daf5cb29a7fbd8f3efed877) *) (* Regenerated by OASIS v0.4.4 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 OASISContext = struct # 22 "src/oasis/OASISContext.ml" open OASISGettext type level = [ `Debug | `Info | `Warning | `Error] 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; } 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; } 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", (* TODO: remove this chdir. *) Arg.String (fun str -> Sys.chdir str), s_ "dir Change directory before running."], fun () -> {!default with ignore_plugins = !ignore_plugins} 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; if !what_idx = String.length what then true else false 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; if !what_idx = -1 then true else false 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 = String.make (String.length s) 'X' in for i = 0 to String.length s - 1 do buf.[i] <- f s.[i] done; buf 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 (String.lowercase s1) (String.lowercase s2) module HashStringCsl = Hashtbl.Make (struct type t = string let equal s1 s2 = (String.lowercase s1) = (String.lowercase s2) let hash s = Hashtbl.hash (String.lowercase 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 String.lowercase 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 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 # 78 "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 String.lowercase 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 s = string 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 version_compare_string s1 s2 = version_compare (version_of_string s1) (version_of_string s2) 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) 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 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 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 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 type host_dirname = string type host_filename = string 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 # 115 "src/oasis/OASISTypes.ml" 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_c_sources: unix_filename list; bs_data_files: (unix_filename * unix_filename option) 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_containers: findlib_name list; } type object_ = { obj_modules: string list; obj_findlib_fullname: findlib_name list 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 | DocText | PDF | PostScript | Info of unix_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; doc_title: string; doc_authors: string list; doc_abstract: string option; doc_format: doc_format; 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; copyrights: string list; maintainers: string list; authors: string list; homepage: url option; synopsis: string; description: OASISText.t option; 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; sections: section list; plugins: [`Extra] plugin list; disable_oasis_section: unix_filename list; 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.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.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.name features in if not has_feature then match 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 str -> 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_ "Building docs require '-docs' flag at configure.") let flag_tests = create "flag_tests" (since_version "0.3") (fun () -> s_ "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_ "It compiles the setup.ml and speed-up actions done with it.") let disable_oasis_section = create "disable_oasis_section" alpha (fun () -> s_ "Allows the OASIS section comments and digest to be omitted in \ generated files.") 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 (String.capitalize base) let uncapitalize_file f = let dir = dirname f in let base = basename f in concat dir (String.uncapitalize base) end module OASISHostPath = struct # 22 "src/oasis/OASISHostPath.ml" open Filename module Unix = OASISUnixPath let make = function | [] -> invalid_arg "OASISHostPath.make" | hd :: tl -> List.fold_left Filename.concat hd tl let of_unix ufn = if Sys.os_type = "Unix" then ufn else 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 '/')) 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 sct = let k, nm = section_id sct in (match k with | `Library -> "library" | `Object -> "object" | `Executable -> "executable" | `Flag -> "flag" | `SrcRepo -> "src repository" | `Test -> "test" | `Doc -> "doc") ^" "^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" 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 OASISUtils open OASISGettext open OASISSection (* Look for a module file, considering capitalization or not. *) let find_module source_file_exists bs modul = let possible_base_fn = List.map (OASISUnixPath.concat bs.bs_path) [modul; OASISUnixPath.uncapitalize_file modul; OASISUnixPath.capitalize_file modul] in (* TODO: we should be able to be able to determine the source for every * files. Hence we should introduce a Module(source: fn) for the fields * Modules and InternalModules *) List.fold_left (fun acc base_fn -> match acc with | `No_sources _ -> begin let file_found = List.fold_left (fun acc ext -> if source_file_exists (base_fn^ext) then (base_fn^ext) :: acc else acc) [] [".ml"; ".mli"; ".mll"; ".mly"] in match file_found with | [] -> acc | lst -> `Sources (base_fn, lst) end | `Sources _ -> acc) (`No_sources possible_base_fn) possible_base_fn let source_unix_files ~ctxt (cs, bs, lib) source_file_exists = List.fold_left (fun acc modul -> match find_module source_file_exists bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in library %s") modul cs.cs_name; 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 source_file_exists bs modul with | `Sources (base_fn, [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 -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in library %s") modul cs.cs_name; 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 headers that should be compiled along *) let headers = if lib.lib_pack then [] else find_modules lib.lib_modules "cmi" 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 (* 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"] :: 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] :: ["dll"^cs.cs_name^"_stubs"^ext_dll] :: acc_nopath end else acc_nopath 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 source_unix_files ~ctxt (cs, bs, obj) source_file_exists = List.fold_left (fun acc modul -> match OASISLibrary.find_module source_file_exists bs modul with | `Sources (base_fn, lst) -> (base_fn, lst) :: acc | `No_sources _ -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in object %s") modul cs.cs_name; acc) [] obj.obj_modules let generated_unix_files ~ctxt ~is_native ~source_file_exists (cs, bs, obj) = let find_module ext modul = match OASISLibrary.find_module source_file_exists bs modul with | `Sources (base_fn, _) -> [base_fn ^ ext] | `No_sources lst -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in object %s") modul cs.cs_name ; 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 open OASISSection 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_] * 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 rec group_of_tree mp = MapString.fold (fun nm node acc -> let cur = match node with | Node (Some (cs, bs, lib), children) -> Package (nm, cs, bs, lib, group_of_tree children) | Node (None, children) -> Container (nm, group_of_tree children) | Leaf (cs, bs, lib) -> Package (nm, cs, bs, lib, []) 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 group_mp in let library_name_of_findlib_name = Lazy.lazy_from_fun (fun () -> (* Revert findlib_name_of_library_name. *) MapString.fold (fun k v mp -> MapString.add v k mp) fndlb_name_of_lib_name MapString.empty) 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 # 2878 "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) () = if Sys.file_exists filename then begin let chn = open_in_bin filename in let st = Stream.of_channel chn in let line = ref 1 in 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 let lexer = Genlex.make_lexer ["="] st_line in let rec read_file mp = match Stream.npeek 3 lexer with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> Stream.junk lexer; Stream.junk lexer; Stream.junk lexer; read_file (MapString.add nm value mp) | [] -> mp | _ -> failwith (Printf.sprintf "Malformed data file '%s' line %d" filename !line) in let mp = read_file MapString.empty in close_in chn; mp 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 # 2983 "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 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) (o, 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 (e: 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 = BaseEnvLight.default_filename let load ?allow_empty ?filename () = env_from_file := BaseEnvLight.load ?allow_empty ?filename () let unload () = env_from_file := MapString.empty; Data.clear env let dump ?(filename=default_filename) () = let chn = open_out_bin filename in let output nm value = Printf.fprintf chn "%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 let value = Schema.get schema env nm in output nm value 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; (* End of the dump *) close_out chn 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 %s\n" name (dot_pad name) 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 OASISExpr 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" 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 let to_filename fn = let fn = OASISHostPath.of_unix fn in if not (Filename.check_suffix fn ".ab") then warning (f_ "File '%s' doesn't have '.ab' extension") fn; Filename.chop_extension fn let replace fn_lst = let buff = Buffer.create 13 in List.iter (fun fn -> let fn = OASISHostPath.of_unix fn in let chn_in = open_in fn in let chn_out = open_out (to_filename fn) in ( try while true do Buffer.add_string buff (var_expand (input_line chn_in)); Buffer.add_char buff '\n' done with End_of_file -> () ); Buffer.output_buffer chn_out buff; Buffer.clear buff; close_in chn_in; close_out chn_out) fn_lst end module BaseLog = struct # 22 "src/base/BaseLog.ml" open OASISUtils let default_filename = Filename.concat (Filename.dirname BaseEnv.default_filename) "setup.log" 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) let load () = if Sys.file_exists default_filename then begin let chn = open_in default_filename in let scbuf = Scanf.Scanning.from_file default_filename in let rec read_aux (st, lst) = if not (Scanf.Scanning.end_of_input scbuf) then begin let acc = try Scanf.bscanf scbuf "%S %S\n" (fun e d -> let t = e, d in if SetTupleString.mem t st then st, lst else SetTupleString.add t st, t :: lst) with Scanf.Scan_failure _ -> failwith (Scanf.bscanf scbuf "%l" (fun line -> Printf.sprintf "Malformed log file '%s' at line %d" default_filename line)) in read_aux acc end else begin close_in chn; List.rev lst end in read_aux (SetTupleString.empty, []) end else begin [] end let register event data = let chn_out = open_out_gen [Open_append; Open_creat; Open_text] 0o644 default_filename in Printf.fprintf chn_out "%S %S\n" event data; close_out chn_out let unregister event data = if Sys.file_exists default_filename then begin let lst = load () in let chn_out = open_out default_filename in let write_something = ref false in List.iter (fun (e, d) -> if e <> event || d <> data then begin write_something := true; Printf.fprintf chn_out "%S %S\n" e d end) lst; close_out chn_out; if not !write_something then Sys.remove default_filename end let filter events = let st_events = List.fold_left (fun st e -> SetString.add e st) SetString.empty events in List.filter (fun (e, _) -> SetString.mem e st_events) (load ()) let exists event data = List.exists (fun v -> (event, data) = v) (load ()) 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 t nm lst = BaseLog.register (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 (to_log_event_file t nm) (if Filename.is_relative fn then Filename.concat (Sys.getcwd ()) fn else fn); true end else registered) false alt in if not registered then warning (f_ "Cannot find an existing alternative files among: %s") (String.concat (s_ ", ") alt)) lst let unregister t nm = List.iter (fun (e, d) -> BaseLog.unregister e d) (BaseLog.filter [to_log_event_file t nm; to_log_event_done t nm]) let fold 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 [to_log_event_file t nm]) let is_built t nm = List.fold_left (fun is_built (_, d) -> (try bool_of_string d with _ -> false)) false (BaseLog.filter [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 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, exec) -> 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 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 OASISExpr open OASISGettext let test 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 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 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 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 BaseEnv open BaseMessage open OASISTypes open OASISSection open OASISGettext open OASISUtils 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; } (* 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 t args = (* Run configure *) BaseCustom.hook t.package.conf_custom (fun () -> (* Reload if preconf has changed it *) begin try unload (); load (); with _ -> () end; (* Run plugin's configure *) t.configure t.package args; (* Dump to allow postconf to change it *) dump ()) (); (* Reload environment *) unload (); load (); (* Save environment *) print (); (* Replace data in file *) BaseFileAB.replace t.package.files_ab let build t args = BaseCustom.hook t.package.build_custom (t.build t.package) args let doc t args = BaseDoc.doc (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 t args = BaseTest.test (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 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 t (Array.of_list (List.rev !arg_rest)); info "Running build step"; build t [||]; (* Load setup.log dynamic variables *) BaseDynVar.init t.package; if not !rno_doc then begin info "Running doc step"; doc t [||]; end else begin info "Skipping doc step" end; if not !rno_test then begin info "Running test step"; test t [||] end else begin info "Skipping test step" end let install t args = BaseCustom.hook t.package.install_custom (t.install t.package) args let uninstall t args = BaseCustom.hook t.package.uninstall_custom (t.uninstall t.package) args let reinstall t args = uninstall t args; install 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 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 _ _ _ -> () in failsafe (f t.package (cs, test)) args | Doc (cs, doc) -> let f = try List.assoc cs.cs_name docs with Not_found -> fun _ _ _ -> () in failsafe (f t.package (cs, doc)) args | Library _ | Object _ | Executable _ | Flag _ | SrcRepo _ -> ()) t.package.sections; (* Clean whole package *) List.iter (fun f -> failsafe (f t.package) args) mains) () in let clean t args = generic_clean t t.package.clean_custom t.clean t.clean_doc t.clean_test args in let distclean t args = (* Call clean *) clean t args; (* Call distclean code *) generic_clean t t.package.distclean_custom t.distclean t.distclean_doc t.distclean_test args; (* Remove generated file *) List.iter (fun fn -> if Sys.file_exists fn then begin info (f_ "Remove '%s'") fn; Sys.remove fn end) (BaseEnv.default_filename :: BaseLog.default_filename :: (List.rev_map BaseFileAB.to_filename t.package.files_ab)) in clean, distclean let version 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.") 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: (function | 0 -> () | n -> 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 try let act_ref = ref (fun _ -> 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 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"); (* Build initial environment *) load ~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 t.package; if t.setup_update && update_setup_ml t then () else !act_ref t (Array.of_list (List.rev !extra_args_ref)) with e when !catch_exn -> error "%s" (Printexc.to_string e); exit 1 end # 5394 "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 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 *) 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, lib) -> cs, bs, lib, []) let obj_hook = ref (fun (cs, bs, obj) -> cs, bs, 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" 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 pkg argv = let in_destdir = try let destdir = destdir () in (* Practically speaking destdir is prepended * at the beginning of the target filename *) fun fn -> destdir^fn with PropList.Not_set _ -> fun fn -> fn in let install_file ?tgt_fn src_file envdir = let tgt_dir = in_destdir (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:!BaseContext.default (fun dn -> info (f_ "Creating directory '%s'") dn; BaseLog.register install_dir_ev dn) tgt_dir; (* Really install files *) info (f_ "Copying file '%s' to '%s'") src_file tgt_file; OASISFileUtil.cp ~ctxt:!BaseContext.default src_file tgt_file; BaseLog.register install_file_ev tgt_file in (* Install data into defined directory *) let install_data 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 fn (fun () -> match tgt_opt with | Some s -> OASISHostPath.of_unix (var_expand s) | None -> tgtdir)) real_srcs) lst in (** Install all libraries *) let install_libs pkg = let files_of_library (f_data, acc) data_lib = let cs, bs, lib, lib_extra = !lib_hook data_lib in if var_choose bs.bs_install && BaseBuilt.is_built BaseBuilt.BLib cs.cs_name then begin let acc = (* Start with acc + lib_extra *) List.rev_append lib_extra acc in let acc = (* Add uncompiled header from the source tree *) let path = OASISHostPath.of_unix bs.bs_path in List.fold_left (fun acc modul -> try List.find OASISFileUtil.file_exists_case (List.map (Filename.concat path) [modul^".mli"; modul^".ml"; String.uncapitalize modul^".mli"; String.capitalize modul^".mli"; String.uncapitalize modul^".ml"; String.capitalize modul^".ml"]) :: acc with Not_found -> begin warning (f_ "Cannot find source header for module %s \ in library %s") modul cs.cs_name; acc end) acc lib.lib_modules in let acc = (* Get generated files *) BaseBuilt.fold BaseBuilt.BLib cs.cs_name (fun acc fn -> fn :: acc) acc in let f_data () = (* Install data associated with the library *) install_data 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, obj_extra = !obj_hook data_obj in if var_choose bs.bs_install && BaseBuilt.is_built BaseBuilt.BObj cs.cs_name then begin let acc = (* Start with acc + obj_extra *) List.rev_append obj_extra acc in let acc = (* Add uncompiled header from the source tree *) let path = OASISHostPath.of_unix bs.bs_path in List.fold_left (fun acc modul -> try List.find OASISFileUtil.file_exists_case (List.map (Filename.concat path) [modul^".mli"; modul^".ml"; String.uncapitalize modul^".mli"; String.capitalize modul^".mli"; String.uncapitalize modul^".ml"; String.capitalize modul^".ml"]) :: acc with Not_found -> begin warning (f_ "Cannot find source header for module %s \ in object %s") modul cs.cs_name; acc end) acc obj.obj_modules in let acc = (* Get generated files *) BaseBuilt.fold BaseBuilt.BObj cs.cs_name (fun acc fn -> fn :: acc) acc in let f_data () = (* Install data associated with the object *) install_data 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, children) -> files_of_library data_and_files (cs, bs, lib), children | Package (_, cs, bs, `Object obj, children) -> files_of_object data_and_files (cs, bs, obj), 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. *) 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 n in List.map (remove_prefix (Sys.getcwd ())) files in info (f_ "Installing findlib library '%s'") findlib_name; let ocamlfind = ocamlfind () in let commands = split_install_command ocamlfind findlib_name meta files in List.iter (OASISExec.run ~ctxt:!BaseContext.default ocamlfind) commands; BaseLog.register 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 pkg = let install_exec data_exec = let cs, bs, exec = !exec_hook data_exec in if var_choose bs.bs_install && BaseBuilt.is_built BaseBuilt.BExec cs.cs_name then begin let exec_libdir () = Filename.concat (libdir ()) pkg.name in BaseBuilt.fold BaseBuilt.BExec cs.cs_name (fun () fn -> install_file ~tgt_fn:(cs.cs_name ^ ext_program ()) fn bindir) (); BaseBuilt.fold BaseBuilt.BExecLib cs.cs_name (fun () fn -> install_file fn exec_libdir) (); install_data 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 pkg = let install_doc data = let cs, doc = !doc_hook data in if var_choose doc.doc_install && BaseBuilt.is_built BaseBuilt.BDoc cs.cs_name then begin let tgt_dir = OASISHostPath.of_unix (var_expand doc.doc_install_dir) in BaseBuilt.fold BaseBuilt.BDoc cs.cs_name (fun () fn -> install_file fn (fun () -> tgt_dir)) (); install_data 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 install_libs pkg; install_execs pkg; install_docs pkg (* Uninstall already installed data *) let uninstall _ argv = List.iter (fun (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:!BaseContext.default 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:!BaseContext.default (ocamlfind ()) ["remove"; data] end else failwithf (f_ "Unknown log event '%s'") ev; BaseLog.unregister ev data) (* We process event in reverse order *) (List.rev (BaseLog.filter [install_file_ev; install_dir_ev; install_findlib_ev])) end # 6243 "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 extra_args = 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"; "-install-lib-dir"; (Filename.concat (standard_library ()) "ocamlbuild") ] else []; if not (bool_of_string (is_native ())) || (os_type ()) = "Win32" then [ "-byte-plugin" ] else []; args; if bool_of_string (debug ()) then ["-tag"; "debug"] 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 extra_argv = let extra_cli = String.concat " " (Array.to_list extra_argv) in (* Run if never called with these args *) if not (BaseLog.exists ocamlbuild_clean_ev extra_cli) then begin OASISExec.run ~ctxt:!BaseContext.default (ocamlbuild ()) (fix_args ["-clean"] extra_argv); BaseLog.register ocamlbuild_clean_ev extra_cli; at_exit (fun () -> try BaseLog.unregister ocamlbuild_clean_ev extra_cli with _ -> ()) end (** Run ocamlbuild, unregister all clean events *) let run_ocamlbuild args extra_argv = (* TODO: enforce that target in args must be UNIX encoded i.e. toto/index.html *) OASISExec.run ~ctxt:!BaseContext.default (ocamlbuild ()) (fix_args args extra_argv); (* Remove any clean event, we must run it again *) List.iter (fun (e, d) -> BaseLog.unregister e d) (BaseLog.filter [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_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 open BaseMessage let cond_targets_hook = ref (fun lst -> lst) let build extra_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 ".cmo" fn || ends_with ".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, unix_exec_is, unix_dll_opt = 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, lst 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 bt bnm lst) in (* Run the hook *) let cond_targets = !cond_targets_hook cond_targets in (* Run a list of target... *) run_ocamlbuild (List.flatten (List.map snd cond_targets) @ extra_args) argv; (* ... and register events *) List.iter check_and_register (List.flatten (List.map fst cond_targets)) let clean pkg extra_args = run_clean extra_args; List.iter (function | Library (cs, _, _) -> BaseBuilt.unregister BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister 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 OASISMessage open OCamlbuildCommon open BaseStandardVar type run_t = { extra_args: string list; run_path: unix_filename; } let doc_build run pkg (cs, doc) 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 (index_html :: run.extra_args) argv; List.iter (fun glb -> BaseBuilt.register BaseBuilt.BDoc cs.cs_name [OASISFileUtil.glob ~ctxt:!BaseContext.default (Filename.concat tgt_dir glb)]) ["*.html"; "*.css"] let doc_clean run pkg (cs, doc) argv = run_clean argv; BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name end # 6616 "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 t _ extra_args = let cmd, args = var_choose ~name:(s_ "main command") t.cmd_main in run cmd args extra_args let clean t pkg extra_args = match var_choose t.cmd_clean with | Some (cmd, args) -> run cmd args extra_args | _ -> () let distclean t pkg extra_args = match var_choose t.cmd_distclean with | Some (cmd, args) -> run cmd args extra_args | _ -> () module Build = struct let main t pkg extra_args = main 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 bt bnm lst) evs) pkg.sections let clean t pkg extra_args = clean 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 BaseBuilt.BLib cs.cs_name | Executable (cs, _, _) -> BaseBuilt.unregister BaseBuilt.BExec cs.cs_name; BaseBuilt.unregister BaseBuilt.BExecLib cs.cs_name | _ -> ()) pkg.sections let distclean t pkg extra_args = distclean t pkg extra_args end module Test = struct let main t pkg (cs, test) extra_args = try main t pkg extra_args; 0.0 with Failure s -> BaseMessage.warning (f_ "Test '%s' fails: %s") cs.cs_name s; 1.0 let clean t pkg (cs, test) extra_args = clean t pkg extra_args let distclean t pkg (cs, test) extra_args = distclean t pkg extra_args end module Doc = struct let main t pkg (cs, _) extra_args = main t pkg extra_args; BaseBuilt.register BaseBuilt.BDoc cs.cs_name [] let clean t pkg (cs, _) extra_args = clean t pkg extra_args; BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name let distclean t pkg (cs, _) extra_args = distclean t pkg extra_args end end # 6764 "setup.ml" open OASISTypes;; let setup_t = { BaseSetup.configure = InternalConfigurePlugin.configure; build = OCamlbuildPlugin.build []; test = [ ("main", CustomPlugin.Test.main { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "-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)] }); ("main_userconf", CustomPlugin.Test.main { CustomPlugin.cmd_main = [(OASISExpr.EBool true, ("$test_userconf", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; doc = [ ("manual", CustomPlugin.Doc.main { CustomPlugin.cmd_main = [ (OASISExpr.EFlag "gettext", ("env", [ "LANG=C"; "$oasis"; "-ignore-plugins"; "manual"; "-o"; "doc/MANUAL.mkd" ])); (OASISExpr.ENot (OASISExpr.EFlag "gettext"), ("$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.extra_args = []; run_path = "src/"}) ]; install = InternalInstallPlugin.install; uninstall = InternalInstallPlugin.uninstall; clean = [OCamlbuildPlugin.clean]; clean_test = [ ("main", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "-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)] }); ("main_userconf", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [(OASISExpr.EBool true, ("$test_userconf", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; clean_doc = [ ("manual", CustomPlugin.Doc.clean { CustomPlugin.cmd_main = [ (OASISExpr.EFlag "gettext", ("env", [ "LANG=C"; "$oasis"; "-ignore-plugins"; "manual"; "-o"; "doc/MANUAL.mkd" ])); (OASISExpr.ENot (OASISExpr.EFlag "gettext"), ("$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.extra_args = []; run_path = "src/"}) ]; distclean = []; distclean_test = [ ("main", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "-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)] }); ("main_userconf", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [(OASISExpr.EBool true, ("$test_userconf", []))]; cmd_clean = [(OASISExpr.EBool true, None)]; cmd_distclean = [(OASISExpr.EBool true, None)] }) ]; distclean_doc = [ ("manual", CustomPlugin.Doc.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EFlag "gettext", ("env", [ "LANG=C"; "$oasis"; "-ignore-plugins"; "manual"; "-o"; "doc/MANUAL.mkd" ])); (OASISExpr.ENot (OASISExpr.EFlag "gettext"), ("$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.3"; ocaml_version = Some (OASISVersion.VGreaterEqual "3.11.2"); findlib_version = Some (OASISVersion.VGreaterEqual "1.3.1"); alpha_features = []; beta_features = []; name = "oasis"; version = "0.4.5"; license = OASISLicense.DEP5License (OASISLicense.DEP5Unit { OASISLicense.license = "LGPL"; excption = Some "OCaml linking"; version = OASISLicense.Version "2.1" }); license_file = Some "COPYING.txt"; copyrights = ["(C) 2008-2010 OCamlCore SARL"]; maintainers = ["Sylvain Le Gall "]; authors = ["Sylvain Le Gall"]; homepage = Some "http://oasis.forge.ocamlcore.org/"; synopsis = "Architecture 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 "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:"; OASISText.BlankLine; OASISText.Verbatim "* OCamlbuild"; OASISText.Verbatim "* OMake (todo)"; 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 GODI." ]; categories = []; 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.3"); build_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [ (OASISExpr.EBool true, None); (OASISExpr.EFlag "gettext", Some (("$make", ["-C"; "po"; "all"]))) ] }; install_type = (`Install, "internal", Some "0.4"); install_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [ (OASISExpr.EBool true, None); (OASISExpr.EFlag "gettext", Some (("$make", [ "-C"; "po"; "install"; "PODIR=$prefix/share/locale" ]))) ] }; uninstall_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [ (OASISExpr.EBool true, None); (OASISExpr.EFlag "gettext", Some (("$make", [ "-C"; "po"; "install"; "PODIR=$prefix/share/locale" ]))) ] }; clean_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [ (OASISExpr.EBool true, None); (OASISExpr.EFlag "gettext", Some (("$make", ["-C"; "po"; "clean"]))) ] }; distclean_custom = { pre_command = [(OASISExpr.EBool true, None)]; post_command = [(OASISExpr.EBool true, None)] }; 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 = "gettext"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { flag_description = Some "Use ocaml-gettext for i18n"; 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); FindlibPackage ("odn", Some (OASISVersion.VGreaterEqual "0.0.11")) ]; bs_build_tools = [ ExternalTool "ocamlbuild"; ExternalTool "make"; ExternalTool "ocamlmod"; ExternalTool "ocamlyacc"; ExternalTool "ocamllex"; ExternalTool "ocamlify" ]; bs_c_sources = []; bs_data_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"; "ODNFunc"; "PropList"; "OASISUtils"; "OASISUnixPath"; "OASISContext"; "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" ]; lib_pack = false; lib_internal_modules = [ "OASISVersion_types"; "OASISVersion_lexer"; "OASISVersion_parser"; "OASISLicense_types"; "OASISLicense_lexer"; "OASISLicense_parser"; "OASISValues_lexer"; "OASISSchema"; "OASISConf"; "OASISAst"; "OASISCheck"; "OASISRecDescParser"; "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_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_c_sources = []; bs_data_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" ]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = Some "oasis"; lib_findlib_name = 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_c_sources = []; bs_data_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" ]; 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" ]; lib_findlib_parent = Some "oasis"; lib_findlib_name = 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_c_sources = []; bs_data_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_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/utils"; bs_compiled_object = Byte; bs_build_depends = [FindlibPackage ("unix", None)]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_c_sources = []; bs_data_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 = "fake_ocamlfind.ml"}); Executable ({ cs_name = "test"; 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"; bs_compiled_object = Byte; 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 "base"; InternalLibrary "builtin-plugins"; FindlibPackage ("pcre", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_c_sources = []; bs_data_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"}); Doc ({ cs_name = "manual"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { doc_type = (`Doc, "custom", Some "0.3"); 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.3"); 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/gildor478/oasis.git"; src_repo_browser = Some "https://github.com/gildor478/oasis"; src_repo_module = None; src_repo_branch = None; src_repo_tag = None; src_repo_subdir = None }); 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_c_sources = []; bs_data_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_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_c_sources = []; bs_data_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"]; lib_findlib_parent = Some "oasis"; lib_findlib_name = 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 = Byte; bs_build_depends = [ InternalLibrary "oasis"; InternalLibrary "base"; InternalLibrary "cli"; InternalLibrary "builtin-plugins" ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_c_sources = []; bs_data_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 = "main"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { test_type = (`Test, "custom", Some "0.3"); test_command = [ (OASISExpr.EBool true, ("$test", [ "-oasis"; "$oasis"; "-is-native"; "$is_native"; "-native-dynlink"; "$native_dynlink"; "-ocamlmod"; "$ocamlmod"; "-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"; ExternalTool "ocamlmod"; InternalExecutable "fake_ocamlfind" ] }); 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_c_sources = []; bs_data_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_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_c_sources = []; bs_data_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_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_c_sources = []; bs_data_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_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_c_sources = []; bs_data_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_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_c_sources = []; bs_data_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 = "pluginloader.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_c_sources = []; bs_data_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.3"); 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" ] }); Library ({ cs_name = "userconf"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { bs_build = [(OASISExpr.EBool true, true)]; bs_install = [(OASISExpr.EBool true, true)]; bs_path = "src/ext/userconf/src"; bs_compiled_object = Best; bs_build_depends = []; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_c_sources = []; bs_data_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 = ["UserConf"]; lib_pack = false; lib_internal_modules = []; lib_findlib_parent = None; lib_findlib_name = None; lib_findlib_containers = [] }); Executable ({ cs_name = "test_userconf"; 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/userconf/test"; bs_compiled_object = Byte; bs_build_depends = [ InternalLibrary "userconf"; FindlibPackage ("oUnit", None) ]; bs_build_tools = [ExternalTool "ocamlbuild"; ExternalTool "make"]; bs_c_sources = []; bs_data_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 = "TestUserConf.ml"}); Test ({ cs_name = "main_userconf"; cs_data = PropList.Data.create (); cs_plugin_data = [] }, { test_type = (`Test, "custom", Some "0.3"); test_command = [(OASISExpr.EBool true, ("$test_userconf", []))]; 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_userconf" ] }) ]; plugins = [ (`Extra, "DevFiles", Some "0.3"); (`Extra, "StdFiles", Some "0.3"); (`Extra, "META", Some "0.3") ]; disable_oasis_section = []; schema_data = PropList.Data.create (); plugin_data = [] }; oasis_fn = Some "_oasis"; oasis_version = "0.4.4"; oasis_digest = Some "*\b~\244\002\202\002u\157\2338\189\220\191)W"; oasis_exec = None; oasis_setup_args = []; setup_update = false };; let setup () = BaseSetup.setup setup_t;; # 8092 "setup.ml" (* OASIS_STOP *) #use "deps.ml";; let () = setup ();; oasis-0.4.5/po/0000755000175000017500000000000012422026741012576 5ustar gildorgildoroasis-0.4.5/po/oasis.pot0000644000175000017500000007410012422026741014442 0ustar gildorgildor# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR , YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-04-07 17:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" #: ../src/base/BaseEnv.ml:514 ../src/base/BaseEnv.ml:506 msgid " %s%s" msgstr "" #: ../src/oasis/OASISHelp.ml:82 msgid " (__mandatory__)" msgstr "" #: ../src/oasis/OASISHelp.ml:88 msgid " * @[`%s`: %a@]" msgstr "" #: ../src/OASISMain.ml:95 msgid " Create a developper mode setup.ml. It will be automatically updated at each run." msgstr "" #: ../src/OASISMain.ml:91 msgid " Display extended help" msgstr "" #: ../src/base/BaseSetup.ml:325 msgid " Don't catch exception, useful for debugging." msgstr "" #: ../src/OASISMain.ml:72 msgid " Launch an helper to write `_oasis` file." msgstr "" #: ../src/oasis/OASISMessage.ml:43 msgid " Output debug message" msgstr "" #: ../src/OASISMain.ml:86 msgid " Quickstart level, skip questions according to this level." msgstr "" #: ../src/oasis/OASISMessage.ml:39 msgid " Run quietly" msgstr "" #: ../src/base/BaseEnv.ml:477 msgid " [%s]" msgstr "" #: ../src/base/BaseEnv.ml:516 ../src/base/BaseEnv.ml:508 msgid " [default]" msgstr "" #: ../src/oasis/OASISHelp.ml:240 msgid "### Plugin %s\n\n" msgstr "" #: ../src/base/BaseEnv.ml:500 ../src/base/BaseEnv.ml:494 msgid "%s %s%s" msgstr "" #: ../src/oasis/OASISValues.ml:421 msgid "'%s' contains unbalanced curly braces" msgstr "" #: ../src/oasis/OASISQuickstart.ml:146 msgid "'%s' is not valid answer" msgstr "" #: ../src/oasis/OASISQuickstart.ml:55 msgid "(default exists) " msgstr "" #: ../src/oasis/OASISQuickstart.ml:48 msgid "(default exists, type '?' for help) " msgstr "" #: ../src/oasis/OASISQuickstart.ml:53 msgid "(default is '%s') " msgstr "" #: ../src/oasis/OASISQuickstart.ml:46 msgid "(default is '%s', type '?' for help) " msgstr "" #: ../src/oasis/OASISQuickstart.ml:50 msgid "(type '?' for help) " msgstr "" #: ../src/oasis/OASISCheck.ml:62 ../src/oasis/OASISHelp.ml:242 #. ../src/oasis/OASISExpr.ml:72 #. ../src/base/BaseEnv.ml:244 #. ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:98 msgid ", " msgstr "" #: ../src/oasis/OASISBuildSection.ml:164 msgid "-cclib arguments to use when building." msgstr "" #: ../src/oasis/OASISBuildSection.ml:157 msgid "-ccopt arguments to use when building." msgstr "" #: ../src/oasis/OASISBuildSection.ml:171 msgid "-dlllib arguments to use when building." msgstr "" #: ../src/oasis/OASISBuildSection.ml:178 msgid "-dllpath arguments to use when building." msgstr "" #: ../src/oasis/OASISExecutable.ml:79 msgid ".ml file" msgstr "" #: ../src/oasis/OASISExpr.ml:69 msgid "" msgstr "" #: ../src/oasis/OASISHelp.ml:117 msgid "@[`%s %s`: %a@]" msgstr "" #: ../src/oasis/OASISHelp.ml:122 msgid "@[`%s`: %a@]" msgstr "" #: ../src/base/BaseSetup.ml:165 msgid "Action fail with error: %s" msgstr "" #: ../src/oasis/OASISDocument.ml:67 msgid "Authors of the document." msgstr "" #: ../src/oasis/OASISValues.ml:51 msgid "Blackbox type cannot be set to the value '%s'" msgstr "" #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:85 msgid "Build documentation associated to the library." msgstr "" #: ../src/oasis/OASISPackage.ml:201 msgid "Build system." msgstr "" #: ../src/base/BaseDoc.ml:40 msgid "Building documentation '%s'" msgstr "" #: ../src/oasis/OASISBuildSection.ml:150 msgid "C source files." msgstr "" #: ../src/oasis/OASISSourceRepository.ml:80 msgid "CVS requires a named module, as each CVS server can host multiple named repositories. (__mandatory__ for CVS)" msgstr "" #: ../src/plugins/internal/InternalConfigurePlugin.ml:57 msgid "Cannot find buildable internal executable '%s' when checking build depends" msgstr "" #: ../src/plugins/internal/InternalConfigurePlugin.ml:97 msgid "Cannot find buildable internal library '%s' when checking build depends" msgstr "" #: ../src/base/BaseOCamlcConfig.ml:118 msgid "Cannot find field '%s' in '%s -config' output" msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:247 msgid "Cannot find file '%s' for findlib library %s" msgstr "" #: ../src/oasis/OASISLicense.ml:110 msgid "Cannot find license exception '%s'" msgstr "" #: ../src/oasis/OASISLicense.ml:188 msgid "Cannot find license short name" msgstr "" #: ../src/oasis/OASISLicense.ml:151 msgid "Cannot find license shortname '%s'" msgstr "" #: ../src/base/BaseSetup.ml:77 msgid "Cannot find plugin %s matching section %s for %s action" msgstr "" #: ../src/oasis/OASISLibrary.ml:55 msgid "Cannot find source file matching module '%s' in library %s" msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:175 msgid "Cannot find source header for module %s in library %s" msgstr "" #: ../src/base/BaseStandardVar.ml:123 msgid "Cannot handle os_type %s filename concat" msgstr "" #: ../src/oasis/PropList.ml:236 msgid "Cannot parse field '%s' when setting value %S" msgstr "" #: ../src/oasis/OASISLicense.ml:163 msgid "Cannot parse license '%s'" msgstr "" #: ../src/base/BaseCheck.ml:103 msgid "Cannot satisfy version constraint on %s: %s (version: %s)" msgstr "" #: ../src/oasis/OASISAst.ml:280 msgid "Cannot use versioned build depends on internal library %s in %s" msgstr "" #: ../src/base/BaseTest.ml:52 msgid "Changing directory to '%s'" msgstr "" #: ../src/oasis/OASISBuildSection.ml:117 msgid "Comma separated list of files to be installed for run-time. ([see here](#data-files))" msgstr "" #: ../src/base/BaseCustom.ml:38 msgid "Command '%s' fail with error: %s" msgstr "" #: ../src/base/BaseExec.ml:41 msgid "Command '%s' terminated with error code %d" msgstr "" #: ../src/base/BaseExec.ml:83 msgid "Command return unexpected output %S" msgstr "" #: ../src/oasis/OASISPackage.ml:206 msgid "Command to run after build." msgstr "" #: ../src/oasis/OASISDocument.ml:54 msgid "Command to run after building the doc." msgstr "" #: ../src/oasis/OASISPackage.ml:228 msgid "Command to run after clean." msgstr "" #: ../src/oasis/OASISPackage.ml:194 msgid "Command to run after configuration." msgstr "" #: ../src/oasis/OASISPackage.ml:233 msgid "Command to run after distclean." msgstr "" #: ../src/oasis/OASISPackage.ml:218 msgid "Command to run after install." msgstr "" #: ../src/oasis/OASISTest.ml:71 msgid "Command to run after the test" msgstr "" #: ../src/oasis/OASISPackage.ml:223 msgid "Command to run after uninstall." msgstr "" #: ../src/oasis/OASISPackage.ml:205 msgid "Command to run before build." msgstr "" #: ../src/oasis/OASISDocument.ml:53 msgid "Command to run before building the doc." msgstr "" #: ../src/oasis/OASISPackage.ml:227 msgid "Command to run before clean." msgstr "" #: ../src/oasis/OASISPackage.ml:193 msgid "Command to run before configuration." msgstr "" #: ../src/oasis/OASISPackage.ml:232 msgid "Command to run before distclean." msgstr "" #: ../src/oasis/OASISPackage.ml:217 msgid "Command to run before install." msgstr "" #: ../src/oasis/OASISTest.ml:70 msgid "Command to run before the test" msgstr "" #: ../src/oasis/OASISPackage.ml:222 msgid "Command to run before uninstall." msgstr "" #: ../src/oasis/OASISTest.ml:59 msgid "Command to run for the test." msgstr "" #: ../src/oasis/OASISValues.ml:471 msgid "Commande line '%s' is invalid" msgstr "" #: ../src/base/BaseStandardVar.ml:299 msgid "Compile with ocaml debug flag on." msgstr "" #: ../src/base/BaseStandardVar.ml:305 msgid "Compile with ocaml profile flag on." msgstr "" #: ../src/oasis/OASISPackage.ml:189 msgid "Configuration system." msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:85 msgid "Copying file '%s' to '%s'" msgstr "" #: ../src/oasis/OASISValues.ml:99 msgid "Copyright must follow the convention '(C) 2008-2009 J.R. Hacker', here it is '%s'" msgstr "" #: ../src/oasis/OASISPackage.ml:155 msgid "Copyright owners." msgstr "" #: ../src/oasis/OASISQuickstart.ml:308 msgid "Create a section?" msgstr "" #: ../src/oasis/OASISQuickstart.ml:306 msgid "Create another section?" msgstr "" #: ../src/oasis/OASISExecutable.ml:94 msgid "Create custom bytecode executable." msgstr "" #: ../src/OASISMain.ml:155 msgid "Creating %s file\n%!" msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:79 msgid "Creating directory '%s'" msgstr "" #: ../src/oasis/OASISPackage.ml:162 msgid "Current maintainers of the package." msgstr "" #: ../src/base/BaseStandardVar.ml:217 msgid "DVI documentation" msgstr "" #: ../src/oasis/OASISDocument.ml:104 msgid "Default target directory to install data and documentation." msgstr "" #: ../src/oasis/OASISFlag.ml:55 msgid "Default value for the flag" msgstr "" #: ../src/oasis/OASISSourceRepository.ml:86 msgid "Define a meaningful branch for this repository." msgstr "" #: ../src/oasis/OASISBuildSection.ml:144 msgid "Define the compilation type of the section: byte, native or best" msgstr "" #: ../src/oasis/OASISSourceRepository.ml:96 msgid "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." msgstr "" #: ../src/oasis/OASISBuildSection.ml:64 msgid "Dependencies on findlib packages, including internal findlib packages." msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:369 msgid "Directory '%s' is not empty (%s)" msgstr "" #: ../src/oasis/OASISBuildSection.ml:126 msgid "Directory containing the section" msgstr "" #: ../src/oasis/OASISTest.ml:66 msgid "Directory to run the test." msgstr "" #: ../src/base/BaseStandardVar.ml:207 msgid "Documentation root" msgstr "" #: ../src/base/BaseSetup.ml:328 ../src/OASISMain.ml:121 msgid "Don't know what to do with '%s'" msgstr "" #: ../src/base/BaseArgExt.ml:40 msgid "Don't know what to do with arguments: '%s'" msgstr "" #: ../src/plugins/extra/stdfiles/StdFilesPlugin.ml:165 msgid "Enable %s file generation." msgstr "" #: ../src/plugins/extra/META/METAPlugin.ml:52 msgid "Enable META generation" msgstr "" #: ../src/oasis/OASISTest.ml:78 msgid "Enable this test." msgstr "" #: ../src/oasis/OASISRecDescParser.ml:473 msgid "Error when parsing expresion '%s' %t: %s" msgstr "" #: ../src/oasis/OASISVersion.ml:206 msgid "Error while parsing '%s': %s" msgstr "" #: ../src/base/BaseDynVar.ml:41 msgid "Executable '%s' not yet built." msgstr "" #: ../src/oasis/OASISQuickstart.ml:271 msgid "Executable name?" msgstr "" #: ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:157 msgid "Expected built file '%s' doesn't exist" msgstr "" #: ../src/oasis/OASISValues.ml:123 msgid "Expecting not empty string" msgstr "" #: ../src/oasis/OASISPackage.ml:262 msgid "Extra plugins to use." msgstr "" #: ../src/oasis/PropList.ml:46 msgid "Field %s is not defined in schema %s" msgstr "" #: ../src/oasis/OASISSchema.ml:191 msgid "Field '%s' cannot be conditional" msgstr "" #: ../src/oasis/PropList.ml:107 msgid "Field '%s' is already defined in schema '%s'" msgstr "" #: ../src/oasis/PropList.ml:42 msgid "Field '%s' is not set" msgstr "" #: ../src/oasis/PropList.ml:40 msgid "Field '%s' is not set: %s" msgstr "" #: ../src/base/BaseFileGenerate.ml:304 msgid "File %s already exists" msgstr "" #: ../src/base/BaseDev.ml:63 msgid "File %s already exists, cannot generate it for dev-mode. Please remove it first." msgstr "" #: ../src/base/BaseFileGenerate.ml:351 msgid "File %s doesn't exist, creating it." msgstr "" #: ../src/base/BaseFileGenerate.ml:298 msgid "File %s has changed, doing a backup in %s" msgstr "" #: ../src/base/BaseFileGenerate.ml:323 msgid "File %s has not changed, skipping" msgstr "" #: ../src/base/BaseFileAB.ml:41 msgid "File '%s' doesn't have '.ab' extension" msgstr "" #: ../src/base/BaseBuilt.ml:79 msgid "File '%s' has been marked as built for %s but doesn't exist" msgstr "" #: ../src/oasis/OASISPackage.ml:142 msgid "File containing license." msgstr "" #: ../src/base/BaseDynVar.ml:24 msgid "Filename of executable '%s'" msgstr "" #: ../src/oasis/OASISPackage.ml:255 msgid "Files to generate using environment variable substitution." msgstr "" #: ../src/oasis/OASISValues.ml:352 msgid "Findlib package name cannot contain '.'" msgstr "" #: ../src/oasis/OASISQuickstart.ml:279 msgid "Flag name?" msgstr "" #: ../src/oasis/OASISDocument.ml:89 msgid "Format for the document." msgstr "" #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:72 msgid "Generate Makefile" msgstr "" #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:81 msgid "Generate configure script" msgstr "" #: ../src/base/BaseStandardVar.ml:212 msgid "HTML documentation" msgstr "" #: ../src/oasis/OASISFlag.ml:48 msgid "Help for the flag" msgstr "" #: ../src/oasis/OASISSourceRepository.ml:91 msgid "Identify a state corresponding to this particular package version." msgstr "" #: ../src/oasis/OASISDocument.ml:121 msgid "Index is mandatory for format HTML in document %s" msgstr "" #: ../src/oasis/OASISDocument.ml:131 msgid "Index is mandatory for format info in document %s" msgstr "" #: ../src/oasis/OASISDocument.ml:96 msgid "Index or top-level file for the document, only apply to HTML and Info." msgstr "" #: ../src/base/BaseStandardVar.ml:192 msgid "Info documentation" msgstr "" #: ../src/base/BaseStandardVar.ml:142 msgid "Install architecture-dependent files in dir" msgstr "" #: ../src/base/BaseStandardVar.ml:129 msgid "Install architecture-independent files dir" msgstr "" #: ../src/oasis/OASISPackage.ml:213 msgid "Install/uninstall system." msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:253 msgid "Installing findlib library '%s'" msgstr "" #: ../src/oasis/OASISQuickstart.ml:263 msgid "Library name?" msgstr "" #: ../src/oasis/OASISLibrary.ml:315 msgid "Library which includes the current library. The current library will be built as its parents and installed along it." msgstr "" #: ../src/oasis/OASISPackage.ml:168 msgid "License type of the package." msgstr "" #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:103 msgid "List of OCaml modules used to generate ocamldoc documentation" msgstr "" #: ../src/oasis/OASISLibrary.ml:308 msgid "List of modules to compile which are not exported." msgstr "" #: ../src/oasis/OASISLibrary.ml:300 msgid "List of modules to compile." msgstr "" #: ../src/base/BaseStandardVar.ml:197 msgid "Locale-dependent data" msgstr "" #: ../src/oasis/OASISPackage.ml:135 msgid "Long description of the package purpose." msgstr "" #: ../src/plugins/extra/META/METAPlugin.ml:60 msgid "META package description" msgstr "" #: ../src/plugins/extra/META/METAPlugin.ml:72 msgid "META type" msgstr "" #: ../src/base/BaseStandardVar.ml:202 msgid "Man documentation" msgstr "" #: ../src/oasis/OASISCheck.ml:60 msgid "Missing field in %s: %s" msgstr "" #: ../src/base/BaseStandardVar.ml:167 msgid "Modifiable architecture-independent data" msgstr "" #: ../src/base/BaseStandardVar.ml:172 msgid "Modifiable single-machine data" msgstr "" #: ../src/oasis/OASISValues.ml:289 msgid "Module path '%s' must not contain a ' '" msgstr "" #: ../src/oasis/OASISPackage.ml:118 msgid "Name of the package." msgstr "" #: ../src/oasis/OASISLibrary.ml:326 msgid "Name used by findlib." msgstr "" #: ../src/base/BaseSetup.ml:263 msgid "No action defined, run '%s %s -help'" msgstr "" #: ../src/base/BaseCustom.ml:25 msgid "No command" msgstr "" #: ../src/oasis/OASISSchema.ml:197 ../src/oasis/OASISSchema.ml:137 msgid "No context defined for field '%s' when parsing value %S" msgstr "" #: ../src/oasis/PropList.ml:44 msgid "No default printer for value %s" msgstr "" #: ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:498 msgid "No exported module defined for library %s" msgstr "" #: ../src/plugins/none/NonePlugin.ml:30 msgid "No implementation for %s" msgstr "" #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:131 msgid "No module defined for documentation of library %s" msgstr "" #: ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:96 msgid "No possible ocamlbuild targets in generated files %s for library %s" msgstr "" #: ../src/base/BaseFileGenerate.ml:251 msgid "No replace section found in template for file %s" msgstr "" #: ../src/base/BaseFileGenerate.ml:328 msgid "No replace section in file %s" msgstr "" #: ../src/oasis/OASISExpr.ml:88 msgid "No result for a choice list: %s" msgstr "" #: ../src/oasis/OASISExpr.ml:83 msgid "No result for the choice list '%s': %s" msgstr "" #: ../src/base/BaseEnv.ml:125 msgid "No variable %s defined when trying to expand %S." msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:232 msgid "Nothing to install for findlib library '%s'" msgstr "" #: ../src/OASISMain.ml:109 msgid "OASIS (C) 2009-2010 OCamlCore SARL" msgstr "" #: ../src/base/BaseStandardVar.ml:48 msgid "OASIS Package is not set" msgstr "" #: ../src/OASISMain.ml:113 msgid "OASIS [options] -action [action-options]" msgstr "" #: ../src/oasis/OASISPackage.ml:106 msgid "OASIS format version '%s' is not supported." msgstr "" #: ../src/oasis/OASISPackage.ml:113 msgid "OASIS format version used to write file `_oasis`." msgstr "" #: ../src/oasis/OASISExecutable.ml:87 msgid "OCaml file (.ml) containing main procedure for the executable." msgstr "" #: ../src/base/BaseStandardVar.ml:177 msgid "Object code libraries" msgstr "" #: ../src/base/BaseStandardVar.ml:222 msgid "PDF documentation" msgstr "" #: ../src/base/BaseStandardVar.ml:227 msgid "PS documentation" msgstr "" #: ../src/base/BaseStandardVar.ml:53 msgid "Package name" msgstr "" #: ../src/base/BaseStandardVar.ml:59 msgid "Package version" msgstr "" #: ../src/oasis/OASISPlugin.ml:220 msgid "Plugin %s is defined without version, use current version at least: %s." msgstr "" #: ../src/oasis/OASISDocument.ml:49 msgid "Plugin to use to build documentation." msgstr "" #: ../src/oasis/OASISTest.ml:46 msgid "Plugin to use to run test." msgstr "" #: ../src/base/BaseCustom.ml:29 msgid "Pre/Post Command" msgstr "" #: ../src/base/BaseStandardVar.ml:232 msgid "Prepend a path when installing package" msgstr "" #: ../src/base/BaseStandardVar.ml:157 msgid "Program executables" msgstr "" #: ../src/base/BaseStandardVar.ml:182 msgid "Read-only arch-independent data root" msgstr "" #: ../src/base/BaseStandardVar.ml:187 msgid "Read-only architecture-independent data" msgstr "" #: ../src/base/BaseStandardVar.ml:162 msgid "Read-only single-machine data" msgstr "" #: ../src/plugins/extra/stdfiles/StdFilesPlugin.ml:172 msgid "Real filename to use for file %s." msgstr "" #: ../src/oasis/OASISPackage.ml:148 msgid "Real people that had contributed to the package." msgstr "" #: ../src/base/BaseFileGenerate.ml:315 msgid "Regenerating file %s" msgstr "" #: ../src/base/BaseSetup.ml:234 msgid "Remove '%s'" msgstr "" #: ../src/base/BaseStandardVar.ml:290 msgid "Remove a directory." msgstr "" #: ../src/base/BaseStandardVar.ml:281 msgid "Remove a file." msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:362 msgid "Removing directory '%s'" msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:350 msgid "Removing file '%s'" msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:380 msgid "Removing findlib library '%s'" msgstr "" #: ../src/plugins/extra/META/METAPlugin.ml:86 msgid "Requires field for META package" msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:329 msgid "Run command to build documentation." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:254 msgid "Run command to build." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:330 msgid "Run command to clean build documentation step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:255 msgid "Run command to clean build step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:240 msgid "Run command to clean configure step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:304 msgid "Run command to clean install step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:384 msgid "Run command to clean test step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:311 msgid "Run command to clean uninstall step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:239 msgid "Run command to configure." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:331 msgid "Run command to distclean build documentation step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:256 msgid "Run command to distclean build step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:241 msgid "Run command to distclean configure step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:305 msgid "Run command to distclean install step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:393 msgid "Run command to distclean test step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:312 msgid "Run command to distclean uninstall step." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:303 msgid "Run command to install." msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:310 msgid "Run command to uninstall." msgstr "" #: ../src/base/BaseExec.ml:35 msgid "Running command '%s'" msgstr "" #: ../src/base/BaseTest.ml:43 msgid "Running test '%s'" msgstr "" #: ../src/plugins/internal/InternalConfigurePlugin.ml:75 msgid "Section %s requires native compilation" msgstr "" #: ../src/oasis/OASISBuildSection.ml:101 msgid "Set if the section should be built." msgstr "" #: ../src/oasis/OASISBuildSection.ml:107 msgid "Set if the section should be distributed." msgstr "" #: ../src/base/BaseSetup.ml:329 msgid "Setup and run build process current package\n" msgstr "" #: ../src/oasis/OASISPackage.ml:128 msgid "Short description of the purpose of this package." msgstr "" #: ../src/oasis/OASISDocument.ml:74 msgid "Short paragraph giving an overview of the document." msgstr "" #: ../src/base/BaseTest.ml:78 msgid "Skipping test '%s'" msgstr "" #: ../src/oasis/OASISQuickstart.ml:287 msgid "Source repository identifier?" msgstr "" #: ../src/oasis/OASISValues.ml:77 msgid "String '%s' is not a %s" msgstr "" #: ../src/oasis/OASISRecDescParser.ml:556 msgid "Syntax error %s %t" msgstr "" #: ../src/oasis/OASISRecDescParser.ml:554 msgid "Syntax error %t" msgstr "" #: ../src/base/BaseEnv.ml:130 msgid "Syntax error when parsing '%s' when trying to expand %S: %s" msgstr "" #: ../src/base/BaseStandardVar.ml:152 msgid "System admin executables" msgstr "" #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:63 msgid "Targets to disable when generating Makefile" msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:114 msgid "Test '%s' fails: %s" msgstr "" #: ../src/oasis/OASISQuickstart.ml:295 msgid "Test name?" msgstr "" #: ../src/base/BaseFileUtil.ml:68 msgid "Testing file existence '%s'" msgstr "" #: ../src/base/BaseTest.ml:100 msgid "Tests had a %.2f%% failure rate" msgstr "" #: ../src/oasis/OASISDocument.ml:60 msgid "Title of the document." msgstr "" #: ../src/oasis/OASISBuildSection.ml:94 msgid "Tools required to compile, including internal executables." msgstr "" #: ../src/oasis/OASISTest.ml:53 msgid "Tools required to run the test, including internal executables." msgstr "" #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:94 msgid "Top level directory for building ocamldoc documentation" msgstr "" #: ../src/oasis/OASISQuickstart.ml:207 msgid "Trying to set field '%s' using mandatory value '%s': %s" msgstr "" #: ../src/plugins/extra/META/METAPlugin.ml:78 msgid "Type of META package, set default predicates for archive" msgstr "" #: ../src/oasis/OASISValues.ml:88 msgid "URL" msgstr "" #: ../src/oasis/OASISPackage.ml:240 msgid "URL of the package homepage." msgstr "" #: ../src/oasis/OASISSourceRepository.ml:61 msgid "URL of the repository. The exact form of this field depends on the repository type." msgstr "" #: ../src/oasis/OASISSourceRepository.ml:69 msgid "URL where the repository can be navigated using a web browser." msgstr "" #: ../src/oasis/OASISPackage.ml:247 msgid "URL(s) describing categories of the package." msgstr "" #: ../src/oasis/OASISLibrary.ml:274 msgid "Unable to determine root library of findlib library '%s'" msgstr "" #: ../src/oasis/OASISLibrary.ml:235 msgid "Unable to translate internal library '%s' to findlib name" msgstr "" #: ../src/oasis/OASISValues.ml:335 msgid "Unexpected abstract choice value for %s" msgstr "" #: ../src/oasis/OASISValues.ml:321 msgid "Unknown %s %S (possible: %s)" msgstr "" #: ../src/oasis/OASISExpr.ml:122 msgid "Unknown OASIS test %s" msgstr "" #: ../src/oasis/OASISPlugin.ml:258 msgid "Unknown build plugin '%s' (available: %s)" msgstr "" #: ../src/base/BaseEnv.ml:119 msgid "Unknown expression '%s' in variable expansion of %s." msgstr "" #: ../src/oasis/OASISExpr.ml:147 msgid "Unknown flag '%s'" msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:384 msgid "Unknown log event '%s'" msgstr "" #: ../src/oasis/OASISHelp.ml:189 msgid "Unknown variable %s in documentationi (line is '%s')" msgstr "" #: ../src/oasis/OASISPlugin.ml:247 msgid "Unkown configure plugin '%s' (available: %s)" msgstr "" #: ../src/oasis/OASISPlugin.ml:269 msgid "Unkown doc plugin '%s' (available: %s)" msgstr "" #: ../src/oasis/OASISPlugin.ml:302 msgid "Unkown extra plugin '%s' (available: %s)" msgstr "" #: ../src/oasis/OASISPlugin.ml:291 msgid "Unkown install plugin '%s' (available: %s)" msgstr "" #: ../src/oasis/OASISPlugin.ml:280 msgid "Unkown test plugin '%s' (available: %s)" msgstr "" #: ../src/base/BaseStandardVar.ml:147 msgid "User executables" msgstr "" #: ../src/oasis/OASISQuickstart.ml:75 msgid "Using default '%s'.\n" msgstr "" #: ../src/oasis/OASISSourceRepository.ml:55 msgid "VCS type." msgstr "" #: ../src/oasis/OASISQuickstart.ml:223 msgid "Value for field '%s'?" msgstr "" #: ../src/oasis/OASISPackage.ml:182 msgid "Version constraint on Finblib." msgstr "" #: ../src/oasis/OASISPackage.ml:175 msgid "Version constraint on OCaml." msgstr "" #: ../src/oasis/OASISPackage.ml:123 msgid "Version of the package." msgstr "" #: ../src/oasis/OASISLibrary.ml:335 msgid "Virtual containers for sub-package, dot-separated" msgstr "" #: ../src/base/BaseCheck.ml:134 msgid "When looking for findlib package %s, directory %s return doesn't exist" msgstr "" #: ../src/plugins/internal/InternalInstallPlugin.ml:106 msgid "Wildcard '%s' doesn't match any files" msgstr "" #: ../src/base/BaseSetup.ml:299 msgid "[options*] Build documentation." msgstr "" #: ../src/base/BaseSetup.ml:321 msgid "[options*] Clean build and configure environment." msgstr "" #: ../src/base/BaseSetup.ml:317 msgid "[options*] Clean build environment." msgstr "" #: ../src/base/BaseSetup.ml:291 msgid "[options*] Configure build process." msgstr "" #: ../src/base/BaseSetup.ml:307 msgid "[options*] Install libraries, data, executables and documentations." msgstr "" #: ../src/base/BaseSetup.ml:295 msgid "[options*] Run build process." msgstr "" #: ../src/base/BaseSetup.ml:303 msgid "[options*] Run tests." msgstr "" #: ../src/base/BaseSetup.ml:312 msgid "[options*] Uninstall libraries, data, executables and documentations." msgstr "" #: ../src/oasis/OASISHelp.ml:242 msgid "__Types__: %s\n\n" msgstr "" #: ../src/oasis/OASISHelp.ml:241 msgid "__Version__: %s
\n" msgstr "" #: ../src/OASISMain.ml:77 msgid "beginner" msgstr "" #: ../src/oasis/OASISValues.ml:342 msgid "boolean" msgstr "" #: ../src/base/BaseSetup.ml:113 msgid "build" msgstr "" #: ../src/oasis/OASISBuildSection.ml:141 msgid "compiled object" msgstr "" #: ../src/base/BaseArgExt.ml:41 msgid "configure options:" msgstr "" #: ../src/oasis/OASISQuickstart.ml:273 msgid "create a flag" msgstr "" #: ../src/oasis/OASISQuickstart.ml:257 msgid "create a library" msgstr "" #: ../src/oasis/OASISQuickstart.ml:281 msgid "create a source repository" msgstr "" #: ../src/oasis/OASISQuickstart.ml:289 msgid "create a test" msgstr "" #: ../src/oasis/OASISQuickstart.ml:265 msgid "create an executable" msgstr "" #: ../src/base/BaseSetup.ml:349 msgid "default value of flag %s" msgstr "" #: ../src/OASISMain.ml:68 msgid "dir Change directory before running." msgstr "" #: ../src/oasis/OASISDocument.ml:39 msgid "document" msgstr "" #: ../src/base/BaseBuilt.ml:89 msgid "documentation %s" msgstr "" #: ../src/base/BaseDoc.ml:35 msgid "documentation %s build" msgstr "" #: ../src/oasis/OASISQuickstart.ml:265 msgid "e" msgstr "" #: ../src/oasis/OASISExecutable.ml:72 ../src/oasis/OASISExecutable.ml:69 msgid "executable" msgstr "" #: ../src/base/BaseBuilt.ml:85 msgid "executable %s" msgstr "" #: ../src/OASISMain.ml:79 msgid "expert" msgstr "" #: ../src/oasis/OASISQuickstart.ml:273 msgid "f" msgstr "" #: ../src/oasis/OASISFlag.ml:41 msgid "flag" msgstr "" #: ../src/OASISMain.ml:100 msgid "fn Change the default name of setup.ml. This option should be used with caution, it is reserved for internal use." msgstr "" #: ../src/oasis/OASISRecDescParser.ml:389 msgid "in file '%s' at line %d, char %d" msgstr "" #: ../src/OASISMain.ml:78 msgid "intermediate" msgstr "" #: ../src/oasis/OASISQuickstart.ml:257 msgid "l" msgstr "" #: ../src/oasis/OASISLibrary.ml:292 ../src/oasis/OASISLibrary.ml:289 msgid "library" msgstr "" #: ../src/base/BaseBuilt.ml:87 msgid "library %s" msgstr "" #: ../src/plugins/custom/CustomPlugin.ml:44 msgid "main command" msgstr "" #: ../src/oasis/OASISValues.ml:275 msgid "module" msgstr "" #: ../src/oasis/OASISQuickstart.ml:255 ../src/oasis/OASISQuickstart.ml:155 msgid "n" msgstr "" #: ../src/oasis/OASISQuickstart.ml:155 msgid "no" msgstr "" #: ../src/oasis/PropList.ml:192 msgid "no default value" msgstr "" #: ../src/oasis/OASISBuildSection.ml:185 msgid "ocamlc arguments to use when building." msgstr "" #: ../src/oasis/OASISBuildSection.ml:192 msgid "ocamlopt arguments to use when building." msgstr "" #: ../src/base/BaseSetup.ml:133 msgid "run" msgstr "" #: ../src/oasis/OASISQuickstart.ml:281 msgid "s" msgstr "" #: ../src/oasis/OASISSourceRepository.ml:41 msgid "source repository" msgstr "" #: ../src/oasis/OASISSourceRepository.ml:46 msgid "source repository type" msgstr "" #: ../src/oasis/OASISQuickstart.ml:255 msgid "stop" msgstr "" #: ../src/oasis/OASISQuickstart.ml:289 msgid "t" msgstr "" #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:60 msgid "target" msgstr "" #: ../src/oasis/OASISTest.ml:39 msgid "test" msgstr "" #: ../src/base/BaseTest.ml:37 msgid "test %s run" msgstr "" #: ../src/base/BaseStandardVar.ml:237 msgid "undefined by construct" msgstr "" #: ../src/oasis/OASISQuickstart.ml:154 msgid "y" msgstr "" #: ../src/oasis/OASISQuickstart.ml:154 msgid "yes" msgstr "" oasis-0.4.5/po/fr.po0000644000175000017500000012753712422026741013564 0ustar gildorgildor#, fuzzy msgid "" msgstr "" "Project-Id-Version: oasis 0.1.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2010-03-24 14:15+0000\n" "PO-Revision-Date: 2010-04-07 19:19+0200\n" "Last-Translator: Sylvain Le Gall \n" "Language-Team: French \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;" #: ../src/base/BaseEnv.ml:514 ../src/base/BaseEnv.ml:506 msgid " %s%s" msgstr " %s%s" #: ../src/oasis/OASISHelp.ml:82 msgid " (__mandatory__)" msgstr " (__obligatoire__)" #: ../src/oasis/OASISHelp.ml:88 msgid " * @[`%s`: %a@]" msgstr " * @[`%s` : %a@]" #: ../src/OASISMain.ml:95 msgid " Create a developper mode setup.ml. It will be automatically updated at each run." msgstr " Crée un setup.ml en mode développement. Il sera mis à jour à chaque lancement." #: ../src/OASISMain.ml:91 msgid " Display extended help" msgstr " Affiche l'aide étendue" #: ../src/base/BaseSetup.ml:325 msgid " Don't catch exception, useful for debugging." msgstr " Ne pas rattraper les exceptions, utile pour debugger." #: ../src/OASISMain.ml:72 msgid " Launch an helper to write `_oasis` file." msgstr " Lance une aide à l'écriture du fichier `_oasis`." #: ../src/oasis/OASISMessage.ml:43 msgid " Output debug message" msgstr " Imprime les messages de debug" #: ../src/OASISMain.ml:86 msgid " Quickstart level, skip questions according to this level." msgstr " Niveau pour quickstart, ignore les questions ne correspondant pas au niveau." #: ../src/oasis/OASISMessage.ml:39 msgid " Run quietly" msgstr " Mode silencieux." #: ../src/base/BaseEnv.ml:477 msgid " [%s]" msgstr " [%s]" #: ../src/base/BaseEnv.ml:516 ../src/base/BaseEnv.ml:508 msgid " [default]" msgstr " [défaut]" #: ../src/oasis/OASISHelp.ml:240 msgid "### Plugin %s\n\n" msgstr "### Plugin: %s\n\n" #: ../src/base/BaseEnv.ml:500 ../src/base/BaseEnv.ml:494 msgid "%s %s%s" msgstr "%s %s%s" #: ../src/oasis/OASISValues.ml:421 msgid "'%s' contains unbalanced curly braces" msgstr "'%s' contient des accolades non-équilibrées" #: ../src/oasis/OASISQuickstart.ml:146 msgid "'%s' is not valid answer" msgstr "'%s' n'est pas une réponse valide" #: ../src/oasis/OASISQuickstart.ml:55 msgid "(default exists) " msgstr "(une valeur par défaut existe)" #: ../src/oasis/OASISQuickstart.ml:48 msgid "(default exists, type '?' for help) " msgstr "(une valeur par défaut existe, taper '?' pour l'aide) " #: ../src/oasis/OASISQuickstart.ml:53 msgid "(default is '%s') " msgstr "(la valeur par défaut est '%s') " #: ../src/oasis/OASISQuickstart.ml:46 msgid "(default is '%s', type '?' for help) " msgstr "(la valeur par défaut est '%s', taper '?' pour l'aide) " #: ../src/oasis/OASISQuickstart.ml:50 msgid "(type '?' for help) " msgstr "(taper '?' pour l'aide) " #: ../src/oasis/OASISCheck.ml:62 ../src/oasis/OASISHelp.ml:242 #. ../src/oasis/OASISExpr.ml:72 #. ../src/base/BaseEnv.ml:244 #. ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:98 msgid ", " msgstr ", " #: ../src/oasis/OASISBuildSection.ml:164 msgid "-cclib arguments to use when building." msgstr "-cclib arguments à utiliser pour la construction " #: ../src/oasis/OASISBuildSection.ml:157 msgid "-ccopt arguments to use when building." msgstr "-ccopt arguments à utiliser pour la construction" #: ../src/oasis/OASISBuildSection.ml:171 msgid "-dlllib arguments to use when building." msgstr "-dlllib arguments à utiliser pour la construction." #: ../src/oasis/OASISBuildSection.ml:178 msgid "-dllpath arguments to use when building." msgstr "-dllpath arguments à utiliser pour la construction." #: ../src/oasis/OASISExecutable.ml:79 msgid ".ml file" msgstr "fichier .ml" #: ../src/oasis/OASISExpr.ml:69 msgid "" msgstr "" #: ../src/oasis/OASISHelp.ml:117 msgid "@[`%s %s`: %a@]" msgstr "@[`%s %s` : %a@]" #: ../src/oasis/OASISHelp.ml:122 msgid "@[`%s`: %a@]" msgstr "@[`%s` : %a@]" #: ../src/base/BaseSetup.ml:165 msgid "Action fail with error: %s" msgstr "L'action a échouée avec l'erreur : %s" #: ../src/oasis/OASISDocument.ml:67 msgid "Authors of the document." msgstr "Auteurs du document." #: ../src/oasis/OASISValues.ml:51 msgid "Blackbox type cannot be set to the value '%s'" msgstr "" "Les valeurs de type boite noire ne peuvent être affectées à la valeur '%s'" #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:85 msgid "Build documentation associated to the library." msgstr "Construit la documentation associé à la librairie." #: ../src/oasis/OASISPackage.ml:201 msgid "Build system." msgstr "Système de construction." #: ../src/base/BaseDoc.ml:40 msgid "Building documentation '%s'" msgstr "Construction de la documentation '%s'" #: ../src/oasis/OASISBuildSection.ml:150 msgid "C source files." msgstr "Fichiers source C." #: ../src/oasis/OASISSourceRepository.ml:80 msgid "" "CVS requires a named module, as each CVS server can host multiple named " "repositories. (__mandatory__ for CVS)" msgstr "" "CVS a besoin du nom d'un module, car les serveurs CVS peuvent contenir " "plusieurs dépot de sources (__obligatoire__ pour CVS)" #: ../src/plugins/internal/InternalConfigurePlugin.ml:57 msgid "" "Cannot find buildable internal executable '%s' when checking build depends" msgstr "" "Impossible un exécutable interne '%s' à construire pendant la vérification " "des dépendances de construction" #: ../src/plugins/internal/InternalConfigurePlugin.ml:97 msgid "Cannot find buildable internal library '%s' when checking build depends" msgstr "" "Impossible de trouver une librairie interne '%s' à construire pendant la " "vérification des dépendances de construction" #: ../src/base/BaseOCamlcConfig.ml:118 msgid "Cannot find field '%s' in '%s -config' output" msgstr "" "Impossible de trouver le champ '%s' dans la sortie de la commande '%s -" "config'" #: ../src/plugins/internal/InternalInstallPlugin.ml:247 msgid "Cannot find file '%s' for findlib library %s" msgstr "Impossible de trouver le fichier '%s' pour la librairie findlib %s" #: ../src/oasis/OASISLicense.ml:110 msgid "Cannot find license exception '%s'" msgstr "Impossible de trouver l'exception '%s' à la licence" #: ../src/oasis/OASISLicense.ml:188 msgid "Cannot find license short name" msgstr "Impossible de trouver le nom court de la licence" #: ../src/oasis/OASISLicense.ml:151 msgid "Cannot find license shortname '%s'" msgstr "Impossible de trouver le nom court de la license '%s'" #: ../src/base/BaseSetup.ml:77 msgid "Cannot find plugin %s matching section %s for %s action" msgstr "Impossible de trouver le plugin %s correspondant à la section %s pour l'action %s" #: ../src/oasis/OASISLibrary.ml:55 msgid "Cannot find source file matching module '%s' in library %s" msgstr "" "Impossible de trouver le fichier source correspondante au module '%s' de la " "librairie %s" #: ../src/plugins/internal/InternalInstallPlugin.ml:175 msgid "Cannot find source header for module %s in library %s" msgstr "" "Impossible de trouver le fichier source d'en-tête pour le module %s de la " "librairie %s" #: ../src/base/BaseStandardVar.ml:123 msgid "Cannot handle os_type %s filename concat" msgstr "Impossible de gérer la concaténation de nom de fichier pour l'OS %s" #: ../src/oasis/PropList.ml:236 msgid "Cannot parse field '%s' when setting value %S" msgstr "Impossible d'analyser '%s' pour mettre à jour la valeur %S" #: ../src/oasis/OASISLicense.ml:163 msgid "Cannot parse license '%s'" msgstr "Impossible d'analyser la licence '%s'" #: ../src/base/BaseCheck.ml:103 msgid "Cannot satisfy version constraint on %s: %s (version: %s)" msgstr "" "Impossible de satisfaire la contrainte de version sur %s : %s (version : %s)" #: ../src/oasis/OASISAst.ml:280 msgid "Cannot use versioned build depends on internal library %s in %s" msgstr "" "Impossible d'utiliser une dépendance avec version pour la librairie interne %" "s dans %s" #: ../src/base/BaseTest.ml:52 msgid "Changing directory to '%s'" msgstr "Changement de répertoire vers '%s'" #: ../src/oasis/OASISBuildSection.ml:117 msgid "" "Comma separated list of files to be installed for run-time. ([see here]" "(#data-files))" msgstr "" "Liste de fichiers, séparée par des virgules, à installer pour l'exécution " "([voir ici](#data-files))" #: ../src/base/BaseCustom.ml:38 msgid "Command '%s' fail with error: %s" msgstr "La commande '%s' a échouée avec l'erreur : %s" #: ../src/base/BaseExec.ml:41 msgid "Command '%s' terminated with error code %d" msgstr "La commande '%s' s'est terminée avec un code d'erreur %d" #: ../src/base/BaseExec.ml:83 msgid "Command return unexpected output %S" msgstr "La commande a émis des données non attendue %S" #: ../src/oasis/OASISPackage.ml:206 msgid "Command to run after build." msgstr "Commande à lancer après la construction." #: ../src/oasis/OASISDocument.ml:54 msgid "Command to run after building the doc." msgstr "Commande à lancer après la construction du document." #: ../src/oasis/OASISPackage.ml:228 msgid "Command to run after clean." msgstr "Commande à lancer après le nettoyage." #: ../src/oasis/OASISPackage.ml:194 msgid "Command to run after configuration." msgstr "Commande à lancer après la configuration." #: ../src/oasis/OASISPackage.ml:233 msgid "Command to run after distclean." msgstr "Commande à lancer après le nettoyage en profondeur." #: ../src/oasis/OASISPackage.ml:218 msgid "Command to run after install." msgstr "Commande à lancer après l'installation." #: ../src/oasis/OASISTest.ml:71 msgid "Command to run after the test" msgstr "Commande à lancer après le test." #: ../src/oasis/OASISPackage.ml:223 msgid "Command to run after uninstall." msgstr "Commande à lancer après la désinstallation." #: ../src/oasis/OASISPackage.ml:205 msgid "Command to run before build." msgstr "Commande à lancer avant la construction." #: ../src/oasis/OASISDocument.ml:53 msgid "Command to run before building the doc." msgstr "Commande à lancer avant la construction du document." #: ../src/oasis/OASISPackage.ml:227 msgid "Command to run before clean." msgstr "Commande à lancer avant le nettoyage." #: ../src/oasis/OASISPackage.ml:193 msgid "Command to run before configuration." msgstr "Commande à lancer avant la configuration." #: ../src/oasis/OASISPackage.ml:232 msgid "Command to run before distclean." msgstr "Commande à lancer avant la construction." #: ../src/oasis/OASISPackage.ml:217 msgid "Command to run before install." msgstr "Commande à lancer avant l'installation." #: ../src/oasis/OASISTest.ml:70 msgid "Command to run before the test" msgstr "Commande à lancer avant le test." #: ../src/oasis/OASISPackage.ml:222 msgid "Command to run before uninstall." msgstr "Commande à lancer avant la désinstallation." #: ../src/oasis/OASISTest.ml:59 msgid "Command to run for the test." msgstr "Commande à lancer pour ce test." #: ../src/oasis/OASISValues.ml:471 msgid "Commande line '%s' is invalid" msgstr "La ligne de commande '%s' n'est pas valide" #: ../src/base/BaseStandardVar.ml:299 msgid "Compile with ocaml debug flag on." msgstr "Compilation avec les options de debug d'OCaml." #: ../src/base/BaseStandardVar.ml:305 msgid "Compile with ocaml profile flag on." msgstr "Compiler avec les options de profilage d'OCaml." #: ../src/oasis/OASISPackage.ml:189 msgid "Configuration system." msgstr "Système de configuration." #: ../src/plugins/internal/InternalInstallPlugin.ml:85 msgid "Copying file '%s' to '%s'" msgstr "Copie du fichier '%s' vers '%s'" #: ../src/oasis/OASISValues.ml:99 msgid "" "Copyright must follow the convention '(C) 2008-2009 J.R. Hacker', here it is " "'%s'" msgstr "" "Le champ 'Copyright' doit suivre la convention suivante '(C) 2008-2009 J.R." " Hacker' ; sa valeur est '%s' ici" #: ../src/oasis/OASISPackage.ml:155 msgid "Copyright owners." msgstr "Détenteur des droit d'auteurs." #: ../src/oasis/OASISQuickstart.ml:308 msgid "Create a section?" msgstr "Créer une section ?" #: ../src/oasis/OASISQuickstart.ml:306 msgid "Create another section?" msgstr "Créer une autre section ?" #: ../src/oasis/OASISExecutable.ml:94 msgid "Create custom bytecode executable." msgstr "Créer un exécutable en mode 'custom'." #: ../src/OASISMain.ml:155 msgid "Creating %s file\n%!" msgstr "Crée le fichier %s\n%!" #: ../src/plugins/internal/InternalInstallPlugin.ml:79 msgid "Creating directory '%s'" msgstr "Création du répertoire '%s'" #: ../src/oasis/OASISPackage.ml:162 msgid "Current maintainers of the package." msgstr "Mainteneurs actuels du paquet." #: ../src/base/BaseStandardVar.ml:217 msgid "DVI documentation" msgstr "Documentation DVI" #: ../src/oasis/OASISDocument.ml:104 msgid "Default target directory to install data and documentation." msgstr "" "Répertoire cible par défaut pour installer les données et la documentation." #: ../src/oasis/OASISFlag.ml:55 msgid "Default value for the flag" msgstr "Valeur par défaut pour ce flag" #: ../src/oasis/OASISSourceRepository.ml:86 msgid "Define a meaningful branch for this repository." msgstr "Défini une branche logique pour ce dépôt." #: ../src/oasis/OASISBuildSection.ml:144 msgid "Define the compilation type of the section: byte, native or best" msgstr "" "Défini le type de compilation pour cette section : byte, native ou best" #: ../src/oasis/OASISSourceRepository.ml:96 msgid "" "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." msgstr "" "Défini le chemin relatif depuis la racine du dépôt source vers le répertoire " "principal du paquet, en d'autre mots le répertoire contenant le fichier " "`_oasis` du paquet." #: ../src/oasis/OASISBuildSection.ml:64 msgid "Dependencies on findlib packages, including internal findlib packages." msgstr "" "Dépendances sur les paquets findlib, incluant les dépendances sur les " "paquets findlib internes." #: ../src/plugins/internal/InternalInstallPlugin.ml:369 msgid "Directory '%s' is not empty (%s)" msgstr "Le répertoire '%s' n'est pas vide (%s)" #: ../src/oasis/OASISBuildSection.ml:126 msgid "Directory containing the section" msgstr "Répertoire contenant cette section" #: ../src/oasis/OASISTest.ml:66 msgid "Directory to run the test." msgstr "Répertoire depuis lequel lancé le test." #: ../src/base/BaseStandardVar.ml:207 msgid "Documentation root" msgstr "Répertoire racine de la documentation" #: ../src/base/BaseSetup.ml:328 ../src/OASISMain.ml:121 msgid "Don't know what to do with '%s'" msgstr "Ne sait que faire avec '%s'" #: ../src/base/BaseArgExt.ml:40 msgid "Don't know what to do with arguments: '%s'" msgstr "Ne sait pas que faire de l'argument : '%s'" #: ../src/plugins/extra/stdfiles/StdFilesPlugin.ml:165 msgid "Enable %s file generation." msgstr "Activer la création du fichier %s." #: ../src/plugins/extra/META/METAPlugin.ml:52 msgid "Enable META generation" msgstr "Activer la création de fichier META" #: ../src/oasis/OASISTest.ml:78 msgid "Enable this test." msgstr "Activer ce test." #: ../src/oasis/OASISRecDescParser.ml:473 msgid "Error when parsing expresion '%s' %t: %s" msgstr "Erreur lors de l'analyse de l'expression '%s' %t %s" #: ../src/oasis/OASISVersion.ml:206 msgid "Error while parsing '%s': %s" msgstr "Erreur lors de l'analyse de '%s': %s" #: ../src/base/BaseDynVar.ml:41 msgid "Executable '%s' not yet built." msgstr "L'exécutable '%s' n'est pas encore construit." #: ../src/oasis/OASISQuickstart.ml:271 msgid "Executable name?" msgstr "Nom de l'Executable ?" #: ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:157 msgid "Expected built file '%s' doesn't exist" msgstr "Le fichier '%s', qui devrait construit, n'existe pas" #: ../src/oasis/OASISValues.ml:123 msgid "Expecting not empty string" msgstr "La chaîne ne doit pas être vide." #: ../src/oasis/OASISPackage.ml:262 msgid "Extra plugins to use." msgstr "Plugins 'extra' à utiliser." #: ../src/oasis/PropList.ml:46 msgid "Field %s is not defined in schema %s" msgstr "Le champs %s n'est pas défini dans le schéma %s" #: ../src/oasis/OASISSchema.ml:191 msgid "Field '%s' cannot be conditional" msgstr "Le champ '%s' ne peut être conditionnel" #: ../src/oasis/PropList.ml:107 msgid "Field '%s' is already defined in schema '%s'" msgstr "Le champ '%s' est déjà défini dans le schéma '%s'" #: ../src/oasis/PropList.ml:42 msgid "Field '%s' is not set" msgstr "La champ %s n'est pas définie" #: ../src/oasis/PropList.ml:40 msgid "Field '%s' is not set: %s" msgstr "Le champ %s n'est pas assigné: %s" #: ../src/base/BaseFileGenerate.ml:304 msgid "File %s already exists" msgstr "Le fichier %s existe déjà" #: ../src/base/BaseDev.ml:63 msgid "" "File %s already exists, cannot generate it for dev-mode. Please remove it " "first." msgstr "" "Le fichier %s existe déjà, impossible de le générer en mode dev. Enlever le " "d'abord." #: ../src/base/BaseFileGenerate.ml:351 msgid "File %s doesn't exist, creating it." msgstr "Le fichier %s n'existe pas, création" #: ../src/base/BaseFileGenerate.ml:298 msgid "File %s has changed, doing a backup in %s" msgstr "Le fichier %s a changé, création d'une sauvegarde dans %s" #: ../src/base/BaseFileGenerate.ml:323 msgid "File %s has not changed, skipping" msgstr "Le fichier %s n'a pas changé, ignoré" #: ../src/base/BaseFileAB.ml:41 msgid "File '%s' doesn't have '.ab' extension" msgstr "Le fichier '%s' n'a pas l'extension '.ab'" #: ../src/base/BaseBuilt.ml:79 msgid "File '%s' has been marked as built for %s but doesn't exist" msgstr "Le fichier '%s' a été marqué comme construit pour %s mais n'existe pas" #: ../src/oasis/OASISPackage.ml:142 msgid "File containing license." msgstr "Fichier contenant la licence." #: ../src/base/BaseDynVar.ml:24 msgid "Filename of executable '%s'" msgstr "Nom de fichier de l'exécutable '%s'" #: ../src/oasis/OASISPackage.ml:255 msgid "Files to generate using environment variable substitution." msgstr "Fichiers à créer par remplacement de variables." #: ../src/oasis/OASISValues.ml:352 msgid "Findlib package name cannot contain '.'" msgstr "Le nom d'un paquet findlib ne peut contenir de '.'" #: ../src/oasis/OASISQuickstart.ml:279 msgid "Flag name?" msgstr "Nom du Flag ?" #: ../src/oasis/OASISDocument.ml:89 msgid "Format for the document." msgstr "Format du document." #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:72 msgid "Generate Makefile" msgstr "Créer un Makefile" #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:81 msgid "Generate configure script" msgstr "Créer un script configure" #: ../src/base/BaseStandardVar.ml:212 msgid "HTML documentation" msgstr "Documentation HTML" #: ../src/oasis/OASISFlag.ml:48 msgid "Help for the flag" msgstr "Aide pour le flag" #: ../src/oasis/OASISSourceRepository.ml:91 msgid "Identify a state corresponding to this particular package version." msgstr "" "Identifie un état correspondant à cette version particulière du paquet." #: ../src/oasis/OASISDocument.ml:121 msgid "Index is mandatory for format HTML in document %s" msgstr "L'index est obligatoire pour le document %s au format HTML" #: ../src/oasis/OASISDocument.ml:131 msgid "Index is mandatory for format info in document %s" msgstr "L'index est obligatoire pour le document %s au format info" #: ../src/oasis/OASISDocument.ml:96 msgid "Index or top-level file for the document, only apply to HTML and Info." msgstr "Index ou document de plus haut niveau pour le document, s'applique seulement aux formats HTML et Info." #: ../src/base/BaseStandardVar.ml:192 msgid "Info documentation" msgstr "Documentation info" #: ../src/base/BaseStandardVar.ml:142 msgid "Install architecture-dependent files in dir" msgstr "Répertoire d'installation des fichiers dépendants de l'architecture" #: ../src/base/BaseStandardVar.ml:129 msgid "Install architecture-independent files dir" msgstr "Répertoire d'installation des fichiers indépendants de l'architecture" #: ../src/oasis/OASISPackage.ml:213 msgid "Install/uninstall system." msgstr "Système d'installation/désinstallation." #: ../src/plugins/internal/InternalInstallPlugin.ml:253 msgid "Installing findlib library '%s'" msgstr "Installe la librairie findlib '%s'" #: ../src/oasis/OASISQuickstart.ml:263 msgid "Library name?" msgstr "Nom de la librairie ?" #: ../src/oasis/OASISLibrary.ml:315 msgid "" "Library which includes the current library. The current library will be " "built as its parents and installed along it." msgstr "" "Librairies qui inclut cette librairie. Elle sera construite et installée en " "même temps que ses parents." #: ../src/oasis/OASISPackage.ml:168 msgid "License type of the package." msgstr "Type de licence pour le paquet." #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:103 msgid "List of OCaml modules used to generate ocamldoc documentation" msgstr "" "Liste des modules OCaml utilisés pour générer la documentation avec ocamldoc" #: ../src/oasis/OASISLibrary.ml:308 msgid "List of modules to compile which are not exported." msgstr "Liste des modules à compiler qui ne sont pas exportés." #: ../src/oasis/OASISLibrary.ml:300 msgid "List of modules to compile." msgstr "Liste des modules à compiler." #: ../src/base/BaseStandardVar.ml:197 msgid "Locale-dependent data" msgstr "Données dépendent de la langue" #: ../src/oasis/OASISPackage.ml:135 msgid "Long description of the package purpose." msgstr "Description longue de l'intérêt du paquet." #: ../src/plugins/extra/META/METAPlugin.ml:60 msgid "META package description" msgstr "Description du paquet pour le fichier META" #: ../src/plugins/extra/META/METAPlugin.ml:72 msgid "META type" msgstr "Type de fichier META" #: ../src/base/BaseStandardVar.ml:202 msgid "Man documentation" msgstr "Documentation man" #: ../src/oasis/OASISCheck.ml:60 msgid "Missing field in %s: %s" msgstr "Champs manquant dans %s: %s" #: ../src/base/BaseStandardVar.ml:167 msgid "Modifiable architecture-independent data" msgstr "Données modifiables indépendantes de l'architecture" #: ../src/base/BaseStandardVar.ml:172 msgid "Modifiable single-machine data" msgstr "Données modifiables liées à une seule machine" #: ../src/oasis/OASISValues.ml:289 msgid "Module path '%s' must not contain a ' '" msgstr "Le chemin pour le module '%s' ne doit pas contenir de ' '" #: ../src/oasis/OASISPackage.ml:118 msgid "Name of the package." msgstr "Nom du paquet." #: ../src/oasis/OASISLibrary.ml:326 msgid "Name used by findlib." msgstr "Nom utilisé par findlib." #: ../src/base/BaseSetup.ml:263 msgid "No action defined, run '%s %s -help'" msgstr "Aucune action définie, lancer la commande '%s %s -help'" #: ../src/base/BaseCustom.ml:25 msgid "No command" msgstr "Pas de commande" #: ../src/oasis/OASISSchema.ml:197 ../src/oasis/OASISSchema.ml:137 msgid "No context defined for field '%s' when parsing value %S" msgstr "" "Aucun contexte défini pour le champ '%s' pendant l'analyse de la valeur %S" #: ../src/oasis/PropList.ml:44 msgid "No default printer for value %s" msgstr "Pas de représentation par défaut pour la valeur %s" #: ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:498 msgid "No exported module defined for library %s" msgstr "Pas de module exportés définis pour la librairie %s" #: ../src/plugins/none/NonePlugin.ml:30 msgid "No implementation for %s" msgstr "Pas d'implémentation pour %s" #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:131 msgid "No module defined for documentation of library %s" msgstr "Pas de module défini pour la documentation de la librairie %s" #: ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml:96 msgid "No possible ocamlbuild targets in generated files %s for library %s" msgstr "" "Pas de cible ocamlbuild dans les fichiers générés %s pour la librairie %s" #: ../src/base/BaseFileGenerate.ml:251 msgid "No replace section found in template for file %s" msgstr "Pas de section de remplacement trouvée dans le fichier gabarit %s" #: ../src/base/BaseFileGenerate.ml:328 msgid "No replace section in file %s" msgstr "Pas de section de remplacement dans le fichier %s" #: ../src/oasis/OASISExpr.ml:88 msgid "No result for a choice list: %s" msgstr "Pas de résultat pour une liste de choix : %s" #: ../src/oasis/OASISExpr.ml:83 msgid "No result for the choice list '%s': %s" msgstr "Pas de résultat pour la liste de choix '%s' : %s" #: ../src/base/BaseEnv.ml:125 msgid "No variable %s defined when trying to expand %S." msgstr "La variable %s n'est pas définie pour l'évaluation de %S." #: ../src/plugins/internal/InternalInstallPlugin.ml:232 msgid "Nothing to install for findlib library '%s'" msgstr "Rien à installer pour la librairie findlib '%s'" #: ../src/OASISMain.ml:109 msgid "OASIS (C) 2009-2010 OCamlCore SARL" msgstr "OASIS (C) 2009-2010 OCamlCore SARL" #: ../src/base/BaseStandardVar.ml:48 msgid "OASIS Package is not set" msgstr "Le paquet OASIS n'est pas défini" #: ../src/OASISMain.ml:113 msgid "OASIS [options] -action [action-options]" msgstr "OASIS [options] -action [action-options]" #: ../src/oasis/OASISPackage.ml:106 msgid "OASIS format version '%s' is not supported." msgstr "Le format OASIS version '%s' n'est pas supporté." #: ../src/oasis/OASISPackage.ml:113 msgid "OASIS format version used to write file `_oasis`." msgstr "Version du format OASIS utilisé pour écrire le fichier `_oasis`." #: ../src/oasis/OASISExecutable.ml:87 msgid "OCaml file (.ml) containing main procedure for the executable." msgstr "" "Fichier source OCaml (.ml) contenant le point d'entrée principal pour " "l'executable." #: ../src/base/BaseStandardVar.ml:177 msgid "Object code libraries" msgstr "Librairies de code objet" #: ../src/base/BaseStandardVar.ml:222 msgid "PDF documentation" msgstr "Documentation PDF" #: ../src/base/BaseStandardVar.ml:227 msgid "PS documentation" msgstr "Documentation PS" #: ../src/base/BaseStandardVar.ml:53 msgid "Package name" msgstr "Nom du paquet" #: ../src/base/BaseStandardVar.ml:59 msgid "Package version" msgstr "Version du paquet" #: ../src/oasis/OASISPlugin.ml:220 msgid "Plugin %s is defined without version, use current version at least: %s." msgstr "" "Le plugin %s est défini sans version, utilisé au moins la version courante %" "s." #: ../src/oasis/OASISDocument.ml:49 msgid "Plugin to use to build documentation." msgstr "Plugin à utiliser pour construire la documentation." #: ../src/oasis/OASISTest.ml:46 msgid "Plugin to use to run test." msgstr "Plugin à utiliser pour lancer le test." #: ../src/base/BaseCustom.ml:29 msgid "Pre/Post Command" msgstr "Pre/Post commande" #: ../src/base/BaseStandardVar.ml:232 msgid "Prepend a path when installing package" msgstr "Ajouter un chemin au début lors de l'instation du paquet" #: ../src/base/BaseStandardVar.ml:157 msgid "Program executables" msgstr "Exécutables utilisés par le programme" #: ../src/base/BaseStandardVar.ml:182 msgid "Read-only arch-independent data root" msgstr "" "Racine pour les données indépendantes de l'architecture en lectures seules" #: ../src/base/BaseStandardVar.ml:187 msgid "Read-only architecture-independent data" msgstr "Données dépendantes de l'architecture en lectures seules" #: ../src/base/BaseStandardVar.ml:162 msgid "Read-only single-machine data" msgstr "Données liées à une machine en lectures seules" #: ../src/plugins/extra/stdfiles/StdFilesPlugin.ml:172 msgid "Real filename to use for file %s." msgstr "Nom de fichier à réellement utiliser pour le fichier %s." #: ../src/oasis/OASISPackage.ml:148 msgid "Real people that had contributed to the package." msgstr "Personnes réelles ayant contribué au paquet" #: ../src/base/BaseFileGenerate.ml:315 msgid "Regenerating file %s" msgstr "Régénère le fichier %s" #: ../src/base/BaseSetup.ml:234 msgid "Remove '%s'" msgstr "Supprime '%s'" #: ../src/base/BaseStandardVar.ml:290 msgid "Remove a directory." msgstr "Supprimer un répertoire." #: ../src/base/BaseStandardVar.ml:281 msgid "Remove a file." msgstr "Supprime un fichier." #: ../src/plugins/internal/InternalInstallPlugin.ml:362 msgid "Removing directory '%s'" msgstr "Supprime le répertoire '%s'" #: ../src/plugins/internal/InternalInstallPlugin.ml:350 msgid "Removing file '%s'" msgstr "Supprime le fichier '%s'" #: ../src/plugins/internal/InternalInstallPlugin.ml:380 msgid "Removing findlib library '%s'" msgstr "Supprime la librairie findlib '%s'" #: ../src/plugins/extra/META/METAPlugin.ml:86 msgid "Requires field for META package" msgstr "Champ \"requires\" pour le paquet du fichier META" #: ../src/plugins/custom/CustomPlugin.ml:329 msgid "Run command to build documentation." msgstr "Commande à lancer pour construire la documentation." #: ../src/plugins/custom/CustomPlugin.ml:254 msgid "Run command to build." msgstr "Commande à lancer pour la construction." #: ../src/plugins/custom/CustomPlugin.ml:330 msgid "Run command to clean build documentation step." msgstr "Commande à lancer pour nettoyer après l'étape de documentation." #: ../src/plugins/custom/CustomPlugin.ml:255 msgid "Run command to clean build step." msgstr "Commande à lancer pour nettoyer après l'étape de construction." #: ../src/plugins/custom/CustomPlugin.ml:240 msgid "Run command to clean configure step." msgstr "Commande à lancer pour nettoyer après l'étape de configuration." #: ../src/plugins/custom/CustomPlugin.ml:304 msgid "Run command to clean install step." msgstr "Commande à lancer pour nettoyer après l'étape d'installation." #: ../src/plugins/custom/CustomPlugin.ml:384 msgid "Run command to clean test step." msgstr "Commande à lancer pour nettoyer après l'étape de test." #: ../src/plugins/custom/CustomPlugin.ml:311 msgid "Run command to clean uninstall step." msgstr "Commande à lancer pour nettoyer après l'étape de désinstallation." #: ../src/plugins/custom/CustomPlugin.ml:239 msgid "Run command to configure." msgstr "Commande à lancer pour configurer." #: ../src/plugins/custom/CustomPlugin.ml:331 msgid "Run command to distclean build documentation step." msgstr "" "Commande à lancer pour nettoyer en profondeur après l'étape de construction " "de la documentation." #: ../src/plugins/custom/CustomPlugin.ml:256 msgid "Run command to distclean build step." msgstr "" "Commande à lancer pour nettoyer en profondeur après l'étape de construction." #: ../src/plugins/custom/CustomPlugin.ml:241 msgid "Run command to distclean configure step." msgstr "" "Commande à lancer pour nettoyer en profondeur après l'étape de configuration." #: ../src/plugins/custom/CustomPlugin.ml:305 msgid "Run command to distclean install step." msgstr "" "Commande à lancer pour nettoyer en profondeur après l'étape d'installation." #: ../src/plugins/custom/CustomPlugin.ml:393 msgid "Run command to distclean test step." msgstr "Commande à lancer pour nettoyer en profondeur après l'étape de test." #: ../src/plugins/custom/CustomPlugin.ml:312 msgid "Run command to distclean uninstall step." msgstr "" "Commande à lancer pour nettoyer en profondeur après l'étape de " "désinstallation." #: ../src/plugins/custom/CustomPlugin.ml:303 msgid "Run command to install." msgstr "Commande pour installer." #: ../src/plugins/custom/CustomPlugin.ml:310 msgid "Run command to uninstall." msgstr "Commande pour désinstaller." #: ../src/base/BaseExec.ml:35 msgid "Running command '%s'" msgstr "Exécute la commande '%s'" #: ../src/base/BaseTest.ml:43 msgid "Running test '%s'" msgstr "Exécute le test '%s'" #: ../src/plugins/internal/InternalConfigurePlugin.ml:75 msgid "Section %s requires native compilation" msgstr "La section %s nécessite une compilation native" #: ../src/oasis/OASISBuildSection.ml:101 msgid "Set if the section should be built." msgstr "Mettre à 'true' si la section doit être construite." #: ../src/oasis/OASISBuildSection.ml:107 msgid "Set if the section should be distributed." msgstr "Mettre à 'true' si la section doit être distribuée." #: ../src/base/BaseSetup.ml:329 msgid "Setup and run build process current package\n" msgstr "Met en place et lance le processus de construction\n" #: ../src/oasis/OASISPackage.ml:128 msgid "Short description of the purpose of this package." msgstr "Description courte de l'intérêt de ce paquet." #: ../src/oasis/OASISDocument.ml:74 msgid "Short paragraph giving an overview of the document." msgstr "Court paragraphe résumant le document." #: ../src/base/BaseTest.ml:78 msgid "Skipping test '%s'" msgstr "Ignore le test '%s'" #: ../src/oasis/OASISQuickstart.ml:287 msgid "Source repository identifier?" msgstr "Identifiant pour le dépot de code source ?" #: ../src/oasis/OASISValues.ml:77 msgid "String '%s' is not a %s" msgstr "La chaîne '%s' n'est pas un %s" #: ../src/oasis/OASISRecDescParser.ml:556 msgid "Syntax error %s %t" msgstr "Erreur de syntaxe %s %t" #: ../src/oasis/OASISRecDescParser.ml:554 msgid "Syntax error %t" msgstr "Erreur de syntaxe %t" #: ../src/base/BaseEnv.ml:130 msgid "Syntax error when parsing '%s' when trying to expand %S: %s" msgstr "Erreur de syntaxe en essayant d'analyser '%s' lors de l'expansion de %S : %s" #: ../src/base/BaseStandardVar.ml:152 msgid "System admin executables" msgstr "Exécutables pour l'administrateur système" #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:63 msgid "Targets to disable when generating Makefile" msgstr "Cibles à désactiver pour la génération du fichier Makefile" #: ../src/plugins/custom/CustomPlugin.ml:114 msgid "Test '%s' fails: %s" msgstr "Le test '%s' a échoué : %s" #: ../src/oasis/OASISQuickstart.ml:295 msgid "Test name?" msgstr "Nom du test ?" #: ../src/base/BaseFileUtil.ml:68 msgid "Testing file existence '%s'" msgstr "Teste l'existence du fichier '%s'" #: ../src/base/BaseTest.ml:100 msgid "Tests had a %.2f%% failure rate" msgstr "Les tests on un taux de %.2f%% d'erreur" #: ../src/oasis/OASISDocument.ml:60 msgid "Title of the document." msgstr "Titre du document." #: ../src/oasis/OASISBuildSection.ml:94 msgid "Tools required to compile, including internal executables." msgstr "Outils nécessaire à la compilation, incluant les exécutable interne." #: ../src/oasis/OASISTest.ml:53 msgid "Tools required to run the test, including internal executables." msgstr "Outils requis pour faire tourner le test, incluant les exécutables internes." #: ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml:94 msgid "Top level directory for building ocamldoc documentation" msgstr "Répertoire racine pour construire la documentation ocamldoc" #: ../src/oasis/OASISQuickstart.ml:207 msgid "Trying to set field '%s' using mandatory value '%s': %s" msgstr "" "Tentative d'utilisation pour le champs '%s' de la valeur obligatoire '%s' : %" "s" #: ../src/plugins/extra/META/METAPlugin.ml:78 msgid "Type of META package, set default predicates for archive" msgstr "" "Type de paquet pour le fichier META, défini les 'predicates' par défault " "pour les champs \"archive\"" #: ../src/oasis/OASISValues.ml:88 msgid "URL" msgstr "URL" #: ../src/oasis/OASISPackage.ml:240 msgid "URL of the package homepage." msgstr "URL de la page d'accueil pour le paquet." #: ../src/oasis/OASISSourceRepository.ml:61 msgid "" "URL of the repository. The exact form of this field depends on the " "repository type." msgstr "" "URL du dépôt de code source. La grammaire exacte de ce champ dépend du type " "de dépôt." #: ../src/oasis/OASISSourceRepository.ml:69 msgid "URL where the repository can be navigated using a web browser." msgstr "" "URL pouvant être utilisée pour parcourir le dépôt à l'aide d'un navigateur " "web." #: ../src/oasis/OASISPackage.ml:247 msgid "URL(s) describing categories of the package." msgstr "URL(s) décrivant les catégories auxquels appartient le paquet." #: ../src/oasis/OASISLibrary.ml:274 msgid "Unable to determine root library of findlib library '%s'" msgstr "" "Impossible de déterminer le répertoire racine de la librairie findlib '%s'" #: ../src/oasis/OASISLibrary.ml:235 msgid "Unable to translate internal library '%s' to findlib name" msgstr "" "Impossible de traduire le nom de la librairie interne '%s' en nom de paquet " "findlib" #: ../src/oasis/OASISValues.ml:335 msgid "Unexpected abstract choice value for %s" msgstr "La valeur abstraite ne correspond à aucun choix pour la valeur %s" #: ../src/oasis/OASISValues.ml:321 msgid "Unknown %s %S (possible: %s)" msgstr "%s inconnue %S (possible: %s)" #: ../src/oasis/OASISExpr.ml:122 msgid "Unknown OASIS test %s" msgstr "Test OASIS %s inconnu" #: ../src/oasis/OASISPlugin.ml:258 msgid "Unknown build plugin '%s' (available: %s)" msgstr "Plugin de construction '%s' inconnu (disponible : %s)" #: ../src/base/BaseEnv.ml:119 msgid "Unknown expression '%s' in variable expansion of %s." msgstr "Expression '%s' inconnue lors de l'expansion des variables dans %s." #: ../src/oasis/OASISExpr.ml:147 msgid "Unknown flag '%s'" msgstr "Flag '%s' inconnu " #: ../src/plugins/internal/InternalInstallPlugin.ml:384 msgid "Unknown log event '%s'" msgstr "Évènement de log '%s' inconnu" #: ../src/oasis/OASISHelp.ml:189 msgid "Unknown variable %s in documentationi (line is '%s')" msgstr "Variable %s inconnue dans la documentation (la ligne étant '%s')" #: ../src/oasis/OASISPlugin.ml:247 msgid "Unkown configure plugin '%s' (available: %s)" msgstr "Plugin de configuration '%s' inconnu (disponible : %s)" #: ../src/oasis/OASISPlugin.ml:269 msgid "Unkown doc plugin '%s' (available: %s)" msgstr "Plugin de documentation '%s' inconnu (disponible : %s)" #: ../src/oasis/OASISPlugin.ml:302 msgid "Unkown extra plugin '%s' (available: %s)" msgstr "Plugin extra '%s' inconnu (disponible : %s)" #: ../src/oasis/OASISPlugin.ml:291 msgid "Unkown install plugin '%s' (available: %s)" msgstr "Plugin d'installation '%s' inconnu (disponible : %s)" #: ../src/oasis/OASISPlugin.ml:280 msgid "Unkown test plugin '%s' (available: %s)" msgstr "Plugin de test '%s' inconnu (disponible : %s)" #: ../src/base/BaseStandardVar.ml:147 msgid "User executables" msgstr "Exécutables pour l'utilistateur" #: ../src/oasis/OASISQuickstart.ml:75 msgid "Using default '%s'.\n" msgstr "Utiliser la valeur par défaut '%s'.\n" #: ../src/oasis/OASISSourceRepository.ml:55 msgid "VCS type." msgstr "Type de VCS" #: ../src/oasis/OASISQuickstart.ml:223 msgid "Value for field '%s'?" msgstr "Valeur du champs '%s' ?" #: ../src/oasis/OASISPackage.ml:182 msgid "Version constraint on Finblib." msgstr "Contraintes sur la version de Findlib." #: ../src/oasis/OASISPackage.ml:175 msgid "Version constraint on OCaml." msgstr "Contraintes sur la version d'OCaml" #: ../src/oasis/OASISPackage.ml:123 msgid "Version of the package." msgstr "Version du paquet" #: ../src/oasis/OASISLibrary.ml:335 msgid "Virtual containers for sub-package, dot-separated" msgstr "Conteneurs virtuels pour un sous-paquet, séparer par des points" #: ../src/base/BaseCheck.ml:134 msgid "When looking for findlib package %s, directory %s return doesn't exist" msgstr "" "Le répertoire %s, retourné par la recherche du paquet findlib %s, n'existe " "pas" #: ../src/plugins/internal/InternalInstallPlugin.ml:106 msgid "Wildcard '%s' doesn't match any files" msgstr "Le joker '%s' ne correspond à aucun fichier" #: ../src/base/BaseSetup.ml:299 msgid "[options*] Build documentation." msgstr "[options*] Construit la documentation" #: ../src/base/BaseSetup.ml:321 msgid "[options*] Clean build and configure environment." msgstr "" "[options*] Nettoie l'environnement de construction et de configuration." #: ../src/base/BaseSetup.ml:317 msgid "[options*] Clean build environment." msgstr "[options*] Nettoie l'environnement de construction." #: ../src/base/BaseSetup.ml:291 msgid "[options*] Configure build process." msgstr "[options*] Configure le processus de construction." #: ../src/base/BaseSetup.ml:307 msgid "[options*] Install libraries, data, executables and documentations." msgstr "" "[options*] Installe les librairies, les données, les exécutables et la " "documentation." #: ../src/base/BaseSetup.ml:295 msgid "[options*] Run build process." msgstr "[options*] Exécute la processus de construction." #: ../src/base/BaseSetup.ml:303 msgid "[options*] Run tests." msgstr "[options*] Exécute les tests" #: ../src/base/BaseSetup.ml:312 msgid "[options*] Uninstall libraries, data, executables and documentations." msgstr "" "[options*] Désinstalle les librairies, les données, les exécutables et la " "documentation." #: ../src/oasis/OASISHelp.ml:242 msgid "__Types__: %s\n\n" msgstr "__Types__: %s\n\n" #: ../src/oasis/OASISHelp.ml:241 msgid "__Version__: %s
\n" msgstr "__Version__: %s
\n" #: ../src/OASISMain.ml:77 msgid "beginner" msgstr "débutant" #: ../src/oasis/OASISValues.ml:342 msgid "boolean" msgstr "booléen" #: ../src/base/BaseSetup.ml:113 msgid "build" msgstr "construction" #: ../src/oasis/OASISBuildSection.ml:141 msgid "compiled object" msgstr "objet compilé" #: ../src/base/BaseArgExt.ml:41 msgid "configure options:" msgstr "options de configuration : " #: ../src/oasis/OASISQuickstart.ml:273 msgid "create a flag" msgstr "créer une option de configuration" #: ../src/oasis/OASISQuickstart.ml:257 msgid "create a library" msgstr "créer une librairie" #: ../src/oasis/OASISQuickstart.ml:281 msgid "create a source repository" msgstr "créer un dépot de code source" #: ../src/oasis/OASISQuickstart.ml:289 msgid "create a test" msgstr "créer un test" #: ../src/oasis/OASISQuickstart.ml:265 msgid "create an executable" msgstr "créer un executable" #: ../src/base/BaseSetup.ml:349 msgid "default value of flag %s" msgstr "valeur par défaut du flag %s" #: ../src/OASISMain.ml:68 msgid "dir Change directory before running." msgstr "dir Change de répertoire avant le lancement." #: ../src/oasis/OASISDocument.ml:39 msgid "document" msgstr "document" #: ../src/base/BaseBuilt.ml:89 msgid "documentation %s" msgstr "documentation %s" #: ../src/base/BaseDoc.ml:35 msgid "documentation %s build" msgstr "documentation %s construite" #: ../src/oasis/OASISQuickstart.ml:265 msgid "e" msgstr "e" #: ../src/oasis/OASISExecutable.ml:72 ../src/oasis/OASISExecutable.ml:69 msgid "executable" msgstr "executable" #: ../src/base/BaseBuilt.ml:85 msgid "executable %s" msgstr "l'executable %s" #: ../src/OASISMain.ml:79 msgid "expert" msgstr "expert" #: ../src/oasis/OASISQuickstart.ml:273 msgid "f" msgstr "f" #: ../src/oasis/OASISFlag.ml:41 msgid "flag" msgstr "flag" #: ../src/OASISMain.ml:100 msgid "fn Change the default name of setup.ml. This option should be used with caution, it is reserved for internal use." msgstr "fn Change le nom par défaut du fichier setup.ml. Cette option doit être manipulée avec précaution, elle est réservée pour un usage interne." #: ../src/oasis/OASISRecDescParser.ml:389 msgid "in file '%s' at line %d, char %d" msgstr "dans le fichier '%s' à la ligne %d, au caractère %d" #: ../src/OASISMain.ml:78 msgid "intermediate" msgstr "intermédiaire" #: ../src/oasis/OASISQuickstart.ml:257 msgid "l" msgstr "l" #: ../src/oasis/OASISLibrary.ml:292 ../src/oasis/OASISLibrary.ml:289 msgid "library" msgstr "library" #: ../src/base/BaseBuilt.ml:87 msgid "library %s" msgstr "la librairie %s" #: ../src/plugins/custom/CustomPlugin.ml:44 msgid "main command" msgstr "commande principale" #: ../src/oasis/OASISValues.ml:275 msgid "module" msgstr "module" #: ../src/oasis/OASISQuickstart.ml:255 ../src/oasis/OASISQuickstart.ml:155 msgid "n" msgstr "n" #: ../src/oasis/OASISQuickstart.ml:155 msgid "no" msgstr "non" #: ../src/oasis/PropList.ml:192 msgid "no default value" msgstr "pas de valeur par défaut" #: ../src/oasis/OASISBuildSection.ml:185 msgid "ocamlc arguments to use when building." msgstr "Argument à utiliser avec ocamlc pendant la construction." #: ../src/oasis/OASISBuildSection.ml:192 msgid "ocamlopt arguments to use when building." msgstr "Arguments à utiliser avec ocamlopt pendant la construction." #: ../src/base/BaseSetup.ml:133 msgid "run" msgstr "lance" #: ../src/oasis/OASISQuickstart.ml:281 msgid "s" msgstr "s" #: ../src/oasis/OASISSourceRepository.ml:41 msgid "source repository" msgstr "dépot de code source" #: ../src/oasis/OASISSourceRepository.ml:46 msgid "source repository type" msgstr "type de dépôt de code source" #: ../src/oasis/OASISQuickstart.ml:255 msgid "stop" msgstr "arréter" #: ../src/oasis/OASISQuickstart.ml:289 msgid "t" msgstr "t" #: ../src/plugins/extra/devfiles/DevFilesPlugin.ml:60 msgid "target" msgstr "cible" #: ../src/oasis/OASISTest.ml:39 msgid "test" msgstr "test" #: ../src/base/BaseTest.ml:37 msgid "test %s run" msgstr "lance le test %s" #: ../src/base/BaseStandardVar.ml:237 msgid "undefined by construct" msgstr "non-défini par construction" #: ../src/oasis/OASISQuickstart.ml:154 msgid "y" msgstr "y" #: ../src/oasis/OASISQuickstart.ml:154 msgid "yes" msgstr "oui" oasis-0.4.5/po/POTFILES0000644000175000017500000000422612422026741013752 0ustar gildorgildor../src/oasis/OASISCheck.ml ../src/oasis/OASISSourceRepository.ml ../src/oasis/OASISSchema.ml ../src/oasis/OASISConf.ml ../src/oasis/OASISHelp.ml ../src/oasis/OASIS.ml ../src/oasis/OASISUnixPath.ml ../src/oasis/FormatExt.ml ../src/oasis/OASISTest.ml ../src/oasis/OASISQuickstart.ml ../src/oasis/OASISUtils.ml ../src/oasis/OASISBuildSection.ml ../src/oasis/OASISExecutable.ml ../src/oasis/OASISLicense.ml ../src/oasis/OASISGettext.ml ../src/oasis/OASISAstTypes.ml ../src/oasis/OASISFlag.ml ../src/oasis/OASISPackage.ml ../src/oasis/OASISCustom.ml ../src/oasis/ODNFunc.ml ../src/oasis/OASISAst.ml ../src/oasis/PropList.ml ../src/oasis/OASISExpr.ml ../src/oasis/OASISSection.ml ../src/oasis/OASISTypes.ml ../src/oasis/OASISLibrary.ml ../src/oasis/OASISValues.ml ../src/oasis/OASISPlugin.ml ../src/oasis/OASISVersion.ml ../src/oasis/OASISDocument.ml ../src/oasis/OASISRecDescParser.ml ../src/oasis/OASISMessage.ml ../src/base/BaseFileUtil.ml ../src/base/BaseFileGenerate.ml ../src/base/BaseEnv.ml ../src/base/BaseGenerate.ml ../src/base/BaseOCamlcConfig.ml ../src/base/BaseDynVar.ml ../src/base/BaseEnvLight.ml ../src/base/BaseFileAB.ml ../src/base/BaseArgExt.ml ../src/base/BaseTest.ml ../src/base/BaseExec.ml ../src/base/BaseCustom.ml ../src/base/BaseDoc.ml ../src/base/BaseFilePath.ml ../src/base/BaseLog.ml ../src/base/BaseDev.ml ../src/base/BaseStandardVar.ml ../src/base/BaseBuilt.ml ../src/base/BaseSetup.ml ../src/base/BaseCheck.ml ../src/tools/ocamlmod.ml ../src/OASISMain.ml ../src/OASISBuiltinPlugins.ml ../src/plugins/none/NonePlugin.ml ../src/plugins/extra/stdfiles/StdFilesPlugin.ml ../src/plugins/extra/docbook.ml ../src/plugins/extra/META/METAPlugin.ml ../src/plugins/extra/devfiles/DevFilesPlugin.ml ../src/plugins/extra/camlidl.ml ../src/plugins/custom/CustomPlugin.ml ../src/plugins/ocamlbuild/OCamlbuildCommon.ml ../src/plugins/ocamlbuild/OCamlbuildId.ml ../src/plugins/ocamlbuild/OCamlbuildPlugin.ml ../src/plugins/ocamlbuild/MyOCamlbuildBase.ml ../src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml ../src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml ../src/plugins/internal/InternalConfigurePlugin.ml ../src/plugins/internal/InternalInstallPlugin.ml ../src/plugins/internal/InternalId.ml oasis-0.4.5/po/Makefile0000644000175000017500000000713412422026741014243 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 # ################################################################################ OCAML_GETTEXT_PACKAGE = oasis LINGUAS=$(shell cat LINGUAS) SOURCES=POTFILES ODN_OPTIONS=-parser Camlp4OCamlParser.cmo \ -parser Camlp4OCamlParserParser.cmo \ $(shell ocamlfind query \ -predicates syntax,preprocessor \ -format "-I %d %A" -r \ odn.without.syntax) OCAML_GETTEXT=ocaml-gettext OCAML_GETTEXT_EXTRACT_OPTIONS=--extract-default-option '$(ODN_OPTIONS)' OCAML_GETTEXT_COMPILE_OPTIONS= OCAML_GETTEXT_INSTALL_OPTIONS= OCAML_GETTEXT_MERGE_OPTIONS= BUILDPO=../_build/po/ POFILES=$(addsuffix .po,$(LINGUAS)) MOFILES=$(addsuffix .mo,$(LINGUAS)) POTFILE=$(OCAML_GETTEXT_PACKAGE).pot all: install-buildpo install: install-po uninstall: uninstall-po clean:: clean-po %.mo: %.po $(OCAML_GETTEXT) --action compile $(OCAML_GETTEXT_COMPILE_OPTIONS) \ --compile-output $@ $^ %.pot: $(SOURCES) $(OCAML_GETTEXT) --action extract $(OCAML_GETTEXT_EXTRACT_OPTIONS) \ --extract-pot $@ $^ %.po: $(POTFILE) $(OCAML_GETTEXT) --action merge $(OCAML_GETTEXT_MERGE_OPTIONS) \ --merge-pot $(POTFILE) $@ $(BUILDPO): mkdir -p $(BUILDPO) .PRECIOUS: $(POTFILE) install-buildpo: $(MOFILES) $(BUILDPO) $(OCAML_GETTEXT) --action install $(OCAML_GETTEXT_INSTALL_OPTIONS) \ --install-textdomain $(OCAML_GETTEXT_PACKAGE) \ --install-destdir $(BUILDPO) $(MOFILES) install-po: $(MOFILES) $(OCAML_GETTEXT) --action install $(OCAML_GETTEXT_INSTALL_OPTIONS) \ --install-textdomain $(OCAML_GETTEXT_PACKAGE) \ --install-destdir $(PODIR) $(MOFILES) uninstall-po: $(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \ --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \ --uninstall-orgdir $(PODIR) $(MOFILES) clean-po: -$(OCAML_GETTEXT) --action uninstall $(OCAML_GETTEXT_INSTALL_OPTIONS) \ --uninstall-textdomain $(OCAML_GETTEXT_PACKAGE) \ --uninstall-orgdir $(BUILDPO) $(MOFILES) -$(RM) $(MOFILES) oasis-0.4.5/po/LINGUAS0000644000175000017500000000000312422026741013614 0ustar gildorgildorfr oasis-0.4.5/myocamlbuild.ml0000644000175000017500000006735412422027105015205 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 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 ( try while true; do deps := (fmod (input_line fd)) :: !deps done; with End_of_file -> () ); close_in fd; 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: ce83d18189da28a701b37098bb40e572) *) 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 OASISExpr = struct # 22 "src/oasis/OASISExpr.ml" open OASISGettext 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 # 132 "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) () = if Sys.file_exists filename then begin let chn = open_in_bin filename in let st = Stream.of_channel chn in let line = ref 1 in 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 let lexer = Genlex.make_lexer ["="] st_line in let rec read_file mp = match Stream.npeek 3 lexer with | [Genlex.Ident nm; Genlex.Kwd "="; Genlex.String value] -> Stream.junk lexer; Stream.junk lexer; Stream.junk lexer; read_file (MapString.add nm value mp) | [] -> mp | _ -> failwith (Printf.sprintf "Malformed data file '%s' line %d" filename !line) in let mp = read_file MapString.empty in close_in chn; mp 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 # 237 "myocamlbuild.ml" module MyOCamlbuildFindlib = struct # 22 "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" (** OCamlbuild extension, copied from * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild * by N. Pouillard and others * * Updated on 2009/02/28 * * Modified by Sylvain Le Gall *) open Ocamlbuild_plugin (* these functions are not really officially exported *) let run_and_read = Ocamlbuild_pack.My_unix.run_and_read let blank_sep_strings = Ocamlbuild_pack.Lexers.blank_sep_strings let exec_from_conf exec = let exec = let env_filename = Pathname.basename BaseEnvLight.default_filename in let env = BaseEnvLight.load ~filename:env_filename ~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 "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 = 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 -> (* 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 = (* Heuristic to identify syntax extensions: whether they end in ".syntax"; some might not. *) if Filename.check_suffix pkg "syntax" || List.mem pkg well_known_syntax then syn_args @ base_args else base_args in flag ["ocaml"; "compile"; "pkg_"^pkg] & S args; flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S args; flag ["ocaml"; "doc"; "pkg_"^pkg] & S args; flag ["ocaml"; "link"; "pkg_"^pkg] & S base_args; flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S args; end (find_packages ()); (* Like -package but for extensions syntax. Morover -syntax is useless * 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 ["ocaml"; "package(threads)"; "compile"] (S[A "-thread"]); flag ["ocaml"; "package(threads)"; "doc"] (S[A "-I"; A "+threads"]); flag ["ocaml"; "package(threads)"; "link"] (S[A "-thread"]); flag ["ocaml"; "package(threads)"; "infer_interface"] (S[A "-thread"]); | _ -> () end module MyOCamlbuildBase = struct # 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 # 62 "src/plugins/ocamlbuild/MyOCamlbuildBase.ml" 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; } 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 ~filename:env_filename ~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 -> (String.uncapitalize m) ^ ".cmi") intf_modules in dep ["ocaml"; "link"; "library"; "file:"^nm^".cma"] cmis | nm, dir :: tl, intf_modules -> ocaml_lib ~dir:dir (dir^"/"^nm); List.iter (fun dir -> List.iter (fun str -> flag ["ocaml"; "use_"^nm; str] (S[A"-I"; P dir])) ["compile"; "infer_interface"; "doc"]) tl; let cmis = List.map (fun m -> dir^"/"^(String.uncapitalize m)^".cmi") intf_modules in dep ["ocaml"; "link"; "library"; "file:"^dir^"/"^nm^".cma"] cmis) t.lib_ocaml; (* Declare directories dependencies, replace "include" in _tags. *) List.iter (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))]); flag ["link"; "program"; "ocaml"; "byte"; tag_libstubs lib] (S[A"-dllib"; A("dll"^(nm_libstubs lib))]); (* When ocaml link something that use the C library, then one need that file to be up to date. *) dep ["link"; "ocaml"; "program"; tag_libstubs lib] [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; dep ["compile"; "ocaml"; "program"; tag_libstubs lib] [dir/"lib"^(nm_libstubs lib)^"."^(!Options.ext_lib)]; (* TODO: be more specific about what depends on headers *) (* Depends on .h files *) dep ["compile"; "c"] headers; (* Setup search path for lib *) flag ["link"; "ocaml"; "use_"^lib] (S[A"-I"; P(dir)]); ) t.lib_c; (* Add flags *) List.iter (fun (tags, cond_specs) -> 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 t = dispatch_combine [ dispatch t; MyOCamlbuildFindlib.dispatch; ] end # 594 "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" ], []); ("dynrun", ["src/dynrun"], []); ("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"], []); ("userconf", ["src/ext/userconf/src"], []) ]; lib_c = []; flags = []; includes = [ ("test", [ "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/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/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/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/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/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/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/ext/userconf/test", ["src/ext/userconf/src"]); ("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/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/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" ]) ] } ;; let dispatch_default = MyOCamlbuildBase.dispatch_default package_default;; # 794 "myocamlbuild.ml" (* OASIS_STOP *) open Ocamlbuild_plugin;; dispatch (MyOCamlbuildBase.dispatch_combine [ dispatch_default; begin function | After_rules -> begin flag ["ocaml"; "compile"] & S[A"-warn-error"; A"+8"]; try let gettext = BaseEnvLight.var_get "gettext" (BaseEnvLight.load ~allow_empty:true ~filename:MyOCamlbuildBase.env_filename ()) in if gettext = "true" then begin flag ["dep"; "pkg_camlp4.macro"] & S[A"-ppopt"; A"-D"; A"-ppopt"; A"HAS_GETTEXT"]; flag ["compile"; "pkg_camlp4.macro"] & S[A"-ppopt"; A"-D"; A"-ppopt"; A"HAS_GETTEXT"]; List.iter (fun pkg -> flag ["ocaml"; "compile"; "cond_pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "ocamldep"; "cond_pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "doc"; "cond_pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "link"; "cond_pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "infer_interface"; "cond_pkg_"^pkg] & S[A"-package"; A pkg]) ["gettext.base"; "gettext-stub"] end with Not_found -> () end | e -> () end ]) ;; oasis-0.4.5/examples/0000755000175000017500000000000012422026741013776 5ustar gildorgildoroasis-0.4.5/examples/with-test/0000755000175000017500000000000012422026741015726 5ustar gildorgildoroasis-0.4.5/examples/with-test/src/0000755000175000017500000000000012422026741016515 5ustar gildorgildoroasis-0.4.5/examples/with-test/src/test.mli0000644000175000017500000000332712422026741020204 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 *) (******************************************************************************) val myrun: OUnit.test -> OUnit.test_result list oasis-0.4.5/examples/with-test/src/test.ml0000644000175000017500000000343612422026741020034 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 OUnit let myrun t = let lst = run_test_tt_main t in lst let _ = myrun ("main" >:: (fun () -> ())) oasis-0.4.5/examples/with-test/_oasis0000644000175000017500000000054512422026741017132 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/with-test/LICENSE.txt0000644000175000017500000000312512422026741017552 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.5/examples/with-subpackage/0000755000175000017500000000000012422026741017054 5ustar gildorgildoroasis-0.4.5/examples/with-subpackage/src/0000755000175000017500000000000012422026741017643 5ustar gildorgildoroasis-0.4.5/examples/with-subpackage/src/syntax/0000755000175000017500000000000012422026741021171 5ustar gildorgildoroasis-0.4.5/examples/with-subpackage/src/syntax/pa_test.ml0000644000175000017500000000324612422026741023167 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 *) (******************************************************************************) oasis-0.4.5/examples/with-subpackage/src/main.ml0000644000175000017500000000324612422026741021126 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 *) (******************************************************************************) oasis-0.4.5/examples/with-subpackage/src/B.ml0000644000175000017500000000324612422026741020363 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 *) (******************************************************************************) oasis-0.4.5/examples/with-subpackage/src/A.ml0000644000175000017500000000324612422026741020362 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 *) (******************************************************************************) oasis-0.4.5/examples/with-subpackage/_oasis0000644000175000017500000000166012422026741020257 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/with-interface-module/0000755000175000017500000000000012422026741020172 5ustar gildorgildoroasis-0.4.5/examples/with-interface-module/src/0000755000175000017500000000000012422026741020761 5ustar gildorgildoroasis-0.4.5/examples/with-interface-module/src/pim_types.mli0000644000175000017500000000350612422026741023501 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 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.5/examples/with-interface-module/src/pim_intf.mli0000644000175000017500000000337312422026741023277 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 *) (******************************************************************************) module type S = sig type t val create: string -> t val value: t -> string end oasis-0.4.5/examples/with-interface-module/src/pim_impl.mli0000644000175000017500000000327212422026741023276 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 *) (******************************************************************************) include Pim_intf.S oasis-0.4.5/examples/with-interface-module/src/pim_impl.ml0000644000175000017500000000333012422026741023120 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.5/examples/with-interface-module/_oasis0000644000175000017500000000050412422026741021371 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.5/examples/with-data/0000755000175000017500000000000012422026741015660 5ustar gildorgildoroasis-0.4.5/examples/with-data/src/0000755000175000017500000000000012422026741016447 5ustar gildorgildoroasis-0.4.5/examples/with-data/src/test.txt0000644000175000017500000000000012422026741020155 0ustar gildorgildoroasis-0.4.5/examples/with-data/src/test.ml0000644000175000017500000000324612422026741017765 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 *) (******************************************************************************) oasis-0.4.5/examples/with-data/src/test.html0000644000175000017500000000000012422026741020302 0ustar gildorgildoroasis-0.4.5/examples/with-data/_oasis0000644000175000017500000000123512422026741017061 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/with-data/LICENSE.txt0000644000175000017500000000000012422026741017471 0ustar gildorgildoroasis-0.4.5/examples/with-c/0000755000175000017500000000000012422026741015171 5ustar gildorgildoroasis-0.4.5/examples/with-c/src/0000755000175000017500000000000012422026741015760 5ustar gildorgildoroasis-0.4.5/examples/with-c/src/main_stub.c0000644000175000017500000000356312422026741020114 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 */ /********************************************************************************/ #include #ifndef OPTION_PASSED #error "CCOpt doesn't work" #endif CAMLprim value caml_reident (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.4.5/examples/with-c/src/main_native_stub.c0000644000175000017500000000350012422026741021451 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 */ /********************************************************************************/ #include CAMLprim value caml_reident_native (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.4.5/examples/with-c/src/main_native.ml0000644000175000017500000000342612422026741020611 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 *) (******************************************************************************) external reident: 'a -> 'a = "caml_reident_native" let () = print_endline (reident (A.ident "hello world!")) oasis-0.4.5/examples/with-c/src/main_custom_stub.c0000644000175000017500000000350012422026741021475 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 */ /********************************************************************************/ #include CAMLprim value caml_reident_custom (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.4.5/examples/with-c/src/main_custom.ml0000644000175000017500000000342612422026741020635 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 *) (******************************************************************************) external reident: 'a -> 'a = "caml_reident_custom" let () = print_endline (reident (A.ident "hello world!")) oasis-0.4.5/examples/with-c/src/main.ml0000644000175000017500000000341712422026741017243 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 *) (******************************************************************************) external reident: 'a -> 'a = "caml_reident" let () = print_endline (reident (A.ident "hello world!")) oasis-0.4.5/examples/with-c/src/A_stub.c0000644000175000017500000000361012422026741017341 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 */ /********************************************************************************/ #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.5/examples/with-c/src/A_header.h0000644000175000017500000000334312422026741017624 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 */ /********************************************************************************/ /* Header for A */ oasis-0.4.5/examples/with-c/src/A.ml0000644000175000017500000000332012422026741016470 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 *) (******************************************************************************) external ident: 'a -> 'a = "caml_ident" oasis-0.4.5/examples/with-c/_oasis0000644000175000017500000000206712422026741016376 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/with-c/LICENSE0000644000175000017500000000324612422026741016203 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 * ******************************************************************************** oasis-0.4.5/examples/syntax-camlp4/0000755000175000017500000000000012422026741016502 5ustar gildorgildoroasis-0.4.5/examples/syntax-camlp4/test/0000755000175000017500000000000012422026741017461 5ustar gildorgildoroasis-0.4.5/examples/syntax-camlp4/test/data/0000755000175000017500000000000012422026741020372 5ustar gildorgildoroasis-0.4.5/examples/syntax-camlp4/test/data/foo.ml.exp0000644000175000017500000000327012422026741022304 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 *) (******************************************************************************) let pi = 3.14159 oasis-0.4.5/examples/syntax-camlp4/test/data/foo.ml0000644000175000017500000000326312422026741021513 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 *) (******************************************************************************) let pi = PI oasis-0.4.5/examples/syntax-camlp4/src/0000755000175000017500000000000012422026741017271 5ustar gildorgildoroasis-0.4.5/examples/syntax-camlp4/src/pi.ml0000644000175000017500000000344412422026741020240 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 Camlp4.PreCast open Syntax EXTEND Gram GLOBAL: expr; expr: LEVEL "simple" [[ "PI" -> <:expr< 3.1415926 >> ]]; END oasis-0.4.5/examples/syntax-camlp4/_oasis0000644000175000017500000000063312422026741017704 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.5/examples/simplelib/0000755000175000017500000000000012422026741015756 5ustar gildorgildoroasis-0.4.5/examples/simplelib/src/0000755000175000017500000000000012422026741016545 5ustar gildorgildoroasis-0.4.5/examples/simplelib/src/foo.mli0000644000175000017500000000332712422026741020040 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 *) (******************************************************************************) type t val create: int -> t val value: t -> int oasis-0.4.5/examples/simplelib/src/foo.ml0000644000175000017500000000332712422026741017667 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 *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.4.5/examples/simplelib/src/bar.mli0000644000175000017500000000333512422026741020020 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 *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.5/examples/simplelib/src/bar.ml0000644000175000017500000000333212422026741017644 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.5/examples/simplelib/src/META0000644000175000017500000000324612422026741017223 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 # ################################################################################ oasis-0.4.5/examples/simplelib/_oasis0000644000175000017500000000137412422026741017163 0ustar gildorgildorName: simplelib Version: 0.0.1 OASISFormat: 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: extlib 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.5/examples/simplelib/LICENSE0000644000175000017500000000324612422026741016770 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 * ******************************************************************************** oasis-0.4.5/examples/packedlib/0000755000175000017500000000000012422026741015714 5ustar gildorgildoroasis-0.4.5/examples/packedlib/test/0000755000175000017500000000000012422026741016673 5ustar gildorgildoroasis-0.4.5/examples/packedlib/test/main.ml0000644000175000017500000000330612422026741020153 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 *) (******************************************************************************) let () = Packedlib.Foo.dump () oasis-0.4.5/examples/packedlib/src/0000755000175000017500000000000012422026741016503 5ustar gildorgildoroasis-0.4.5/examples/packedlib/src/foo.mli0000644000175000017500000000335612422026741020000 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 *) (******************************************************************************) type t val create: int -> t val value: t -> int val dump: unit -> unit oasis-0.4.5/examples/packedlib/src/foo.ml0000644000175000017500000000340612422026741017623 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 *) (******************************************************************************) type t = int let create n = n let value n = n let dump () = prerr_endline "In Packedlib.Foo" oasis-0.4.5/examples/packedlib/src/bar.mli0000644000175000017500000000333512422026741017756 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 *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.5/examples/packedlib/src/bar.ml0000644000175000017500000000333212422026741017602 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.5/examples/packedlib/src/Baz.ml0000644000175000017500000000324612422026741017556 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 *) (******************************************************************************) oasis-0.4.5/examples/packedlib/_oasis0000644000175000017500000000074012422026741017115 0ustar gildorgildorOASISFormat: 0.3 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.3) 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.5/examples/packedlib/LICENSE0000644000175000017500000000324612422026741016726 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 * ******************************************************************************** oasis-0.4.5/examples/order-matter/0000755000175000017500000000000012422026741016403 5ustar gildorgildoroasis-0.4.5/examples/order-matter/src/0000755000175000017500000000000012422026741017172 5ustar gildorgildoroasis-0.4.5/examples/order-matter/src/foo/0000755000175000017500000000000012422026741017755 5ustar gildorgildoroasis-0.4.5/examples/order-matter/src/foo/Foo.ml0000644000175000017500000000327312422026741021037 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 *) (******************************************************************************) let doit = Baz.doit oasis-0.4.5/examples/order-matter/src/baz/0000755000175000017500000000000012422026741017746 5ustar gildorgildoroasis-0.4.5/examples/order-matter/src/baz/Baz.ml0000644000175000017500000000327312422026741021021 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 *) (******************************************************************************) let doit = Bar.doit oasis-0.4.5/examples/order-matter/src/bar/0000755000175000017500000000000012422026741017736 5ustar gildorgildoroasis-0.4.5/examples/order-matter/src/bar/Bar.ml0000644000175000017500000000331012422026741020771 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 *) (******************************************************************************) let doit () = prerr_endline "" oasis-0.4.5/examples/order-matter/_oasis0000644000175000017500000000134312422026741017604 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/ocamlbuild/0000755000175000017500000000000012422026741016111 5ustar gildorgildoroasis-0.4.5/examples/ocamlbuild/src/0000755000175000017500000000000012422026741016700 5ustar gildorgildoroasis-0.4.5/examples/ocamlbuild/src/test.ml0000644000175000017500000000324612422026741020216 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 *) (******************************************************************************) oasis-0.4.5/examples/ocamlbuild/myocamlbuild.ml0000644000175000017500000000343012422026741021124 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 *) (******************************************************************************) (* OASIS_START *) (* OASIS_STOP *) Ocamlbuild_plugin.dispatch dispatch_default type t = {test: string} with odn oasis-0.4.5/examples/ocamlbuild/_oasis0000644000175000017500000000060212422026741017307 0ustar gildorgildorName: object Version: 0.0.1 OASISFormat: 0.4 AlphaFeatures: ocamlbuild_more_args Authors: Jacques-Pascal Deplaix License: LGPL with OCaml linking exception Synopsis: Example for ocamlbuild fields BuildTools: ocamlbuild XOCamlbuildPluginTags: package(odn.with.syntax), syntax(camlp4o) XOCamlbuildExtraArgs: -j 4 -verbose 0 OCamlVersion: >= 4.01 Library test Path: src Modules: Test oasis-0.4.5/examples/object/0000755000175000017500000000000012422026741015244 5ustar gildorgildoroasis-0.4.5/examples/object/src2/0000755000175000017500000000000012422026741016115 5ustar gildorgildoroasis-0.4.5/examples/object/src2/m2.mli0000644000175000017500000000324612422026741017143 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 *) (******************************************************************************) oasis-0.4.5/examples/object/src2/m2.ml0000644000175000017500000000324612422026741016772 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 *) (******************************************************************************) oasis-0.4.5/examples/object/src2/m1.ml0000644000175000017500000000324612422026741016771 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 *) (******************************************************************************) oasis-0.4.5/examples/object/src1/0000755000175000017500000000000012422026741016114 5ustar gildorgildoroasis-0.4.5/examples/object/src1/single.mli0000644000175000017500000000324612422026741020105 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 *) (******************************************************************************) oasis-0.4.5/examples/object/src1/single.ml0000644000175000017500000000324612422026741017734 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 *) (******************************************************************************) oasis-0.4.5/examples/object/_oasis0000644000175000017500000000064512422026741016451 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.5/examples/oasis/0000755000175000017500000000000012422026741015114 5ustar gildorgildoroasis-0.4.5/examples/oasis/uuidm.oasis0000644000175000017500000000135312422026741017301 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/oasis/cryptokit.oasis0000644000175000017500000000606512422026741020213 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/interdepend-libraries/0000755000175000017500000000000012422026741020251 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/0000755000175000017500000000000012422026741021040 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/libe/0000755000175000017500000000000012422026741021753 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/libe/E.ml0000644000175000017500000000330112422026741022466 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 *) (******************************************************************************) let doit () = D.doit () oasis-0.4.5/examples/interdepend-libraries/src/libd/0000755000175000017500000000000012422026741021752 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/libd/D.ml0000644000175000017500000000331412422026741022470 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 *) (******************************************************************************) let doit () = prerr_endline "toto" oasis-0.4.5/examples/interdepend-libraries/src/libc/0000755000175000017500000000000012422026741021751 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/libc/C.ml0000644000175000017500000000333612422026741022472 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 *) (******************************************************************************) let doit () = B.doit (); ignore (Num.num_of_int 0) oasis-0.4.5/examples/interdepend-libraries/src/libb/0000755000175000017500000000000012422026741021750 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/libb/B.ml0000644000175000017500000000334212422026741022465 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 *) (******************************************************************************) let doit () = A.doit (); ignore (Unix.gettimeofday ()) oasis-0.4.5/examples/interdepend-libraries/src/liba/0000755000175000017500000000000012422026741021747 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/liba/intern/0000755000175000017500000000000012422026741023246 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/liba/intern/A_parser.mly0000644000175000017500000000443212422026741025530 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 */ /********************************************************************************/ %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.5/examples/interdepend-libraries/src/liba/intern/A_lexer.mll0000644000175000017500000000421412422026741025334 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 *) (********************************************************************************) (* 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.5/examples/interdepend-libraries/src/liba/intern/A2.ml0000644000175000017500000000331612422026741024045 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 *) (******************************************************************************) let doit () = print_endline "Coucou" oasis-0.4.5/examples/interdepend-libraries/src/liba/A.ml0000644000175000017500000000334012422026741022461 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 *) (******************************************************************************) let doit () = A2.doit (); ignore (Str.regexp "abcd") oasis-0.4.5/examples/interdepend-libraries/src/execa/0000755000175000017500000000000012422026741022125 5ustar gildorgildoroasis-0.4.5/examples/interdepend-libraries/src/execa/Main.ml0000644000175000017500000000331112422026741023341 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 *) (******************************************************************************) let () = C.doit (); E.doit () oasis-0.4.5/examples/interdepend-libraries/_oasis0000644000175000017500000000234512422026741021455 0ustar gildorgildorOASISFormat: 0.1 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.5/examples/flags/0000755000175000017500000000000012422026741015072 5ustar gildorgildoroasis-0.4.5/examples/flags/src/0000755000175000017500000000000012422026741015661 5ustar gildorgildoroasis-0.4.5/examples/flags/src/simplelibext/0000755000175000017500000000000012422026741020362 5ustar gildorgildoroasis-0.4.5/examples/flags/src/simplelibext/META0000644000175000017500000000324612422026741021040 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 # ################################################################################ oasis-0.4.5/examples/flags/src/simplelibext/FooExt.ml0000644000175000017500000000324612422026741022125 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 *) (******************************************************************************) oasis-0.4.5/examples/flags/src/simplelibext/BarExt.ml0000644000175000017500000000324612422026741022106 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 *) (******************************************************************************) oasis-0.4.5/examples/flags/src/simplelib/0000755000175000017500000000000012422026741017641 5ustar gildorgildoroasis-0.4.5/examples/flags/src/simplelib/META0000644000175000017500000000324612422026741020317 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 # ################################################################################ oasis-0.4.5/examples/flags/src/simplelib/Foo.ml0000644000175000017500000000324612422026741020723 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 *) (******************************************************************************) oasis-0.4.5/examples/flags/src/simplelib/Conf.ml.ab0000644000175000017500000000330612422026741021443 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 *) (******************************************************************************) let version = "$(pkg_version)" oasis-0.4.5/examples/flags/src/simplelib/Bar.ml0000644000175000017500000000324612422026741020704 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 *) (******************************************************************************) oasis-0.4.5/examples/flags/_oasis0000644000175000017500000000204612422026741016274 0ustar gildorgildorOASISFormat: 0.1 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: extlib 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.5/examples/flags/LICENSE0000644000175000017500000000324612422026741016104 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 * ******************************************************************************** oasis-0.4.5/examples/findlib/0000755000175000017500000000000012422026741015405 5ustar gildorgildoroasis-0.4.5/examples/findlib/src/0000755000175000017500000000000012422026741016174 5ustar gildorgildoroasis-0.4.5/examples/findlib/src/foo.mli0000644000175000017500000000332712422026741017467 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 *) (******************************************************************************) type t val create: int -> t val value: t -> int oasis-0.4.5/examples/findlib/src/foo.ml0000644000175000017500000000332712422026741017316 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 *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.4.5/examples/findlib/src/bar.mli0000644000175000017500000000333512422026741017447 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 *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.5/examples/findlib/src/bar.ml0000644000175000017500000000333212422026741017273 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.5/examples/findlib/src/META0000644000175000017500000000324612422026741016652 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 # ################################################################################ oasis-0.4.5/examples/findlib/_oasis0000644000175000017500000000044112422026741016604 0ustar gildorgildorName: findlib Version: 0.0.1 OASISFormat: 0.1 Authors: Sylvain Le Gall Copyrights: (C) 2008 Sylvain Le Gall Homepage: http://example.com 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.5/examples/findlib/LICENSE0000644000175000017500000000324612422026741016417 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 * ******************************************************************************** oasis-0.4.5/examples/custom/0000755000175000017500000000000012422026741015310 5ustar gildorgildoroasis-0.4.5/examples/custom/src/0000755000175000017500000000000012422026741016077 5ustar gildorgildoroasis-0.4.5/examples/custom/src/foo.mli0000644000175000017500000000332712422026741017372 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 *) (******************************************************************************) type t val create: int -> t val value: t -> int oasis-0.4.5/examples/custom/src/foo.ml0000644000175000017500000000332712422026741017221 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 *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.4.5/examples/custom/src/bar.mli0000644000175000017500000000333512422026741017352 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 *) (******************************************************************************) type t val create: string -> t val value: t -> string oasis-0.4.5/examples/custom/src/bar.ml0000644000175000017500000000333212422026741017176 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.4.5/examples/custom/src/META0000644000175000017500000000324612422026741016555 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 # ################################################################################ oasis-0.4.5/examples/custom/myconfigure.bat0000644000175000017500000000336212422026741020333 0ustar gildorgildorrem==============================================================================# rem OASIS: architecture for building OCaml libraries and applications # rem # rem Copyright (C) 2011-2013, 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.5/examples/custom/myconfigure0000755000175000017500000000332512422026741017570 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 # ################################################################################ #!/bin/sh echo 'ocamlc="ocamlc"' > setup.data oasis-0.4.5/examples/custom/_oasis0000644000175000017500000000156112422026741016513 0ustar gildorgildorName: simplelib Version: 0.0.1 OASISFormat: 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.5/examples/custom/TopMakefile0000644000175000017500000000365112422026741017440 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 # ################################################################################ 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.5/examples/custom/LICENSE0000644000175000017500000000324612422026741016322 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 * ******************************************************************************** oasis-0.4.5/doc/0000755000175000017500000000000012422026741012725 5ustar gildorgildoroasis-0.4.5/doc/ext/0000755000175000017500000000000012422026741013525 5ustar gildorgildoroasis-0.4.5/doc/ext/fetch-doc.sh0000644000175000017500000000334012422026741015715 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 # ################################################################################ wget -N "http://www.haskell.org/cabal/proposal/x611.html" oasis-0.4.5/doc/ext/README.txt0000644000175000017500000000020512422026741015220 0ustar gildorgildorFor licensing problem, no external documentation is included. You can run "sh fetch-doc.sh" to get required external documentation. oasis-0.4.5/doc/FAQ.mkd0000644000175000017500000000020612422026741014027 0ustar gildorgildor 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.5/doc/ANALYSIS.mkd0000644000175000017500000000606612422026741014655 0ustar gildorgildor Architecture ============ The first goal is to be able to generate most of the required file for ocamlbuild. The build tool of choice for OASIS will be ocamlbuild. Other build tools like OCamlMakefile and OMake should also be used, but this will be only secondary goals. The minimum requirement for using OASIS is findlib and ocaml. It is used to detect available packages and install package. If the package doesn't depend on external package, findlib dependencies can be ignored. We consider that a full build system should configure, build and install a software package. configure --------- The configure phase provides a way to set various options of the build system depending of software/hardware configurations and user choices. A project has requirements regarding third party softwares, this is its "build dependencies". The user's choices can also change the build scheme: don't build a module, use an alternate implementation for another. We call it the "user choices". The configure step try to auto detect various parameters and see if they match with "build dependencies" and "user choices". At the endi, the configure scheme should create files which summarize choices 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 this 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 and bytecode object 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) build phase use configure phase result through a generated file that list important variable regarding build process. test ---- The test phase is optional. TODO doc --- The doc phase is optional. TODO install ------- The install phase install all generated objects into the target system. OASIS provides 1 choice for install: - internal (default): use ocamlfind to install library FileUtils to install data and executable. install phase use configure phase result through a generated file that list important variable regarding 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 ------ Developper ---------- oasis-0.4.5/doc-dist.sh0000755000175000017500000000435112422026741014230 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e OASIS_VERSION=$(oasis 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.5/dist.ml0000644000175000017500000001346112422026741013462 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 *) (******************************************************************************) let () = try Topdirs.dir_directory (Sys.getenv "OCAML_TOPLEVEL_PATH") with Not_found -> () ;; #use "topfind";; #require "odn";; #require "unix";; #require "fileutils";; #load "_build/src/oasis/oasis.cma";; #directory "_build/src/oasis/";; open OASISUtils open OASISTypes let debug_self = true let exec nm = try FileUtil.which nm with Not_found -> failwithf "Executable '%s' not found." nm let distdir = Filename.concat (Sys.getcwd ()) "dist" let oasis_exec = FilePath.make_filename [(Sys.getcwd ()); "_build"; "src"; "cli"; "Main.byte"] let git_exec = exec "git" let tar_exec = exec "tar" (* Argument parsing. *) let dev = ref false let () = 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." let ctxt = {!OASISContext.default with OASISContext.ignore_plugins = true} let run = OASISExec.run ~ctxt 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 let pkg = OASISParse.from_file ~ctxt OASISParse.default_oasis_fn let uncommited_changes = match OASISExec.run_read_output ~ctxt git_exec ["status"; "--porcelain"] with | [] -> false | _ -> true let () = if not debug_self && uncommited_changes then failwith "Uncommited changes." let ver_str = OASISVersion.string_of_version pkg.version 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 let tag = if !dev then "dev" else ver_str let () = 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.version_compare_string 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 let topdir = pkg.name^"-"^tag let tarball = Filename.concat distdir (topdir^".tar.gz") let () = (* 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)) let () = 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.5/deps.ml0000644000175000017500000001434612422026741013455 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 *) (******************************************************************************) 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, lib) 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 (cs, bs, exec) 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.5/configure0000755000175000017500000000055312422026741014072 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.5/ardivink.lua0000644000175000017500000000113612422026741014473 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") -- Create documentation package. ci.exec("make", "doc-dist") -- Create dev tarball. ci.exec("make", "dist-dev") oasis-0.4.5/_tags0000644000175000017500000002360612422026741013207 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 # ################################################################################ # OASIS_START # DO NOT EDIT (digest: ba905c04424b96d55f58854850a00499) # Ignore VCS directories, you can use the same kind of rule outside # OASIS_START/STOP if you want to exclude directories that contains # useless stuff for the build process <**/.svn>: -traverse <**/.svn>: not_hygienic ".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 : pkg_odn : pkg_unix # Library base "src/base/base.cmxs": use_base : pkg_odn : pkg_unix : use_oasis # Library builtin-plugins "src/builtin-plugins.cmxs": use_builtin-plugins : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_oasis # Library dynrun "src/dynrun/dynrun.cmxs": use_dynrun : pkg_ocamlbuild : pkg_odn : pkg_unix : use_base : use_builtin-plugins : use_oasis # Executable fake_ocamlfind "test/utils/fake_ocamlfind.byte": pkg_unix : pkg_unix # Executable test "test/test.byte": pkg_expect.pcre "test/test.byte": pkg_fileutils "test/test.byte": pkg_findlib "test/test.byte": pkg_oUnit "test/test.byte": pkg_ocamlbuild "test/test.byte": pkg_odn "test/test.byte": pkg_pcre "test/test.byte": pkg_unix "test/test.byte": use_base "test/test.byte": use_builtin-plugins "test/test.byte": use_oasis : pkg_expect.pcre : pkg_fileutils : pkg_findlib : pkg_oUnit : pkg_ocamlbuild : pkg_odn : pkg_pcre : pkg_unix : use_base : use_builtin-plugins : use_oasis # Library plugin-loader "src/ext/plugin-loader/src/plugin-loader.cmxs": use_plugin-loader : pkg_dynlink : pkg_findlib # Library cli "src/cli/cli.cmxs": use_cli # Executable oasis "src/cli/Main.byte": pkg_dynlink "src/cli/Main.byte": pkg_findlib "src/cli/Main.byte": pkg_ocamlbuild "src/cli/Main.byte": pkg_odn "src/cli/Main.byte": pkg_unix "src/cli/Main.byte": use_base "src/cli/Main.byte": use_builtin-plugins "src/cli/Main.byte": use_cli "src/cli/Main.byte": use_oasis "src/cli/Main.byte": use_plugin-loader : pkg_dynlink : pkg_findlib : pkg_ocamlbuild : pkg_odn : pkg_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/pluginloader.byte": pkg_dynlink "src/ext/plugin-loader/test/data/pluginloader.byte": pkg_findlib "src/ext/plugin-loader/test/data/pluginloader.byte": use_plugin-loader "src/ext/plugin-loader/test/data/pluginloader.byte": use_pluginloaderLib : pkg_dynlink : pkg_findlib : use_plugin-loader : use_pluginloaderLib # Executable test_loader "src/ext/plugin-loader/test/TestLoader.byte": pkg_dynlink "src/ext/plugin-loader/test/TestLoader.byte": pkg_fileutils "src/ext/plugin-loader/test/TestLoader.byte": pkg_findlib "src/ext/plugin-loader/test/TestLoader.byte": pkg_oUnit "src/ext/plugin-loader/test/TestLoader.byte": use_plugin-loader : pkg_dynlink : pkg_fileutils : pkg_findlib : pkg_oUnit : use_plugin-loader # Library userconf "src/ext/userconf/src/userconf.cmxs": use_userconf # Executable test_userconf "src/ext/userconf/test/TestUserConf.byte": pkg_oUnit "src/ext/userconf/test/TestUserConf.byte": use_userconf : pkg_oUnit : use_userconf # OASIS_STOP # Base system and OASIS library : use_ocamlbuild : use_ocamlbuild "src/oasis/OASISGettext.ml": syntax_camlp4o, pkg_camlp4.macro "src/oasis/OASISGettext.ml": cond_pkg_gettext.base "src/cli/MainGettext.ml": syntax_camlp4o, pkg_camlp4.macro "src/cli/MainGettext.ml": cond_pkg_gettext-stub, use_oasis "src/cli/Main.byte": cond_pkg_gettext-stub, use_oasis "test/TestCommon.ml": syntax_camlp4o, pkg_camlp4.macro "test/TestCommon.ml": cond_pkg_gettext-stub "test/test.byte": cond_pkg_gettext-stub "src/oasis/OASISTypes.ml": syntax_camlp4o, pkg_odn.with.syntax "src/oasis/OASISRecDescParser.ml": syntax_camlp4o, pkg_camlp4 "src/oasis/OASISVersion.ml": syntax_camlp4o, pkg_odn.with.syntax "src/oasis/OASISLicense.ml": syntax_camlp4o, pkg_odn.with.syntax "src/oasis/OASISExpr.ml": syntax_camlp4o, pkg_odn.with.syntax "src/oasis/OASISText.ml": syntax_camlp4o, pkg_odn.with.syntax "src/base/BaseDev.ml": syntax_camlp4o, pkg_odn.with.syntax "src/cli/Query.ml": syntax_camlp4o, pkg_camlp4 # Plugins "src/plugins/custom/CustomPlugin.ml": syntax_camlp4o, pkg_odn.with.syntax "src/plugins/ocamlbuild/MyOCamlbuildBase.ml": syntax_camlp4o, pkg_odn.with.syntax "src/plugins/ocamlbuild/MyOCamlbuildBase.ml": use_ocamlbuild "src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml": use_ocamlbuild "src/plugins/ocamlbuild/OCamlbuildPlugin.ml": syntax_camlp4o, pkg_odn.with.syntax "src/plugins/ocamlbuild/OCamlbuildPlugin.ml": use_ocamlbuild "src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml": syntax_camlp4o, pkg_odn.with.syntax "src/plugins/ocamlbuild/OCamlbuildCommon.ml": syntax_camlp4o, pkg_odn.with.syntax # TODO: The fact that we need to remove these tags is maybe a bug : -use_base : -use_oasis : -use_base : -use_oasis <**/*.ml>: annot "build": -traverse "build": not_hygienic oasis-0.4.5/_oasis0000644000175000017500000002344412422026741013367 0ustar gildorgildorOASISFormat: 0.3 OCamlVersion: >= 3.11.2 FindlibVersion: >= 1.3.1 Name: oasis Version: 0.4.5 LicenseFile: COPYING.txt License: LGPL-2.1 with OCaml linking exception BuildType: ocamlbuild (0.3) Authors: Sylvain Le Gall Maintainers: Sylvain Le Gall Copyrights: (C) 2008-2010 OCamlCore SARL Homepage: http://oasis.forge.ocamlcore.org/ Plugins: DevFiles (0.3), StdFiles (0.3), META (0.3) FilesAB: src/oasis/OASISConf.ml.ab 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. Flag libraries Description: Install oasis and base libraries, for plugins development Flag gettext Description: Use ocaml-gettext for i18n Default: false if flag(gettext) PostBuildCommand: $make -C po all PostCleanCommand: $make -C po clean PostInstallCommand: $make -C po install PODIR=$prefix/share/locale PostUninstallCommand: $make -C po install PODIR=$prefix/share/locale Library oasis Path: src/oasis Modules: FormatExt, ODNFunc, PropList, OASISUtils, OASISUnixPath, OASISContext, 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 InternalModules: OASISVersion_types, OASISVersion_lexer, OASISVersion_parser, OASISLicense_types, OASISLicense_lexer, OASISLicense_parser, OASISValues_lexer, OASISSchema, OASISConf, OASISAst, OASISCheck, OASISRecDescParser, 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, odn (>= 0.0.11) 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 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 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 CompiledObject: Best BuildDepends: oasis, oasis.base, ocamlbuild FindlibParent: oasis Library cli Path: src/cli Modules: CLISubCommand, CLIArgExt, CLICommon, CLIPager InternalModules: CLIData, CLIPluginsLoaded 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 Executable fake_ocamlfind Path: test/utils MainIs: fake_ocamlfind.ml Install: false CompiledObject: byte Build$: flag(tests) BuildDepends: unix Executable test Path: test MainIs: test.ml Install: false CompiledObject: byte Build$: flag(tests) BuildDepends: oUnit (>= 2.0.0), findlib, fileutils (>= 0.4.2), expect.pcre (>= 0.0.4), oasis, oasis.base, oasis.builtin-plugins, pcre Test main Type: custom (0.3) Command: $test -oasis $oasis -is-native $is_native -native-dynlink $native_dynlink -ocamlmod $ocamlmod -fake-ocamlfind $fake_ocamlfind WorkingDirectory: test TestTools: oasis, test, ocamlmod, fake_ocamlfind Document manual Type: custom (0.3) Title: OASIS User Manual if flag(gettext) XCustom: env LANG=C $oasis -ignore-plugins manual -o doc/MANUAL.mkd else 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.3) InstallDir: $htmldir/oasis BuildTools+: ocamldoc XOCamlbuildPath: src/ XOCamlbuildLibraries: oasis, oasis.base, oasis.cli SourceRepository head Type: git Location: git://github.com/gildor478/oasis.git Browser: https://github.com/gildor478/oasis # Third party: plugin-loader Library "plugin-loader" Path: src/ext/plugin-loader/src Modules: PluginLoader BuildDepends: dynlink, findlib Library "pluginloaderLib" Path: src/ext/plugin-loader/test/data/findlib/pluginloaderLib Modules: PluginloaderLib Build$: flag(tests) Install: false Library "plugin1" Path: src/ext/plugin-loader/test/data/findlib/plugin1 Modules: Plugin1 Install: false Build$: flag(tests) BuildDepends: pluginloaderLib 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 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 XMETAExtraLines: plugin_system = "pluginloader" plugin_name = "plugin3" plugin_synopsis = "third plugin" Executable "pluginloader" Path: src/ext/plugin-loader/test/data MainIs: pluginloader.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.3) Command: $test_loader -pluginloader $pluginloader TestTools: test_loader, pluginloader # Third party: user-conf Library "userconf" Path: src/ext/userconf/src Modules: UserConf Executable "test_userconf" Path: src/ext/userconf/test MainIs: TestUserConf.ml BuildDepends: userconf, oUnit Build$: flag(tests) Install: false Test main_userconf Type: custom (0.3) Command: $test_userconf TestTools: test_userconf oasis-0.4.5/_header0000644000175000017500000000154712422026741013501 0ustar gildorgildorOASIS: 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 oasis-0.4.5/_headache.config0000644000175000017500000001044312422026741015232 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 # ################################################################################ | ".*\\.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:"#" | ".*\\.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 | ".*src/tools/oasis" -> skip match:"#!.*" oasis-0.4.5/TODO.txt0000644000175000017500000000124412422026741013467 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.5/README.txt0000644000175000017500000000254012422026741013657 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: 850a4f92bc8d28b3dd7640aaec5892a2) *) 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.txt](INSTALL.txt) for building and installation instructions. [Home page](http://oasis.forge.ocamlcore.org/) 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_STOP *) oasis-0.4.5/Makefile0000644000175000017500000001066712422026741013632 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 # ################################################################################ CONFIGUREFLAGS += --override ocamlbuildflags -classic-display --enable-tests # TODO: gettext doesn't play nice with dynrun. #CONFIGUREFLAGS += $(if $(shell ocamlfind query gettext),--enable-gettext,--disable-gettext) default: test #TESTFLAGS=-only-test "OASIS:3:FileTemplate:6:META.cohttp" TIMINGS=1 #export TIMINGS # 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: 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 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 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 $(MAKE) build ./Main.byte setup admin-gallu-oasis-increment --setup_run $(MAKE) distclean ./configure --enable-tests --enable-docs $(MAKE) test git commit -am "Update OASIS version." .PHONY: deploy # Create a tarball for rebuilding the current version dist-dev: ocaml dist.ml -dev oasis-0.4.5/INSTALL.txt0000644000175000017500000000314712422026741014034 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: 2e5179ceaf2e2997ce42df0cf788e588) *) 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) for all, test main, test main_loader, test main_userconf, doc api-oasis, doc manual * findlib (>= 1.3.1) * odn (>= 0.0.11) for library oasis * make for all, test main, test main_loader, test main_userconf, doc api-oasis, doc manual * ocamlmod for library base, library oasis, test main * ocamlify for library base, library oasis * ocamlbuild for library builtin-plugins * oUnit (>= 2.0.0) for executable test, executable test_loader, executable test_userconf * fileutils (>= 0.4.2) for executable test, executable test_loader * expect (>= 0.0.4) for executable test * pcre for executable test 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 *) i18n ==== This package supports l10n through ocaml-gettext. If you have installed this library, you can enable i18n by using the flag `--enable-gettext` when running `ocaml setup.ml -configure`. oasis-0.4.5/HACKING.md0000644000175000017500000001173112422026741013551 0ustar gildorgildor Guidelines to develop OASIS =========================== Updates in _oasis: _oasis and setup.ml of the OASIS project need to be updated with the officialy released version of OASIS. __You should never use the version of OASIS under development to update__ Go to http://oasis.forge.ocamlcore.org/ and install the latest available version. The reason of that decision is that if you generate a new version of setup.ml using your current version, each commit will include a change in setup.ml and it will be mostly a repetition of something you write elsewhere in your commit. Moreover, it can lead to conflict and it is never good to have to worry about conflicts (it has generated unreconciliable changes when the project was using darcs). Creating plugins ================ TODO: complete There are two kind of plugin: * command line plugins: they create subcommand for the command line interface of `oasis`. For example, the subcommand `oasis install pkg_name` is provided by the plugin `install`. * plugin that are used in `_oasis`: these plugins help to process the content of an `_oasis` file. They generate additional content in `setup.ml` and so on. You don''t have to load them, they will be automatically loaded when they are found in the `_oasis` file. For example `Plugins: AutoGenerate (0.1)` in the `_oasis` file will trigger the load of the plugin `autogenerate`. The plugin system of `oasis` use findlib to detect plugins, so you must install plugins as a standard OCaml library with a META file. OASIS detects plugin 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`. Cut a release ============= * Check status on [Jenkins][jenkins]. * 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. * Thanks section. * Create [blog post][blog-post]. * `make deploy` * Update Change Log in the Files section of forge: * Copy-paste last entry of CHANGES.txt. * Don''t Merge lines of para. * Check 'Preserve my pre-formatted text.' * Check the result. * Add new version to trackers ([Bugs][bugs-version]/[Patches][patches-version]). * Close all bugs in the CHANGES.txt on trackers ([1][bugs], [2][patches]). * Publish blog post with updated download links. * G+ announce as OASIS. * Reshare G+ post on OCaml community. * Send mail to caml-list, oasis-devel. * Run 'oasis setup' with the new version, inside oasis/ and commit the changes. [jenkins]: http://deci.ovh.le-gall.net:8080/job/ocaml-oasis/ [blog-post]: http://le-gall.net/sylvain+violaine/blog/admin/posts.php [bugs-version]: https://forge.ocamlcore.org/tracker/admin/index.php?add_opt=1&boxid=995&group_id=54&atid=291 [patches-version]: https://forge.ocamlcore.org/tracker/admin/index.php?add_opt=1&boxid=1007&group_id=54&atid=293 [bugs]: https://forge.ocamlcore.org/tracker/?atid=291&group_id=54&func=browse [patches]: https://forge.ocamlcore.org/tracker/?atid=293&group_id=54&func=browse Versions support policy ======================= Since OASIS should allow to compile projects in most environment, it should not set constraint on dependencies too high. Here are some policies, to determine what version of a dependencies we should support: * 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 express 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. OASIS backward compatibility ============================ OASIS supports former version of OASISFormat. Most of the important things are automatically backported to former version. However on the long term we might decide to drop support of old OASISFormat. We will support as long as possible an OASISFormat version but for any version below the OASIS version present in Debian stable, we may drop the support. For example: * Debian stable is released with OASIS 0.2.0 * We may support OASISFormat: 0.1 as long as possible but, at one point we may enforce 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.5/COPYING.txt0000644000175000017500000006546012422026741014044 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.5/CHANGES.txt0000644000175000017500000005503112422026741013775 0ustar gildorgildor2014-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). For 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.5/AUTHORS.txt0000644000175000017500000000032012422026741014041 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: 42d3c82e95c25b7f485d1a22832dc8cd) *) Authors of oasis: * Sylvain Le Gall Current maintainers of oasis: * Sylvain Le Gall (* OASIS_STOP *) oasis-0.4.5/.gitignore0000644000175000017500000000027612422026741014155 0ustar gildorgildor_build *.byte *.native 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/ po/*.mo