Commits

Sebastien Mondet committed 407a708

build,doc: import generated files

Comments (0)

Files changed (4)

+BUILD INSTRUCTIONS
+==================
+
+Build
+-----
+
+You need the following libraries:
+
+- Library `smart_print` (opam package: `smart-print`)
+
+Then you can build the library:
+
+    ocaml please.ml build
+
+Install
+-------
+
+You can install the library with `ocamlfind`:
+
+    ocaml please.ml install
+
+You may want to control the destination with the variable
+`OCAMLFIND_DESTDIR`.
+
+Uninstall
+---------
+
+You can uninstall the library (also `ocamlfind`):
+
+    ocaml please.ml uninstall
+
+
+Copyright (c) 2013, Sebastien Mondet <seb@mondet.org>
+
+Permission to use, copy, modify, and/or distribute this software for any
+purpose with or without fee is hereby granted, provided that the above
+copyright notice and this permission notice appear in all copies. THE
+SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS
+ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR
+BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+SOFTWARE.
+version = "0.0.1-dev"
+description = "Functor to create (text) output functions"
+archive(byte) = "docout.cma"
+archive(byte,plugin) = "docout.cma"
+archive(native) = "docout.cmxa"
+archive(native,plugin) = "docout.cmxs"
+exists_if = "docout.cma"
+requires = "smart_print"
+#! /usr/bin/env ocaml
+ open Printf
+ module List = ListLabels
+ let say fmt = ksprintf (printf "Please-> %s\n%!") fmt
+ let cmdf fmt =
+   ksprintf (fun s -> ignore (Sys.command s)) fmt
+ let chain l =
+   List.iter l ~f:(fun cmd ->
+       printf "! %s\n%!" cmd;
+       if  Sys.command cmd = 0
+       then ()
+       else ksprintf failwith "%S failed." cmd
+     )
+ let args = Array.to_list Sys.argv
+ let in_build_directory f =
+   cmdf "mkdir -p _build/";
+   Sys.chdir "_build/";
+   begin try
+     f ();
+   with
+     e ->
+     Sys.chdir "../";
+     raise e
+   end;
+   Sys.chdir "../";
+   ()
+
+
+let build () =
+in_build_directory (fun () ->
+chain 
+[
+    "cp ../docout.ml .";
+    "ocamlfind ocamlc -package smart_print -c docout.ml -o docout.cmo";
+    "ocamlfind ocamlopt -package smart_print -c docout.ml  -annot -bin-annot -o docout.cmx";
+    "ocamlc docout.cmo -a -o docout.cma";
+    "ocamlopt docout.cmx -a -o docout.cmxa";
+    "ocamlopt docout.cmxa docout.a -shared -o docout.cmxs";
+
+]
+
+)
+
+let install () =
+    in_build_directory (fun () ->
+        chain [
+          "ocamlfind install docout ../META docout.cmx docout.cmo docout.cma docout.cmi docout.cmxa docout.cmxs docout.a docout.o"
+        ])
+
+
+let uninstall () =
+    chain [
+      "ocamlfind remove docout"
+    ]
+
+
+let merlinize () =
+    chain [
+      "echo 'S .' > .merlin";
+      "echo 'B _build' >> .merlin";
+      "echo 'PKG smart_print' >> .merlin";
+     ]
+
+
+let build_doc () =
+    in_build_directory (fun () ->
+        chain [
+          "mkdir -p doc";
+                         sprintf "ocamlfind ocamldoc -package smart_print -charset UTF-8 -keep-code -colorize-code -html docout.ml -d doc/";
+        ])
+
+
+let name = "docout"
+
+let () = begin
+match args with
+| _ :: "build" :: [] ->(
+say "Building";
+build ();
+say "Done."
+)
+| _ :: "build_doc" :: [] ->(
+say "Building Documentation";
+build_doc ();
+say "Done."
+)
+| _ :: "install" :: [] ->(
+say "Installing";
+install ();
+say "Done."
+)
+| _ :: "uninstall" :: [] ->(
+say "Uninstalling";
+uninstall ();
+say "Done."
+)
+| _ :: "merlinize" :: [] ->(
+say "Updating `.merlin` file";
+merlinize ();
+say "Done."
+)
+| _ :: "clean" :: [] ->(
+say "Cleaning";
+cmdf "rm -fr _build";
+say "Done."
+)
+| _ ->(
+say "usage: ocaml %s [build|install|uninstall|clean|build_doc|melinize]" Sys.argv.(0)
+)
+
+end
+
+