oasis-0.3.0/0000755000175000017500000000000011773154623012163 5ustar gildorgildoroasis-0.3.0/_oasis0000644000175000017500000002236011773154621013364 0ustar gildorgildorOASISFormat: 0.3 OCamlVersion: >= 3.11.0 Name: oasis Version: 0.3.0 LicenseFile: COPYING.txt License: LGPL-2.1 with OCaml linking exception BuildType: ocamlbuild (0.3) Authors: 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, FormatMarkdown, ODNFunc, PropList, OASISUtils, OASISUnixPath, OASISContext, OASISGettext, OASISMessage, OASISTypes, OASISParse, OASISValues, OASISExpr, OASISVersion, OASISLicense, OASISFileTemplate, OASISBuildSection, OASISDocument, OASISExecutable, OASISFlag, OASISLibrary, OASISPackage, OASISSourceRepository, OASISTest, OASISPlugin, OASISSchema, OASISSection, OASISData, OASISString, OASISExec, OASISFileUtil, OASISHostPath, OASISGraph 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, OASISPackage_intern, OASISSourceRepository_intern, OASISTest_intern, OASISSchema_intern, OASISPath_intern CompiledObject: Best BuildDepends: unix, odn (>= 0.0.3) 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 FindlibParent: oasis Library cli Path: src/cli Modules: SubCommand, ArgExt, Pager InternalModules: CLIData CompiledObject: byte BuildDepends: oasis, oasis.base 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, plugin-loader Executable test Path: test MainIs: test.ml Install: false CompiledObject: byte Build$: flag(tests) BuildDepends: oUnit (>= 1.1.0), findlib, fileutils (>= 0.4.2), expect.pcre (>= 0.0.2), oasis, oasis.base, oasis.builtin-plugins Test main Type: custom (0.3) Command: $test -oasis-exec $oasis -has-ocamlopt $is_native WorkingDirectory: test TestTools: oasis, test Document manual Type: custom (0.3) Title: OASIS User Manual if flag(gettext) XCustom: env LANG=C $oasis manual > doc/MANUAL.mkd else XCustom: $oasis 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: darcs Location: http://darcs.ocamlcore.org/repos/oasis Browser: http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=oasis;a=summary # 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.3.0/_headache.config0000644000175000017500000000734511773154621015242 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 # ################################################################################ | ".*\\.txt" -> no | ".*\\.txt-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:" " | ".*\\.mli?" -> skip match:"(\\*pp .* \\*)" | ".*\\.mli?" -> frame open:"(*" line:"*" close:"*)" margin:" " | "_headache\\.config" -> frame open:"#" line:"#" close:"#" | "_announce" -> no | "_header" -> no | "_fixperms" -> 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:"#" | ".*\\.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:"#" | "oasis-i18n" -> frame open:"#" line:"#" close:"#" | "foo\.bar" -> no | ".*\\.tar\\.gz" -> no | ".*\\.tar\\.gz\\.asc" -> no oasis-0.3.0/_header0000644000175000017500000000147611773154621013503 0ustar gildorgildorOASIS: 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.3.0/README.txt0000644000175000017500000000221411773154621013656 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: a319542397f6b38d6e3c3e8d3428c081) *) This is the README file for the oasis distribution. (C) 2008-2010 OCamlCore SARL 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 files INSTALL.txt for building and installation instructions. See the file COPYING.txt for copying conditions. Home page: http://oasis.forge.ocamlcore.org/ (* OASIS_STOP *) oasis-0.3.0/examples/0000755000175000017500000000000011773154621013777 5ustar gildorgildoroasis-0.3.0/examples/with-subpackage/0000755000175000017500000000000011773154621017055 5ustar gildorgildoroasis-0.3.0/examples/with-subpackage/_oasis0000644000175000017500000000166311773154621020263 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.3.0/examples/with-subpackage/src/0000755000175000017500000000000011773154621017644 5ustar gildorgildoroasis-0.3.0/examples/with-subpackage/src/B.ml0000644000175000017500000000312511773154621020360 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.3.0/examples/with-subpackage/src/A.ml0000644000175000017500000000312511773154621020357 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.3.0/examples/with-subpackage/src/main.ml0000644000175000017500000000312511773154621021123 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.3.0/examples/with-subpackage/src/syntax/0000755000175000017500000000000011773154621021172 5ustar gildorgildoroasis-0.3.0/examples/with-subpackage/src/syntax/pa_test.ml0000644000175000017500000000312511773154621023164 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.3.0/examples/oasis/0000755000175000017500000000000011773154621015115 5ustar gildorgildoroasis-0.3.0/examples/oasis/uuidm.oasis0000644000175000017500000000135311773154621017302 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.3.0/examples/oasis/cryptokit.oasis0000644000175000017500000000610311773154621020205 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.3.0/examples/interdepend-libraries/0000755000175000017500000000000011773154621020252 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/_oasis0000644000175000017500000000235311773154621021455 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.3.0/examples/interdepend-libraries/src/0000755000175000017500000000000011773154621021041 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/libe/0000755000175000017500000000000011773154621021754 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/libe/E.ml0000644000175000017500000000316011773154621022472 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 *) (******************************************************************************) let doit () = D.doit () oasis-0.3.0/examples/interdepend-libraries/src/libb/0000755000175000017500000000000011773154621021751 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/libb/B.ml0000644000175000017500000000322411773154621022465 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 *) (******************************************************************************) let doit () = A.doit (); ignore (Unix.gettimeofday ()) ;; oasis-0.3.0/examples/interdepend-libraries/src/liba/0000755000175000017500000000000011773154621021750 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/liba/A.ml0000644000175000017500000000322211773154621022461 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 *) (******************************************************************************) let doit () = A2.doit (); ignore (Str.regexp "abcd") ;; oasis-0.3.0/examples/interdepend-libraries/src/liba/intern/0000755000175000017500000000000011773154621023247 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/liba/intern/A_parser.mly0000644000175000017500000000430711773154621025532 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 */ /********************************************************************************/ %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.3.0/examples/interdepend-libraries/src/liba/intern/A_lexer.mll0000644000175000017500000000407111773154621025336 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 *) (********************************************************************************) (* 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.3.0/examples/interdepend-libraries/src/liba/intern/A2.ml0000644000175000017500000000320011773154621024036 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 *) (******************************************************************************) let doit () = print_endline "Coucou" ;; oasis-0.3.0/examples/interdepend-libraries/src/libc/0000755000175000017500000000000011773154621021752 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/libc/C.ml0000644000175000017500000000322011773154621022463 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 *) (******************************************************************************) let doit () = B.doit (); ignore (Num.num_of_int 0) ;; oasis-0.3.0/examples/interdepend-libraries/src/libd/0000755000175000017500000000000011773154621021753 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/libd/D.ml0000644000175000017500000000317311773154621022474 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 *) (******************************************************************************) let doit () = prerr_endline "toto" oasis-0.3.0/examples/interdepend-libraries/src/execa/0000755000175000017500000000000011773154621022126 5ustar gildorgildoroasis-0.3.0/examples/interdepend-libraries/src/execa/Main.ml0000644000175000017500000000317311773154621023350 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 *) (******************************************************************************) let () = C.doit (); E.doit () ;; oasis-0.3.0/examples/with-c/0000755000175000017500000000000011773154621015172 5ustar gildorgildoroasis-0.3.0/examples/with-c/_oasis0000644000175000017500000000207211773154621016373 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.3.0/examples/with-c/LICENSE0000644000175000017500000000312511773154621016200 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.3.0/examples/with-c/src/0000755000175000017500000000000011773154621015761 5ustar gildorgildoroasis-0.3.0/examples/with-c/src/A_stub.c0000644000175000017500000000346511773154621017352 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 */ /********************************************************************************/ #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.3.0/examples/with-c/src/main_native_stub.c0000644000175000017500000000335511773154621021462 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 */ /********************************************************************************/ #include CAMLprim value caml_reident_native (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.3.0/examples/with-c/src/A.ml0000644000175000017500000000320011773154621016466 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 *) (******************************************************************************) external ident: 'a -> 'a = "caml_ident";; oasis-0.3.0/examples/with-c/src/main_custom_stub.c0000644000175000017500000000335511773154621021506 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 */ /********************************************************************************/ #include CAMLprim value caml_reident_custom (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.3.0/examples/with-c/src/main.ml0000644000175000017500000000327011773154621017241 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 *) (******************************************************************************) external reident : 'a -> 'a = "caml_reident";; print_endline (reident (A.ident "hello world!"));; oasis-0.3.0/examples/with-c/src/main_stub.c0000644000175000017500000000344011773154621020107 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 */ /********************************************************************************/ #include #ifndef OPTION_PASSED #error "CCOpt doesn't work" #endif CAMLprim value caml_reident (value va) { CAMLparam1(va); CAMLreturn(va); } oasis-0.3.0/examples/with-c/src/main_native.ml0000644000175000017500000000327711773154621020616 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 *) (******************************************************************************) external reident : 'a -> 'a = "caml_reident_native";; print_endline (reident (A.ident "hello world!"));; oasis-0.3.0/examples/with-c/src/A_header.h0000644000175000017500000000322011773154621017617 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 */ /********************************************************************************/ /* Header for A */ oasis-0.3.0/examples/with-c/src/main_custom.ml0000644000175000017500000000327711773154621020642 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 *) (******************************************************************************) external reident : 'a -> 'a = "caml_reident_custom";; print_endline (reident (A.ident "hello world!"));; oasis-0.3.0/examples/findlib/0000755000175000017500000000000011773154621015406 5ustar gildorgildoroasis-0.3.0/examples/findlib/_oasis0000644000175000017500000000044111773154621016605 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.3.0/examples/findlib/LICENSE0000644000175000017500000000312511773154621016414 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.3.0/examples/findlib/src/0000755000175000017500000000000011773154621016175 5ustar gildorgildoroasis-0.3.0/examples/findlib/src/bar.ml0000644000175000017500000000320711773154621017275 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.3.0/examples/findlib/src/bar.mli0000644000175000017500000000321511773154621017445 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 *) (******************************************************************************) type t val create : string -> t val value : t -> string oasis-0.3.0/examples/findlib/src/META0000644000175000017500000000312511773154621016647 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.3.0/examples/findlib/src/foo.ml0000644000175000017500000000320411773154621017311 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 *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.3.0/examples/findlib/src/foo.mli0000644000175000017500000000320711773154621017465 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 *) (******************************************************************************) type t val create : int -> t val value : t -> int oasis-0.3.0/examples/simplelib/0000755000175000017500000000000011773154621015757 5ustar gildorgildoroasis-0.3.0/examples/simplelib/_oasis0000644000175000017500000000137511773154621017165 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.3.0/examples/simplelib/LICENSE0000644000175000017500000000312511773154621016765 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.3.0/examples/simplelib/src/0000755000175000017500000000000011773154621016546 5ustar gildorgildoroasis-0.3.0/examples/simplelib/src/bar.ml0000644000175000017500000000320711773154621017646 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.3.0/examples/simplelib/src/bar.mli0000644000175000017500000000321511773154621020016 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 *) (******************************************************************************) type t val create : string -> t val value : t -> string oasis-0.3.0/examples/simplelib/src/META0000644000175000017500000000312511773154621017220 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.3.0/examples/simplelib/src/foo.ml0000644000175000017500000000320411773154621017662 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 *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.3.0/examples/simplelib/src/foo.mli0000644000175000017500000000320711773154621020036 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 *) (******************************************************************************) type t val create : int -> t val value : t -> int oasis-0.3.0/examples/with-data/0000755000175000017500000000000011773154621015661 5ustar gildorgildoroasis-0.3.0/examples/with-data/_oasis0000644000175000017500000000123511773154621017062 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.3.0/examples/with-data/src/0000755000175000017500000000000011773154621016450 5ustar gildorgildoroasis-0.3.0/examples/with-data/src/test.ml0000644000175000017500000000312511773154621017762 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.3.0/examples/with-data/src/test.txt0000644000175000017500000000000011773154621020156 0ustar gildorgildoroasis-0.3.0/examples/with-data/src/test.html0000644000175000017500000000000011773154621020303 0ustar gildorgildoroasis-0.3.0/examples/with-data/LICENSE.txt0000644000175000017500000000000011773154621017472 0ustar gildorgildoroasis-0.3.0/examples/custom/0000755000175000017500000000000011773154621015311 5ustar gildorgildoroasis-0.3.0/examples/custom/_oasis0000644000175000017500000000156411773154621016517 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.3.0/examples/custom/TopMakefile0000644000175000017500000000353011773154621017435 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 # ################################################################################ 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.3.0/examples/custom/myconfigure0000755000175000017500000000320411773154621017565 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 # ################################################################################ #!/bin/sh echo 'ocamlc="ocamlc"' > setup.data oasis-0.3.0/examples/custom/myconfigure.bat0000644000175000017500000000323711773154621020335 0ustar gildorgildorrem============================================================================== rem OASIS: architecture for building OCaml libraries and applications rem rem Copyright (C) 2008-2010, 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.3.0/examples/custom/LICENSE0000644000175000017500000000312511773154621016317 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.3.0/examples/custom/src/0000755000175000017500000000000011773154621016100 5ustar gildorgildoroasis-0.3.0/examples/custom/src/bar.ml0000644000175000017500000000320711773154621017200 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 *) (******************************************************************************) type t = string let create s = s let value s = s oasis-0.3.0/examples/custom/src/bar.mli0000644000175000017500000000321511773154621017350 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 *) (******************************************************************************) type t val create : string -> t val value : t -> string oasis-0.3.0/examples/custom/src/META0000644000175000017500000000312511773154621016552 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.3.0/examples/custom/src/foo.ml0000644000175000017500000000320411773154621017214 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 *) (******************************************************************************) type t = int let create n = n let value n = n oasis-0.3.0/examples/custom/src/foo.mli0000644000175000017500000000320711773154621017370 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 *) (******************************************************************************) type t val create : int -> t val value : t -> int oasis-0.3.0/examples/with-test/0000755000175000017500000000000011773154621015727 5ustar gildorgildoroasis-0.3.0/examples/with-test/_oasis0000644000175000017500000000057411773154621017135 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 WorkingDirectory: src oasis-0.3.0/examples/with-test/src/0000755000175000017500000000000011773154621016516 5ustar gildorgildoroasis-0.3.0/examples/with-test/src/test.mli0000644000175000017500000000320611773154621020201 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 *) (******************************************************************************) val myrun : OUnit.test -> OUnit.test_result list oasis-0.3.0/examples/with-test/src/test.ml0000644000175000017500000000331411773154621020030 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 *) (******************************************************************************) open OUnit;; let myrun t = let lst = run_test_tt_main t in lst ;; myrun ("main" >:: (fun () -> ())) ;; oasis-0.3.0/examples/with-test/LICENSE.txt0000644000175000017500000000312511773154621017553 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.3.0/examples/order-matter/0000755000175000017500000000000011773154621016404 5ustar gildorgildoroasis-0.3.0/examples/order-matter/_oasis0000644000175000017500000000135111773154621017604 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.3.0/examples/order-matter/src/0000755000175000017500000000000011773154621017173 5ustar gildorgildoroasis-0.3.0/examples/order-matter/src/foo/0000755000175000017500000000000011773154621017756 5ustar gildorgildoroasis-0.3.0/examples/order-matter/src/foo/Foo.ml0000644000175000017500000000315111773154621021033 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 *) (******************************************************************************) let doit = Baz.doit oasis-0.3.0/examples/order-matter/src/baz/0000755000175000017500000000000011773154621017747 5ustar gildorgildoroasis-0.3.0/examples/order-matter/src/baz/Baz.ml0000644000175000017500000000315111773154621021015 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 *) (******************************************************************************) let doit = Bar.doit oasis-0.3.0/examples/order-matter/src/bar/0000755000175000017500000000000011773154621017737 5ustar gildorgildoroasis-0.3.0/examples/order-matter/src/bar/Bar.ml0000644000175000017500000000316711773154621021004 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 *) (******************************************************************************) let doit () = prerr_endline "" oasis-0.3.0/examples/packedlib/0000755000175000017500000000000011773154621015715 5ustar gildorgildoroasis-0.3.0/examples/packedlib/_oasis0000644000175000017500000000074011773154621017116 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.3.0/examples/packedlib/test/0000755000175000017500000000000011773154621016674 5ustar gildorgildoroasis-0.3.0/examples/packedlib/test/main.ml0000644000175000017500000000003711773154621020152 0ustar gildorgildorlet () = Packedlib.Foo.dump () oasis-0.3.0/examples/packedlib/LICENSE0000644000175000017500000000312511773154621016723 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.3.0/examples/packedlib/src/0000755000175000017500000000000011773154621016504 5ustar gildorgildoroasis-0.3.0/examples/packedlib/src/bar.ml0000644000175000017500000000325711773154621017611 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 *) (********************************************************************************) type t = string let create s = s let value s = s oasis-0.3.0/examples/packedlib/src/bar.mli0000644000175000017500000000326511773154621017761 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 *) (********************************************************************************) type t val create : string -> t val value : t -> string oasis-0.3.0/examples/packedlib/src/Baz.ml0000644000175000017500000000000011773154621017540 0ustar gildorgildoroasis-0.3.0/examples/packedlib/src/foo.ml0000644000175000017500000000333311773154621017623 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 *) (********************************************************************************) type t = int let create n = n let value n = n let dump () = prerr_endline "In Packedlib.Foo" oasis-0.3.0/examples/packedlib/src/foo.mli0000644000175000017500000000330711773154621017775 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 *) (********************************************************************************) type t val create : int -> t val value : t -> int val dump : unit -> unit oasis-0.3.0/examples/flags/0000755000175000017500000000000011773154621015073 5ustar gildorgildoroasis-0.3.0/examples/flags/_oasis0000644000175000017500000000204711773154621016276 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.3.0/examples/flags/LICENSE0000644000175000017500000000312511773154621016101 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.3.0/examples/flags/src/0000755000175000017500000000000011773154621015662 5ustar gildorgildoroasis-0.3.0/examples/flags/src/simplelib/0000755000175000017500000000000011773154621017642 5ustar gildorgildoroasis-0.3.0/examples/flags/src/simplelib/Conf.ml.ab0000644000175000017500000000316511773154621021447 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 *) (******************************************************************************) let version = "$(pkg_version)" oasis-0.3.0/examples/flags/src/simplelib/META0000644000175000017500000000312511773154621020314 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.3.0/examples/flags/src/simplelib/Bar.ml0000644000175000017500000000312511773154621020701 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.3.0/examples/flags/src/simplelib/Foo.ml0000644000175000017500000000312511773154621020720 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.3.0/examples/flags/src/simplelibext/0000755000175000017500000000000011773154621020363 5ustar gildorgildoroasis-0.3.0/examples/flags/src/simplelibext/META0000644000175000017500000000312511773154621021035 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.3.0/examples/flags/src/simplelibext/BarExt.ml0000644000175000017500000000312511773154621022103 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.3.0/examples/flags/src/simplelibext/FooExt.ml0000644000175000017500000000312511773154621022122 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.3.0/po/0000755000175000017500000000000011773154621012577 5ustar gildorgildoroasis-0.3.0/po/Makefile0000644000175000017500000000701711773154621014244 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 # ################################################################################ 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.3.0/po/LINGUAS0000644000175000017500000000000311773154621013615 0ustar gildorgildorfr oasis-0.3.0/po/fr.po0000644000175000017500000012753711773154621013565 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.3.0/po/POTFILES0000644000175000017500000000422611773154621013753 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.3.0/po/oasis.pot0000644000175000017500000007410011773154621014443 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.3.0/Makefile0000644000175000017500000001143411773154621013624 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 # ################################################################################ CONFIGUREFLAGS += --override ocamlbuildflags -classic-display CONFIGUREFLAGS += $(if $(shell ocamlfind query gettext),--enable-gettext,--disable-gettext) default: test -OCamlDarcsPrecommit export OCAMLRUNPARAM=b TESTFLAGS += -not-long #TESTFLAGS += -verbose #TESTFLAGS += -only-test OASIS:5:TestFull:2:../examples/packedlib:0:standard # OASIS_START # DO NOT EDIT (digest: bc1e05bfc8b39b664f29dae8dbd3ebbb) 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) .PHONY: build doc test all install uninstall reinstall clean distclean configure # OASIS_STOP wc: find src/ -name "*.ml" | xargs wc -l wc-setup: awk -f src/tools/setup-wc.awk setup.ml headache: find ./ -name _darcs -prune -false -o -name _build -prune \ -false -o -name ext -prune -false -o -name bindist -prune \ -false -o -name boot -prune -false \ -o -name '*[^~]' -type f \ | xargs headache -h _header -c _headache.config .PHONY: wc wc-setup headache # Binary distribution BINDIST_DEBUG=false bindist: if ! $(BINDIST_DEBUG); then $(SETUP) -distclean; fi $(SETUP) -configure $(MAKE) bindist-step2 BINDIST_CUSTOM=true -include setup.data BINDISTDIR=$(CURDIR)/bindist BINDIR=$(BINDISTDIR)/bin-$(system)-$(architecture) ifeq ($(os_type),"Win32") tr_path = cygpath -w else tr_path = echo endif BINDISTGZ=$(pkg_name)-$(pkg_version)-bindist.tar.gz bindist-step2: if ! $(BINDIST_DEBUG); then $(SETUP) -distclean; fi if test -d $(BINDISTDIR); then $(RM) -r $(BINDISTDIR); fi if test -e $(BINDISTGZ); then tar xzf $(BINDISTGZ); fi mkdir -p "$(BINDISTDIR)" mkdir -p "$(BINDISTDIR)/share/doc" mkdir -p "$(BINDIR)" $(SETUP) -configure \ --prefix "$$($(tr_path) $(BINDISTDIR))" \ --bindir "$$($(tr_path) $(BINDIR))" \ --docdir "$$($(tr_path) $(BINDISTDIR)/share/doc)" \ --disable-libraries \ --override ocamlbuildflags "-classic-display -tag custom" \ $(CONFIGUREFLAGS) $(SETUP) -build if ! $(BINDIST_DEBUG); then $(SETUP) -test; fi if ! [ "$(os_type)" = "Win32" ]; then $(SETUP) -doc; fi $(SETUP) -install tar czf $(BINDISTGZ) bindist -$(RM) -r $(BINDISTDIR) .PHONY: bindist bindist-step2 # Source distribution dist: # Check consistency of versions OASIS_CMD_VER=$$(oasis version); \ OASIS_DIST_VER=$$(oasis query version); \ OASIS_SETUP_VER=$$($(SETUP) -version); \ if [ "x$$OASIS_CMD_VER" != "x$$OASIS_DIST_VER" ]; then \ echo "Must be running the same version of oasis as the one being built" >&2; \ exit 1; \ fi; \ if [ "x$$OASIS_SETUP_VER" != "x$$OASIS_DIST_VER" ]; then \ echo "Must be running the have used the same version for setup.ml as the one being built" >&2; \ exit 1; \ fi ./src/tools/oasis-dist.ml .PHONY: dist # Fixing permissions fixperms: for i in $$(cat _fixperms); do chmod +x "./$$i"; done .PHONY: fixperms oasis-0.3.0/myocamlbuild.ml0000644000175000017500000006175711773154621015214 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 *) (******************************************************************************) 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: 0407626965c95e1099ce090076142c17) *) module OASISGettext = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISGettext.ml" let ns_ str = str let s_ str = str let f_ (str : ('a, 'b, 'c, 'd) format4) = str let fn_ fmt1 fmt2 n = if n = 1 then fmt1^^"" else fmt2^^"" let init = [] end module OASISExpr = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISExpr.ml" open OASISGettext type test = string type flag = string type t = | EBool of bool | ENot of t | 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 # 117 "myocamlbuild.ml" module BaseEnvLight = struct # 21 "/home/gildor/programmation/oasis/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) type t = string MapString.t let default_filename = Filename.concat (Sys.getcwd ()) "setup.data" let load ?(allow_empty=false) ?(filename=default_filename) () = if Sys.file_exists filename then begin 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 var_get name env = let rec var_expand str = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try var_expand (MapString.find var env) with Not_found -> failwith (Printf.sprintf "No variable %s defined when trying to expand %S." var str)) str; Buffer.contents buff in var_expand (MapString.find name env) let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst end # 215 "myocamlbuild.ml" module MyOCamlbuildFindlib = struct # 21 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml" (** OCamlbuild extension, copied from * http://brion.inria.fr/gallium/index.php/Using_ocamlfind_with_ocamlbuild * by N. Pouillard and others * * 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 split s ch = let x = ref [] in let rec go s = let pos = String.index s ch in x := (String.before s pos)::!x; go (String.after s (pos + 1)) in try go s with Not_found -> !x let split_nl s = split s '\n' let before_space s = try String.before s (String.index s ' ') with Not_found -> s (* this lists all supported packages *) let find_packages () = List.map before_space (split_nl & run_and_read "ocamlfind list") (* this is supposed to list available syntaxes, but I don't know how to do it. *) let find_syntaxes () = ["camlp4o"; "camlp4r"] (* ocamlfind command *) let ocamlfind x = S[A"ocamlfind"; x] let dispatch = function | Before_options -> (* 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" | 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 -> flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg]; end (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"]) | _ -> () end module MyOCamlbuildBase = struct # 21 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" (** Base functions for writing myocamlbuild.ml @author Sylvain Le Gall *) open Ocamlbuild_plugin module OC = Ocamlbuild_pack.Ocaml_compiler type dir = string type file = string type name = string type tag = string # 56 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/MyOCamlbuildBase.ml" type t = { lib_ocaml: (name * dir list) list; 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" 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, [] -> ocaml_lib nm | nm, dir :: tl -> 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) 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 flag tags & spec) t.flags | _ -> () let dispatch_default t = dispatch_combine [ dispatch t; MyOCamlbuildFindlib.dispatch; ] end # 476 "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" ]); ("cli", ["src/cli"]); ("dynrun", ["src/dynrun"]); ("plugin-loader", ["src/ext/plugin-loader/src"]); ("pluginloaderLib", ["src/ext/plugin-loader/test/data/findlib/pluginloaderLib"]); ("plugin1", ["src/ext/plugin-loader/test/data/findlib/plugin1"]); ("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;; # 668 "myocamlbuild.ml" (* OASIS_STOP *) open Ocamlbuild_plugin;; dispatch (MyOCamlbuildBase.dispatch_combine [ dispatch_default; begin function | After_rules -> begin 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.3.0/TODO.txt0000644000175000017500000000110511773154621013464 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 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.3.0/setup.ml0000644000175000017500000061776411773154621013700 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_START *) (* DO NOT EDIT (digest: fade9191a40db1b840f66c5a7cf3ab67) *) (* Regenerated by OASIS v0.3.0 Visit http://oasis.forge.ocamlcore.org for more information and documentation about functions used in this file. *) module OASISGettext = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISGettext.ml" let ns_ str = str let s_ str = str let f_ (str : ('a, 'b, 'c, 'd) format4) = str let fn_ fmt1 fmt2 n = if n = 1 then fmt1^^"" else fmt2^^"" let init = [] end module OASISContext = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISContext.ml" open OASISGettext type level = [ `Debug | `Info | `Warning | `Error] type t = { 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 args () = ["-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")] end module OASISString = struct # 1 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/src/oasis/OASISUtils.ml" open OASISGettext module MapString = Map.Make(String) let map_string_of_assoc assoc = List.fold_left (fun acc (k, v) -> MapString.add k v acc) MapString.empty assoc module SetString = Set.Make(String) let set_string_add_list st lst = List.fold_left (fun acc e -> SetString.add e acc) st lst let set_string_of_list = set_string_add_list SetString.empty 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) 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 # 21 "/home/gildor/programmation/oasis/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 # 71 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 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 version_0_3_or_after t = comparator_apply t (VGreaterEqual (string_of_version "0.3")) end module OASISLicense = struct # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/src/oasis/OASISExpr.ml" open OASISGettext type test = string type flag = string type t = | EBool of bool | ENot of t | 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 OASISTypes = struct # 21 "/home/gildor/programmation/oasis/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 # 102 "/home/gildor/programmation/oasis/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 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 | 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 | `Executable | `Flag | `SrcRepo | `Test | `Doc ] type package = { oasis_version: OASISVersion.t; ocaml_version: OASISVersion.comparator option; findlib_version: OASISVersion.comparator option; 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: string 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; schema_data: PropList.Data.t; plugin_data: plugin_data; } end module OASISUnixPath = struct # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/src/oasis/OASISSection.ml" open OASISTypes let section_kind_common = function | Library (cs, _, _) -> `Library, 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) | 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" | `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 # 21 "/home/gildor/programmation/oasis/src/oasis/OASISBuildSection.ml" end module OASISExecutable = struct # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/src/oasis/OASISLibrary.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 * group_t list) (* Look for a module file, considering capitalization or not. *) let find_module source_file_exists (cs, bs, lib) 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 (cs, bs, lib) 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 (cs, bs, lib) modul with | `Sources (base_fn, _) -> [base_fn] | `No_sources lst -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in library %s") modul cs.cs_name; lst in List.map (fun nm -> List.map (fun base_fn -> base_fn ^"."^ext) (find_module nm)) 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 = (not lib.lib_pack) && (* Do not install .cmx packed submodules *) match bs.bs_compiled_object with | Native -> true | Best -> is_native | Byte -> false in if should_be_built then 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) type data = common_section * build_section * library 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 | 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, lib) 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 # 21 "/home/gildor/programmation/oasis/src/oasis/OASISFlag.ml" end module OASISPackage = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISPackage.ml" end module OASISSourceRepository = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISSourceRepository.ml" end module OASISTest = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISTest.ml" end module OASISDocument = struct # 21 "/home/gildor/programmation/oasis/src/oasis/OASISDocument.ml" end module OASISExec = struct # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 (if case_sensitive then file_exists_case else Sys.file_exists) 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 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 # 2142 "setup.ml" module BaseEnvLight = struct # 21 "/home/gildor/programmation/oasis/src/base/BaseEnvLight.ml" module MapString = Map.Make(String) type t = string MapString.t let default_filename = Filename.concat (Sys.getcwd ()) "setup.data" let load ?(allow_empty=false) ?(filename=default_filename) () = if Sys.file_exists filename then begin 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 var_get name env = let rec var_expand str = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try var_expand (MapString.find var env) with Not_found -> failwith (Printf.sprintf "No variable %s defined when trying to expand %S." var str)) str; Buffer.contents buff in var_expand (MapString.find name env) let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst end # 2240 "setup.ml" module BaseContext = struct # 21 "/home/gildor/programmation/oasis/src/base/BaseContext.ml" open OASISContext let args = args let default = default end module BaseMessage = struct # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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" -> ".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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/src/base/BaseBuilt.ml" open OASISTypes open OASISGettext open BaseStandardVar open BaseMessage type t = | BExec (* Executable *) | BExecLib (* Library coming with executable *) | BLib (* Library *) | BDoc (* Document *) let to_log_event_file t nm = "built_"^ (match t with | BExec -> "exec" | BExecLib -> "exec_lib" | BLib -> "lib" | 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") | 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 end module BaseCustom = struct # 21 "/home/gildor/programmation/oasis/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 # 21 "/home/gildor/programmation/oasis/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 _ | Flag _ | Test _ | SrcRepo _ | Doc _ -> ()) pkg.sections end module BaseTest = struct # 21 "/home/gildor/programmation/oasis/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 OASISVersion.version_0_3_or_after pkg.oasis_version && 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 # 21 "/home/gildor/programmation/oasis/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 OASISVersion.version_0_3_or_after pkg.oasis_version && 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 # 21 "/home/gildor/programmation/oasis/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 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"; ] (failwithf (f_ "Don't know what to do with '%s'")) ""; info "Running configure step"; configure t [||]; 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 _ | 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 update_setup_ml t = let oasis_fn = match t.oasis_fn with | Some fn -> fn | None -> "_oasis" 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 "_oasis" 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 # 4480 "setup.ml" module InternalConfigurePlugin = struct # 21 "/home/gildor/programmation/oasis/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; (* 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 # 21 "/home/gildor/programmation/oasis/src/plugins/internal/InternalInstallPlugin.ml" (** Install using internal scheme @author Sylvain Le Gall *) open BaseEnv open BaseStandardVar open BaseMessage open OASISTypes open OASISLibrary 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 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 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, lib, children) -> files_of_library data_and_files (cs, bs, lib), 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 # 5233 "setup.ml" module OCamlbuildCommon = struct # 21 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/OCamlbuildCommon.ml" (** Functions common to OCamlbuild build and doc plugin *) open OASISGettext open BaseEnv open BaseStandardVar 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 # 21 "/home/gildor/programmation/oasis/src/plugins/ocamlbuild/OCamlbuildPlugin.ml" (** Build using ocamlbuild @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OASISUtils open BaseEnv open OCamlbuildCommon open BaseStandardVar open BaseMessage let cond_targets_hook = ref (fun lst -> lst) let build 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 ends_with nd fn = let nd_len = String.length nd in (String.length fn >= nd_len) && (String.sub fn (String.length fn - nd_len) nd_len) = nd in let tgts = List.flatten (List.filter (fun l -> l <> []) (List.map (List.filter (fun fn -> ends_with ".cma" fn || ends_with ".cmxs" fn || ends_with ".cmxa" fn || ends_with (ext_lib ()) fn || ends_with (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 | 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 _ | 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 (f_ "No one of expected built files %s exists") (String.concat (s_ ", ") (List.map (Printf.sprintf "'%s'") fns))) lst; (BaseBuilt.register bt bnm lst) in let cond_targets = (* Run the hook *) !cond_targets_hook cond_targets in (* Run a list of target... *) run_ocamlbuild (List.flatten (List.map snd cond_targets)) 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 # 21 "/home/gildor/programmation/oasis/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 let doc_build path pkg (cs, doc) argv = let index_html = OASISUnixPath.make [ path; cs.cs_name^".docdir"; "index.html"; ] in let tgt_dir = OASISHostPath.make [ build_dir argv; OASISHostPath.of_unix path; cs.cs_name^".docdir"; ] in run_ocamlbuild [index_html] 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 t pkg (cs, doc) argv = run_clean argv; BaseBuilt.unregister BaseBuilt.BDoc cs.cs_name end # 5558 "setup.ml" module CustomPlugin = struct # 21 "/home/gildor/programmation/oasis/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 # 5694 "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-exec"; "$oasis"; "-has-ocamlopt"; "$is_native" ])) ]; 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"; "manual"; ">"; "doc/MANUAL.mkd" ])); (OASISExpr.ENot (OASISExpr.EFlag "gettext"), ("$oasis", ["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 "src/") ]; install = InternalInstallPlugin.install; uninstall = InternalInstallPlugin.uninstall; clean = [OCamlbuildPlugin.clean]; clean_test = [ ("main", CustomPlugin.Test.clean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test", [ "-oasis-exec"; "$oasis"; "-has-ocamlopt"; "$is_native" ])) ]; 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"; "manual"; ">"; "doc/MANUAL.mkd" ])); (OASISExpr.ENot (OASISExpr.EFlag "gettext"), ("$oasis", ["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 "src/") ]; distclean = []; distclean_test = [ ("main", CustomPlugin.Test.distclean { CustomPlugin.cmd_main = [ (OASISExpr.EBool true, ("$test", [ "-oasis-exec"; "$oasis"; "-has-ocamlopt"; "$is_native" ])) ]; 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"; "manual"; ">"; "doc/MANUAL.mkd" ])); (OASISExpr.ENot (OASISExpr.EFlag "gettext"), ("$oasis", ["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.0"); findlib_version = None; name = "oasis"; version = "0.3.0"; 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 = []; authors = ["Sylvain Le Gall"]; homepage = Some "http://oasis.forge.ocamlcore.org/"; synopsis = "Architecture for building OCaml libraries and applications"; description = Some "OASIS generates a full configure, build and install system for your\napplication. It starts with a simple `_oasis` file at the toplevel of your\nproject and creates everything required.\n\nIt uses external tools like OCamlbuild and it can be considered as the glue\nbetween various subsystems that do the job. It should support the following\ntools:\n\n- OCamlbuild\n- OMake (todo)\n- OCamlMakefile (todo),\n- ocaml-autoconf (todo)\n\nIt also features a do-it-yourself command line invocation and an internal\nconfigure/install scheme. Libraries are managed through findlib. It has been\ntested on GNU Linux and Windows.\n\nIt also allows to have standard entry points and description. It helps to\nintegrates your libraries and software with third parties tools like GODI."; categories = []; conf_type = (`Configure, "internal", Some "0.3"); 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.3"); 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.3")) ]; 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"; "FormatMarkdown"; "ODNFunc"; "PropList"; "OASISUtils"; "OASISUnixPath"; "OASISContext"; "OASISGettext"; "OASISMessage"; "OASISTypes"; "OASISParse"; "OASISValues"; "OASISExpr"; "OASISVersion"; "OASISLicense"; "OASISFileTemplate"; "OASISBuildSection"; "OASISDocument"; "OASISExecutable"; "OASISFlag"; "OASISLibrary"; "OASISPackage"; "OASISSourceRepository"; "OASISTest"; "OASISPlugin"; "OASISSchema"; "OASISSection"; "OASISData"; "OASISString"; "OASISExec"; "OASISFileUtil"; "OASISHostPath"; "OASISGraph" ]; 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"; "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"]; 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 = "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"]; 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 = ["SubCommand"; "ArgExt"; "Pager"]; lib_pack = false; lib_internal_modules = ["CLIData"]; 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 = "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 "1.1.0")); FindlibPackage ("findlib", None); FindlibPackage ("fileutils", Some (OASISVersion.VGreaterEqual "0.4.2")); FindlibPackage ("expect.pcre", Some (OASISVersion.VGreaterEqual "0.0.2")); InternalLibrary "oasis"; 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, [])]; }, {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 = Darcs; src_repo_location = "http://darcs.ocamlcore.org/repos/oasis"; src_repo_browser = Some "http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=oasis;a=summary"; 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 = []; }); 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"; 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 = "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-exec"; "$oasis"; "-has-ocamlopt"; "$is_native" ])) ]; 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" ]; }); 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") ]; schema_data = PropList.Data.create (); plugin_data = []; }; oasis_fn = Some "_oasis"; oasis_version = "0.3.0"; oasis_digest = Some "\130z\189\141{\014\215\002]%\216\154$\154\247,"; oasis_exec = None; oasis_setup_args = []; setup_update = false; };; let setup () = BaseSetup.setup setup_t;; # 6907 "setup.ml" (* OASIS_STOP *) #use "deps.ml";; let () = setup ();; oasis-0.3.0/_fixperms0000644000175000017500000000037111773154621014101 0ustar gildorgildorconfigure src/tools/oasis-dist.ml src/tools/oasis src/tools/oasis-i18n src/tools/oasis-announce.ml examples/custom/myconfigure test/data/bug982/test-setup-data.sh test/data/bug823/postconf.sh test/data/bug823/preconf.sh test/data/bug938/postconf.sh oasis-0.3.0/configure0000755000175000017500000000055411773154621014074 0ustar gildorgildor#!/bin/sh # OASIS_START # DO NOT EDIT (digest: 425187ed8bfdbdd207fd76392dd243a7) 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.3.0/tarballs/0000755000175000017500000000000011773154621013765 5ustar gildorgildoroasis-0.3.0/test/0000755000175000017500000000000011773154622013141 5ustar gildorgildoroasis-0.3.0/test/test.ml0000644000175000017500000001154311773154622014456 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 *) (******************************************************************************) (** Run tests for OASIS @author Sylvain Le Gall *) open OUnit;; open TestCommon;; module SetString = Set.Make(String) let _ = let () = OASISBuiltinPlugins.init () in let () = if Sys.os_type <> "Win32" then begin (* Check permission before anything else. This is a little bit * outside the scope of testing, but will make tests fail. We * also check for completeness of _fixperms files, which should * help OASIS devel to fix it early. *) let topdir = Filename.parent_dir_name in let exec_set = let rst = ref SetString.empty in let chn = open_in (Filename.concat topdir "_fixperms") in let () = try while true do rst := SetString.add (Filename.concat topdir (input_line chn)) !rst done; with End_of_file -> () in close_in chn; !rst in let fn_build = FilePath.concat topdir "_build" in let fn_build' = FilePath.concat topdir "build" in let (found_missing, unfound) = (* Check files that need to be executable *) FileUtil.find (FileUtil.And (FileUtil.Custom (fun fn -> not (FilePath.is_subdir fn fn_build) && not (FilePath.is_subdir fn fn_build')), FileUtil.And (FileUtil.Is_exec, FileUtil.And (FileUtil.Is_file, FileUtil.Not FileUtil.Is_link)))) topdir (fun (found_missing, unfound) fn -> if SetString.mem fn unfound then begin (found_missing, SetString.remove fn unfound) end else begin Printf.eprintf "E: File '%S' is executable but not in _fixperms\n%!" fn; (true, unfound) end) (false, exec_set) in if unfound <> SetString.empty then begin SetString.iter (fun fn -> if FileUtil.test FileUtil.Exists fn then Printf.eprintf "E: File '%S' should be executable, run 'make fixperms'\n%!" fn else Printf.eprintf "E: File '%S' in _fixperms but doesn't exist, remove it\n%!" fn) unfound; failwith "Fix your permissions" end else if found_missing then failwith "Fix your permissions" end in run_test_tt_main ~arg_specs:test_args ~set_verbose ("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; ]) ;; oasis-0.3.0/test/TestLog.ml0000644000175000017500000000550211773154621015055 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 *) (******************************************************************************) (** BaseLog tests @author Sylvain Le Gall *) open OUnit open TestCommon open BaseLog let tests = let test_of_vector (nm, f) = nm >:: bracket ignore f (fun () -> FileUtil.rm [BaseLog.default_filename]) 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.3.0/test/TestDevFiles.ml0000644000175000017500000000533511773154621016041 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 *) (******************************************************************************) (** Test the devfiles plugin @author Sylvain Le Gall *) open TestCommon open OUnit (* TODO: move this to OUnit *) let bracket_tmpdir f = bracket (fun () -> let dn = Filename.temp_file "oasis-db-" ".dir" in FileUtil.rm [dn]; FileUtil.mkdir dn; dn) f (fun dn -> FileUtil.rm ~recurse:true [dn]) let tests = "DevFiles" >:: (bracket_tmpdir (fun dn -> bracket (fun () -> let pwd = FileUtil.pwd () in Sys.chdir dn; pwd) (fun _ -> FileUtil.cp [in_data "test-devfiles1.oasis"] "_oasis"; assert_command (oasis ()) (!oasis_args @ ["setup"]); if Sys.os_type <> "Win32" then assert_command "./configure" ["--prefix=/usr"; "--mandir=/usr/share/man"; "--infodir=/usr/share/info"; "--datadir=/usr/share"; "--sysconfdir=/etc"; "--localstatedir=/var/lib"];) (fun pwd -> Sys.chdir pwd) ())) oasis-0.3.0/test/TestBasic.ml0000644000175000017500000000565711773154621015370 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 *) (******************************************************************************) open OUnit;; open TestCommon;; let tests = "Basic" >::: [ "Help1" >:: (fun () -> assert_oasis_cli ["--help"]); "Help2" >:: (fun () -> assert_oasis_cli ["help"]); "Env dump/load" >:: (fun () -> BaseEnv.unload (); BaseEnv.load ~filename:(in_data "dir.data") (); (* Reset lazy values ? *) assert_equal ~printer:(fun s -> s) "toto" (BaseStandardVar.bindir ())); "OCaml dev version" >:: (fun () -> PropList.Schema.set BaseEnv.schema BaseEnv.env ~context:BaseEnv.OCommandLine "ocamlc_config_map" (Marshal.to_string (MapString.add "version" "3.13.0+dev2 (2010-10-22)" MapString.empty) []); assert_equal ~printer:(fun s -> s) "3.13.0" (BaseStandardVar.ocaml_version ())); "Compileable BaseSysBundle.ml" >:: TestDevFiles.bracket_tmpdir (fun dn -> 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 "ocamlc" ["-o"; (Filename.concat dn "bundle"); (Filename.concat dn "bundle.ml")]) ] ;; oasis-0.3.0/test/TestQuickstart.ml0000644000175000017500000003525711773154621016500 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 *) (******************************************************************************) (** Test quickstart subcommand @author Sylvain Le Gall *) open TestCommon open Expect open ExpectPcre open OUnit open OASISTypes let () = METAPlugin.init () module MapString = Map.Make(String) let tests = let assert_exit_code_equal exp rel = assert_equal ~msg:"exit code" ~printer:(function | Unix.WEXITED i | Unix.WSIGNALED i | Unix.WSTOPPED i -> string_of_int i) exp rel in let with_quickstart_spawn args f exp_exit_code = let args = ["quickstart"; "-machine"] @ args in let args = if not !dbug then "-quiet" :: args else "-debug" :: args in let args = !oasis_args @ args in let () = if !dbug then Printf.eprintf "Quickstart command line: %s\n%!" (String.concat " " (oasis () :: args)) in let _, exit_code = try with_spawn ~verbose:!dbug ~timeout:(Some 0.1) (oasis ()) (Array.of_list args) (fun t () -> f t) () with e -> Printexc.print_backtrace stderr; raise e in assert_exit_code_equal exp_exit_code exit_code in let run_quickstart args qa = with_quickstart_spawn 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 >:: bracket (fun () -> let pwd = FileUtil.pwd () in let tmp = temp_dir () in Sys.chdir tmp; pwd, tmp) (fun _ -> run_quickstart args qa; if !dbug then begin let chn = open_in "_oasis" in let () = try while true do prerr_endline (input_line chn) done with End_of_file -> () in close_in chn end; assert_oasis_cli ["check"]; begin try assert_oasis_cli ["setup"]; with e -> failwith "'oasis setup' failed but 'oasis check' succeed" end; let pkg = OASISParse.from_file ~ctxt:!oasis_ctxt "_oasis" in post pkg) (fun (pwd, tmp) -> Sys.chdir pwd; FileUtil.rm ~recurse:true [tmp]) 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", ""; ], (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"; ], (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 () -> with_quickstart_spawn [] (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)) (if Sys.os_type = "Win32" then (Unix.WEXITED 2) else (Unix.WSIGNALED ~-8))); ] oasis-0.3.0/test/TestFull.ml0000644000175000017500000013771711773154621015254 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 *) (******************************************************************************) (** Run full OASIS use cases @author Sylvain Le Gall *) open FileUtil;; open OUnit;; open TestCommon;; type filename = FilePath.filename;; let exec fn = if Sys.os_type = "Win32" then fn^".exe" else fn let compare_filename = 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 module SetFileDigest = Set.Make (struct type t = filename * Digest.t let compare (f1,d1) (f2, d2) = match compare_filename f1 f2 with | 0 -> String.compare d1 d2 | n -> n end) ;; module SetFile = Set.Make (struct type t = filename let compare = compare_filename end) ;; type location_t = { build_dir: filename; ocaml_lib_dir: filename; bin_dir: filename; lib_dir: filename; data_dir: filename; doc_dir: filename; html_dir: filename; } ;; let assert_equal_ext ?cmp ?printer ?diff ?msg exp real = try assert_equal ?cmp ?printer ?msg exp real with (Failure txt) as e -> (match diff with | Some f -> failwith (txt ^ "\ndiff: " ^(f exp real)) | None -> raise e) ;; module OUnitSet (S:Set.S) = struct let assert_equal ?msg ?printer exp real = match printer with | Some printer -> assert_equal_ext ?msg ~cmp:S.equal ~printer:(fun st -> String.concat ", " (List.rev_map printer (S.elements st))) ~diff:(fun exp real -> let added = S.diff real exp in let removed = S.diff exp real in String.concat ", " (List.rev_append (List.rev_map (fun e -> "+"^(printer e)) (S.elements added)) (List.rev_map (fun e -> "-"^(printer e)) (S.elements removed)))) exp real | None -> assert_equal ?msg exp real end ;; module OUnitSetFileDigest = OUnitSet(SetFileDigest);; module OUnitSetFile = OUnitSet(SetFile);; let tests = (* Create a temporary dir *) let temp_dir pref suff = let res = Filename.temp_file pref suff in rm [res]; mkdir res; res in let set_file_of_file_digest st = SetFileDigest.fold (fun (fn, _) st -> SetFile.add fn st) st SetFile.empty in let setup_ml = "setup.ml" in (* Assert with setup.ml *) let assert_run_setup ?exit_code ?extra_env args = (* Speed up for testing, compile setup.ml *) let can_compile = let chn = open_in 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 setup_base = Filename.chop_extension setup_ml in let setup_digest = setup_base ^ ".digest" in let setup_exe = Filename.concat Filename.current_dir_name (exec setup_base) in if can_compile then begin let self_digest = let chn = open_in setup_ml in let digest = Digest.channel chn (in_channel_length chn) in close_in chn; digest in let pre_digest = try let chn = open_in setup_digest in let digest = try Digest.input chn with _ -> Digest.string "" in close_in chn; digest with _ -> Digest.string "" in let clean ?(all=false) () = List.iter (fun fn -> try Sys.remove fn with _ -> ()) ( (if all then [setup_exe; setup_digest] else []) @ [setup_base ^ ".cmi"; setup_base ^ ".cmo"] ) in if not (Sys.file_exists setup_exe) || self_digest <> pre_digest then begin match Sys.command ("ocamlfind ocamlc -o "^(exec "setup")^" setup.ml") with | 0 -> (* Compilation succeed, update the digest *) let chn = open_out setup_digest in Digest.output chn self_digest; close_out chn; clean () | _ -> prerr_endline "E: Compilation of setup.ml doesn't succeed."; clean ~all:true () end end; if Sys.file_exists setup_exe then assert_command ?exit_code ?extra_env setup_exe ("-info" :: "-debug" :: args) else assert_command ?exit_code ?extra_env "ocaml" (setup_ml :: "-info" :: "-debug" :: args) in (* Files always generated *) let oasis_std_files = [ setup_ml; ] in (* Files generated when ocamlbuild buildsys is used *) let oasis_ocamlbuild_files = [ "myocamlbuild.ml"; "_tags"; ] in (* Set all files location into build_dir + lib_dir *) let in_library files loc acc = List.fold_left (fun acc fn -> (FilePath.concat loc.lib_dir fn) :: acc) acc files in (* Set all files location into build_dir + ocaml_lib_dir + library *) let in_ocaml_library lib files loc acc = List.fold_left (fun acc fn -> (FilePath.make_filename [loc.ocaml_lib_dir; lib; fn]) :: acc) acc files in (* Set all files location into html_dir + library *) let in_html lib files loc acc = List.fold_left (fun acc fn -> (FilePath.make_filename [loc.html_dir; lib; fn]) :: acc) acc files in let api_ref_html lib moduls = in_html lib (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"]) moduls))) in let add_path nm dir = nm, try FilePath.string_of_path ((FilePath.path_of_string (Sys.getenv nm)) @ [dir]) with Not_found -> dir in (* Set all files location into buid_dir + data *) let in_data_dir files loc acc = List.fold_left (fun acc fn -> (FilePath.concat loc.data_dir fn) :: acc) acc files in (* Set all file location into bin_dir *) let in_bin files loc acc = List.fold_left (fun acc fn -> (FilePath.concat loc.bin_dir fn) :: acc) acc files in (* Run target conditionally *) let conditional cond f loc acc = if cond then f loc acc else acc in (* Try to run an installed executable *) let try_installed_exec ?exit_code cmd args loc = (* Libraries located inside the test * directory *) let local_lib_paths = find Is_dir loc.lib_dir (fun acc fn -> fn :: acc) (find Is_dir loc.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_env = if Sys.os_type = "Win32" then begin (loc.bin_dir :: (local_lib_paths @ env_paths)), [] end else begin let paths = loc.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 test () = let real_cmd = try which ~path:paths cmd with Not_found -> assert_failure (Printf.sprintf "Command '%s' cannot be found in %s" cmd (String.concat ";" paths)) in assert_command ?exit_code ~extra_env:((add_path "OCAMLPATH" loc.ocaml_lib_dir) :: (List.map (fun (v, lst) -> v, FilePath.string_of_path lst) (("PATH", paths) :: extra_env))) real_cmd args in fun acc -> test :: acc in let try_installed_library pkg modules loc acc = let test () = (* Create a file that contains every modules *) let srcdir = let res = FilePath.concat loc.build_dir ("src-"^pkg) in mkdir res; res in try let pkg_as_module = OASISString.replace_chars (function | '-' -> '_' | c -> c) pkg in let fn = FilePath.concat srcdir ("test_"^pkg_as_module^".ml") in let extra_env = [add_path "OCAMLPATH" loc.ocaml_lib_dir] in let assert_compile cmd args = assert_command ~extra_env "ocamlfind" (cmd :: "-package" :: pkg :: args ) 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 (* Library + bytecode compilation *) assert_compile "ocamlc" ["-a"; "-o"; FilePath.replace_extension fn "cma"; fn]; (* Program + bytecode compilation *) assert_compile "ocamlc" ["-o"; FilePath.replace_extension fn "byte"; fn]; if !has_ocamlopt then begin (* Library + native compilation *) assert_compile "ocamlopt" ["-a"; "-o"; FilePath.replace_extension fn "cmxa"; fn]; (* Program + native compilation *) assert_compile "ocamlopt" ["-o"; FilePath.replace_extension fn "native"; fn]; end; rm ~recurse:true [srcdir]; with e -> ( rm ~recurse:true [srcdir]; raise e ) in test :: acc in (* List all files in directory *) let all_files dir = find Is_file dir (fun st fn -> SetFile.add fn st) SetFile.empty in (* List all files in current working dir *) let all_files_cwd () = all_files (pwd ()) in (* Create a set of file/digest of the current directory *) let all_file_digests () = SetFile.fold (fun fn st -> SetFileDigest.add (fn, Digest.file fn) st) (all_files_cwd ()) SetFileDigest.empty in (* Print a short version of the filename *) let fn_printer ?(root = pwd ()) fn = Printf.sprintf "'%s'" (FilePath.make_relative root fn) in let mkloc build_dir = (* 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 { 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"]; } in let long_test () = skip_if (not !long) "Long test" in let filter_platform lst = let check_suff fn suff = Filename.check_suffix fn ("."^suff) in List.fold_left (fun acc fn -> if (check_suff fn "cmx" || check_suff fn "cmxa") then if !has_ocamlopt then fn :: acc else acc else if check_suff fn "cmxs" then if !has_native_dynlink then fn :: acc else acc else if check_suff fn "a" then let fn = if Sys.os_type = "Win32" then (Filename.chop_extension fn) ^ ".lib" else fn in if OASISString.starts_with (Filename.basename fn) "lib" then (* stubs library *) fn :: acc else if !has_ocamlopt then (* library matching the .cmxa *) fn :: acc else acc else if check_suff fn "so" then let fn = if Sys.os_type = "Win32" then (Filename.chop_extension fn) ^ ".dll" else fn in fn :: acc else fn :: acc) [] lst in let bracket_setup ?(dev=false) ?(dynamic=false) (srcdir, vars) f = bracket (fun () -> let (skip_cond, oasis_extra_files, _, post_install_runs) = vars () in let cur_dir = pwd () in (* Create build dir *) let build_dir = temp_dir "oasis-" ".dir" in let () = (* Change to srcdir directory *) Sys.chdir srcdir in (* Make a backup of already existing OASIS files *) let bak_lst = List.fold_left (fun acc fn -> if Sys.file_exists fn then begin let bak_fn = Filename.temp_file "oasis-" ".bak" in FileUtil.cp [fn] bak_fn; (fn, bak_fn) :: acc end else begin acc end) [] oasis_extra_files in let pristine = (* Memorize file listing/digest of the current srcdir *) all_file_digests () in cur_dir, (mkloc build_dir), pristine, bak_lst) (fun (cur_dir, loc, pristine, bak_lst) -> let (skip_cond, oasis_extra_files, _, post_install_runs) = vars () in let () = skip_cond () in let expected_post_oasis_files = List.fold_left (fun st e -> SetFile.add e st) (set_file_of_file_digest pristine) (List.rev_map (FilePath.make_absolute (pwd ())) (List.rev_append oasis_std_files oasis_extra_files)) in (* Create build system using OASIS *) let () = assert_oasis_cli ("setup" :: (if dev then ["-real-oasis"; "-setup-update"; if dynamic then "dynamic" else "weak"] else [])); if Sys.file_exists "_tags" && !dbug then begin let chn = open_in "_tags" in print_endline "file _tags"; try while true do print_endline (input_line chn) done with End_of_file -> close_in chn end; (* Fix #require in dynamic *) if dynamic then begin let chn = open_in "setup.ml" in let lst = ref [] in let mkload lst = let cma = Filename.concat cur_dir (FilePath.make_filename (".." :: "_build" :: "src" :: lst)) in Printf.sprintf "#load %S;;\n#directory %S;;" cma (Filename.dirname cma) in let () = try while true do let line = input_line chn in if OASISString.starts_with ~what:"#require \"oasis.dynrun\";;" line then begin lst := List.rev_append ("#require \"unix\";;" :: "#require \"odn\";;" :: (List.map mkload [["oasis"; "oasis.cma"]; ["base"; "base.cma"]; ["builtin-plugins.cma"]; ["dynrun"; "dynrun.cma"]])) !lst end else lst := line :: !lst done with End_of_file -> close_in chn in let chn = open_out "setup.ml" in let () = if !dbug then print_endline "file setup.ml:"; List.iter (fun line -> if !dbug then print_endline line; output_string chn (line^"\n")) (List.rev !lst); close_out chn in () end; (* Check generated files *) OUnitSetFile.assert_equal ~msg:"Generated files" ~printer:fn_printer expected_post_oasis_files (all_files_cwd ()) in (* If a _tags file exists, try to test its content. *) let () = if Sys.file_exists "_tags" then let chn = open_in "_tags" in let lineno = ref 0 in try while true do let line = input_line chn in let () = incr lineno 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 let fn_ml = FilePath.replace_extension fn "ml" in if not (Sys.file_exists fn_ml) then assert_failure (Printf.sprintf "source file '%s' doesn't exist" fn_ml) end else if not (Sys.file_exists fn) then assert_failure (Printf.sprintf "file '%s' doesn't exist in _tags file line %d (%S)" fn !lineno line) with Not_found -> (* TODO: handle ocamlbuild wildcard *) () done with End_of_file -> close_in chn in (* Run the main function *) f (cur_dir, loc, pristine, expected_post_oasis_files); (* Clean test environment -- the standard way *) rm oasis_std_files; rm oasis_extra_files; (* Restore backup file *) List.iter (fun (fn, bak_fn) -> FileUtil.cp [bak_fn] fn; FileUtil.rm [bak_fn]) bak_lst; (* Check that we are back to pristine ls *) OUnitSetFileDigest.assert_equal ~msg:"Source directory back to pristine" ~printer:(fun (fn, dgst) -> Printf.sprintf "'%s(%s)'" (FilePath.make_relative (pwd ()) fn) (Digest.to_hex dgst)) pristine (all_file_digests ()) ) (* Clean test environment -- the backup way *) (fun (cur_dir, loc, pristine, bak_lst) -> (* Restore backup file *) let () = List.iter (fun (fn, bak_fn) -> if Sys.file_exists bak_fn then begin FileUtil.cp [bak_fn] fn; FileUtil.rm [bak_fn] end) bak_lst in let st_pristine = set_file_of_file_digest pristine in (* Remove what was not here *) find Is_file (pwd ()) (fun () fn -> if not (SetFile.mem fn st_pristine) then rm [fn]) (); rm ~recurse:true ["_build"]; rm ["setup.data"; "setup.log"]; (* Back into current dir *) Sys.chdir cur_dir; (* Destroy build directory *) rm ~recurse:true [loc.build_dir] ) in (* Run short test *) let test_of_vector_short ?extra_env e = "ocaml setup.ml -all" >:: bracket_setup e (fun _ -> assert_run_setup ?extra_env ["-all"]; assert_run_setup ?extra_env ["-distclean"]; rm ~force:Force [exec "setup"; "setup.digest"]) in (* Run standard test *) let test_of_vector_std ((_, f) as e) = "standard" >:: bracket_setup e (* Run test *) (fun (cur_dir, loc, pristine, expected_post_oasis_files) -> let (_, _, installed_files, post_install_runs) = f () in let expected_installed_files loc = (* Gather all file into a set *) List.fold_left (fun st e -> SetFile.add e st) SetFile.empty (* Compute all file that should have been installed *) (filter_platform (List.fold_left (fun acc f -> f loc acc) [] installed_files)) in (* Run configure target *) let () = assert_run_setup ["-configure"; "--prefix"; loc.build_dir; "--docdir"; loc.doc_dir; "--htmldir"; loc.html_dir; ]; assert_bool "File 'setup.data' has been created" (Sys.file_exists "setup.data") in (* Extract ocamlbuild flags and check that they are correct. *) let () = if Sys.file_exists "myocamlbuild.ml" then let documentation_output = let buf = Buffer.create 16000 in OUnit.assert_command ~foutput:(Stream.iter (Buffer.add_char buf)) "ocamlbuild" ["-documentation"]; Buffer.contents buf in let lst = OASISUtils.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 in (* Run build target *) let () = assert_run_setup ["-build"] in (* Run test target *) let () = assert_run_setup ["-test"] in (* Run documentation target *) let () = assert_run_setup ["-doc"] in (* Generic function to run install/test/uninstall *) let install_test_uninstall ?(extra_env=[]) id loc test = let extra_env = ("OCAMLFIND_DESTDIR", loc.ocaml_lib_dir) :: ("OCAMLFIND_LDCONF", "ignore") :: extra_env in (* Install *) assert_run_setup ~extra_env ["-install"]; (* Check that we have installed everything as expected *) OUnitSetFile.assert_equal ~msg:(Printf.sprintf "Installed files (%s)" id) ~printer:(fn_printer ~root:loc.build_dir) (expected_installed_files loc) (all_files loc.build_dir); (* Test that installed files are working *) test (); (* Uninstall *) assert_run_setup ~extra_env ["-uninstall"]; (* Check that no more files present in build_dir *) OUnitSetFile.assert_equal ~msg:(Printf.sprintf "Build directory is empty after uninstall (%s)" id) ~printer:(fn_printer ~root:loc.build_dir) SetFile.empty (all_files loc.build_dir) in (* Run install/uninstall target *) let () = install_test_uninstall "1st time" loc (fun () -> (* Test that installed files are working *) List.iter (fun f -> f ()) (List.fold_left (fun acc f -> f loc acc) [] post_install_runs)) in (* Run install/uninstall target 2nd time *) let () = install_test_uninstall "2nd time" loc (fun () -> (* Test that installed files are working *) List.iter (fun f -> f ()) (List.fold_left (fun acc f -> f loc acc) [] post_install_runs)) in (* Run install/uninstall target with destdir *) let () = (* 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 *) if Sys.os_type <> "Win32" then begin let destdir = loc.build_dir in let loc = mkloc (Filename.concat destdir (FilePath.make_relative (if Sys.os_type = "Win32" then begin if String.length loc.build_dir >= 2 then String.sub loc.build_dir 0 2 else failwith (Printf.sprintf "Cannot extract drive letter of filename '%s'" loc.build_dir) end else "/") loc.build_dir)) in install_test_uninstall ~extra_env:["destdir", destdir] "with destdir" loc ignore end in (* Run clean target *) assert_run_setup ["-clean"]; assert_run_setup ["-distclean"]; rm ~force:Force [exec "setup"; "setup.digest"]; (* Check that only OASIS generated files remain *) OUnitSetFile.assert_equal ~msg:"Remaining files after distclean" ~printer:fn_printer expected_post_oasis_files (all_files_cwd ()) ) in let test_of_vector ((srcdir, _) as e) = srcdir >::: [ test_of_vector_std e; test_of_vector_short e; ] in "TestFull" >::: (List.map test_of_vector [ (* Use flags *) "../examples/flags", (fun () -> ignore, oasis_ocamlbuild_files @ [ "src/simplelib/simplelib.mllib"; "src/simplelib/simplelib.odocl"; "src/simplelibext/simplelibext.mllib"; "src/simplelibext/simplelibext.odocl"; ], [ in_ocaml_library "simplelib" ["simplelib.cma"; "Foo.cmi"; "Foo.ml"; "Bar.cmi"; "Bar.ml"; "META"; "simplelib.cmxa"; "simplelib.cmxs"; "Foo.cmx"; "Bar.cmx"; "simplelib.a"]; in_ocaml_library "simplelibext" ["simplelibext.cma"; "FooExt.cmi"; "FooExt.ml"; "BarExt.cmi"; "BarExt.ml"; "META"; "simplelibext.cmxa"; "simplelibext.cmxs"; "FooExt.cmx"; "BarExt.cmx"; "simplelibext.a"]; api_ref_html "simplelib" ["Foo"; "Bar"]; api_ref_html "simplelibext" ["FooExt"; "BarExt"]; ], [ ]); (* Complete library *) "../examples/simplelib", (fun () -> long_test, oasis_ocamlbuild_files @ [ "src/simplelib.mllib"; "src/simplelib.odocl"; ], [ in_ocaml_library "simplelib" ["simplelib.cma"; "foo.cmi"; "foo.mli"; "bar.cmi"; "bar.mli"; "META"; "simplelib.cmxa"; "simplelib.cmxs"; "foo.cmx"; "bar.cmx"; "simplelib.a"]; api_ref_html "simplelib" ["Bar"; "Foo"]; ], []); (* Packed library *) "../examples/packedlib", (fun () -> long_test, oasis_ocamlbuild_files @ [ "src/packedlib.mlpack"; "src/META" ], [ in_ocaml_library "packedlib" ["packedlib.cma"; "packedlib.cmi"; "foo.mli"; "bar.mli"; "Baz.ml"; "META"; "packedlib.cmxa"; "packedlib.cmxs"; "packedlib.a"]; ], [ try_installed_library "packedlib" ["Packedlib.Foo"] ]); (* Complete library with findlib package to check *) "../examples/findlib", (fun () -> long_test, oasis_ocamlbuild_files, [], []); (* Complete library with custom build system *) "../examples/custom", (fun () -> long_test, [], [ in_ocaml_library "simplelib" ["simplelib.cma"; "foo.cmi"; "foo.mli"; "bar.cmi"; "bar.mli"; "META"]; ], []); (* Library/executable using C files *) "../examples/with-c", (fun () -> long_test, [ "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.odocl"; ] @ oasis_ocamlbuild_files, [ in_bin [exec "test-with-c"; exec "test-with-c-custom"]; conditional !has_ocamlopt (in_bin [exec "test-with-c-native"]); in_library ["with-c/dlltest-with-c_stubs.so"]; in_ocaml_library "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"]; api_ref_html "with-c" ["A"]; in_html "with-c" ["code_VALA.ident.html"]; ], (if !has_ocamlopt then (fun lst -> (try_installed_exec "test-with-c-native" []) :: lst) else (fun lst -> lst)) [ try_installed_exec "test-with-c-custom" []; try_installed_exec "test-with-c" []; try_installed_library "with-c" ["A"]; ]); (* Library/executable using data files *) "../examples/with-data", (fun () -> long_test, [ "src/META"; "src/test.mllib"; "src/test.odocl"; ] @ oasis_ocamlbuild_files, [ in_bin [exec "test"]; in_ocaml_library "test" [ "test.ml"; "test.cmi"; "META"; "test.cma"; ]; in_data_dir ["with-data/test.txt"; "doc/html/test.html"; "with-data-0.1/test.txt"]; api_ref_html "test" ["Test"]; ], [ try_installed_library "test" ["Test"]; ]); (* Test executable *) "../examples/with-test", (fun () -> long_test, oasis_ocamlbuild_files, [], []); (* Use sub-packages *) "../examples/with-subpackage", (fun () -> long_test, [ "src/META"; "src/test.mllib"; "src/test.odocl"; "src/syntax/pa_test.mllib"; ] @ oasis_ocamlbuild_files, [ in_ocaml_library "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"]; api_ref_html "test" ["A"; "B"]; ], [ try_installed_library "test" ["A"; "B"]; ]); (* Interdependencies *) "../examples/interdepend-libraries", (fun () -> long_test, [ "src/interdepend.odocl"; "src/liba/liba.mllib"; "src/libb/libb.mllib"; "src/libc/libc.mllib"; "src/libd/libd.mllib"; "src/libe/libe.mllib"; ] @ oasis_ocamlbuild_files, [], []); (* Build order *) "../examples/order-matter", (fun () -> long_test, [ "src/order-matter.odocl"; "src/foo/foo.mllib"; "src/bar/bar.mllib"; "src/baz/baz.mllib"; ] @ oasis_ocamlbuild_files, [], []); (* Single level package *) "data/1level", (fun () -> long_test, [ "META"; "with-a.mllib"; "with-a.odocl"; ] @ oasis_ocamlbuild_files, [ in_ocaml_library "with-a" ["META"; "A.ml"; "A.cmi"; "with-a.cma"; "A.cmx"; "with-a.cmxa"; "with-a.cmxs"; "with-a.a"]; in_bin [exec "test-with-a"]; api_ref_html "with-a" ["A"]; ], [ try_installed_library "with-a" ["A"]; try_installed_exec "test-with-a" []; ]); (* Try custom document build *) "data/customdoc", (fun () -> long_test, ["META"; "with-a.mllib"] @ oasis_ocamlbuild_files, [ in_ocaml_library "with-a" ["META"; "A.ml"; "A.cmi"; "with-a.cma"]; ], []); (* Use cclib option *) "data/with-cclib", (fun () -> (fun () -> long_test (); skip_if (not (Sys.file_exists "/usr/include/stringprep.h")) "Cannot find 'stringprep.h'"), ["src/META"; "Makefile"; "configure"; "src/libtest_oasis_c_dependency_stubs.clib"; "src/test_oasis_c_dependency.mllib"] @ oasis_ocamlbuild_files, [], []); (* With a documentation that is not built *) "data/no-install-doc", (fun () -> long_test, [] @ oasis_ocamlbuild_files, [], []); (* Need to create a a parent directory *) "data/create-parent-dir", (fun () -> long_test, [] @ oasis_ocamlbuild_files, [in_data_dir ["toto/toto/toto.txt"]], []); "data/bug588", (fun () -> (fun () -> long_test (); 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"), ["libtest.mllib"; "libtest.odocl"] @ (List.filter (( <> ) "_tags") oasis_ocamlbuild_files), [], []); "data/bug619", (fun () -> long_test, oasis_ocamlbuild_files, [], []); "data/bug571", (fun () -> long_test, oasis_ocamlbuild_files, [], []); "data/flag-ccopt", (fun () -> long_test, "cryptokit.mllib" :: oasis_ocamlbuild_files, [], []); "data/bug738", (fun () -> long_test, "src/test.mllib" :: "src/META" :: oasis_ocamlbuild_files, [in_ocaml_library "test" ["META"; "foo.cmi"; "test.cma"]], []); "data/bug982", (fun () -> (fun () -> long_test (); skip_if (Sys.os_type = "Win32") "UNIX only test"), oasis_ocamlbuild_files, [], []); "data/bug823", (fun () -> (fun () -> long_test (); skip_if (Sys.os_type = "Win32") "UNIX test"), oasis_ocamlbuild_files, [], []); "data/bugClib", (fun () -> long_test, "META" :: "mylib.mlpack" :: "libmylib_stubs.clib" :: oasis_ocamlbuild_files, [in_ocaml_library "mylib" ["META"; "dllmylib_stubs.so"; "foo.ml"; "mylib.cma"; "mylib.cmi"; "mylib.cmxa"; "mylib.cmxs"; "mylib.a"; "libmylib_stubs.a"]], [ try_installed_library "mylib" ["Mylib.Foo"; "Mylib.Bar"] ]); "data/bug791", (fun () -> long_test, "src/testA.mllib" :: oasis_ocamlbuild_files, [], []); ] ) @ ["data/bug938">:: bracket_setup ("data/bug938", fun () -> (fun () -> skip_if (Sys.os_type = "Win32") "UNIX test"), oasis_ocamlbuild_files, [], []) (* Run test *) (fun _ -> (* Run configure target *) assert_run_setup ["-configure"; "--enable-all"; "--disable-over"]; rm ["setup.data"; exec "setup"; "setup.digest"]); "TEMP=a b">:: bracket (fun () -> let dn = readlink "a b" in mkdir dn; dn) (fun dn -> bracket_setup ("data/bug571", fun () -> ignore, oasis_ocamlbuild_files, [], []) (fun _ -> assert_run_setup ~extra_env:[if Sys.os_type = "Win32" then "TEMP", dn else "TMPDIR", dn] ["-configure"]; rm ["setup.data"; exec "setup"; "setup.digest"]) ()) (fun dn -> rm ~recurse:true [dn]); "setup with dev mode (weak)">:: bracket ignore (fun () -> skip_if (Sys.os_type = "Win32") "UNIX test"; cp ["data/dev/_oasis.v1"] "data/dev/_oasis"; bracket_setup ~dev:true ("data/dev", fun () -> ignore, oasis_ocamlbuild_files, [], []) (* Run test *) (fun _ -> assert_run_setup ["-all"]; assert_bool "Library .cma not created." (not (Sys.file_exists "_build/mylib.cma")); cp ["_oasis.v2"] "_oasis"; assert_run_setup ["-all"]; assert_bool "Library .cma created." (Sys.file_exists "_build/mylib.cma"); assert_run_setup ["-distclean"]; rm ["META"; "mylib.mllib"; exec "setup"; "setup.digest"]; cp ["_oasis.v1"] "_oasis") ()) (fun () -> rm ["data/dev/_oasis"]); "setup with dev mode (light)">:: bracket ignore (fun () -> cp ["data/dev/_oasis.v2"] "data/dev/_oasis"; bracket_setup ~dev:true ~dynamic:true ("data/dev", fun () -> ignore, ["setup.ml"], [], []) (* Run test *) (fun _ -> assert_bool "setup.ml is smaller than 2kB" (let chn = open_in "setup.ml" in try let size = in_channel_length chn in close_in chn; size < 2048 (* 2kB *) with e -> close_in chn; raise e); assert_run_setup ["-all"]; assert_bool "Library .cma created." (Sys.file_exists "_build/mylib.cma"); assert_run_setup ["-distclean"]; rm ["META"; "mylib.mllib"; exec "setup"; "setup.digest"]) ()) (fun () -> rm ["data/dev/_oasis"]); "setup with no dev mode">:: bracket ignore (fun () -> cp ["data/dev/_oasis.v1"] "data/dev/_oasis"; bracket_setup ("data/dev", fun () -> ignore, oasis_ocamlbuild_files, [], []) (* Run test *) (fun _ -> assert_run_setup ["-all"]; assert_bool "Library .cma not created." (not (Sys.file_exists "_build/mylib.cma")); cp ["_oasis.v2"] "_oasis"; assert_run_setup ["-all"]; assert_bool "Library .cma still not created." (not (Sys.file_exists "_build/mylib.cma")); assert_run_setup ["-distclean"]; rm ["META"; "mylib.mllib"; exec "setup"; "setup.digest"]; cp ["_oasis.v1"] "_oasis") ()) (fun () -> rm ["data/dev/_oasis"]); "ver0.3">:: bracket_setup ("data/ver0.3", fun () -> ignore, oasis_ocamlbuild_files, [], []) (* Run test *) (fun _ -> assert_run_setup ["-configure"]; assert_run_setup ["-test"]; assert_bool "test not run." (not (Sys.file_exists "test-done")); assert_run_setup ["-doc"]; assert_bool "doc done." (Sys.file_exists "doc-done"); assert_run_setup ["-distclean"]; rm ["test-done"; "doc-done"]; assert_run_setup ["-configure"; "--enable-tests"; "--disable-docs"]; assert_run_setup ["-test"]; assert_bool "test run." (Sys.file_exists "test-done"); assert_run_setup ["-doc"]; assert_bool "doc not done." (not (Sys.file_exists "doc-done")); assert_run_setup ["-distclean"]; rm ["test-done"; "doc-done"; exec "setup"; "setup.digest"]) ] ;; oasis-0.3.0/test/TestOASIS.ml0000644000175000017500000003072711773154621015221 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 *) (******************************************************************************) (** Tests for OASIS @author Sylvain Le Gall *) open OUnit 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 file_of_vector (fn, test) = fn >:: (fun () -> let pkg = from_file ~ctxt:{!oasis_ctxt with OASISContext.ignore_plugins = true} fn in test pkg) in let test_file_of_vector (fn, test) = file_of_vector (in_data fn, test) in let test_value_parser_of_vector (str, value_parse, fail) = str >:: (fun () -> 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 "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_optional_string (Some "a\nb\n\nc") pkg.description); "test11.oasis", ignore; "test12.oasis", (fun pkg -> assert_equal ~printer:printer_optional_string (Some "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 = OASISLibrary.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"]); ]) @ (List.rev_map file_of_vector (List.rev_map (fun fn -> fn, ignore) (find (* Collect _oasis in examples/ *) (Basename_is "_oasis") "../examples" (fun a e -> e :: a) (* Collect examples/oasis/*.oasis *) (filter (Has_extension "oasis") (ls "../examples/oasis")))))) @ [ "SinceVersion" >:: (fun () -> 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_ctxt with OASISContext.ignore_plugins = true} (in_data "test13.oasis") in ())); "test15.oasis" >:: (fun () -> try let _pkg : OASISTypes.package = from_file ~ctxt:{!oasis_ctxt with OASISContext.ignore_plugins = true} (in_data "test13.oasis") in assert_string "test15.oasis should fail to parse" with Failure _ -> ()); ] ] ;; oasis-0.3.0/test/TestPropList.ml0000644000175000017500000000450411773154621016111 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 *) (******************************************************************************) (** Tests for PropList @author Sylvain Le Gall *) open OUnit;; open TestCommon;; open PropList;; open PropList.Field;; let tests = "PropList" >:: (fun () -> 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.3.0/test/data/0000755000175000017500000000000011773154622014052 5ustar gildorgildoroasis-0.3.0/test/data/test6.oasis0000644000175000017500000000027511773154622016163 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.3.0/test/data/filetemplate3.txt-exp0000644000175000017500000000014111773154622020137 0ustar gildorgildor toto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP tata oasis-0.3.0/test/data/bug938/0000755000175000017500000000000011773154622015073 5ustar gildorgildoroasis-0.3.0/test/data/bug938/_oasis0000644000175000017500000000063311773154622016275 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.3.0/test/data/bug938/postconf.sh0000755000175000017500000000335411773154622017272 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ 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.3.0/test/data/customdoc/0000755000175000017500000000000011773154622016052 5ustar gildorgildoroasis-0.3.0/test/data/customdoc/_oasis0000644000175000017500000000070111773154622017250 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.3.0/test/data/customdoc/Makefile0000644000175000017500000000323211773154622017512 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 # ################################################################################ all: doc: ocamldoc -html A.ml doc-clean: $(RM) *.html style.css oasis-0.3.0/test/data/customdoc/A.ml0000644000175000017500000000312511773154622016565 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.3.0/test/data/with-cclib/0000755000175000017500000000000011773154622016077 5ustar gildorgildoroasis-0.3.0/test/data/with-cclib/_oasis0000644000175000017500000000077211773154622017305 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.3.0/test/data/with-cclib/src/0000755000175000017500000000000011773154622016666 5ustar gildorgildoroasis-0.3.0/test/data/with-cclib/src/test_compile.ml0000644000175000017500000000323011773154622021705 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 *) (******************************************************************************) let s = "test" let _ = Stringprep.caml_stringprep_xmpp_nodeprep s oasis-0.3.0/test/data/with-cclib/src/stringprep_stubs.c0000644000175000017500000000402311773154622022446 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 */ /********************************************************************************/ #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.3.0/test/data/with-cclib/src/stringprep.ml0000644000175000017500000000325611773154622021423 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 *) (******************************************************************************) external caml_stringprep_xmpp_nodeprep : string -> int = "caml_stringprep_xmpp_nodeprep" oasis-0.3.0/test/data/test-devfiles1.oasis0000644000175000017500000000056211773154622017754 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.3.0/test/data/bug738/0000755000175000017500000000000011773154622015071 5ustar gildorgildoroasis-0.3.0/test/data/bug738/_oasis0000644000175000017500000000036411773154622016274 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.3.0/test/data/bug738/myocamlbuild.ml0000644000175000017500000000363611773154622020114 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_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.3.0/test/data/bug738/src/0000755000175000017500000000000011773154622015660 5ustar gildorgildoroasis-0.3.0/test/data/bug738/src/foo.bar0000644000175000017500000000003611773154622017130 0ustar gildorgildorprint_endline "Hello, world!" oasis-0.3.0/test/data/bug623/0000755000175000017500000000000011773154622015062 5ustar gildorgildoroasis-0.3.0/test/data/bug623/_oasis0000644000175000017500000000022011773154622016254 0ustar gildorgildorOASISFormat: 0.1 Name: bug623 Version: 0 Synopsis: Test bug 623 Authors: Me License: GPL Test "false" Command: toto oasis-0.3.0/test/data/test-freeform.oasis0000644000175000017500000000040211773154622017670 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.3.0/test/data/bugClib/0000755000175000017500000000000011773154622015421 5ustar gildorgildoroasis-0.3.0/test/data/bugClib/_oasis0000644000175000017500000000076111773154622016625 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.3.0/test/data/bugClib/foo.ml0000644000175000017500000000000011773154622016524 0ustar gildorgildoroasis-0.3.0/test/data/bugClib/src/0000755000175000017500000000000011773154622016210 5ustar gildorgildoroasis-0.3.0/test/data/bugClib/src/bar.ml0000644000175000017500000000000011773154622017274 0ustar gildorgildoroasis-0.3.0/test/data/bugClib/src/fooC.c0000644000175000017500000000000011773154622017230 0ustar gildorgildoroasis-0.3.0/test/data/filetemplate3.txt0000644000175000017500000000005211773154622017346 0ustar gildorgildor toto # OASIS_START # OASIS_STOP tata oasis-0.3.0/test/data/filetemplate4.txt-exp0000644000175000017500000000013111773154622020137 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP oasis-0.3.0/test/data/dir.data0000644000175000017500000000002011773154622015453 0ustar gildorgildorbindir = "toto" oasis-0.3.0/test/data/bug571/0000755000175000017500000000000011773154622015064 5ustar gildorgildoroasis-0.3.0/test/data/bug571/_oasis0000644000175000017500000000064611773154622016272 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.3.0/test/data/bug571/A.ml0000644000175000017500000000326411773154622015603 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 *) (******************************************************************************) open OUnit open Big_int let () = let _ = Big_int.big_int_of_string "1234" in () oasis-0.3.0/test/data/dev/0000755000175000017500000000000011773154622014630 5ustar gildorgildoroasis-0.3.0/test/data/dev/_oasis.v20000644000175000017500000000051011773154622016352 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.3.0/test/data/dev/A.ml0000644000175000017500000000314411773154622015344 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 *) (******************************************************************************) let () = () oasis-0.3.0/test/data/dev/main.ml0000644000175000017500000000312511773154622016107 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.3.0/test/data/dev/_tags0000644000175000017500000000006011773154622015644 0ustar gildorgildor # OASIS_START # OASIS_STOP "A.ml": pkg_oUnit oasis-0.3.0/test/data/dev/_oasis.v10000644000175000017500000000044011773154622016353 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.3.0/test/data/bug619/0000755000175000017500000000000011773154622015067 5ustar gildorgildoroasis-0.3.0/test/data/bug619/_oasis0000644000175000017500000000026211773154622016267 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.3.0/test/data/test4.oasis0000644000175000017500000000101411773154622016151 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.3.0/test/data/filetemplate1.txt0000644000175000017500000000001011773154622017336 0ustar gildorgildor toto oasis-0.3.0/test/data/test9.oasis0000644000175000017500000000102111773154622016154 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.3.0/test/data/test3.oasis0000644000175000017500000000074611773154622016163 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.3.0/test/data/test13.oasis0000644000175000017500000000034311773154622016235 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.3.0/test/data/test11.oasis0000644000175000017500000000050211773154622016230 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.3.0/test/data/bug823/0000755000175000017500000000000011773154622015064 5ustar gildorgildoroasis-0.3.0/test/data/bug823/_oasis0000644000175000017500000000027111773154622016264 0ustar gildorgildorOASISFormat: 0.1 Name: test Version: 0 Synopsis: test Authors: me License: GPL BuildTools: ocamlbuild PreConfCommand: ./preconf.sh PostConfCommand: ./postconf.sh oasis-0.3.0/test/data/bug823/preconf.sh0000755000175000017500000000326511773154622017065 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e echo 'myvar="true"' >> setup.data echo 'ocamlopt="myocamlopt"' >> setup.data oasis-0.3.0/test/data/bug823/postconf.sh0000755000175000017500000000334611773154622017264 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e . ./setup.data set -x echo "testing ocamlopt" test "$ocamlopt" = "myocamlopt" echo "testing myvar" test "$myvar" = "true" oasis-0.3.0/test/data/test8.oasis0000644000175000017500000000062511773154622016164 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.3.0/test/data/test7.oasis0000644000175000017500000000070211773154622016157 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.3.0/test/data/test2.oasis0000644000175000017500000000073611773154622016161 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.3.0/test/data/1level/0000755000175000017500000000000011773154622015242 5ustar gildorgildoroasis-0.3.0/test/data/1level/_oasis0000644000175000017500000000116511773154622016445 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.3.0/test/data/1level/A.ml0000644000175000017500000000314011773154621015751 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 *) (******************************************************************************) open OUnit oasis-0.3.0/test/data/1level/main.ml0000644000175000017500000000312511773154622016521 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.3.0/test/data/bug588/0000755000175000017500000000000011773154622015074 5ustar gildorgildoroasis-0.3.0/test/data/bug588/test.ml0000644000175000017500000000316111773154622016406 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 *) (******************************************************************************) let () = Libtest.run () oasis-0.3.0/test/data/bug588/_oasis0000644000175000017500000000114711773154622016277 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.3.0/test/data/bug588/libtest.ml0000644000175000017500000000323211773154622017074 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 *) (******************************************************************************) let run () = print_endline "hello" let q = BITSTRING { 1l : 32 } oasis-0.3.0/test/data/bug588/_tags_manual0000644000175000017500000000321511773154622017452 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_START # OASIS_STOP "libtest.ml": syntax_camlp4o oasis-0.3.0/test/data/bug588/_tags0000644000175000017500000000445211773154622016121 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_START # DO NOT EDIT (digest: ebc87079f25591189cb846704a266658) # 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.3.0/test/data/LICENSE0000644000175000017500000000313211773154622015056 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 * ******************************************************************************** toto oasis-0.3.0/test/data/no-install-doc/0000755000175000017500000000000011773154622016675 5ustar gildorgildoroasis-0.3.0/test/data/no-install-doc/_oasis0000644000175000017500000000036411773154622020100 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.3.0/test/data/test15.oasis0000644000175000017500000000536111773154622016244 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.3.0/test/data/filetemplate5.txt-exp0000644000175000017500000000013611773154622020145 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: 49d02d55ad10973b7b9d0dc9eba7fdf0) tata # OASIS_STOP oasis-0.3.0/test/data/bug982/0000755000175000017500000000000011773154622015072 5ustar gildorgildoroasis-0.3.0/test/data/bug982/_oasis0000644000175000017500000000037111773154622016273 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.3.0/test/data/bug982/Makefile.setup-data0000644000175000017500000000321011773154622020574 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 # ################################################################################ include setup.data all: test "x$(ocamlc)" != "x" oasis-0.3.0/test/data/bug982/A.ml0000644000175000017500000000317011773154622015605 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 *) (******************************************************************************) let () = print_endline "coucou" oasis-0.3.0/test/data/bug982/test-setup-data.sh0000755000175000017500000000326511773154622020463 0ustar gildorgildor#!/bin/sh ################################################################################ # 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 # ################################################################################ set -e . "./setup.data" set -x test "x$ocamlc" != "x" make -f Makefile.setup-data oasis-0.3.0/test/data/test5.oasis0000644000175000017500000000023311773154622016154 0ustar gildorgildorName: oasis Version: 0.0.1 OASISFormat: 0.1 Synopsis: Just a test License: GPL LicenseFile: LICENSE Authors: Sylvain Le Gall oasis-0.3.0/test/data/src/0000755000175000017500000000000011773154622014641 5ustar gildorgildoroasis-0.3.0/test/data/src/toto.ml0000644000175000017500000000312511773154622016161 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.3.0/test/data/src/stuff/0000755000175000017500000000000011773154622015770 5ustar gildorgildoroasis-0.3.0/test/data/src/stuff/A.ml0000644000175000017500000000312511773154622016503 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.3.0/test/data/src/stuff/META0000644000175000017500000000312511773154622016442 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.3.0/test/data/src/stuff/B.mli0000644000175000017500000000312511773154622016655 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.3.0/test/data/src/stuff/C.ml0000644000175000017500000000312511773154622016505 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.3.0/test/data/test14.oasis0000644000175000017500000000105211773154622016234 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.3.0/test/data/test1.oasis0000644000175000017500000000222311773154622016151 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.3.0/test/data/flag-ccopt/0000755000175000017500000000000011773154622016071 5ustar gildorgildoroasis-0.3.0/test/data/flag-ccopt/_oasis0000644000175000017500000000063011773154622017270 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.3.0/test/data/flag-ccopt/A.ml0000644000175000017500000000312511773154622016604 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.3.0/test/data/test12.oasis0000644000175000017500000000071511773154622016237 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.3.0/test/data/filetemplate2.txt0000644000175000017500000000002511773154622017345 0ustar gildorgildortoto # OASIS_START oasis-0.3.0/test/data/test10.oasis0000644000175000017500000000053111773154622016231 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.3.0/test/data/filetemplate1.txt-exp0000644000175000017500000000001011773154622020130 0ustar gildorgildor toto oasis-0.3.0/test/data/bug791/0000755000175000017500000000000011773154622015070 5ustar gildorgildoroasis-0.3.0/test/data/bug791/_oasis0000644000175000017500000000056511773154622016276 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.3.0/test/data/bug791/test/0000755000175000017500000000000011773154622016047 5ustar gildorgildoroasis-0.3.0/test/data/bug791/test/C.ml0000644000175000017500000000000711773154622016560 0ustar gildorgildoropen B oasis-0.3.0/test/data/bug791/src/0000755000175000017500000000000011773154622015657 5ustar gildorgildoroasis-0.3.0/test/data/bug791/src/A.ml0000644000175000017500000000000011773154622016357 0ustar gildorgildoroasis-0.3.0/test/data/bug791/src/lib/0000755000175000017500000000000011773154622016425 5ustar gildorgildoroasis-0.3.0/test/data/bug791/src/lib/B.ml0000644000175000017500000000000011773154622017126 0ustar gildorgildoroasis-0.3.0/test/data/comment-in-field.oasis0000644000175000017500000000034311773154622020241 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.3.0/test/data/ver0.3/0000755000175000017500000000000011773154622015067 5ustar gildorgildoroasis-0.3.0/test/data/ver0.3/_oasis0000644000175000017500000000047211773154622016272 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.3.0/test/data/ver0.3/touch.ml0000644000175000017500000000012011773154622016534 0ustar gildorgildorlet () = Arg.parse [] (fun fn -> close_out (open_out fn)) "foo" oasis-0.3.0/test/data/filetemplate2.txt-exp0000644000175000017500000000013211773154622020136 0ustar gildorgildortoto # OASIS_START # DO NOT EDIT (digest: d41d8cd98f00b204e9800998ecf8427e) # OASIS_STOP oasis-0.3.0/test/data/create-parent-dir/0000755000175000017500000000000011773154622017360 5ustar gildorgildoroasis-0.3.0/test/data/create-parent-dir/_oasis0000644000175000017500000000045511773154622020564 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.3.0/test/TestValues.ml0000644000175000017500000000772111773154621015600 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 *) (******************************************************************************) (** Test OASISValues defined fields @author Sylvain Le Gall *) open Printf open TestCommon open OASISValues open OUnit let tests_url = List.map (fun txt -> TestCase (fun () -> 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) -> let title = sprintf "command_line_options: %S" s in title >:: (fun () -> 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 -> let title = sprintf "OASISUtils.POSIXShell: %S" s in title >:: (fun () -> let q = OASISUtils.POSIXShell.escape s in let u = if q.[0] = '"' then let q' = String.sub q 1 (String.length q - 2) in OASISUtils.POSIXShell.unescape q' else q in assert_equal s u)) [""; "a b"; "a'b"; "echo \'abcd"; "a\\b"] let tests = "Values" >::: (tests_url @ tests_command_line_options @ tests_posix_quoting) oasis-0.3.0/test/TestFileTemplate.ml0000644000175000017500000001243711773154621016714 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 *) (******************************************************************************) (** Tests for OASISFileTemplate @author Sylvain Le Gall *) open OUnit open TestCommon open OASISFileTemplate let tests = let test_of_vector (fn, content_lst, comment_fmt) = fn >:: bracket (fun () -> ref NoChange) (fun rchng -> let real_fn = in_data fn in let expected_fn = real_fn ^ "-exp" in 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 in rchng := file_generate ~ctxt:!oasis_ctxt ~backup:true (template_of_string_list ~ctxt:!oasis_ctxt ~template:true real_fn comment_fmt content_lst); assert_equal ~msg:"File content" ~printer:(Printf.sprintf "%S") (file_content expected_fn) (file_content real_fn)) (fun rchng -> file_rollback ~ctxt:!oasis_ctxt !rchng) 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 () -> let () = skip_if (Sys.os_type = "Win32") "UNIX only test" in let fn, chn = Filename.open_temp_file "oasis-db" ".txt" in output_string chn "# OASIS_START\n\ # OASIS_STOP\n"; close_out chn; try 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); Sys.remove fn with e -> Sys.remove fn; raise e) ] ;; oasis-0.3.0/test/TestMETA.ml0000644000175000017500000002125011773154621015060 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 *) (******************************************************************************) (** Test plugin META @author Sylvain Le Gall *) open OUnit open TestCommon open Fl_metascanner open OASISTypes open OASISLibrary let tests = let test_of_vector (nm, oasis_str, pkg_tests) = nm >:: (bracket (fun () -> Filename.temp_file "oasis-meta-" ".meta") (fun fn -> (* 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, _ = OASISLibrary.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 let dbug_meta () = let chn = open_in fn in begin try while true do prerr_endline (input_line chn) done with End_of_file -> () end; close_in 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 ExtString.String.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; if !dbug then dbug_meta (); 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 ()) (fun fn -> Sys.remove fn)) in "META" >::: (List.map test_of_vector [ "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.3.0/test/TestQuery.ml0000644000175000017500000000642011773154621015441 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 *) (******************************************************************************) (** Tests the subcommand query of OASIS @author Sylvain Le Gall *) open TestCommon open OUnit 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 () -> assert_oasis_cli ~output:((String.concat "\n" a)^"\n") ~unorder:true (["-quiet"; "query"; "-oasis"; in_data 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.3.0/test/TestVersion.ml0000644000175000017500000001021711773154621015760 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 *) (******************************************************************************) (** Tests for BaseVersion @author Sylvain Le Gall *) open OUnit 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 () -> 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 () -> 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 () -> 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 () -> 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.3.0/test/TestCommon.ml0000644000175000017500000001336311773154621015570 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 *) (******************************************************************************) (** 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 OUnit module MapString = Map.Make(String) module SetString = Set.Make(String) let dbug = ref false let long = ref true let oasis_exec = ref None let oasis_args = ref [] let has_ocamlopt = ref (bool_of_string (BaseStandardVar.is_native ())) let has_native_dynlink = ref (bool_of_string (BaseStandardVar.native_dynlink ())) let oasis () = match !oasis_exec with | None -> failwith "You must define oasis executable with -oasis-exec" | Some e -> e let oasis_ctxt = ref OASISContext.quiet let set_verbose b = dbug := b; if b then oasis_ctxt := !OASISContext.default let test_args = let gettext_args, _ = Gettext.init in [ "-not-long", Arg.Clear long, " Don't run long tests"; (* TODO: remove *) "-has-ocamlopt", Arg.String (fun s -> has_ocamlopt := bool_of_string s), "bool Can use ocamlopt for tests"; "-oasis-exec", Arg.String (fun s -> oasis_exec := Some s), "fn Define oasis executable"; "-oasis-args", Arg.Rest (fun str -> oasis_args := !oasis_args @ [str]), "args* Define oasis arguments"; ] @ gettext_args @ (BaseContext.args ()) let in_data = let pwd = FileUtil.pwd () in fun fn -> FilePath.make_filename [pwd; "data"; fn] ;; (* Create a temporary dir *) let temp_dir () = let res = Filename.temp_file "oasis-" ".dir" in FileUtil.rm [res]; FileUtil.mkdir res; at_exit (fun () -> FileUtil.rm ~recurse:true [res]); res 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 ?exit_code ?output ?extra_env ?(unorder=false) cmd args = let foutput = match output with | Some exp_output -> let foutput strm = let output = let buff = Buffer.create 13 in Stream.iter (Buffer.add_char buff) strm; Buffer.contents buff in let exp_output = ExtString.String.nsplit exp_output "\n" in let rel_output = ExtString.String.nsplit 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 -> None 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 ?foutput ?env ?exit_code ~use_stderr:true ~verbose:!dbug cmd args let assert_oasis_cli ?exit_code ?output ?extra_env ?unorder args = assert_command ?exit_code ?output ?extra_env ?unorder (oasis ()) (!oasis_args @ args) oasis-0.3.0/test/TestLicense.ml0000644000175000017500000001042111773154621015712 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 *) (******************************************************************************) (** Test for OASISLicense @author Sylvain Le Gall *) open OUnit 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 () -> 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 -> ())) [ "BSD4", mk bsd4; "BSD4-1.0+", mk ~v:(VersionOrLater (ver "1.0")) bsd4; "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 BSD3", Some (DEP5License (DEP5And [ mk_base ~v:(VersionOrLater (ver "2")) gpl; mk_base bsd3; ])); "GPL-2+ or Artistic-2.0, and BSD3", Some (DEP5License (DEP5And [DEP5Or [ mk_base ~v:(VersionOrLater (ver "2")) gpl; mk_base ~v:(Version (ver "2.0")) artistic; ]; mk_base bsd3])); ] ) oasis-0.3.0/doc/0000755000175000017500000000000011773154621012726 5ustar gildorgildoroasis-0.3.0/doc/FAQ.mkd0000644000175000017500000000020611773154621014030 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.3.0/doc/ext/0000755000175000017500000000000011773154621013526 5ustar gildorgildoroasis-0.3.0/doc/ext/README.txt0000644000175000017500000000020611773154621015222 0ustar gildorgildorFor licensing problem, no external documentation is included. You can run "sh fetch-doc.sh" to get required external documentation. oasis-0.3.0/doc/ext/fetch-doc.sh0000644000175000017500000000321711773154621015721 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 # ################################################################################ wget -N "http://www.haskell.org/cabal/proposal/x611.html" oasis-0.3.0/doc/ANALYSIS.mkd0000644000175000017500000000607311773154621014654 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.3.0/CHANGES.txt0000644000175000017500000003057011773154621013777 0ustar gildorgildor2012-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.3.0/deps.ml0000644000175000017500000001024311773154621013446 0ustar gildorgildor module MapString = Map.Make(String) module SetString = Set.Make(String) open OASISTypes open BaseEnv let generated_fn = OASISHostPath.of_unix "src/cli/PluginsLoaded.ml" let post_configure pkg = (* Compute build depends *) let _, findlib_of_name, _ = OASISLibrary.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 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 Printf.fprintf chn "let exec_%s_build_depends_rec = [%s]\n" (OASISUtils.varname_of_string cs.cs_name) (String.concat "; " (List.rev_map (Printf.sprintf "%S") (SetString.elements st))) | _ -> ()) pkg.sections; 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.3.0/src/0000755000175000017500000000000011773154621012750 5ustar gildorgildoroasis-0.3.0/src/api-oasis.odocl0000644000175000017500000000512611773154621015663 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_START # DO NOT EDIT (digest: 0e62ab6c871c5ff24dbe4ca8f3684337) oasis/FormatExt oasis/FormatMarkdown oasis/ODNFunc oasis/PropList oasis/OASISUtils oasis/OASISUnixPath oasis/OASISContext oasis/OASISGettext oasis/OASISMessage oasis/OASISTypes oasis/OASISParse oasis/OASISValues oasis/OASISExpr oasis/OASISVersion oasis/OASISLicense oasis/OASISFileTemplate oasis/OASISBuildSection oasis/OASISDocument oasis/OASISExecutable oasis/OASISFlag oasis/OASISLibrary oasis/OASISPackage oasis/OASISSourceRepository oasis/OASISTest oasis/OASISPlugin oasis/OASISSchema oasis/OASISSection oasis/OASISData oasis/OASISString oasis/OASISExec oasis/OASISFileUtil oasis/OASISHostPath oasis/OASISGraph 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/SubCommand cli/ArgExt cli/Pager # OASIS_STOP oasis-0.3.0/src/ext/0000755000175000017500000000000011773154621013550 5ustar gildorgildoroasis-0.3.0/src/ext/README.txt0000644000175000017500000000046611773154621015254 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.3.0/src/ext/plugin-loader/0000755000175000017500000000000011773154621016312 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/README.txt0000644000175000017500000000041411773154621020007 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.3.0/src/ext/plugin-loader/test/0000755000175000017500000000000011773154621017271 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/test/data/0000755000175000017500000000000011773154621020202 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/test/data/pluginloader.ml0000644000175000017500000000272411773154621023226 0ustar gildorgildor 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); exit 1 oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/0000755000175000017500000000000011773154621021611 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin1/0000755000175000017500000000000011773154621023170 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.mllib0000644000175000017500000000013411773154621025566 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: efc9da8b11268a70c1ab38946d979286) Plugin1 # OASIS_STOP oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin1/plugin1.ml0000644000175000017500000000014411773154621025100 0ustar gildorgildorlet () = PluginloaderLib.registered_plugins := "plugin1" :: !PluginloaderLib.registered_plugins oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin1/META0000644000175000017500000000071611773154621023645 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: b134a5370d972ba097ca30fc33357ec3) version = "0.3.0" 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.3.0/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/0000755000175000017500000000000011773154621024725 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.mllib0000644000175000017500000000014411773154621031061 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 6358d6dd34f78bae610d82b2933c82f2) PluginloaderLib # OASIS_STOP oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/META0000644000175000017500000000060211773154621025374 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: f1ba2e2cb70ee46af8467c5e374f2e6c) version = "0.3.0" 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.3.0/src/ext/plugin-loader/test/data/findlib/pluginloaderLib/pluginloaderLib.ml0000644000175000017500000000006511773154621030374 0ustar gildorgildor let registered_plugins : string list ref = ref [] oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin3/0000755000175000017500000000000011773154621023172 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.ml0000644000175000017500000000014411773154621025104 0ustar gildorgildorlet () = PluginloaderLib.registered_plugins := "plugin3" :: !PluginloaderLib.registered_plugins oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin3/plugin3.mllib0000644000175000017500000000013411773154621025572 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 476f28492db73d8d3b435d24ae78858e) Plugin3 # OASIS_STOP oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin3/META0000644000175000017500000000071611773154621023647 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 62d24ca1a370b9916e886714885c34a7) version = "0.3.0" 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.3.0/src/ext/plugin-loader/test/data/findlib/plugin2/0000755000175000017500000000000011773154621023171 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.ml0000644000175000017500000000014411773154621025102 0ustar gildorgildorlet () = PluginloaderLib.registered_plugins := "plugin2" :: !PluginloaderLib.registered_plugins oasis-0.3.0/src/ext/plugin-loader/test/data/findlib/plugin2/META0000644000175000017500000000072711773154621023650 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 0c0407d2e7eaf1a08d848662ee6e7b20) version = "0.3.0" 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.3.0/src/ext/plugin-loader/test/data/findlib/plugin2/plugin2.mllib0000644000175000017500000000013411773154621025570 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 1f1aeaa6bfdb5dc87a2c122bd3ce5eb6) Plugin2 # OASIS_STOP oasis-0.3.0/src/ext/plugin-loader/test/TestLoader.ml0000644000175000017500000000627711773154621021705 0ustar gildorgildor open OUnit let verbose = ref false let pluginloader = ref "false" let datadir = FilePath.make_filename ["src"; "ext"; "plugin-loader"; "test"; "data"] let findlibdir = FilePath.concat datadir "findlib" let bracket_tmpdir f = bracket (fun () -> let fn = Filename.temp_file "plugin-loader-" ".dir" in FileUtil.rm [fn]; FileUtil.mkdir fn; fn) f (fun fn -> FileUtil.rm ~recurse:true [fn]) let bracket_findlib f = bracket_tmpdir (fun dn -> 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); if !verbose then Printf.eprintf "I: 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. *) 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) (); f dn) let assert_pluginloader dn args = let buf = Buffer.create 13 in let lst = ref [] in let env = Array.append [|"OCAMLPATH="^ (try FilePath.string_of_path ((FilePath.path_of_string (Sys.getenv "OCAMLPATH")) @ [dn]) with Not_found -> dn)|] (Unix.environment ()) in assert_command ~env ~foutput:(Stream.iter (function | '\n' -> lst := Buffer.contents buf :: !lst; Buffer.clear buf | c -> Buffer.add_char buf c)) !pluginloader args; List.rev (Buffer.contents buf :: !lst) let _lst : test_result list = run_test_tt_main ~arg_specs:["--pluginloader", Arg.Set_string pluginloader, "exec Set pluginloader executable."; "-not-long", Arg.Unit ignore, " Run long tests."] ~set_verbose:(fun b -> verbose := b) ("PluginLoader" >::: ["list" >:: bracket_findlib (fun dn -> let lst = assert_pluginloader dn [] in assert_equal ~printer:(String.concat ", ") ["plugin1: first plugin"; "plugin2: second plugin"; "plugin3: third plugin"; ""] lst); "load" >:: bracket_findlib (fun dn -> let lst = assert_pluginloader dn ["-load"; "plugin1"] in assert_equal ~printer:(String.concat ", ") ["plugin_loaded: plugin1"; ""] lst)]) oasis-0.3.0/src/ext/plugin-loader/src/0000755000175000017500000000000011773154621017101 5ustar gildorgildoroasis-0.3.0/src/ext/plugin-loader/src/PluginLoader.ml0000644000175000017500000002064611773154621022030 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 *) (******************************************************************************) (* 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 let init findlib_packages_loaded = 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; description: string option; version: string option; } (* 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_str var dflt = match default_lookup var with | Some str -> str | None -> dflt in if plugin_system = t.system then begin let entry = { findlib_name = pkg_str; name = default_lookup_str "plugin_name" pkg_str; synopsis = default_lookup "plugin_synopsis"; description = default_lookup "plugin_description"; version = default_lookup "version"; } 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 acc with e -> acc) SetEntry.empty lst in SetEntry.elements set let load t nm = 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.3.0/src/ext/plugin-loader/src/META0000644000175000017500000000062511773154621017555 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: de4648854e0f82fd0a6bd8a04449ef5b) version = "0.3.0" 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.3.0/src/ext/plugin-loader/src/plugin-loader.mllib0000644000175000017500000000014111773154621022660 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 6f92f061f99224a7d433dbc90f7586b7) PluginLoader # OASIS_STOP oasis-0.3.0/src/ext/userconf/0000755000175000017500000000000011773154621015374 5ustar gildorgildoroasis-0.3.0/src/ext/userconf/README.txt0000644000175000017500000000042311773154621017071 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.3.0/src/ext/userconf/test/0000755000175000017500000000000011773154621016353 5ustar gildorgildoroasis-0.3.0/src/ext/userconf/test/TestUserConf.ml0000644000175000017500000000001411773154621021264 0ustar gildorgildor open OUnit oasis-0.3.0/src/ext/userconf/src/0000755000175000017500000000000011773154621016163 5ustar gildorgildoroasis-0.3.0/src/ext/userconf/src/META0000644000175000017500000000053711773154621016641 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 83fe61e27e080c8133f98ba407b7a0f3) version = "0.3.0" 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.3.0/src/ext/userconf/src/userconf.mllib0000644000175000017500000000013511773154621021027 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 789c8d67a5037deef77ae24368386fa7) UserConf # OASIS_STOP oasis-0.3.0/src/ext/userconf/src/UserConf.ml0000644000175000017500000000000311773154621020232 0ustar gildorgildor oasis-0.3.0/src/oasis/0000755000175000017500000000000011773154623014070 5ustar gildorgildoroasis-0.3.0/src/oasis/OASISLicense_types.ml0000644000175000017500000000012511773154621020023 0ustar gildorgildortype t = | Or of t * t | And of t * t | License of string * (string option) oasis-0.3.0/src/oasis/FormatMarkdown.ml0000644000175000017500000000612111773154621017353 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 *) (******************************************************************************) (** Markdown formatter @author Sylvain Le Gall *) open Format open FormatExt let pp_print_endblock ?check_last_char fmt () = match check_last_char with | Some s -> begin if String.length s > 0 && s.[(String.length s) - 1] = '\n' then begin pp_print_newline fmt () end else begin pp_print_newline fmt (); pp_print_newline fmt () end end | None -> begin pp_print_newline fmt (); pp_print_newline fmt () end let pp_print_title lvl fmt 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_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 () let pp_print_para fmt str = pp_open_box fmt 0; pp_print_string_spaced fmt str; pp_close_box fmt (); pp_print_endblock fmt () oasis-0.3.0/src/oasis/OASISValues.mli0000644000175000017500000001206011773154621016626 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISSysBundle.mod0000644000175000017500000000026611773154621017302 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.3.0/src/oasis/OASISTest.ml0000644000175000017500000000321411773154621016136 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISTest_intern.schema oasis-0.3.0/src/oasis/OASISQuickstart.ml0000644000175000017500000006141611773154621017361 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 *) (******************************************************************************) (** 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 -> 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 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 PropList.Schema.fold (fun (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) (PropList.Data.create (), plugins) schm (** Ask questions for a package and its sections *) let ask_package ~ctxt lvl intrf = let pkg_data, plugins = ask_schema ~ctxt OASISPackage.schema lvl intrf OASISPlugin.SetPlugin.empty in let oasis_version = OASISConf.version_short 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 (* Plugin define in section don't propagate *) let data, _ = ask_schema ~ctxt schema lvl intrf plugins in gen oasis_version 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 _ -> 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.3.0/src/oasis/OASISPackage_intern.ml0000644000175000017500000003264111773154621020137 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 *) (******************************************************************************) (** 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) | 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 _ | 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.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 generator = let schm = schema in let new_field ?quickstart_level ?quickstart_question ?default nm value hlp sync = new_field schm ?quickstart_level ?quickstart_question ?default nm value hlp sync 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 string_not_empty) (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 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 List.fold_right add_build_depend (build_depends data) (List.fold_right add_build_tool (build_tools data) { oasis_version = oasis_version data; ocaml_version = ocaml_version data; findlib_version = findlib_version data; 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; sections = sections; schema_data = data; plugin_data = plugin_data; })) oasis-0.3.0/src/oasis/OASISHelp.ml0000644000175000017500000003723011773154621016114 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 *) (******************************************************************************) (* 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 Format open FormatExt 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) :: acc | FieldFromPlugin plg, Some plg' -> if OASISPlugin.plugin_compare plg' plg = 0 then (key, help) :: 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) -> let help = (match help with | Some h -> h () | None -> "")^ ( try let _s : string = PropList.Schema.get schm fake_data key in "" with | PropList.Not_set _ -> s_ " (__mandatory__)" | PropList.No_printer _ | OASISValues.Not_printable -> "" ) in fprintf fmt (f_ " * @[`%s`: %a@]") key pp_print_string_spaced help) "@," 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_string_spaced 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_string_spaced 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_string_spaced 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_string_spaced 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_string_spaced 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", "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_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, executable_fields = let set_fields_of_section schm = set_string_of_list (List.rev_map fst (fields_of_section ?plugin schm.schm)) in let lib_flds = set_fields_of_section OASISLibrary.schema in let exec_flds = set_fields_of_section OASISExecutable.schema in let common_flds = SetString.inter lib_flds exec_flds in common_flds, SetString.diff lib_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 [ "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: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 two variables are handled directly, to make * a difference with common build fields. *) nm <> "ListOASISLibraryFields" && nm <> "ListOASISExecutableFields") vars in pp_help_replace vars fmt OASISData.readme_template_mkd oasis-0.3.0/src/oasis/OASISValues.ml0000644000175000017500000002640411773154621016464 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 *) (******************************************************************************) 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 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 Not_found -> failwithf (f_ "String '%s' is not a %s") str (nm ())); 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) (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) (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 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 (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.3.0/src/oasis/OASISSourceRepository_intern.ml0000644000175000017500000001101511773154621022134 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 *) (******************************************************************************) (** 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 oasis_version nm data -> SrcRepo (cmn_section_gen oasis_version 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.3.0/src/oasis/OASISVersion_lexer.mll0000644000175000017500000000376011773154621020225 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 *) (********************************************************************************) { 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.3.0/src/oasis/OASISSchema.ml0000644000175000017500000000576011773154621016427 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 *) (******************************************************************************) 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 ?since_version parse hlp pivot_data sync = let plugin = OASISPlugin.to_plugin t in OASISSchema_intern.new_field schema (make_field_name plugin nm) ?default ?since_version ~plugin parse hlp (sync_proxy schema plugin nm pivot_data sync) let new_field_conditional schema t nm ?default_cond ?default ?since_version 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 ?since_version ~plugin parse hlp (sync_proxy schema plugin nm pivot_data sync) oasis-0.3.0/src/oasis/OASISAstTypes.ml0000644000175000017500000000475511773154621017006 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 *) (******************************************************************************) (** 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 | 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.3.0/src/oasis/OASISSection.mli0000644000175000017500000000540711773154621017002 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISExec.mli0000644000175000017500000000455011773154621016260 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISSourceRepository.mli0000644000175000017500000000343111773154621020731 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISFileTemplate.mli0000644000175000017500000001255311773154621017751 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 *) (******************************************************************************) (** 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 (** {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; } (** [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 fn cmt lst] Split a the list [lst] of into an header, a body and a footer, using comment [cmt] to determine each part. Set [~template] if this is an embedded template (i.e. not a file loaded from disk). See {!template_make} for other options. *) val template_of_string_list : ctxt:OASISContext.t -> template: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} *) (** 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. *) val file_generate : ctxt:OASISContext.t -> 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. *) val empty : 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.3.0/src/oasis/OASISLicense_lexer.mll0000644000175000017500000000042611773154621020156 0ustar gildorgildor { 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.3.0/src/oasis/MANUAL-template.mkd0000644000175000017500000003366611773154621017367 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://ocaml.info/home/ocaml_sources.html) * [OMake](http://omake.metaprl.org) 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) 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. * `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. ### 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 informations. There is two special identified repository: * 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.3.0/src/oasis/OASISGraph.ml0000644000175000017500000000562711773154621016272 0ustar gildorgildortype vertex = int module SetInt = Set.Make (struct type t = int let compare = ( - ) end) type 'a t = { mutable vertexes: ('a * SetInt.t ref) array; values: ('a, int) Hashtbl.t; } let create len = { vertexes = [||]; values = Hashtbl.create len; } let copy t = { vertexes = Array.copy t.vertexes; values = Hashtbl.copy t.values; } let value_of_vertex t v = if 0 <= v && v < Array.length t.vertexes then fst (Array.unsafe_get t.vertexes v) else invalid_arg "get_vertex" let vertex_of_value t e = Hashtbl.find t.values e let add_vertex t e = if Hashtbl.mem t.values e then Hashtbl.find t.values e else begin let v = Array.length t.vertexes in let nvertexes = Array.init (v + 1) (fun i -> if i = v then e, ref SetInt.empty else t.vertexes.(i)) in t.vertexes <- nvertexes; Hashtbl.add t.values e v; v end let add_edge t v1 v2 = let size = Array.length t.vertexes in if 0 <= v1 && v1 < size && 0 <= v2 && v2 < size then begin let _, edges = t.vertexes.(v1) in edges := SetInt.add v2 !edges end else invalid_arg "add_edge" let topological_sort t = let size = Array.length t.vertexes in (* Empty list that will contain the sorted vertexes *) let l = ref [] in (* Visited vertexes *) let visited = Array.make size false in let reverted_edges = let arr = Array.make size [] in for v1 = 0 to size - 1 do SetInt.iter (fun v2 -> arr.(v2) <- v1 :: arr.(v2)) !(snd t.vertexes.(v1)) done; arr in let rec visit v = if not visited.(v) then begin visited.(v) <- true; List.iter visit reverted_edges.(v); l := v :: !l end in (* Go through all vertexes with no outgoing edges *) for v = 0 to size - 1 do visit v done; !l let fold_edges f t acc = let racc = ref acc in for v1 = 0 to Array.length t.vertexes - 1 do SetInt.iter (fun v2 -> racc := f v1 v2 !racc) !(snd t.vertexes.(v1)) done; !racc let transitive_closure t = let size = Array.length t.vertexes in let visited = Array.make size false in let rec visit set v = if not visited.(v) then begin (* The set of outgoing edges is not complete *) let current_set = snd t.vertexes.(v) in let set' = SetInt.fold (fun v set' -> visit set' v) !current_set !current_set in visited.(v) <- true; current_set := set'; SetInt.union set set' end else begin (* The set is complete *) SetInt.union set !(snd t.vertexes.(v)) end in for v = 0 to size - 1 do let _set : SetInt.t = visit SetInt.empty v in () done oasis-0.3.0/src/oasis/OASISParse.mli0000644000175000017500000000434611773154621016451 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 *) (******************************************************************************) (** Parse '_oasis' file The whole module is {b not exported}. @author Sylvain Le Gall *) open OASISTypes (** [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.3.0/src/oasis/OASISTest_intern.ml0000644000175000017500000001065411773154621017523 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 *) (******************************************************************************) (** 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 oasis_version nm data -> let cs = cmn_section_gen oasis_version 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 OASISVersion.version_0_3_or_after oasis_version 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.3.0/src/oasis/OASISMessage.mli0000644000175000017500000000447111773154621016762 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 *) (******************************************************************************) (** 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 *) (** 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.3.0/src/oasis/oasis.mllib0000644000175000017500000000504411773154621016230 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_START # DO NOT EDIT (digest: f2a4952ef6e0f0186ba679a1819bd98f) FormatExt FormatMarkdown ODNFunc PropList OASISUtils OASISUnixPath OASISContext OASISGettext OASISMessage OASISTypes OASISParse OASISValues OASISExpr OASISVersion OASISLicense OASISFileTemplate OASISBuildSection OASISDocument OASISExecutable OASISFlag OASISLibrary OASISPackage OASISSourceRepository OASISTest OASISPlugin OASISSchema OASISSection OASISData OASISString OASISExec OASISFileUtil OASISHostPath OASISGraph 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 OASISPackage_intern OASISSourceRepository_intern OASISTest_intern OASISSchema_intern OASISPath_intern # OASIS_STOP oasis-0.3.0/src/oasis/OASISSection.ml0000644000175000017500000000616211773154621016630 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 *) (******************************************************************************) open OASISTypes let section_kind_common = function | Library (cs, _, _) -> `Library, 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) | 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" | `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.3.0/src/oasis/OASISDocument.mli0000644000175000017500000000340111773154621017144 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 *) (******************************************************************************) (** Document section @author Sylvain Le Gall *) open OASISTypes (** Schema for the section. {b Not exported}. *) val schema: (common_section * doc) OASISSchema.t oasis-0.3.0/src/oasis/OASISValues_lexer.mll0000644000175000017500000000077711773154621020044 0ustar gildorgildor 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.3.0/src/oasis/OASISVersion.ml0000644000175000017500000001660111773154621016650 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 *) (******************************************************************************) 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 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 version_0_3_or_after t = comparator_apply t (VGreaterEqual (string_of_version "0.3")) (* 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.3.0/src/oasis/OASISUnixPath.mli0000644000175000017500000000767711773154621017151 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 *) (******************************************************************************) (** 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 oasis-0.3.0/src/oasis/OASISContext.mli0000644000175000017500000000440611773154621017020 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 *) (******************************************************************************) (** 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 change {!default}. *) val args: unit -> (string * Arg.spec * string) list (** Quiet context. *) val quiet : t oasis-0.3.0/src/oasis/OASISSourceRepository.ml0000644000175000017500000000323011773154621020555 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISSourceRepository_intern.schema oasis-0.3.0/src/oasis/OASISUtils.ml0000644000175000017500000002304411773154621016322 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 *) (******************************************************************************) open OASISGettext module MapString = Map.Make(String) let map_string_of_assoc assoc = List.fold_left (fun acc (k, v) -> MapString.add k v acc) MapString.empty assoc module SetString = Set.Make(String) let set_string_add_list st lst = List.fold_left (fun acc e -> SetString.add e acc) st lst let set_string_of_list = set_string_add_list SetString.empty 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) 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 split_comma str = List.map OASISString.trim (OASISString.nsplit str ',') let split_newline ?(trim=true) str = let lst = OASISString.nsplit str '\n' in if trim then List.map OASISString.trim lst else lst let split_optional_parentheses str = try let beg_str, end_str = OASISString.split (OASISString.trim str) '(' in let content_str = OASISString.strip_ends_with ~what:")" end_str in OASISString.trim beg_str, Some (OASISString.trim content_str) with Not_found -> OASISString.trim str, 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.3.0/src/oasis/OASISMessage.ml0000644000175000017500000000426611773154621016613 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 *) (******************************************************************************) 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.3.0/src/oasis/OASISLibrary_intern.ml0000644000175000017500000001055611773154621020211 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 *) (******************************************************************************) (** 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 ~since_version:"0.3" 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 oasis_version nm data -> Library (cmn_section_gen oasis_version 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.3.0/src/oasis/OASISExpr.ml0000644000175000017500000001544211773154621016143 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 *) (******************************************************************************) 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.3.0/src/oasis/OASISCheck.ml0000644000175000017500000002155111773154621016240 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 *) (******************************************************************************) (** Check an OASIS package *) open OASISGettext open OASISSchema_intern open OASISUtils open OASISPlugin open OASISTypes open PropList let check_schema ~ctxt where schm oasis_version 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 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 (** Check all mandatory fields are set. *) let plugins, msgfld = Schema.fold (fun ((plugins, msgfld) as acc) 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, msgfld with _ -> plugins, check_get schm data fld msgfld 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, msgfld with _ -> plugins, check_get schm data fld msgfld end | StandardField | FieldFromPlugin _ -> acc) (SetPlugin.empty, []) schm in let msgfld = Schema.fold (fun acc fld extra hlp -> match extra.kind with | DefinePlugin _ | DefinePlugins _ -> begin (* Already checked before *) acc end | StandardField -> begin check_get schm data fld acc end | FieldFromPlugin plg_id -> begin if SetPlugin.mem 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 is not enabled.") fld; acc end else begin acc end end) msgfld 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 () = let sov = OASISVersion.string_of_version in Schema.fold (fun () fld extra _ -> if check_is_set schm data fld then match extra.since_version with | Some ver -> begin match extra.kind with | DefinePlugin _ | DefinePlugins _ | StandardField -> if not (OASISVersion.comparator_apply oasis_version (OASISVersion.VGreaterEqual ver)) then failwithf (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 (sov ver) (sov oasis_version) (sov ver) | FieldFromPlugin plg_id -> let plugin_name, plugin_version = match plg_id with | _, nm, Some ver -> nm, ver | _, plugin_name, 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 (sov ver) plugin_name plugin_name (sov ver) in if not (OASISVersion.comparator_apply plugin_version (OASISVersion.VGreaterEqual ver)) then failwithf (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 (sov ver) plugin_name (sov plugin_version) plugin_name (sov ver) end | None -> ()) () schm in () let check_package ~ctxt pkg = let standard_vars = if OASISVersion.version_0_3_or_after pkg.oasis_version then set_string_of_list ["tests"; "docs"] else SetString.empty 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 _ | Doc _ | SrcRepo _ | Test _ -> mp) MapString.empty pkg.sections in () oasis-0.3.0/src/oasis/OASISExecutable.mli0000644000175000017500000000430611773154621017454 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISBuildSection_intern.ml0000644000175000017500000001623211773154621021166 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 *) (******************************************************************************) (** 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.3.0/src/oasis/FormatExt.ml0000644000175000017500000000402611773154621016333 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 *) (******************************************************************************) 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 oasis-0.3.0/src/oasis/OASISVersion.mli0000644000175000017500000000717711773154621017031 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 *) (******************************************************************************) (** 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 Debian policy for version: http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Version @author Sylvain Le Gall *) (** {2 Version} *) type s = string type t (** Compare versions. *) val version_compare: t -> t -> int (** Convert a string to version. *) val version_of_string: string -> t (** Convert a version to string. *) val string_of_version: t -> string (** Version number value. {b Not exported}. *) val value: t OASISValues.t (** Dump [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. *) val string_of_comparator: comparator -> string (** Convert a comparator to variable name. *) val varname_of_comparator: comparator -> string (** Convert a string to comparator. {b Not exported}. *) val comparator_of_string: string -> comparator (** Simplify comparator, if possible. {b Not exported}. *) val comparator_reduce: comparator -> comparator (** Check that we have a version constraint. {b Not exported}. *) val comparator_value: comparator OASISValues.t (** Check that >= 0.3, useful for oasis version comparison. *) val version_0_3_or_after : t -> bool (** Dump [ODN.t]. {b Not exported}. *) val odn_of_comparator: comparator -> ODN.t oasis-0.3.0/src/oasis/OASISTest.mli0000644000175000017500000000337711773154621016321 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 *) (******************************************************************************) (** Test section @author Sylvain Le Gall *) open OASISTypes (** Schema for the section. {b Not exported}. *) val schema : (common_section * test) OASISSchema.t oasis-0.3.0/src/oasis/OASISUtils.mli0000644000175000017500000001104011773154621016464 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 *) (******************************************************************************) (** Various utilities @author Sylvain Le Gall *) (** {2 Map} *) module MapString: Map.S with type key = String.t (** Convert a string association list to a map. *) val map_string_of_assoc : (string * 'a) list -> 'a MapString.t (** {2 Set} *) (** Set for String. *) module SetString: Set.S with type elt = String.t (** Add a string list to an existing Set. *) val set_string_add_list : SetString.t -> SetString.elt list -> SetString.t (** Convert a string list to a Set. *) val set_string_of_list : SetString.elt list -> SetString.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 (** Split a list using ',' as separator. {b Not exported} *) val split_comma : string -> string list (** Split a list using '\n' as separator. {b Not exported} *) val split_newline : ?trim:bool -> string -> string list (** Split a string containing '(...)' optionally. {b Not exported} *) val split_optional_parentheses : string -> string * (string option) module POSIXShell : sig val split : string -> string list (** [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 escape : string -> string (** [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 unescape : string -> string (** [unescape s] returns a string [s'] removing all backslashes preceding a char. *) ;; end oasis-0.3.0/src/oasis/OASISFlag.ml0000644000175000017500000000321411773154621016070 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISFlag_intern.schema oasis-0.3.0/src/oasis/META0000644000175000017500000000573011773154621014544 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_START # DO NOT EDIT (digest: 724a07cf2dbf32aab7b40e5cb88e7fec) version = "0.3.0" 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.3.0" 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.3.0" description = "'setup.ml' modules for OASIS" requires = "oasis oasis.base" archive(byte) = "cli.cma" archive(byte, plugin) = "cli.cma" exists_if = "cli.cma" ) package "builtin-plugins" ( version = "0.3.0" description = "_oasis file functions" requires = "oasis oasis.base" 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.3.0" 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.3.0/src/oasis/OASISSchema_intern.ml0000644000175000017500000002665111773154621020010 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 *) (******************************************************************************) (** 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; since_version: OASISVersion.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)) ?since_version 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 let since_version = match since_version with | Some str -> Some (OASISVersion.version_of_string str) | None -> None in { kind = kind; qckstrt_lvl = qckstrt_lvl; qckstrt_q = qckstrt_q; since_version = since_version; } (** Create a conditional field *) let new_field_conditional t name ?plugin ?default_cond ?default ?quickstart_level ?quickstart_question ?since_version 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 ?since_version 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 ?since_version 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 ?since_version value) (** Create a field that enables a plugin *) let new_field_plugin t name ?default ?quickstart_level ?quickstart_question ?since_version 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 ?since_version 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 ?since_version 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 ?since_version 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.3.0/src/oasis/OASISExecutable.ml0000644000175000017500000000433211773154621017302 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 *) (******************************************************************************) 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.3.0/src/oasis/OASISDocument.ml0000644000175000017500000000322011773154621016772 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISDocument_intern.schema oasis-0.3.0/src/oasis/OASISTypes.mli0000644000175000017500000003567511773154621016514 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 *) (******************************************************************************) (** 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 containes (empty findlib package) between findlib parent and findlib name *) } (** 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 | 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 | `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. *) 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: string 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. *) (* 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 an OASIS beginner and above. *) | Intermediate (** Ask the question to an intermediate OASIS user and above. *) | Expert (** Ask the question to an OASIS 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.3.0/src/oasis/OASISRecDescParser.ml0000644000175000017500000005311711773154621017713 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 *) (******************************************************************************) (** 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 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"; "Executable"; "SourceRepository"; "Test"; "Document"; (* Expression *) "!"; "&&"; "||"; "("; ")"; "true"; "false" ] in (* OASIS expression *) let rec parse_factor = parser | [< 'Kwd "true" >] -> EBool true | [< 'Kwd "false" >] -> EBool false | [< '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 expresion '%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 "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.3.0/src/oasis/OASISData.mlify0000644000175000017500000000027211773154621016601 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.3.0/src/oasis/OASISLibrary.ml0000644000175000017500000003405711773154621016634 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 *) (******************************************************************************) 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 * group_t list) (* Look for a module file, considering capitalization or not. *) let find_module source_file_exists (cs, bs, lib) 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 (cs, bs, lib) 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 (cs, bs, lib) modul with | `Sources (base_fn, _) -> [base_fn] | `No_sources lst -> OASISMessage.warning ~ctxt (f_ "Cannot find source file matching \ module '%s' in library %s") modul cs.cs_name; lst in List.map (fun nm -> List.map (fun base_fn -> base_fn ^"."^ext) (find_module nm)) 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 = (not lib.lib_pack) && (* Do not install .cmx packed submodules *) match bs.bs_compiled_object with | Native -> true | Best -> is_native | Byte -> false in if should_be_built then 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) type data = common_section * build_section * library 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 | 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, lib) 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 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) let schema = OASISLibrary_intern.schema oasis-0.3.0/src/oasis/OASISSys.mod0000644000175000017500000000056011773154621016145 0ustar gildorgildorOASISGettext.ml OASISContext.ml OASISString.ml OASISUtils.ml PropList.ml OASISMessage.ml OASISVersion.ml OASISLicense.ml OASISExpr.ml OASISTypes.ml OASISUnixPath.ml OASISHostPath.ml OASISSection.ml OASISBuildSection.ml OASISExecutable.ml OASISLibrary.ml OASISFlag.ml OASISPackage.ml OASISSourceRepository.ml OASISTest.ml OASISDocument.ml OASISExec.ml OASISFileUtil.ml oasis-0.3.0/src/oasis/OASISFlag_intern.ml0000644000175000017500000000515511773154621017455 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 *) (******************************************************************************) (** 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 oasis_version nm data -> Flag (cmn_section_gen oasis_version nm data, { flag_description = descr data; flag_default = default data; })) oasis-0.3.0/src/oasis/OASISLicense.mli0000644000175000017500000001124011773154621016750 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 *) (******************************************************************************) (** 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. *) } (** 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 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 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 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 public_domain: license val ocaml_linking_exception: license_exception oasis-0.3.0/src/oasis/OASISFileUtil.ml0000644000175000017500000001334711773154621016744 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 *) (******************************************************************************) 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 (if case_sensitive then file_exists_case else Sys.file_exists) 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 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.3.0/src/oasis/OASISParse.ml0000644000175000017500000000402311773154621016270 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 *) (******************************************************************************) open OASISRecDescParser 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.3.0/src/oasis/OASISDocument_intern.ml0000644000175000017500000001670111773154621020361 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 *) (******************************************************************************) (** 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 oasis_version nm data -> let cs = cmn_section_gen oasis_version 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 OASISVersion.version_0_3_or_after oasis_version 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.3.0/src/oasis/OASISPath_intern.ml0000644000175000017500000000321111773154621017467 0ustar gildorgildor 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" 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.3.0/src/oasis/OASISTypes.ml0000644000175000017500000001714311773154621016331 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 *) (******************************************************************************) 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 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 | 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 | `Executable | `Flag | `SrcRepo | `Test | `Doc ] type package = { oasis_version: OASISVersion.t; ocaml_version: OASISVersion.comparator option; findlib_version: OASISVersion.comparator option; 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: string 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; 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.3.0/src/oasis/FormatExt.mli0000644000175000017500000000405211773154621016503 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 *) (******************************************************************************) (** Extra functions for Format @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 oasis-0.3.0/src/oasis/OASISLexer.mll0000644000175000017500000000430011773154621016447 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 *) (********************************************************************************) { 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.3.0/src/oasis/OASISExecutable_intern.ml0000644000175000017500000000660511773154621020666 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 *) (******************************************************************************) (** 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 oasis_version nm data -> Executable (cmn_section_gen oasis_version nm data, build_section_gen nm data, { exec_main_is = main_is data; exec_custom = custom data; })) oasis-0.3.0/src/oasis/OASISBuildSection.ml0000644000175000017500000001366611773154621017617 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 *) (******************************************************************************) (* 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 = G.vertex_of_value g (`Library, 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, _) | 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.3.0/src/oasis/OASISExec.ml0000644000175000017500000000647311773154621016115 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 *) (******************************************************************************) 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.3.0/src/oasis/OASISFileTemplate.ml0000644000175000017500000004123211773154621017574 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 *) (******************************************************************************) open OASISMessage open OASISGettext open OASISUtils open OASISTypes open OASISString 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; } 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 template_make fn comment header body footer = { fn = fn; comment = comment; header = header; body = Body body; footer = footer; perm = 0o644; } let template_of_string_list ~ctxt ~template fn comment lst = (* Convert a Digest.to_hex string back into Digest.t *) let digest_of_hex s = let d = String.make 16 '\000' in let hex_str = "0x00" in for i = 0 to (String.length d) - 1 do hex_str.[2] <- s.[2 * i]; hex_str.[3] <- s.[2 * i + 1]; d.[i] <- Char.chr (int_of_string hex_str) done; 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 (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 -> 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 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 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 ~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 -> BodyWithDigest (Digest.string (String.concat "\n" lst), 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 = {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_file t = (* Be sure that digest match body content *) let t = digest_update t in (* Write body, header and footer to output file. Separate * each part by appropriate comment and digest. *) let chn_out = open_out_gen [Open_wronly; Open_creat; Open_trunc; Open_binary] t.perm t.fn in let output_line str = output_string chn_out str; output_char chn_out '\n' in let output_lst = List.iter output_line in output_lst t.header; begin match t.body with | NoBody -> () | BodyWithDigest (d, lst) -> output_line t.comment.start; output_line (t.comment.of_string (Printf.sprintf "DO NOT EDIT (digest: %s)" (Digest.to_hex d))); output_lst lst; output_line t.comment.stop | Body lst -> output_line t.comment.start; output_lst lst; output_line t.comment.stop end; output_lst t.footer; 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) -> begin 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 end | Change (fn, None) -> warning ~ctxt (f_ "Cannot restore file '%s', no backup.") fn | NoChange -> () let file_generate ~ctxt ~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 -> begin let fn_backup = fn ^ "." ^ ext in if not (Sys.file_exists fn_backup) then begin Sys.rename fn fn_backup; OASISFileUtil.cp ~ctxt fn_backup fn; fn_backup end else begin backup_aux tl end 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.fn t.comment in 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 info ~ctxt (f_ "File %s doesn't exist, creating it.") t.fn; to_file t; Create t.fn end module S = Map.Make ( struct type t = host_filename let compare = OASISHostPath.compare end) exception AlreadyExists of host_filename type templates = template S.t let empty = S.empty let find = S.find let add e t = if S.mem e.fn t then raise (AlreadyExists e.fn) else S.add e.fn e t let remove fn t = S.remove fn t let replace e t = S.add e.fn e t let fold f t acc = S.fold (fun k e acc -> f e acc) t acc oasis-0.3.0/src/oasis/OASISSysLight.mod0000644000175000017500000000003511773154621017132 0ustar gildorgildorOASISGettext.ml OASISExpr.ml oasis-0.3.0/src/oasis/OASISPlugin.mli0000644000175000017500000002074211773154621016633 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 *) (******************************************************************************) (** Plugins creation and management The whole module is {b not exported}. @author Sylvain Le Gall *) (** {2 Types} *) open OASISTypes module MapPlugin: Map.S with type key = plugin_kind plugin module SetPlugin: Set.S with type elt = plugin_kind plugin 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. *) 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.3.0/src/oasis/OASISGettext.ml0000644000175000017500000000375611773154621016656 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 *) (******************************************************************************) 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.3.0/src/oasis/OASISFormat.ml0000644000175000017500000001237511773154621016457 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 *) (******************************************************************************) 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) | 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.3.0/src/oasis/OASISGettext.mli0000644000175000017500000000506011773154621017015 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISLicense.ml0000644000175000017500000004214211773154621016604 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 *) (******************************************************************************) (** 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 let string_of_license s = s let string_of_license_exception s = s type license_data = { long_name: string; versions: OASISVersion.t list; note: string option; } let all_licenses = HashStringCsl.create 13 let mk_license nm ?(versions=[]) ?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 if HashStringCsl.mem all_licenses nm then failwithf (f_ "Duplicate license '%s'") nm; HashStringCsl.add all_licenses nm { long_name = long_name; versions = List.map OASISVersion.version_of_string (expand_version versions); note = note; }; nm let license_data () = let lst = HashStringCsl.fold (fun license data acc -> (license, {data with (* Really translate strings *) long_name = s_ data.long_name; note = match data.note with | Some str -> Some (s_ str) | None -> None}) :: acc) 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 bsd3 = mk_license "BSD3" (ns_ "Berkeley software distribution license (3 clauses)") let bsd4 = mk_license "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 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 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_dep5 ~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 = if HashStringCsl.mem all_licenses str then begin { license = str; excption = None; version = NoVersion; } end else begin (* Try to find a version *) let str', plus_present = try OASISString.strip_ends_with ~what:"+" str, true with Not_found -> str, false in let license, version = let to_string lst = let buf = Buffer.create (List.length lst) in List.iter (Buffer.add_char buf) lst; Buffer.contents buf in let ver = ref [] in let nm = ref [] in let in_ver = ref true in for i = String.length str' - 1 downto 0 do if !in_ver then begin match str'.[i] with | '-' -> in_ver := false | '0'..'9' | '.' as c -> ver := c :: !ver | c -> nm := c :: !nm; in_ver := false end else nm := str'.[i] :: !nm done; (* We don't want an empty name for license *) if !nm = [] then begin nm := !ver; ver := [] end; if !ver = [] && plus_present then begin nm := !nm @ ['+'] end; to_string !nm, if !ver = [] then NoVersion else if plus_present then VersionOrLater (OASISVersion.version_of_string (to_string !ver)) else Version (OASISVersion.version_of_string (to_string !ver)) in if not (HashStringCsl.mem all_licenses license) then OASISMessage.warning ~ctxt (f_ "Unknown license '%s' in '%s'") license str else begin match version with | VersionOrLater ver | Version ver -> let license_data = HashStringCsl.find all_licenses license in if not (List.mem ver license_data.versions) then OASISMessage.warning ~ctxt (f_ "Version '%s' is not known for \ license '%s' in '%s'") (OASISVersion.string_of_version ver) license str | NoVersion -> () end; { license = license; excption = None; version = version; } end 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_dep5 ~ctxt str) with e -> begin failwithf (f_ "Cannot parse license '%s': %s") str (Printexc.to_string e) end let rec string_of_dep5 = function | DEP5Unit t -> begin let ver = match t.version with | Version v -> "-"^(OASISVersion.string_of_version v) | VersionOrLater v -> "-"^(OASISVersion.string_of_version v)^"+" | NoVersion -> "" in let exceptions = match t.excption with | None -> "" | Some str -> " with "^str^" exception" in t.license^ver^exceptions end | DEP5Or lst -> begin String.concat " or " (List.map string_of_dep5 lst) end | DEP5And [DEP5Or _ as t1; DEP5Unit _ as t2] -> (string_of_dep5 t1)^", and "^(string_of_dep5 t2) | DEP5And lst -> begin String.concat " and " (List.map (fun t -> let str = string_of_dep5 t in match t with | DEP5Or _ -> "("^str^")" | _ -> str) lst) end let to_string = function | DEP5License dep5 -> string_of_dep5 dep5 | OtherLicense url -> 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 = HashStringCsl.fold (fun license extra acc -> 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) extra.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 = 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.3.0/src/oasis/OASISLibrary.mli0000644000175000017500000000762711773154621017010 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 *) (******************************************************************************) (** Library section @author Sylvain Le Gall *) 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 (** [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 (** 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 * 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 (** Schema for the section. {b Not exported}. *) val schema : (common_section * build_section * library) OASISSchema.t oasis-0.3.0/src/oasis/OASISConf.ml.ab0000644000175000017500000000331311773154621016465 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 *) (******************************************************************************) let version_full = OASISVersion.version_of_string "$(pkg_version)" let version_short = OASISVersion.chop version_full oasis-0.3.0/src/oasis/OASISSection_intern.ml0000644000175000017500000000450611773154621020207 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 *) (******************************************************************************) open OASISTypes open OASISSection (** Add section fields *) let section_fields hlp (schm: 'a OASISSchema_intern.t) (sync: 'a -> common_section) = fun (oasis_version: OASISVersion.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.3.0/src/oasis/ODNFunc.mli0000644000175000017500000000503011773154621016023 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISAst.ml0000644000175000017500000002746211773154621015761 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 *) (******************************************************************************) (** 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 let default_ctxt = { cond = None; append = false; valid_flags = []; ctxt = conf.OASISRecDescParser.ctxt; } in (* Convert flags into ctxt *) let ctxt_of_sections scts = {default_ctxt with valid_flags = (List.fold_left (fun acc -> function | Flag (cs, _) -> cs.cs_name :: acc | _ -> acc) default_ctxt.valid_flags scts)} 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 oasis_version scts stmt' = let data = PropList.Data.create () in let ctxt = ctxt_of_sections scts in let schm = schm.OASISSchema_intern.schm in stmt schm data ctxt stmt'; OASISCheck.check_schema ~ctxt:ctxt.ctxt ((PropList.Schema.name schm)^" "^nm) schm oasis_version data; (gen oasis_version nm data) :: scts in (* Extract and cache oasis_version *) let oasis_version = let rver = ref None in fun data -> try let nver = OASISPackage_intern.oasis_version data in let () = match !rver with | Some ver -> if nver <> ver then failwithf (f_ "Multiple definition of OASISFormat (%s and %s)") (OASISVersion.string_of_version ver) (OASISVersion.string_of_version nver); | None -> rver := Some nver in nver with PropList.Not_set _ -> failwith (s_ "OASISFormat not defined at the beginning of the file, \ consider starting with 'OASISFormat: ...'") 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 acc = function | TSLibrary (nm, stmt) -> schema_stmt OASISLibrary_intern.generator nm OASISLibrary.schema (oasis_version pkg_data) acc stmt | TSExecutable (nm, stmt) -> schema_stmt OASISExecutable_intern.generator nm OASISExecutable.schema (oasis_version pkg_data) acc stmt | TSFlag (nm, stmt) -> schema_stmt OASISFlag_intern.generator nm OASISFlag.schema (oasis_version pkg_data) acc stmt | TSSourceRepository (nm, stmt) -> schema_stmt OASISSourceRepository_intern.generator nm OASISSourceRepository.schema (oasis_version pkg_data) acc stmt | TSTest (nm, stmt) -> schema_stmt OASISTest_intern.generator nm OASISTest.schema (oasis_version pkg_data) acc stmt | TSDocument (nm, stmt) -> schema_stmt OASISDocument_intern.generator nm OASISDocument.schema (oasis_version pkg_data) acc stmt | TSStmt stmt' -> stmt OASISPackage.schema.OASISSchema_intern.schm pkg_data (ctxt_of_sections acc) stmt'; acc | TSBlock blk -> List.fold_left (top_stmt pkg_data) acc blk in (* Start with package schema/writer *) let data = PropList.Data.create () in let sections = top_stmt data [] ast in let pkg = OASISCheck.check_schema ~ctxt:default_ctxt.ctxt "package" OASISPackage.schema.OASISSchema_intern.schm (oasis_version data) data; 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 = OASISLibrary.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 (OASISLibrary.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) | 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:default_ctxt.ctxt pkg; pkg oasis-0.3.0/src/oasis/OASISBuildSection.mli0000644000175000017500000000406611773154621017762 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISPackage.ml0000644000175000017500000000321711773154621016555 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 *) (******************************************************************************) (* END EXPORT *) let schema = OASISPackage_intern.schema oasis-0.3.0/src/oasis/OASISString.ml0000644000175000017500000001122111773154621016462 0ustar gildorgildor (** 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 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 oasis-0.3.0/src/oasis/OASISParser.mly0000644000175000017500000000534611773154621016654 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 */ /********************************************************************************/ %{ 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.3.0/src/oasis/PropList.mli0000644000175000017500000001251511773154621016351 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISVersion_types.ml0000644000175000017500000000346011773154621020073 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISFileUtil.mli0000644000175000017500000000543511773154621017114 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISPackage.mli0000644000175000017500000000335411773154621016730 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 *) (******************************************************************************) (** Package toplevel @author Sylvain Le Gall *) (** Schema for the section. {b Not exported}. *) val schema: OASISTypes.package OASISSchema.t oasis-0.3.0/src/oasis/OASISVersion_parser.mly0000644000175000017500000000426411773154621020417 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 */ /********************************************************************************/ %{ 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.3.0/src/oasis/OASISExpr.mli0000644000175000017500000000756711773154621016325 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 *) (******************************************************************************) (** 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 against provided 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.3.0/src/oasis/OASISFlag.mli0000644000175000017500000000340011773154621016236 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 *) (******************************************************************************) (** Flag section @author Sylvain Le Gall *) open OASISTypes (** Schema for the section. {b Not exported}. *) val schema : (common_section * flag) OASISSchema.t oasis-0.3.0/src/oasis/OASISHostPath.mli0000644000175000017500000000412411773154621017123 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 *) (******************************************************************************) (** 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 (** 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 oasis-0.3.0/src/oasis/OASISCustom.ml0000644000175000017500000000442011773154621016471 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 *) (******************************************************************************) (** 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.3.0/src/oasis/OASISSchema.mli0000644000175000017500000000636511773154621016602 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 *) (******************************************************************************) (** 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 valye. [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 -> ?since_version:string -> '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 -> ?since_version:string -> 'a OASISValues.t -> (unit -> string) -> 'c OASISPlugin.prop -> ('b -> 'c -> 'a OASISExpr.choices) -> PropList.Data.t -> 'a OASISExpr.choices oasis-0.3.0/src/oasis/OASISPlugin.ml0000644000175000017500000003363511773154621016467 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 *) (******************************************************************************) 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; 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 = Map.Make ( struct type t = plugin_kind plugin let compare = plugin_compare end) module SetPlugin = Set.Make ( struct type t = plugin_kind plugin let compare = plugin_compare end) 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 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) (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.3.0/src/oasis/PropList.ml0000644000175000017500000001646311773154621016206 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 *) (******************************************************************************) 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.3.0/src/oasis/OASISHostPath.ml0000644000175000017500000000566011773154621016760 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 *) (******************************************************************************) 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 compare fn1 fn2 = let fn_norm fn = match OASISPath_intern.fn_reduce [] (OASISPath_intern.fn_reader fn) with | (`RootRelative str) :: tl -> (`Root str) :: `CurrentDir :: tl | lst -> lst in 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 add_extension fn ext = fn^"."^ext oasis-0.3.0/src/oasis/ODNFunc.ml0000644000175000017500000000412411773154621015655 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 *) (******************************************************************************) 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.3.0/src/oasis/OASISContext.ml0000644000175000017500000000533211773154621016646 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 *) (******************************************************************************) open OASISGettext type level = [ `Debug | `Info | `Warning | `Error] type t = { 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 args () = ["-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")] oasis-0.3.0/src/oasis/OASISLicense_parser.mly0000644000175000017500000000120011773154621020337 0ustar gildorgildor %{ 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.3.0/src/oasis/OASISUnixPath.ml0000644000175000017500000001417711773154621016771 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 *) (******************************************************************************) 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] oasis-0.3.0/src/cli/0000755000175000017500000000000011773154623013521 5ustar gildorgildoroasis-0.3.0/src/cli/MainHelp.mkd0000644000175000017500000000046711773154621015720 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.3.0/src/cli/SetupCleanHelp.mkd0000644000175000017500000000041511773154621017070 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.3.0/src/cli/HelpHelp.mkd0000644000175000017500000000011111773154621015706 0ustar gildorgildorThis subcommand display help of other subcommands or of all subcommands. oasis-0.3.0/src/cli/PluginBundle.ml0000644000175000017500000000323411773154621016443 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 *) (******************************************************************************) (** Actions relative to oasis-bundle @author Sylvain Le Gall *) oasis-0.3.0/src/cli/Main.ml0000644000175000017500000000460711773154621014744 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 *) (******************************************************************************) (** Main for OASIS *) open MainGettext open OASISTypes open OASISUtils open OASISPlugin open OASISBuiltinPlugins open BaseMessage open SubCommand open Format open FormatExt open Setup open SetupDev open SetupClean open Quickstart open Manual open Check open Query open Version open PluginDB open PluginInstall open PluginVCS open PluginBundle open Plugins open Help let () = (* Run subcommand *) try let () = OASISBuiltinPlugins.init () in let main = ArgExt.parse () in main () with e -> begin if Printexc.backtrace_status () then Printexc.print_backtrace stderr; begin match e with | Failure str -> error "%s" str | e -> error "%s" (Printexc.to_string e) end; exit 1 end oasis-0.3.0/src/cli/Quickstart.ml0000644000175000017500000000544711773154621016215 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 *) (******************************************************************************) (** Run a oasis writer helper @author Sylvain Le Gall *) open OASISGettext open OASISQuickstart open OASISTypes open SubCommand let qckstrt_lvl = ref Beginner let interf = ref Human let main () = OASISQuickstart.to_file ~ctxt:!BaseContext.default !ArgCommon.oasis_fn !qckstrt_lvl !interf Setup.main let scmd = let lvls = [ s_ "beginner", Beginner; s_ "intermediate", Intermediate; s_ "expert", Expert; ] in {(SubCommand.make ~std_usage:true "quickstart" (s_ "Launch an helper to write `_oasis` file") CLIData.quickstart_mkd main) with scmd_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.") ) :: SetupDev.scmd.scmd_specs} let () = SubCommand.register scmd oasis-0.3.0/src/cli/MainGettext.ml0000644000175000017500000000405711773154621016310 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 *) (******************************************************************************) (** 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.3.0/src/cli/CLIData.mlify0000644000175000017500000000065411773154621015767 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" VarString plugin_mkd "PluginHelp.mkd" oasis-0.3.0/src/cli/QueryHelp.mkd0000644000175000017500000000102511773154621016130 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.3.0/src/cli/SetupDev.ml0000644000175000017500000000524311773154621015614 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 *) (******************************************************************************) (** Like Setup but in development mode (deprecated). @author Sylvain Le Gall *) open SubCommand open OASISGettext let main () = failwith (s_ "The SetupDev subcommand is deprecated, use Setup") let scmd = {(SubCommand.make ~std_usage:true "setup-dev" (s_ "Translate _oasis into a build system that auto-update (deprecated).") CLIData.setup_dev_mkd main) with scmd_specs = ([ "-real-oasis", Arg.Unit ignore, s_ " Use the real 'oasis' executable filename when generating developper mode \ setup.ml."; "-run", Arg.Rest ignore, s_ " Run a command after generating files, this is the mode used \ by setup.ml in developper mode. Don't use it directly."; "-only-setup", Arg.Set (ref false), s_ " When generating the build system, keep only setup.ml and \ delete other generated files."; ] @ ArgCommon.oasis_fn_specs)} let () = SubCommand.register scmd oasis-0.3.0/src/cli/SetupHelp.mkd0000644000175000017500000000113211773154621016122 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. It also contains a small piece of code that checks for `_oasis` changes. If it detects a change in this file, it will try to run `oasis setup` again to regenerate the `setup.ml`. It also checks for `oasis` version, because we need to use at least the same version as the one that has generated the first version of `setup.ml`. You can disable this behavior using `ocaml setup.ml -no-update-setup-ml [...]`. oasis-0.3.0/src/cli/Setup.ml0000644000175000017500000001052411773154621015153 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 *) (******************************************************************************) (** Create the configure, build and install system @author Sylvain Le Gall *) open OASISGettext open OASISUtils open SubCommand open BaseGenerate let roasis_exec = ref None let rupdate = ref NoUpdate let main () = let oasis_setup_args = List.flatten [ if !roasis_exec <> None then ["-real-oasis"] else []; if !ArgCommon.ignore_plugins then ["-ignore-plugins"] else []; if !ArgCommon.oasis_fn <> ArgCommon.default_oasis_fn then ["-oasis"; !ArgCommon.oasis_fn] else []; if !rupdate = Weak then ["-setup-update"; "weak"] else if !rupdate = 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:!ArgCommon.oasis_fn ?oasis_exec:!roasis_exec ~oasis_setup_args !rupdate (OASISParse.from_file ~ctxt:!BaseContext.default !ArgCommon.oasis_fn) in () let scmd = {(SubCommand.make "setup" (s_ "Translate _oasis into a build system") CLIData.setup_mkd main) with scmd_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_ "mod Different ways to allow setup.ml to auto-update. \ The 'weak' is 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 'dynamic' mode has a strong \ dependency on the library oasis but it generates a very \ small `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 have very avoid VCS history \ pollution, use the 'dynamic' mode. Always distribute tarball with mode 'none'." ] @ ArgCommon.oasis_fn_specs} let () = SubCommand.register scmd oasis-0.3.0/src/cli/PluginInstall.ml0000644000175000017500000000323511773154621016641 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 *) (******************************************************************************) (** Actions relative to oasis-install @author Sylvain Le Gall *) oasis-0.3.0/src/cli/SetupDevHelp.mkd0000644000175000017500000000023711773154621016566 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.3.0/src/cli/SubCommand.ml0000644000175000017500000000537511773154621016113 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 *) (******************************************************************************) open OASISUtils open OASISGettext type t = { scmd_name: string; scmd_synopsis: string; scmd_help: string; scmd_specs: (Arg.key * Arg.spec * Arg.doc) list; scmd_usage: string; scmd_anon: string -> unit; scmd_main: unit -> unit; } let make ?(std_usage=false) nm snps hlp main = { scmd_name = nm; scmd_synopsis = snps; scmd_help = hlp; scmd_specs = []; scmd_usage = if std_usage then s_ "[options*]" else ""; scmd_anon = (failwithf (f_ "Don't know what to do with '%s'")); scmd_main = main; } module Set = Set.Make ( struct type t' = t type t = t' let compare t1 t2 = String.compare t1.scmd_name t2.scmd_name end) let all = ref Set.empty let register t = all := Set.add t !all let fold f acc = Set.fold f !all acc let find nm = let res = fold (fun c acc -> if acc = None && c.scmd_name = nm then Some c else acc) None in match res with | Some c -> c | None -> failwithf (f_ "Subcommand '%s' doesn't exist") nm oasis-0.3.0/src/cli/CheckHelp.mkd0000644000175000017500000000010211773154621016033 0ustar gildorgildorThis subcommand load an `_oasis` file and apply standard checks. oasis-0.3.0/src/cli/QuickstartHelp.mkd0000644000175000017500000000051511773154621017160 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.3.0/src/cli/VersionHelp.mkd0000644000175000017500000000000011773154621016440 0ustar gildorgildoroasis-0.3.0/src/cli/ArgExt.ml0000644000175000017500000002042711773154621015250 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 *) (******************************************************************************) (** Parsing of command line arguments *) open OASISGettext open BaseMessage open SubCommand open OASISUtils open Format open FormatExt open FormatMarkdown let global_options = ref [] let add_global_options lst = global_options := lst @ !global_options let specs, usage_msg = [ "-C", Arg.String (fun str -> Sys.chdir str), (s_ "dir Change directory before running."); ] @ (BaseContext.args ()) @ !global_options, ("OASIS v" ^ OASISVersion.string_of_version OASISConf.version_full ^ " (C) 2009-2010 OCamlCore SARL\n" ^ s_ "\n\ oasis [global-options*] subcommand [subcommand-options*]\n\ \n\ Environment variables: \n\ \n\ OASIS_PAGER: pager to use to display long textual output.\n\ \n\ Global command line options:") type help_extent = | NoSubCommand | SubCommand of string | AllSubCommand type help_style = | Markdown | Output let pp_print_help 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 sz = SubCommand.fold (fun c sz -> max sz (String.length c.scmd_name)) 0 in pp_print_para fmt (s_ "Available subcommands:"); SubCommand.fold (fun c () -> match hsty with | Markdown -> pp_print_def fmt ("`"^c.scmd_name^"`") [pp_print_string_spaced, c.scmd_synopsis] | Output -> pp_print_output_def sz fmt (c.scmd_name, c.scmd_synopsis)) (); if hsty = Output then pp_print_newline fmt () in let pp_print_scmd fmt ~global_options scmd = pp_print_title 2 fmt (Printf.sprintf (f_ "Subcommand %s") scmd.scmd_name); 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 scmd.scmd_usage; pp_print_endblock fmt (); if global_options then begin pp_print_para fmt (s_ "Global options: "); pp_print_specs true fmt specs end; if scmd.scmd_specs <> [] then begin pp_print_para fmt (s_ "Options: "); pp_print_specs false fmt scmd.scmd_specs end in 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 specs; pp_print_scmds fmt (); end | SubCommand _ -> () end; begin match hext with | NoSubCommand -> () | SubCommand nm -> pp_print_scmd fmt ~global_options:true (SubCommand.find nm) | AllSubCommand -> SubCommand.fold (fun scmd () -> pp_print_scmd fmt ~global_options:false scmd) () end let parse () = let pos = ref 0 in let scmd = ref (SubCommand.make (s_ "none") "" "" (fun () -> pp_print_help NoSubCommand Output err_formatter (); failwith (s_ "No subcommand defined, call 'oasis help' for help"))) in let scmd_args = ref [||] in let set_scmd s = scmd := SubCommand.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 split_newline ~trim:false str with | fst :: _ -> fst | [] -> s_ "Unknown error on the command line" in match exc with | Arg.Bad txt -> pp_print_help hext Output err_formatter (); prerr_newline (); prerr_endline (get_bad txt); exit 2 | Arg.Help txt -> pp_print_help hext Output std_formatter (); exit 0 | e -> raise e in (* Parse global options and set scmd *) begin try Arg.parse_argv ~current:pos Sys.argv (Arg.align specs) set_scmd usage_msg with e -> handle_error e NoSubCommand end; (* Parse subcommand options *) begin try Arg.parse_argv ~current:(ref 0) !scmd_args (Arg.align !scmd.scmd_specs) !scmd.scmd_anon (Printf.sprintf (f_ "Subcommand %s options:\n") !scmd.scmd_name) with e -> handle_error e (SubCommand !scmd.scmd_name) end; !scmd.scmd_main oasis-0.3.0/src/cli/Plugins.ml0000644000175000017500000001014011773154621015466 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 *) (******************************************************************************) (** Load extra action from plugins @author Sylvain Le Gall *) open OASISGettext open SubCommand open PluginLoader (** Plugin for the command line. *) let plugin_cli_t () = { PluginLoader. system = "oasis-cli"; msg = !BaseContext.default.OASISContext.printf } (** Plugin for handling _oasis. *) let plugin_pkg_t () = {(plugin_cli_t ()) with system = "oasis"} (** Initialization and general command-line argument. *) let () = PluginLoader.init PluginsLoaded.exec_oasis_build_depends_rec; ArgExt.add_global_options [ "--plugin-cli", Arg.String (fun str -> PluginLoader.load (plugin_cli_t ()) str), (s_ "nm Load a plugin.") ] (** Display long help. *) let long = ref false let main () = let print = function | [] -> print_endline (s_ "") | lst -> List.iter (fun e -> let synopsis = match e.synopsis with | Some str -> str | None -> s_ "" in begin match e.version with | Some ver -> Printf.printf (f_ "%s (v%s): %s\n") e.name ver synopsis | None -> Printf.printf (f_ "%s: %s\n") e.name synopsis end; if !long then begin Printf.printf (f_ "Findlib name: %s\n") e.findlib_name; match e.description with | Some str -> Printf.printf (f_ "Description:\n%s\n") str | None -> () end; Printf.printf "%!") lst in print_endline (s_ "Command-line plugins, use --plugin-cli command \ line option to load:"); print (PluginLoader.list (plugin_cli_t ())); print_newline (); print_endline (s_ "_oasis plugins, loaded if present in _oasis:"); print (PluginLoader.list (plugin_pkg_t ())) let scmd = {(SubCommand.make ~std_usage:true "plugin-list" (s_ "List available plugin") CLIData.plugin_mkd main) with scmd_specs = [ "--long", Arg.Set long, " Display a long description for plugin." ]} let () = SubCommand.register scmd oasis-0.3.0/src/cli/Version.ml0000644000175000017500000000365711773154621015511 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 *) (******************************************************************************) (** Display version of the OASIS command *) open SubCommand open OASISGettext let main () = print_endline (OASISVersion.string_of_version OASISConf.version_full) let scmd = SubCommand.make "version" (s_ "Display the version of the OASIS program running") CLIData.version_mkd main let () = SubCommand.register scmd oasis-0.3.0/src/cli/SubCommand.mli0000644000175000017500000000623011773154621016253 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 *) (******************************************************************************) (** SubCommand definition @author Sylvain Le Gall *) open OASISTypes 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_specs: (Arg.key * Arg.spec * Arg.doc) list; (** [Arg] spec list *) scmd_usage: string; (** [Arg] usage text *) scmd_anon: string -> unit; (** [Arg] anon function *) scmd_main: unit -> unit; (** Real action of the subcommand *) } (** [make ~std_usage name synopsis help main] Create a subcommand using provided data, see {!t} for their meanings. If [~std_usage] is set use ["[options*]"] for it. Fields that are not defined by make use a sane default. *) val make : ?std_usage:bool -> name -> string -> string -> (unit -> unit) -> t (** Register a subcommand. *) val register : t -> unit (** Iterate through subcommands. *) val fold : (t -> 'a -> 'a) -> 'a -> 'a (** Find a subcommand. *) val find : name -> t oasis-0.3.0/src/cli/SetupClean.ml0000644000175000017500000000612511773154621016120 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 *) (******************************************************************************) (** Clean generated template files @author Sylvain Le Gall *) open SubCommand open OASISGettext open OASISFileTemplate open OASISPlugin let replace_sections = ref false let main () = BaseGenerate.restore (); if !replace_sections then begin let ctxt, _ = BaseSetup.of_package ~oasis_fn:!ArgCommon.oasis_fn ~setup_update:false (OASISParse.from_file ~ctxt:!BaseContext.default !ArgCommon.oasis_fn) in OASISFileTemplate.fold (fun tmpl () -> match tmpl.body with | Body _ | BodyWithDigest _ -> begin let _chng: file_generate_change = file_generate ~ctxt:!BaseContext.default ~backup:false {tmpl with body = Body []} in () end | NoBody -> ()) ctxt.files () end let scmd = {(SubCommand.make ~std_usage:true "setup-clean" (s_ "Clean all template files from their content") CLIData.setup_clean_mkd main) with scmd_specs = [ "-replace-sections", Arg.Set replace_sections, s_ "Empty replace section in generated files (i.e. remove content \ between OASIS_START and OASIS_STOP)."; ]} let () = SubCommand.register scmd oasis-0.3.0/src/cli/Pager.ml0000644000175000017500000000563111773154621015114 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 *) (******************************************************************************) (** 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.3.0/src/cli/cli.mllib0000644000175000017500000000331111773154621015305 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_START # DO NOT EDIT (digest: 50d3a189d7e6256264a84b5ba2a3d58c) SubCommand ArgExt Pager CLIData # OASIS_STOP oasis-0.3.0/src/cli/Help.ml0000644000175000017500000000456611773154621014754 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 *) (******************************************************************************) (** Help on subcommands *) open SubCommand open ArgExt open OASISGettext let scmd_name = ref None let main () = let pp_print_help = match !scmd_name with | None -> pp_print_help NoSubCommand | Some "all" -> pp_print_help AllSubCommand | Some nm -> pp_print_help (SubCommand nm) in let pager, fmt = Pager.open_out () in try pp_print_help Output fmt (); Pager.close_out pager with e -> Pager.close_out pager; raise e let scmd = {(SubCommand.make "help" (s_ "Display help for a subcommand") CLIData.help_mkd main) with scmd_usage = s_ "[subcommand|all]"; scmd_anon = (fun s -> scmd_name := Some s)} let () = SubCommand.register scmd oasis-0.3.0/src/cli/Manual.ml0000644000175000017500000000533011773154621015267 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 *) (******************************************************************************) (** Display the manual @author Sylvain Le Gall *) open SubCommand open OASISGettext let output = ref None let main () = 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 = Pager.open_out () in fmt, (fun () -> Pager.close_out pager) in OASISHelp.pp_print_help fmt (* CLI help *) (ArgExt.pp_print_help ArgExt.AllSubCommand ArgExt.Markdown) (* Fields from schema *) BaseEnv.schema (* Environment variable *) (let lst = BaseEnv.var_all () in fun nm _ -> List.mem nm lst); fclose () let scmd = {(SubCommand.make "manual" (s_ "Display user manual") CLIData.manual_mkd main) with scmd_specs = ["-o", Arg.String (fun s -> output := Some s), "fn Output manual to filename."]} let () = SubCommand.register scmd oasis-0.3.0/src/cli/PluginVCS.ml0000644000175000017500000000323111773154621015662 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 *) (******************************************************************************) (** Actions relative to oasis-vcs @author Sylvain Le Gall *) oasis-0.3.0/src/cli/PluginDB.ml0000644000175000017500000000322711773154621015521 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 *) (******************************************************************************) (** Action relative to oasis-db @author Sylvain Le Gall *) oasis-0.3.0/src/cli/ArgCommon.ml0000644000175000017500000000372211773154621015737 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 *) (******************************************************************************) (** Common arguments *) open MainGettext let default_oasis_fn = "_oasis" let oasis_fn = ref default_oasis_fn let oasis_fn_specs = [ "-oasis", Arg.Set_string oasis_fn, s_ "fn _oasis file to use."; ] let ignore_plugins = ref false let ignore_plugins_specs = [ "-ignore-plugins", Arg.Set ignore_plugins, s_ " Ignore plugin's field."; ] oasis-0.3.0/src/cli/ManualHelp.mkd0000644000175000017500000000056111773154621016244 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.3.0/src/cli/Query.ml0000644000175000017500000001461311773154621015163 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 *) (******************************************************************************) (** Load and query _oasis file @author Sylvain Le Gall *) open SubCommand open BaseMessage open Genlex open OASISGettext open OASISTypes open OASISSection open OASISUtils let queries = ref [] let separator = ref "\n" let lexer = make_lexer ["ListSections"; "ListFields"; "("; ")"; "."] let query pkg 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 _ _ -> try let _v : string = PropList.Schema.get schm data nm in (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 () = let pkg = OASISParse.from_file ~ctxt:{!BaseContext.default with OASISContext.ignore_plugins = !ArgCommon.ignore_plugins} !ArgCommon.oasis_fn in let answers = List.rev_map (query pkg) !queries in print_endline (String.concat !separator answers) let scmd = {(SubCommand.make ~std_usage:false "query" (s_ "Query an _oasis file") CLIData.query_mkd main) with scmd_usage = s_ "[options*] query*"; scmd_anon = (fun e -> queries := e :: !queries); scmd_specs = ([ "-separator", Arg.Set_string separator, s_ "str String to add between answers." ] @ ArgCommon.oasis_fn_specs @ ArgCommon.ignore_plugins_specs)} let () = SubCommand.register scmd oasis-0.3.0/src/cli/PluginHelp.mkd0000644000175000017500000000201611773154621016262 0ustar gildorgildorThis subcommand list available plugins on the system. TODO: most of the plugins listed here are not yet released. 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`. You can load them using `oasis --plugin-cli 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 instal 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. oasis-0.3.0/src/cli/Check.ml0000644000175000017500000000431311773154621015067 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 *) (******************************************************************************) (** Check an _oasis file @author Sylvain Le Gall *) open OASISGettext open SubCommand let main () = let _pkg: OASISTypes.package = OASISParse.from_file ~ctxt:{!BaseContext.default with OASISContext.ignore_plugins = !ArgCommon.ignore_plugins} !ArgCommon.oasis_fn in () let scmd = {(SubCommand.make ~std_usage:true "check" (s_ "Check an _oasis file") CLIData.check_mkd main) with scmd_specs = (ArgCommon.ignore_plugins_specs @ ArgCommon.oasis_fn_specs)} let () = SubCommand.register scmd oasis-0.3.0/src/tools/0000755000175000017500000000000011773154621014110 5ustar gildorgildoroasis-0.3.0/src/tools/oasis-dist.ml0000755000175000017500000002263411773154621016533 0ustar gildorgildor#!/usr/bin/ocamlrun ocaml (******************************************************************************) (* 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 *) (******************************************************************************) #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 () = 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."; ] (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 "_oasis" 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; 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.3.0/src/tools/oasis-i18n0000755000175000017500000000652711773154621015743 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 # ################################################################################ #!/bin/sh ################################################################################ # 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 # ################################################################################ LOCDIR="$(dirname $(readlink -f $0))" BUILDDIR="$(readlink -f "$LOCDIR/../../_build")" export OASIS_GETTEXT_DIR="$BUILDDIR/po" exec "$BUILDDIR/src/cli/oasis" "$@" oasis-0.3.0/src/tools/oasis0000755000175000017500000000664111773154621015163 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 # ################################################################################ #!/bin/sh ################################################################################ # 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 # ################################################################################ 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.3.0/src/tools/oasis-announce.ml0000755000175000017500000001212111773154621017364 0ustar gildorgildor#!/usr/bin/ocamlrun ocaml (******************************************************************************) (* 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 *) (******************************************************************************) #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 "_oasis" 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.3.0/src/tools/setup-wc.awk0000644000175000017500000000067211773154621016370 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.3.0/src/tools/guess-cmx.ml0000644000175000017500000001313311773154621016356 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 *) (******************************************************************************) (* Work in progress, only for testing purpose Try to guess file to install depending on archive (.cma) and published interface (.cmi) *) #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.3.0/src/tools/oasis.bat0000644000175000017500000000317511773154621015724 0ustar gildorgildorrem############################################################################### rem OASIS: architecture for building OCaml libraries and applications # rem # rem Copyright (C) 2008-2010, 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.3.0/src/builtin-plugins.mllib0000644000175000017500000000456511773154621017130 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_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.3.0/src/OASISBuiltinPlugins.ml0000644000175000017500000000357111773154621017057 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 *) (******************************************************************************) (** 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.3.0/src/base/0000755000175000017500000000000011773154621013662 5ustar gildorgildoroasis-0.3.0/src/base/BaseCheck.ml0000644000175000017500000001072611773154621016032 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 *) (******************************************************************************) 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.3.0/src/base/BaseStandardVar.ml0000644000175000017500000002427211773154621017227 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 *) (******************************************************************************) 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" -> ".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.3.0/src/base/BaseGenerate.mli0000644000175000017500000000434211773154621016715 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 *) (******************************************************************************) (** Generate 'setup.ml' and other files @author Sylvain Le Gall *) open OASISTypes type update = NoUpdate | Weak | Dynamic (** 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 -> update -> package -> OASISFileTemplate.file_generate_change list oasis-0.3.0/src/base/BaseGenerate.ml0000644000175000017500000001514411773154621016546 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 *) (******************************************************************************) open Format open OASISTypes open OASISUtils open OASISFileTemplate open ODN open OASISPlugin open BaseMessage open OASISGettext type update = NoUpdate | Weak | Dynamic 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) 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 [ "#use \"topfind\";;"; "#require \"oasis.dynrun\";;"; "open OASISDynRun;;"; ]} acc else if tmpl.fn = "Makefile" || tmpl.fn = "configure" then OASISFileTemplate.add tmpl acc else acc) ctxt.files OASISFileTemplate.empty 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.3.0/src/base/BaseDoc.mli0000644000175000017500000000372611773154621015675 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseFileAB.mli0000644000175000017500000000425611773154621016251 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseSysEnvironment.mod0000644000175000017500000000002011773154621020151 0ustar gildorgildorBaseEnvLight.ml oasis-0.3.0/src/base/BaseArgExt.mli0000644000175000017500000000350111773154621016351 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseData.mli0000644000175000017500000000421011773154621016026 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 *) (******************************************************************************) (** 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 oasis-0.3.0/src/base/BaseCustom.mli0000644000175000017500000000372211773154621016436 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseSysBundle.mod0000644000175000017500000000012411773154621017063 0ustar gildorgildorBaseContext.ml BaseMessage.ml BaseEnvLight.ml BaseEnv.ml BaseArgExt.ml BaseCheck.ml oasis-0.3.0/src/base/BaseOCamlcConfig.ml0000644000175000017500000001015711773154621017277 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 *) (******************************************************************************) 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.3.0/src/base/BaseData.mlify0000644000175000017500000000023011773154621016363 0ustar gildorgildorVarString basesys_ml "BaseSys.ml" VarString basesysenvironment_ml "BaseSysEnvironment.ml" VarString basesysbundle_ml "BaseSysBundle.ml" oasis-0.3.0/src/base/BaseOCamlcConfig.mli0000644000175000017500000000405111773154621017444 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseDynVar.mli0000644000175000017500000000371511773154621016371 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseContext.mli0000644000175000017500000000361011773154621016604 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseLog.mli0000644000175000017500000000422411773154621015703 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseTest.mli0000644000175000017500000000404611773154621016103 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseDoc.ml0000644000175000017500000000460411773154621015520 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 *) (******************************************************************************) 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 OASISVersion.version_0_3_or_after pkg.oasis_version && 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.3.0/src/base/BaseTest.ml0000644000175000017500000000717711773154621015742 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 *) (******************************************************************************) 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 OASISVersion.version_0_3_or_after pkg.oasis_version && 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.3.0/src/base/BaseEnvLight.ml0000644000175000017500000000726511773154621016541 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 *) (******************************************************************************) 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 var_get name env = let rec var_expand str = let buff = Buffer.create ((String.length str) * 2) in Buffer.add_substitute buff (fun var -> try var_expand (MapString.find var env) with Not_found -> failwith (Printf.sprintf "No variable %s defined when trying to expand %S." var str)) str; Buffer.contents buff in var_expand (MapString.find name env) let var_choose lst env = OASISExpr.choose (fun nm -> var_get nm env) lst oasis-0.3.0/src/base/BaseCustom.ml0000644000175000017500000000527011773154621016265 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 *) (******************************************************************************) 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.3.0/src/base/BaseMessage.mli0000644000175000017500000000412611773154621016547 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseBuilt.ml0000644000175000017500000001157211773154621016074 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 *) (******************************************************************************) open OASISTypes open OASISGettext open BaseStandardVar open BaseMessage type t = | BExec (* Executable *) | BExecLib (* Library coming with executable *) | BLib (* Library *) | BDoc (* Document *) let to_log_event_file t nm = "built_"^ (match t with | BExec -> "exec" | BExecLib -> "exec_lib" | BLib -> "lib" | 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") | 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 oasis-0.3.0/src/base/BaseSys.mod0000644000175000017500000000032111773154621015730 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.3.0/src/base/BaseContext.ml0000644000175000017500000000322011773154621016430 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 *) (******************************************************************************) open OASISContext let args = args let default = default oasis-0.3.0/src/base/BaseEnv.mli0000644000175000017500000001103011773154621015703 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseDynVar.ml0000644000175000017500000000607111773154621016216 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 *) (******************************************************************************) 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 _ | Flag _ | Test _ | SrcRepo _ | Doc _ -> ()) pkg.sections oasis-0.3.0/src/base/BaseEnvLight.mli0000644000175000017500000000450111773154621016700 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 *) (******************************************************************************) (** 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 (** 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.3.0/src/base/BaseCheck.mli0000644000175000017500000000547711773154621016212 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseStandardVar.mli0000644000175000017500000001111711773154621017372 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseBuilt.mli0000644000175000017500000000620511773154621016242 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 *) (******************************************************************************) (** Register files built to be installed @author Sylvain Le Gall *) open OASISTypes type t = | BExec (* Executable. *) | BExecLib (* Library coming with executable. *) | BLib (* Library. *) | 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/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 oasis-0.3.0/src/base/BaseMessage.ml0000644000175000017500000000355711773154621016405 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 *) (******************************************************************************) (** 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.3.0/src/base/BaseArgExt.ml0000644000175000017500000000415511773154621016206 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 *) (******************************************************************************) 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.3.0/src/base/BaseFileAB.ml0000644000175000017500000000503411773154621016073 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 *) (******************************************************************************) 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.3.0/src/base/base.mllib0000644000175000017500000000356011773154621015621 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_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.3.0/src/base/BaseSetup.mli0000644000175000017500000001076411773154621016270 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 *) (******************************************************************************) (** 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 '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 -> package -> OASISPlugin.context_act * t oasis-0.3.0/src/base/BaseLog.ml0000644000175000017500000001042711773154621015534 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 *) (******************************************************************************) 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.3.0/src/base/BaseSetup.ml0000644000175000017500000006217411773154621016121 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 *) (******************************************************************************) 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 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"; ] (failwithf (f_ "Don't know what to do with '%s'")) ""; info "Running configure step"; configure t [||]; 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 _ | 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 update_setup_ml t = let oasis_fn = match t.oasis_fn with | Some fn -> fn | None -> "_oasis" 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 "_oasis" 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 pkg = let ctxt = (* Initial context *) { error = false; files = OASISFileTemplate.empty; other_actions = []; ctxt = !BaseContext.default; } in let ctxt, configure_changes = (Configure.act pkg.conf_type) ctxt pkg in let ctxt, build_changes = (Build.act pkg.build_type) ctxt pkg in let ctxt, test_odn, test_changes = let ctxt, test_odns, test_changes = List.fold_left (fun ((ctxt, test_odns, test_changes) as acc) -> function | Test (cs, tst) -> begin let ctxt, chng = (Test.act tst.test_type) ctxt pkg (cs, tst) in ctxt, (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.3.0/src/base/BaseEnv.ml0000644000175000017500000003037211773154621015544 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 *) (******************************************************************************) 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.3.0/src/dynrun/0000755000175000017500000000000011773154621014267 5ustar gildorgildoroasis-0.3.0/src/dynrun/OASISDynRun.ml0000644000175000017500000000252311773154621016641 0ustar gildorgildor (* 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 oasis_fn = "_oasis" let setup_t = let pkg = OASISParse.from_file ~ctxt:!BaseContext.default oasis_fn in let _, setup_t = BaseSetup.of_package ~setup_update:false pkg in setup_t let setup () = 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 BaseGenerate.NoUpdate (OASISParse.from_file ~ctxt:!BaseContext.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 oasis-0.3.0/src/dynrun/dynrun.mllib0000644000175000017500000000014011773154621016622 0ustar gildorgildor# OASIS_START # DO NOT EDIT (digest: 62eb0a8c35367ef6905fd8a62007fe9a) OASISDynRun # OASIS_STOP oasis-0.3.0/src/plugins/0000755000175000017500000000000011773154621014431 5ustar gildorgildoroasis-0.3.0/src/plugins/none/0000755000175000017500000000000011773154621015370 5ustar gildorgildoroasis-0.3.0/src/plugins/none/MANUAL-template.mkd0000644000175000017500000000012311773154621020647 0ustar gildorgildorThis plugin basically does nothing. It helps to replace mandatory step by nothing. oasis-0.3.0/src/plugins/none/NoneData.mlify0000644000175000017500000000015111773154621020120 0ustar gildorgildorVarString nonesys_ml "NoneSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.3.0/src/plugins/none/NoneSys.mod0000644000175000017500000000001611773154621017464 0ustar gildorgildorNonePlugin.ml oasis-0.3.0/src/plugins/none/NonePlugin.ml0000644000175000017500000000646211773154621020010 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 *) (******************************************************************************) (** 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.3.0/src/plugins/internal/0000755000175000017500000000000011773154621016245 5ustar gildorgildoroasis-0.3.0/src/plugins/internal/InternalSys.mod0000644000175000017500000000006411773154621021221 0ustar gildorgildorInternalConfigurePlugin.ml InternalInstallPlugin.ml oasis-0.3.0/src/plugins/internal/InternalConfigurePlugin.ml0000644000175000017500000002114311773154621023375 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 *) (******************************************************************************) (** 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; (* 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.3.0/src/plugins/internal/MANUAL-template.mkd0000644000175000017500000000065711773154621021540 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.3.0/src/plugins/internal/InternalData.mlify0000644000175000017500000000015511773154621021656 0ustar gildorgildorVarString internalsys_ml "InternalSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.3.0/src/plugins/internal/InternalId.ml0000644000175000017500000000361311773154621020633 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 *) (******************************************************************************) (** 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.3.0/src/plugins/internal/InternalInstallPlugin.ml0000644000175000017500000004177011773154621023072 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 *) (******************************************************************************) (** Install using internal scheme @author Sylvain Le Gall *) open BaseEnv open BaseStandardVar open BaseMessage open OASISTypes open OASISLibrary 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 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 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, lib, children) -> files_of_library data_and_files (cs, bs, lib), 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.3.0/src/plugins/ocamlbuild/0000755000175000017500000000000011773154621016544 5ustar gildorgildoroasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildPlugin.ml0000644000175000017500000006464211773154621022304 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 *) (******************************************************************************) (** Build using ocamlbuild @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OASISUtils open BaseEnv open OCamlbuildCommon open BaseStandardVar open BaseMessage let cond_targets_hook = ref (fun lst -> lst) let build 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 ends_with nd fn = let nd_len = String.length nd in (String.length fn >= nd_len) && (String.sub fn (String.length fn - nd_len) nd_len) = nd in let tgts = List.flatten (List.filter (fun l -> l <> []) (List.map (List.filter (fun fn -> ends_with ".cma" fn || ends_with ".cmxs" fn || ends_with ".cmxa" fn || ends_with (ext_lib ()) fn || ends_with (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 | 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 _ | 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 (f_ "No one of expected built files %s exists") (String.concat (s_ ", ") (List.map (Printf.sprintf "'%s'") fns))) lst; (BaseBuilt.register bt bnm lst) in let cond_targets = (* Run the hook *) !cond_targets_hook cond_targets in (* Run a list of target... *) run_ocamlbuild (List.flatten (List.map snd cond_targets)) 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 OASISValues open MyOCamlbuildBase open Ocamlbuild_plugin open OCamlbuildId let plugin = `Build, name, Some version let self_id, all_id = Build.create 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 (set_string_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 _ | 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}") (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 add_tags tag_t (if link_pkg then link_tgt :: src_tgts else src_tgts) (List.fold_left (fun acc -> function | FindlibPackage (findlib_pkg, _) -> ("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 | `Executable of string] let compare t1 t2 = match t1, t2 with | `Library _, `Executable _ -> -1 | `Executable _, `Library _ -> 1 | `Library s1, `Library 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.union st (set_string_of_list 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 | 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, _ = MapDirs.find (`Library nm) map_dirs in SetString.union set (set_string_of_list 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.union (set_string_of_list src_dirs) (set_string_of_list 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 | 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 [] 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 (* 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 let base_sources = OASISLibrary.source_unix_files ~ctxt:ctxt.ctxt (cs, bs, lib) (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 lib.lib_modules = [] then warning ~ctxt:ctxt.ctxt (f_ "No exported module defined for library %s") cs.cs_name; in let ctxt = (* Generate .mllib or .mlpack files *) let extension, not_extension = if lib.lib_pack then "mlpack", "mllib" else "mllib", "mlpack" in let fn_base = prepend_bs_path bs cs.cs_name in let fn = OASISHostPath.add_extension fn_base extension in let not_fn = OASISHostPath.add_extension fn_base not_extension in let ctxt = add_file (template_make fn comment_ocamlbuild [] (lib.lib_modules @ lib.lib_internal_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 -> if (String.length tag > 0 && tag.[0] = '#') || (* Don't remove comment *) not (SetString.mem tag prev_tag) then (* Remove already seen tag *) ( 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" :: 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 () ); ""; "let dispatch_default = \ MyOCamlbuildBase.dispatch_default package_default;;"; ""; ] ["Ocamlbuild_plugin.dispatch dispatch_default;;"]; ] in ctxt let qstrt_completion pkg = fix_build_tools (ExternalTool "ocamlbuild") pkg let init () = let doit ctxt pkg = let ctxt = add_ocamlbuild_files ctxt pkg in ctxt, { chng_moduls = [OCamlbuildData.ocamlbuildsys_ml]; chng_main = ODNFunc.func build "OCamlbuildPlugin.build"; chng_clean = Some (ODNFunc.func clean "OCamlbuildPlugin.clean"); chng_distclean = None; } in OCamlbuildId.init (); Build.register_act self_id doit; register_quickstart_completion all_id qstrt_completion oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildBase.ml0000644000175000017500000001447311773154621022223 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 *) (******************************************************************************) (** 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) 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" 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, [] -> ocaml_lib nm | nm, dir :: tl -> 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) 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 flag tags & spec) t.flags | _ -> () let dispatch_default t = dispatch_combine [ dispatch t; MyOCamlbuildFindlib.dispatch; ] (* END EXPORT *) oasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildCommon.ml0000644000175000017500000001176311773154621022272 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 *) (******************************************************************************) (** Functions common to OCamlbuild build and doc plugin *) open OASISGettext open BaseEnv open BaseStandardVar 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 EXPORT *) open OASISTypes 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) | 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 oasis-0.3.0/src/plugins/ocamlbuild/MANUAL-template.mkd0000644000175000017500000000045111773154621022027 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. Document fields: $ListOCamlbuildDocDocumentFields oasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildId.ml0000644000175000017500000000362011773154621021367 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 *) (******************************************************************************) (* 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.3.0/src/plugins/ocamlbuild/MyOCamlbuildFindlib.ml0000644000175000017500000001252111773154621022710 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 *) (******************************************************************************) (** 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 split s ch = let x = ref [] in let rec go s = let pos = String.index s ch in x := (String.before s pos)::!x; go (String.after s (pos + 1)) in try go s with Not_found -> !x let split_nl s = split s '\n' let before_space s = try String.before s (String.index s ' ') with Not_found -> s (* this lists all supported packages *) let find_packages () = List.map before_space (split_nl & run_and_read "ocamlfind list") (* this is supposed to list available syntaxes, but I don't know how to do it. *) let find_syntaxes () = ["camlp4o"; "camlp4r"] (* ocamlfind command *) let ocamlfind x = S[A"ocamlfind"; x] let dispatch = function | Before_options -> (* 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" | 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 -> flag ["ocaml"; "compile"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "ocamldep"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "doc"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "link"; "pkg_"^pkg] & S[A"-package"; A pkg]; flag ["ocaml"; "infer_interface"; "pkg_"^pkg] & S[A"-package"; A pkg]; end (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"]) | _ -> () oasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildDocPlugin.ml0000644000175000017500000001624611773154621022727 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 *) (******************************************************************************) (* Create documentation using ocamlbuild .odocl files @author Sylvain Le Gall *) open OASISTypes open OASISGettext open OASISMessage open OCamlbuildCommon open BaseStandardVar TYPE_CONV_PATH "OCamlbuildDocPlugin" let doc_build path pkg (cs, doc) argv = let index_html = OASISUnixPath.make [ path; cs.cs_name^".docdir"; "index.html"; ] in let tgt_dir = OASISHostPath.make [ build_dir argv; OASISHostPath.of_unix path; cs.cs_name^".docdir"; ] in run_ocamlbuild [index_html] 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 t 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; } let pivot_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 doit ctxt pkg (cs, doc) = let path = path cs.cs_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 = OASISLibrary.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 cs.cs_data)) in let modules_from_doc = (* Fetch modules defined directly *) modules cs.cs_data in let modules = modules_from_libraries @ modules_from_doc in let ctxt = (* Create .odocl file *) add_file (template_make (OASISHostPath.add_extension (Filename.concat path cs.cs_name) "odocl") comment_ocamlbuild [] 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 (modules = []) (Printf.sprintf (f_ "No module defined for document %s.") cs.cs_name); ] in ctxt, { chng_moduls = [OCamlbuildData.ocamlbuildsys_ml]; chng_main = ODNFunc.func_with_arg doc_build "OCamlbuildDocPlugin.doc_build" path ODN.of_string; chng_clean = Some (ODNFunc.func_with_arg doc_clean "OCamlbuildDocPlugin.doc_clean" path ODN.of_string); 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.3.0/src/plugins/ocamlbuild/OCamlbuildSys.mod0000644000175000017500000000007711773154621021763 0ustar gildorgildorOCamlbuildCommon.ml OCamlbuildPlugin.ml OCamlbuildDocPlugin.ml oasis-0.3.0/src/plugins/ocamlbuild/OCamlbuildData.mlify0000644000175000017500000000024411773154621022413 0ustar gildorgildorVarString myocamlbuild_ml "MyOCamlbuildSys.ml" VarString ocamlbuildsys_ml "OCamlbuildSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.3.0/src/plugins/ocamlbuild/MyOCamlbuildSys.mod0000644000175000017500000000005311773154621022263 0ustar gildorgildorMyOCamlbuildFindlib.ml MyOCamlbuildBase.ml oasis-0.3.0/src/plugins/custom/0000755000175000017500000000000011773154621015743 5ustar gildorgildoroasis-0.3.0/src/plugins/custom/MANUAL-template.mkd0000644000175000017500000000151411773154621021227 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.3.0/src/plugins/custom/CustomSys.mod0000644000175000017500000000002011773154621020405 0ustar gildorgildorCustomPlugin.ml oasis-0.3.0/src/plugins/custom/CustomData.mlify0000644000175000017500000000015111773154621021046 0ustar gildorgildorVarString customsys_ml "CustomSys.ml" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.3.0/src/plugins/custom/CustomPlugin.ml0000644000175000017500000003112611773154621020731 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 *) (******************************************************************************) (** 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.3.0/src/plugins/ocamlmakefile/0000755000175000017500000000000011773154621017222 5ustar gildorgildoroasis-0.3.0/src/plugins/extra/0000755000175000017500000000000011773154621015554 5ustar gildorgildoroasis-0.3.0/src/plugins/extra/devfiles/0000755000175000017500000000000011773154621017355 5ustar gildorgildoroasis-0.3.0/src/plugins/extra/devfiles/MANUAL-template.mkd0000644000175000017500000000027311773154621022642 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.3.0/src/plugins/extra/devfiles/configure0000644000175000017500000000046311773154621021264 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 ocaml setup.ml -configure "$@" # OASIS_STOP oasis-0.3.0/src/plugins/extra/devfiles/DevFilesData.mlify0000644000175000017500000000015011773154621022706 0ustar gildorgildorVarStringList configure "configure" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.3.0/src/plugins/extra/devfiles/DevFilesPlugin.ml0000644000175000017500000001351111773154621022570 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 *) (******************************************************************************) (** 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 ctxt = (* Generate Makefile (for standard dev. env.) *) if t.enable_makefile then begin let buff = Buffer.create 13 in let targets = let excludes = OASISUtils.set_string_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 = Printf.bprintf buff "%s: %s\n\ \t$(SETUP) -%s $(%sFLAGS)\n\n" nm (String.concat " " ((if need_configure then (fun l -> "setup.data" :: l) else (fun l -> l)) other_depends)) nm (String.uppercase nm) in Buffer.add_string buff "\nSETUP = ocaml setup.ml\n\n"; List.iter (function | "all" | "clean" | "distclean" as nm -> add_one_target ~need_configure:false nm | "test" | "doc" as nm -> add_one_target ~other_depends:["build"] nm | "configure" -> Printf.bprintf buff "setup.data:\n\ \t$(SETUP) -configure $(CONFIGUREFLAGS)\n\n" | nm -> add_one_target nm) targets; Buffer.add_string buff (".PHONY: "^(String.concat " " targets)^"\n"); OASISPlugin.add_file (template_make "Makefile" comment_sh [] (OASISUtils.split_newline ~trim:false (Buffer.contents buff)) []) ctxt end else ctxt in let ctxt = (* Generate configure (for standard dev. env.) *) if t.enable_configure then begin let tmpl = template_of_string_list ~ctxt:ctxt.OASISPlugin.ctxt ~template:true "configure" comment_sh DevFilesData.configure in OASISPlugin.add_file {tmpl with perm = 0o755} 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.3.0/src/plugins/extra/stdfiles/0000755000175000017500000000000011773154621017371 5ustar gildorgildoroasis-0.3.0/src/plugins/extra/stdfiles/MANUAL-template.mkd0000644000175000017500000000052411773154621022655 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.3.0/src/plugins/extra/stdfiles/StdFilesData.mlify0000644000175000017500000000015211773154621022740 0ustar gildorgildorVarString install "INSTALL.txt" VarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.3.0/src/plugins/extra/stdfiles/StdFilesPlugin.ml0000644000175000017500000004134011773154621022621 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 *) (******************************************************************************) (** 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 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 = map_string_of_assoc (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 = map_string_of_assoc (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 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:(fn^".txt") 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 let pp_print_cut2 fmt () = pp_print_cut fmt (); pp_print_cut fmt () in let pp_print_para fmt 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 (); pp_print_cut2 fmt (); pp_close_box fmt () in let pp_print_title fmt str = (* TODO: use Markdown formatting *) fprintf fmt "@[%s@]@," str; fprintf fmt "@[%s@]@,@," (String.make (String.length str) '=') 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, _) | 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 = function | Some ver_cmp -> fprintf fmt " (%a)" pp_print_string (OASISVersion.string_of_comparator (OASISVersion.comparator_reduce ver_cmp)) | None -> () 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, _) | 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; ] (* 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, ppf) = match fn_opt with | Some unix_fn -> begin let content = ppf str_formatter; flush_str_formatter () in add_file (template_make unix_fn comment_ml [] [content] []) ctxt end | None -> ctxt in let t = generator data in List.fold_left add_file ctxt [ (* Generate README.txt *) t.readme, (fun fmt -> pp_open_vbox fmt 0; fprintf fmt "@[This is the README file for the %s distribution.@]@,@," pkg.name; List.iter (pp_print_para fmt) pkg.copyrights; pp_print_para fmt pkg.synopsis; begin match pkg.description with | Some str -> pp_print_para fmt str | None -> () end; pp_open_box fmt 0; begin match t.install with | Some fn -> fprintf fmt "See@ the@ files@ %s@ for@ building@ and@ installation@ instructions.@ " fn | None -> () end; begin match pkg.license_file with | Some fn -> fprintf fmt "See@ the@ file@ %s@ for@ copying@ conditions.@ " fn | None -> () end; pp_close_box fmt (); pp_print_cut2 fmt (); begin match pkg.homepage with | Some url -> fprintf fmt "@[Home page: %s@]@,@," url; | None -> () end; pp_close_box fmt ()); (* Generate INSTALL.txt *) t.install, (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 "Dependencies"; fprintf fmt "@[In order to compile this package, you will need:@]@,"; pp_open_vbox fmt 0; 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, (fun fmt -> pp_open_vbox fmt 0; fprintf fmt "@[Authors of %s@]@," pkg.name; pp_print_list pp_print_string "@," fmt pkg.OASISTypes.authors; if pkg.maintainers <> [] then begin pp_print_cut2 fmt (); fprintf fmt "@[Current maintainers of %s@]@," pkg.name; pp_print_list pp_print_string "@," 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.3.0/src/plugins/extra/stdfiles/INSTALL.txt0000644000175000017500000000076311773154621021246 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.3.0/src/plugins/extra/camlidl.ml0000644000175000017500000000337111773154621017517 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 *) (******************************************************************************) (** Camlidl package *) module Camlidl = struct module Env = Environment module Chk = Check module Msg = Message let camlidl = Chk.prog "camlidl" end oasis-0.3.0/src/plugins/extra/META/0000755000175000017500000000000011773154621016302 5ustar gildorgildoroasis-0.3.0/src/plugins/extra/META/METAPlugin.ml0000644000175000017500000002260311773154621020544 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 *) (******************************************************************************) (** META generator @author Sylvain Le Gall *) open OASISGettext open OASISTypes open OASISValues open OASISLibrary 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 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:[] ~since_version:"0.3" (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 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 (lib_cs, lib_bs, lib, children) = let lib_name = lib_cs.cs_name in let lib_cma, lib_cmxa, lib_cmxs = lib_name^".cma", lib_name^".cmxa", lib_name^".cmxs" in let t = generator lib_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) lib_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"], lib_cma); pp_print_field fmt ("archive", ["byte"; "plugin"], lib_cma); begin match lib_bs.bs_compiled_object with | Best | Native -> pp_print_field fmt ("archive", ["native"], lib_cmxa); pp_print_field fmt ("archive", ["native"; "plugin"], lib_cmxs) | Byte -> () end | METASyntax -> pp_print_field fmt ("archive", ["syntax"; "preprocessor"], lib_cma); pp_print_field fmt ("archive", ["syntax"; "toploop"], lib_cma) end; List.iter (fprintf fmt "@,%s") t.extra_lines; pp_print_sfield fmt ("exists_if", if lib_bs.bs_compiled_object = Native then lib_cmxa else lib_cma); 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 (OASISUtils.split_newline ~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.3.0/src/plugins/extra/META/MANUAL-template.mkd0000644000175000017500000000036611773154621021572 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.3.0/src/plugins/extra/META/METAData.mlify0000644000175000017500000000007011773154621020661 0ustar gildorgildorVarStringList readme_template_mkd "MANUAL-template.mkd" oasis-0.3.0/src/plugins/extra/docbook.ml0000644000175000017500000000344211773154621017531 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 *) (******************************************************************************) (** 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.3.0/src/plugins/omake/0000755000175000017500000000000011773154621015525 5ustar gildorgildoroasis-0.3.0/_tags0000644000175000017500000002167511773154621013214 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_START # DO NOT EDIT (digest: 2c3d9ec2e42ca28272d52c84996a4be0) # 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_unix : pkg_odn # Library base "src/base/base.cmxs": use_base : use_oasis : pkg_unix : pkg_odn # Library builtin-plugins "src/builtin-plugins.cmxs": use_builtin-plugins : use_base : use_oasis : pkg_unix : pkg_odn : use_base : use_oasis : pkg_unix : pkg_odn : use_base : use_oasis : pkg_unix : pkg_odn : use_base : use_oasis : pkg_unix : pkg_odn : use_base : use_oasis : pkg_unix : pkg_odn : use_base : use_oasis : pkg_unix : pkg_odn : use_base : use_oasis : pkg_unix : pkg_odn : use_base : use_oasis : pkg_unix : pkg_odn # Library cli "src/cli/cli.cmxs": use_cli # Library dynrun "src/dynrun/dynrun.cmxs": use_dynrun : use_builtin-plugins : use_base : use_oasis : pkg_unix : pkg_odn # Executable test "test/test.byte": use_builtin-plugins "test/test.byte": use_base "test/test.byte": use_oasis "test/test.byte": pkg_oUnit "test/test.byte": pkg_fileutils "test/test.byte": pkg_findlib "test/test.byte": pkg_expect.pcre "test/test.byte": pkg_unix "test/test.byte": pkg_odn : use_builtin-plugins : use_base : use_oasis : pkg_oUnit : pkg_fileutils : pkg_findlib : pkg_expect.pcre : pkg_unix : pkg_odn # Library plugin-loader "src/ext/plugin-loader/src/plugin-loader.cmxs": use_plugin-loader : pkg_dynlink : pkg_findlib # Executable oasis "src/cli/Main.byte": use_cli "src/cli/Main.byte": use_builtin-plugins "src/cli/Main.byte": use_base "src/cli/Main.byte": use_oasis "src/cli/Main.byte": use_plugin-loader "src/cli/Main.byte": pkg_dynlink "src/cli/Main.byte": pkg_findlib "src/cli/Main.byte": pkg_unix "src/cli/Main.byte": pkg_odn : use_cli : use_builtin-plugins : use_base : use_oasis : use_plugin-loader : pkg_dynlink : pkg_findlib : pkg_unix : pkg_odn # 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": use_plugin-loader "src/ext/plugin-loader/test/data/pluginloader.byte": use_pluginloaderLib "src/ext/plugin-loader/test/data/pluginloader.byte": pkg_dynlink "src/ext/plugin-loader/test/data/pluginloader.byte": pkg_findlib : use_plugin-loader : use_pluginloaderLib : pkg_dynlink : pkg_findlib # Executable test_loader "src/ext/plugin-loader/test/TestLoader.byte": use_plugin-loader "src/ext/plugin-loader/test/TestLoader.byte": pkg_oUnit "src/ext/plugin-loader/test/TestLoader.byte": pkg_fileutils "src/ext/plugin-loader/test/TestLoader.byte": pkg_dynlink "src/ext/plugin-loader/test/TestLoader.byte": pkg_findlib : use_plugin-loader : pkg_oUnit : pkg_fileutils : pkg_dynlink : pkg_findlib # Library userconf "src/ext/userconf/src/userconf.cmxs": use_userconf # Executable test_userconf "src/ext/userconf/test/TestUserConf.byte": use_userconf "src/ext/userconf/test/TestUserConf.byte": pkg_oUnit : use_userconf : pkg_oUnit # 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/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": use_ocamlbuild "src/plugins/ocamlbuild/OCamlbuildDocPlugin.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 : use_ocamlbuild <**/*.ml>: annot "build": -traverse "build": not_hygienic oasis-0.3.0/AUTHORS.txt0000644000175000017500000000020111773154621014040 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: ed015b4f93f97d04d297bb9801e8f1bb) *) Authors of oasis Sylvain Le Gall (* OASIS_STOP *) oasis-0.3.0/.boring0000644000175000017500000000254511773154621013450 0ustar gildorgildor# Boring file regexps: \.hi$ \.hi-boot$ \.o-boot$ \.o$ \.o\.cmd$ \.p_hi$ \.p_o$ \.installed-pkg-config \.setup-config \.setup-config^dist(/|$) # *.ko files aren't boring by default because they might # be Korean translations rather than kernel modules. # \.ko$ \.ko\.cmd$ \.mod\.c$ (^|/)\.tmp_versions($|/) (^|/)CVS($|/) \.cvsignore$ ^\.# (^|/)RCS($|/) ,v$ (^|/)\.svn($|/) (^|/)\.hg($|/) (^|/)\.git($|/) \.bzr$ (^|/)SCCS($|/) ~$ (^|/)_darcs($|/) (^|/)\.darcsrepo($|/) \.bak$ \.BAK$ \.orig$ \.rej$ (^|/)vssver\.scc$ \.swp$ (^|/)MT($|/) (^|/)\{arch\}($|/) (^|/).arch-ids($|/) (^|/), \.prof$ (^|/)\.DS_Store$ (^|/)BitKeeper($|/) (^|/)ChangeSet($|/) \.py[co]$ \.elc$ \.class$ \.zwc$ \.revdep-rebuild.* \..serverauth.* \# (^|/)Thumbs\.db$ (^|/)autom4te\.cache($|/) (^|/)config\.(log|status)$ ^\.depend$ (^|/)(tags|TAGS)$ #(^|/)\.[^/] (^|/|\.)core$ \.(obj|a|exe|so|lo|la)$ ^\.darcs-temp-mail$ -darcs-backup[[:digit:]]+$ \.(fas|fasl|sparcf|x86f)$ \.part$ (^|/)\.waf-[[:digit:].]+-[[:digit:]]+($|/) (^|/)\.lock-wscript$ ^\.darcs-temp-mail$ \_vti_cnf$ \_vti_pvt$ ^_build$ ^doc/ext/x611.html$ ^doc/ext/mod.pdf$ ^doc/ext/configure.till$ \.cmo$ \.cmx$ \.cmi$ \.cma$ \.cmxa$ ^po/.*\.mo$ ^installbuilder-license.xml$ ^doc/MANUAL.mkd$ ^setup.data$ ^setup.log$ ^boot/ ^bindist(/|$) ^src/oasis/OASISConf.ml$ \.tar\.gz$ \.tar\.gz\.asc$ ^OASISMain.byte$ ^patches-to-apply$ ^src/cli/PluginsLoaded.ml$ oasis-0.3.0/COPYING.txt0000644000175000017500000006546411773154621014051 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. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 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.3.0/ci-main.lua0000644000175000017500000000102111773154621014173 0ustar gildorgildorbootstrap = require("bootstrap") bootstrap.init() ci = require("ci") godi = require("godi") oasis = require("oasis") darcs = require("darcs") ci.init() godi.init() darcs.init() oasis.init() godi.bootstrap("3.12") godi.update() godi.upgrade() godi.build_many( {"godi-findlib", "godi-ocaml-fileutils", "godi-ocaml-data-notation", "godi-ocaml-expect", "godi-ounit", "apps-ocamlmod", "apps-ocamlify"}) ci.exec("make", "fixperms") oasis.std_process("--enable-tests") darcs.create_tag(oasis.package_version()) oasis-0.3.0/bootstrap.lua0000644000175000017500000000203111773154621014675 0ustar gildorgildor local os = os local error = error local lfs = require("lfs") local package = package module("bootstrap") function init () local ci_url = os.getenv("CI_URL") if not ci_url then ci_url = "http://mini:8080/job/continuous-integration/label=debian-squeeze64/lastSuccessfulBuild/artifact/dist/ci.zip" end local bootstrapdir = "build/bootstrap" if lfs.attributes(bootstrapdir) then for fn in lfs.dir(bootstrapdir) do if fn ~= "." and fn ~= ".." then local realfn = bootstrapdir .. "/" .. fn if not os.remove(realfn) then error("Cannot remove " .. realfn) end end end lfs.rmdir("build/bootstrap") end lfs.mkdir("build") lfs.mkdir("build/bootstrap") local topdir = lfs.currentdir() lfs.chdir("build/bootstrap") if os.execute("curl -o ci.zip " .. ci_url) ~= 0 then error "Cannot download ci.zip" end if os.execute("unzip ci.zip") ~= 0 then error "Cannot unzip ci.zip" end lfs.chdir(topdir) package.path = "./build/bootstrap/?.lua;" .. package.path end oasis-0.3.0/INSTALL.txt0000644000175000017500000000301411773154621014026 0ustar gildorgildor(* OASIS_START *) (* DO NOT EDIT (digest: 0ba4956f247cb4642db5ea3d4d15507b) *) This is the INSTALL file for the oasis distribution. This package uses OASIS to generate its build system. See section OASIS for full information. Dependencies ============ In order to compile this package, you will need: * ocaml (>= 3.11.0) for all, test main, test main_loader, test main_userconf, doc api-oasis, doc manual * findlib * odn (>= 0.0.3) 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 * ocamlify for library base, library oasis * oUnit (>= 1.1.0) for executable test, executable test_loader, executable test_userconf * fileutils (>= 0.4.2) for executable test, executable test_loader * expect (>= 0.0.2) 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`.