Commits

camlspotter committed bf91b1e

added files

Comments (0)

Files changed (13)

+(* OASIS_START *)
+(* DO NOT EDIT (digest: cd7ffde1c98c46d7a730ab9b435519f8) *)
+Authors of tiny_json_conv
+Jun Furuse
+(* OASIS_STOP *)
+(* OASIS_START *)
+(* DO NOT EDIT (digest: 9f17c3f69e534399a329e6dcffdb6b24) *)
+This is the INSTALL file for the tiny_json_conv distribution.
+
+This package uses OASIS to generate its build system. See section OASIS for
+full information. 
+
+Dependencies
+============
+
+In order to compile this package, you will need:
+* ocaml
+* findlib
+
+Installing
+==========
+
+1. Uncompress the source archive and go to the root of the package
+2. Run 'ocaml setup.ml -configure'
+3. Run 'ocaml setup.ml -build'
+4. Run 'ocaml setup.ml -install'
+
+Uninstalling
+============
+
+1. Go to the root of the package 
+2. Run 'ocaml setup.ml -uninstall'
+
+OASIS
+=====
+
+OASIS is a program that generates a setup.ml file using a simple '_oasis'
+configuration file. The generated setup only depends on the standard OCaml
+installation: no additional library is required.
+
+(* OASIS_STOP *)
+# How-to-build using OMake
+#
+# yes no | omake --install # to create OMakeroot for the first time
+
+# If OMakeroot is here, include OMyMakefile
+if $(file-exists OMakeroot)
+   include OMyMakefile
+   export
+
+Subdirs()
+
+setup.ml: _oasis
+	oasis setup
+# ==========================
+# OMyMakefile
+# ==========================
+# Useful functions to build OCaml projects
+
+#| A flag to tell that we can use OMyMakefile functions
+WithOMy=true
+
+#| The prefix. Equal to the PREFIX environment variable
+try
+  PREFIX=$(getenv PREFIX)
+default
+  eprintln(Specify PREFIX or prefix environment variable.)
+  exit 1 
+
+# OCaml 
+# ========================================================================
+
+#|Path to the OCaml library directory
+OCAML_WHERE = $(shell ocamlc -where)
+
+#|Version without extensions
+OCAML_VERSION = $(shell ocamlc -version | sed -e 's/^\([0-9.]*\).*/\1/')
+
+#|OMy requires OCamlFind!
+USE_OCAMLFIND = true
+OCAMLFIND_DESTDIR= $(shell ocamlfind printconf destdir)
+
+#|Set NATIVE_ENABLED false locally if a project does not requre opt compilation.
+NATIVE_ENABLED = $(OCAMLOPT_EXISTS)
+NATIVE_SHARED_ENABLED = $(OCAMLOPT_EXISTS)
+BYTE_ENABLED = true
+
+#|The default warning and errors. If you want to use different warning and error switches, use redefine the variable.
+OCAMLFLAGS = -w A-4-9 -warn-error A-4-9
+
+#|Global variable to be defined as empty
+OCAMLPACKAGEFLAGS=
+
+#|Preinstalled libraries which are always available for normal ocaml.
+#
+# You may want to add the required packages which are built and installed out of OMy framework:
+#
+#::
+#
+#   include OMyMakefile
+#   
+#   OCAML_PREINSTALLED_PACKS += llvm # llvm has been installed already, independently
+#   
+#   Subdirs()
+#
+# It includes "findlib" by default. If you want to build findlib in OMy framework, you have to remove it from the list.
+OCAML_PREINSTALLED_PACKS[]= bigarray camlp4 dbm dynlink graphics num num-top stdlib str threads unix findlib compiler-libs compiler-libs.common
+
+#|Redefinition of compiler commands
+public.OCamlC() =
+    value $(OCAMLFIND) $(OCAMLC) $(OCAMLPACKAGEFLAGS) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS)\
+              $(OCAMLCFLAGS) $(OCAMLPPFLAGS) $(PREFIXED_OCAMLINCLUDES)
+# Why we need "public." ?
+
+public.OCamlOpt() =
+    value $(OCAMLFIND) $(OCAMLOPT) $(OCAMLPACKAGEFLAGS) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS)\
+              $(OCAMLOPTFLAGS) $(OCAMLPPFLAGS) $(PREFIXED_OCAMLINCLUDES)
+
+if $(and $(not $(NATIVE_ENABLED)) $(not $(BYTE_ENABLED)))
+   err. =
+       extends $(UnbuildableException)
+       message = $(string $"You must turn on either NATIVE_ENABLED or BYTE_ENABLED")
+       raise $(err)
+
+#|Additional implicit rules by file extensions
+# annot, cmt, cmti files
+%.annot %.cmt: %.ml %.cmi
+	$(OCamlC) -c -annot -bin-annot $<
+
+%.spit %.cmti: %.mli 
+	$(OCamlC) -c -bin-annot $<
+
+#|Define OCAML_ANNOT so that ocamlc/ocamlopt automatically create spot/spit/annot/cmt/cmti files, even without -annot/-bin-annot option. This requires a special compiler patch 
+setenv(OCAML_ANNOT, 1)
+
+#|Enable the backtrace
+setenv(OCAMLRUNPARAM, b)
+
+# Common phonies
+# ==================================================================
+.PHONY: all install uninstall clean
+
+# Directories
+# =====================================================================
+
+#| The build root directory  
+BIG_ROOT=$(dir .)
+
+# Installation mark files
+# =======================================================================
+
+#| To enable the installation mark files, you must define INSTALLED path variable
+# for the mark file directory like INSTALLED=$(BIG_ROOT)/installed and make sure
+# the directory $(INSTALLED) exists. This preparation must be done outside of 
+# this OMyMakefile.
+
+#|Returns the installation mark files of $(packs)
+Installed(packs) = 
+  if $(defined INSTALLED)
+      return $(addprefix $(INSTALLED)/, $(packs))
+  else
+      return $(array)
+
+#|Create md5 sum file of files $(targets)
+CreateCheckSum(pack, targets)=
+    chan=$(fopen $(pack), w)
+    fprintln($(chan), $(string $(targets)))
+    fprintln($(chan), $(string $(digest $(targets))))
+    close($(chan))
+
+#|Create $(Installed $(pack)) file from the digests of $(targets)
+CreateInstalled(pack, targets)=
+    if $(defined INSTALLED)
+        println(dump md5 $(INSTALLED)/$(pack))
+        CreateCheckSum($(INSTALLED)/$(pack), $(targets))
+
+# Packages
+# =========================================================
+
+#| OCaml packages required for compilation. MyCaml* functions automatically add necessary dependencies over packages in $(OCAMLPACKS).
+# 
+# .. note:: They are also required for dependency analysis.
+public.OCAMLPACKS[]=
+
+#| CamlP4 syntax extension packages required for parsing. MyCaml* functions automatically add necessary dependencies over packages in $(CAMLP4PACKS).
+public.CAMLP4PACKS[]=
+
+# Dependencies
+# =========================================================================
+
+#|Returns packages managed by OMy framework
+OMyManagedPackages(packages) =
+   return $(set-diff $(packages), $(OCAML_PREINSTALLED_PACKS))
+
+#|Add dependencies of OCaml compiled files (cmx, cmo, etc.) over $(files).
+#
+# .. note:: These functions introduce implicit rules: *you may need to export it, if you use this function in a local context.*
+OCamlRequire(files) =
+    %.cmx %.cmo %.cmi %.cma %.cmxa %.annot %.spot %.spit %.cmt %.cmti: $(files)
+    export
+
+#|Add dependencies of OCaml compiled files (cmx, cmo, etc.) over $(packages).
+# $(packages) listed in OCAML_PREINSTALLED_PACKS are ignored.
+#
+# .. note:: These functions introduce implicit rules: *you may need to export it, if you use this function in a local context.*
+#
+# .. note:: Usually you do not need to call this function. Use OCAMLPACKS variable instead. 
+OCamlRequirePackages(packages) =
+    required_packs = $(OMyManagedPackages $(packages))
+    if $(defined INSTALLED)
+      %.cmx %.cmo %.cmi %.cma %.cmxa %.annot %.spot %.spit %.cmt %.cmti: $(Installed $(required_packs))
+      export
+    export
+
+#|Add dependencies of OCaml dependency analysis and build over $(packages).
+# Use this for adding dependencies for CamlP4 extensions.
+# $(packages) listed in OCAML_PREINSTALLED_PACKS are ignored.
+#
+# .. note:: These functions introduce implicit rules: *you may need to export it, if you use this function in a local context.*
+#
+# .. note:: Usually you do not need to call this function. Use CAML4PACKS variable instead. 
+OCamlRequireCamlP4Packages(packages) =
+    required_packs = $(OMyManagedPackages $(packages))
+    if $(defined INSTALLED)
+      .SCANNER: scan-ocaml-%: $(Installed $(required_packs))
+      %.cmx %.cmo %.cmi %.cma %.cmxa %.annot %.spot %.spit : $(Installed $(required_packs))
+      export 
+    export
+
+#|``omake xxx.auto.mli`` generates .mli file from xxx.ml 
+%.auto.mli: %.ml
+	$(OCamlC) -i -c $< > $@
+
+# Build rules
+# ==========================================================
+
+# Extend the bundled OCamlPackage with .spot creation
+public.OCamlLibrary(name, files) =
+   # XXX: JYH: these variables should be marked private in 0.9.9
+   protected.name = $(file $(name))
+
+   protected.OFILES   = $(addsuffix $(EXT_OBJ), $(files))
+   protected.CMOFILES = $(addsuffix .cmo, $(files))
+   protected.CMXFILES = $(addsuffix .cmx, $(files))
+
+   protected.CLIB      = $(file $(name)$(EXT_LIB))
+   protected.BYTELIB   = $(file $(name).cma)
+   protected.NATIVELIB = $(file $(name).cmxa)
+   protected.NATIVESHAREDLIB = $(file $(name).cmxs)
+
+   #
+   # Link commands
+   #
+   $(BYTELIB): $(CMOFILES)
+        $(OCAMLFIND) $(OCAMLLINK) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) $(OCAMLCFLAGS) \
+                $(OCAML_LIB_FLAGS) -a -o $@ $(OCamlLinkSort $(CMOFILES))
+
+   $(NATIVELIB) $(CLIB): $(CMXFILES) $(OFILES)
+        $(OCAMLFIND) $(OCAMLOPTLINK) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) \
+                $(OCAML_LIB_FLAGS) -a -o $(NATIVELIB) $(OCamlLinkSort $(CMXFILES))
+
+   $(NATIVESHAREDLIB): $(CMXFILES) $(OFILES)
+         $(OCAMLFIND) $(OCAMLOPTLINK) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) $(OCAMLOPTFLAGS) \
+                 $(OCAML_LIB_FLAGS) -shared -o $(NATIVESHAREDLIB) $(OCamlLinkSort $(CMXFILES))
+
+   return $(array $(if $(NATIVE_ENABLED), $(NATIVELIB)), \
+                  $(if $(NATIVE_ENABLED), $(CLIB)), \
+                  $(if $(NATIVE_SHARED_ENABLED), $(NATIVESHAREDLIB)), \
+                  $(if $(BYTE_ENABLED), $(BYTELIB)))
+
+# Extend the bundled OCamlPackage with .spot creation
+public.OCamlPackage(name, files) =
+   # XXX: JYH: these variables should be marked private in 0.9.9
+   protected.OFILES   = $(addsuffix $(EXT_OBJ), $(files))
+   protected.CMOFILES = $(addsuffix .cmo, $(files))
+   protected.CMXFILES = $(addsuffix .cmx, $(files))
+
+   protected.OBJ       = $(file $(name)$(EXT_OBJ))
+   protected.CMO       = $(file $(name).cmo)
+   protected.CMX       = $(file $(name).cmx)
+   protected.CMI       = $(file $(name).cmi)
+   protected.MLI       = $(file $(name).mli)
+
+   protected.BYTE_TARGETS   = $(CMO)
+   protected.NATIVE_TARGETS = $(CMX) $(OBJ)
+
+   if $(BYTE_ENABLED)
+      BYTE_TARGETS += $(file $(name).cmt)
+      export
+   else
+      NATIVE_TARGETS += $(file $(name).cmt)
+      export
+   export
+
+   protected.TARGETS = $(CMI)
+   if $(NATIVE_ENABLED)
+       TARGETS += $(NATIVE_TARGETS)
+       export
+
+   if $(BYTE_ENABLED)
+       TARGETS += $(BYTE_TARGETS)
+       export
+
+   #
+   # Link commands
+   #
+   protected.BYTE_DEPS = $(CMOFILES)
+   $(BYTE_TARGETS): $(CMOFILES)
+      section rule
+         if $(or $(NATIVE_ENABLED), $(target-exists $(MLI)))
+             BYTE_DEPS += $(CMI)
+             export
+         else
+             BYTE_TARGETS += $(CMI)
+             export
+         $(BYTE_TARGETS): $(BYTE_DEPS)
+            $(OCAMLFIND) $(OCAMLC) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) \
+                $(OCAMLCFLAGS) $(OCAML_LIB_FLAGS) -pack -bin-annot -o $(CMO) $(OCamlLinkSort $(CMOFILES))
+
+   protected.NATIVE_DEPS = $(CMXFILES) $(OFILES)
+   $(NATIVE_TARGETS): $(NATIVE_DEPS)
+      section rule
+         if $(target-exists $(MLI))
+            NATIVE_DEPS += $(CMI)
+            export
+         else
+            NATIVE_TARGETS += $(CMI)
+            export
+         $(NATIVE_TARGETS): $(NATIVE_DEPS)
+            $(OCAMLFIND) $(OCAMLOPTLINK) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) \
+                $(OCAMLOPTFLAGS) $(OCAML_LIB_FLAGS) -pack -bin-annot -o $(CMX) $(OCamlLinkSort $(CMXFILES))
+
+   $(CMI):
+      section rule
+         if $(target-exists $(MLI))
+            $(CMI): $(MLI) :scanner: scan-ocaml-$(name).mli
+                $(OCamlC) -c $<
+         elseif $(NATIVE_ENABLED)
+            $(NATIVE_TARGETS) $(CMI): $(NATIVE_DEPS)
+               $(OCAMLFIND) $(OCAMLOPTLINK) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) \
+                   $(OCAMLOPTFLAGS) $(OCAML_LIB_FLAGS) -pack -o $(CMX) $(OCamlLinkSort $(CMXFILES))
+         else
+            $(BYTE_TARGETS) $(CMI): $(BYTE_DEPS)
+               $(OCAMLFIND) $(OCAMLC) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) \
+                   $(OCAMLCFLAGS) $(OCAML_LIB_FLAGS) -pack -o $(CMO) $(OCamlLinkSort $(CMOFILES))
+
+   return $(TARGETS)
+
+# Add implicit dependencies over the packages declared in OCAMLPACKS and CAMLP4PACKS
+# If this function is used in a local scope, you may want to export. 
+AddLocalOCamlPackageDependencies() =
+  # We make sure the required libraries are installed
+  OCamlRequirePackages($(OCAMLPACKS)) # must be exported!
+  OCamlRequireCamlP4Packages($(OCAMLPACKS) $(CAMLP4PACKS))
+  export
+
+#| Add a rule for OCaml package $(library_name).cmo, $(library_name).cmx and etc.
+#     library_name
+#         target package name
+#     files
+#         ML module names (without .ml)
+#     cmodules
+#         C source files (without .c)
+#     linkopts
+#         C library link option (without OCaml -cclib options)    
+#
+#  You can specify MyOCamlPackageExtras before using this function to install files out of the scope of this rule.   
+#  
+#  If $(NO_INSTALL) is defined, omake install does not install the package
+#
+#  Example::
+#
+#      MyOCamlPackage(foo, alpha beta, $(EMPTY), $(EMPTY))
+#
+#  Todo: external C library
+MyOCamlPackage(library_name, files, cmodules, linkopts) =
+  AddLocalOCamlPackageDependencies()
+  export # The above thing is local: need to be exported
+
+  CSTUBS=$(addsuffix .o,$(cmodules))
+  CMOS=$(addsuffix .cmo,$(library_name))
+  CMXS=$(addsuffix .cmx,$(library_name))
+  CMA=$(library_name).cma
+  CMXA=$(library_name).cmxa
+
+  if $(not $(defined MyOCamlPackageExtras))
+      MyOCamlPackageExtras[]=
+      export
+
+  CSTUBLIBRARIES=
+  if $(not $(equal $(cmodules), $(EMPTY)))
+      CSTUBLIBRARIES= dll$(library_name).so lib$(library_name).a 
+      export
+
+  # CR jfuruse: I guess we do not need the following
+  # export # export the implicit rule above
+
+  .PHONY: install-lib
+  install-lib: $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(MyOCamlPackageExtras)
+
+  $(CMA) $(CMXA) $(library_name).a $(CSTUBLIBRARIES) : $(CSTUBS) $(CMOS) $(CMXS)
+      if $(not $(equal $(cmodules), $(EMPTY)))
+          ocamlmklib -verbose -o $(library_name) $(CSTUBS) $(linkopts) $(CMOS) $(CMXS)
+      else
+          $(OCamlC) -a -o $(CMA) $(CMOS)
+          $(OCamlOpt) -a -o $(CMXA) $(CMXS)
+
+  ## the followings are necessary for packing
+
+  OCAMLPACKAGEFLAGS += -for-pack $(capitalize $(library_name))
+  # export OCAMLPACKAGEFLAGS
+
+  ## build rule
+
+  .DEFAULT: $(OCamlPackage $(library_name), $(files))
+
+  ## clean
+  AutoClean()
+  clean:
+	rm -f $(library_name).spot $(library_name).cmt
+
+  ## install
+
+  # CR jfuruse: x.cmi is required if x.mli does not exist!
+  targets[]=META $(glob i, *.mli) $(library_name).cmi $(library_name).cmo $(library_name).cmx $(library_name).cma $(library_name).cmxa $(library_name).o $(library_name).a $(CSTUBLIBRARIES) $(MyOCamlPackageExtras)
+
+  targets[]+= $(library_name).cmt
+
+  if $(not $(defined NO_INSTALL))
+    if $(defined INSTALLED)
+      $(Installed $(library_name)): $(targets)
+        $(OCAMLFIND) remove $(library_name)
+        section:
+              $(OCAMLFIND) install $(library_name) $(targets)
+              CreateInstalled($(library_name), $(targets))
+
+      install: $(Installed $(library_name))
+
+      uninstall:
+        rm -f $(Installed $(library_name))
+        $(OCAMLFIND) remove $(library_name)
+      export
+    else
+      install: $(targets)
+        $(OCAMLFIND) remove $(library_name)
+        $(OCAMLFIND) install $(library_name) $(targets)
+
+      uninstall:
+	$(OCAMLFIND) remove $(library_name)
+      export
+    export
+
+############################################################## build ocaml exec
+
+#| Add a rule to build a program $(name)
+#      name
+#          Name of the program
+#      files
+#          OCaml module names (without .ml)
+MyOCamlTestProgram(name, files) =
+  AddLocalOCamlPackageDependencies()
+  export # The above thing is local: need to be exported
+
+  $(name).run $(name).opt: $(Installed $(OMyManagedPackages $(OCAMLPACKS)))
+
+  # CR jfuruse: forgot to add the deps over the packages!
+  .DEFAULT: $(OCamlProgram $(name), $(files))
+
+  # The following clean the files twice if MyOCamlPackge coexists,
+  # but who cases ?
+  AutoClean()
+
+#| Add a rule to build a program $(name)
+#      name
+#          Name of the program
+#      files
+#          OCaml module names (without .ml)
+#  In addition to MyOCamlTestProgram, the binary is installed by omake install
+MyOCamlProgram(name, files) =
+  MyOCamlTestProgram($(name), $(files))
+  export # The above thing is local: need to be exported
+
+  if $(not $(defined NO_INSTALL))
+    install: $(name) $(name).run $(name).opt
+      install $(name) $(name).run $(name).opt $(PREFIX)/bin
+    uninstall:
+      rm -f $(PREFIX)/bin/$(name) $(PREFIX)/bin/$(name).run $(PREFIX)/bin/$(name).opt
+    export
+
+#| Add a rule to build a toplevel $(name)
+#      name
+#          Name of the program
+#      files
+#          OCaml module names (without .ml)
+OCamlTop(name, files) =
+   # XXX: JYH: these variables should be marked private in 0.9.9
+   protected.CMOFILES  = $(addsuffix .cmo, $(files))
+   # protected.CMXFILES  = $(addsuffix .cmx, $(files))
+   # protected.OFILES    = $(addsuffix $(EXT_OBJ), $(files))
+
+   protected.CMAFILES  = $(addsuffix .cma,  $(OCAML_LIBS))
+   # protected.CMXAFILES = $(addsuffix .cmxa, $(OCAML_LIBS))
+   protected.ARFILES   = $(addsuffix $(EXT_LIB), $(OCAML_LIBS))
+   protected.CMA_OTHER_FILES = $(addsuffix .cma, $(OCAML_OTHER_LIBS))
+   # protected.CMXA_OTHER_FILES = $(addsuffix .cmxa, $(OCAML_OTHER_LIBS))
+
+   protected.CLIBS = $(addsuffix $(EXT_LIB), $(OCAML_CLIBS))
+
+   protected.name = $(file $(name))
+
+   protected.PROG     = $(file $(name)$(EXE))
+   protected.BYTEPROG = $(file $(name).run)
+   # protected.OPTPROG  = $(file $(name).opt)
+
+   #
+   # Rules to build byte-code and native targets
+   #
+   $(BYTEPROG): $(CMAFILES) $(CMOFILES) $(CLIBS)
+        $(OCAMLFIND) $(OCAMLMKTOP) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLFLAGS) $(OCAMLCFLAGS)\
+                $(PREFIXED_OCAMLINCLUDES) $(OCAML_BYTE_LINK_FLAGS)\
+                -o $@ $(CMA_OTHER_FILES) $(CMAFILES) $(OCamlLinkSort $(CMOFILES))\
+                $(CLIBS) $(OCAML_LINK_FLAGS)
+
+   $(PROG): $(BYTEPROG)
+        ln-or-cp $< $@
+
+   return $(array $(PROG), $(BYTEPROG))
+
+MyOCamlTop(name, files) =
+  AddLocalOCamlPackageDependencies()
+  export # The above thing is local: need to be exported
+
+  $(name): $(Installed $(OMyManagedPackages $(OCAMLPACKS)))
+
+  # CR jfuruse: forgot to add the deps over the packages!
+  .DEFAULT: $(OCamlTop $(name), $(files))
+
+  # The following clean the files twice if MyOCamlPackge coexists,
+  # but who cases ?
+  AutoClean()
+  export # The above thing is local: need to be exported
+
+  if $(not $(defined NO_INSTALL))
+    install: $(name) $(name).run
+      install $(name) $(name).run $(PREFIX)/bin
+    uninstall:
+      rm -f $(PREFIX)/bin/$(name) $(PREFIX)/bin/$(name).run
+    export
+
+#|  Add rules to build OCaml library $(name)
+#        name
+#            Name of the library
+#        files
+#            OCaml module name (without .ml)
+#
+#   .. note :: Probably you should use MyOCamlPackage
+MyOCamlLibrary(library_name, files) =
+  AddLocalOCamlPackageDependencies()
+  targets = $(OCamlLibrary $(library_name), $(files))
+
+  .DEFAULT: $(targets)
+
+  export # The above thing is local: need to be exported
+
+  if $(not $(defined NO_INSTALL))
+    targets[] += META 
+    if $(defined INSTALLED)
+      $(Installed $(library_name)): $(targets)
+        $(OCAMLFIND) remove $(library_name)
+        section:
+              $(OCAMLFIND) install $(library_name) $(targets)
+              CreateInstalled($(library_name), $(targets))
+
+      install: $(Installed $(library_name))
+
+      uninstall:
+        rm -f $(Installed $(library_name))
+        $(OCAMLFIND) remove $(library_name)
+      export
+    else
+      install: $(targets)
+        $(OCAMLFIND) remove $(library_name)
+        $(OCAMLFIND) install $(library_name) $(targets)
+
+      uninstall:
+	$(OCAMLFIND) remove $(library_name)
+      export
+    export
+
+  # The following clean the files twice if MyOCamlPacakge coexists,
+  # but who cases ?
+  AutoClean()
+
+# Auto clean
+# ====================================================================
+
+#| Install clean command which cleans all the target files exists under the directory. Use with care.
+AutoClean()=
+    .PHONY: clean
+    clean:
+        rm -f $(filter-proper-targets $(ls R, .))
+
+# Subdir traversal
+# =====================================================================
+
+#| Recursively traverse the subdirs except $(dirs)
+Subdirs_except(dirs) =
+  # println(PWD: $(shell pwd))
+
+  # need to export since .SUBDIRS is evaluated in the global scope
+  export VISIT_SUBDIRS
+
+  sub_omakefiles = $(glob i, */OMakefile)
+  subdirs = $(sub_omakefiles.map $(dirname))
+
+  VISIT_SUBDIRS=$(set-diff $(subdirs), $(dirs))
+
+  # println(SUBDIRS: $(string $(VISIT_SUBDIRS)))
+
+  # The rule
+  .SUBDIRS: $(VISIT_SUBDIRS)
+
+#| Recursively traverse all the subdirs
+Subdirs() =
+  Subdirs_except($(array))
+
+#| Recursively traverse the given subdirs $(dirs)
+Subdirs_only(dirs) =
+ .SUBDIRS: $(dirs)
+
+# Dependency dot files for Graphviz
+# ======================================================================
+
+#| Add a rule for ``depend.dot`` for a dependency graph of OCaml files in the current directory
+Dot() =
+	depend.dot: $(ls *.ml *.mli)
+	    $(OCAMLFIND) ocamldoc -I +threads $(OCAMLPACKAGEFLAGS) $(LAZY_OCAMLFINDFLAGS) $(PREFIXED_OCAMLPACKS) $(OCAMLPPFLAGS) $(PREFIXED_OCAMLINCLUDES) -dot -dot-include-all -dot-reduce $+ -o $@
+
+
+#| filter list
+#  example::
+#     is_url(file) =
+#       match $(file)
+#       case $'://'
+#         return true
+#       default
+#         return false
+# 
+#     DOWNLOAD_URLS[]=$(list_filter $(fun x, $(is_url $(x))), $(URLS))
+list_filter(pred, list) =
+  result=
+  foreach(x, $(list))
+    if $(apply $(pred), $(x))
+      result+=$(x)
+      export
+    export
+  return $(result)
+
+#| Obtain files installed as PACK
+GET_OCAMLFIND_OBJS(pack)=
+    return $(Files $(OCAMLFIND_DESTDIR)/$(pack))
+
+# Misc tools
+# ======================================================================
+
+#|ditto.
+mkdir_if_not_exists(dir) =
+  if $(not $(test -e $(dir))):
+    mkdir $(dir) 
+  return
+(* OASIS_START *)
+(* DO NOT EDIT (digest: ea2d16be8053506e23da99c31bf17266) *)
+This is the README file for the tiny_json_conv distribution.
+
+Meta conv for Tiny Json
+
+See the files INSTALL.txt for building and installation instructions. 
+
+
+(* OASIS_STOP *)
+OASISFormat: 0.2
+Name:        tiny_json_conv
+Version:     1.0.0
+Synopsis:    Meta conv for Tiny Json
+Authors:     Jun Furuse
+License:     LGPL-2.0 with OCaml linking exception
+Plugins:      StdFiles (0.2)
+BuildType:    Custom (0.2)
+InstallType:    Custom (0.2)
+XCustomBuild: yes no | omake --install; omake
+XCustomInstall: omake install
+XCustomUninstall: omake uninstall
+BuildTools: omake
+BuildDepends:  meta_conv
+name="tiny_json_conv"
+version="1.0.0"
+description="Meta conv for Tiny Json"
+requires=""
+archive(byte)="tiny_json_conv.cmo"
+archive(native)="tiny_json_conv.cmx"
+linkopts = ""
+OCAMLFLAGS    = -annot -w Ae
+
+OCAMLPACKS[]=
+    tiny_json
+    meta_conv
+
+# OCAMLDEPFLAGS= -syntax camlp4o -package sexplib.syntax
+# OCAMLPPFLAGS= -syntax camlp4o -package sexplib.syntax
+
+# OCamlGeneratedFiles(parser.ml lexer.ml)
+
+LIBFILES[] =
+   json_conv
+
+LIB = json_conv
+
+MyOCamlLibrary($(LIB), $(LIBFILES))
+open Tiny_json
+open Json
+
+module Encode = struct
+  let int n       = Number (float n)
+  let int32 n     = Number (Int32.to_float n)
+  let int64 n     = Number (Int64.to_float n)
+  let nativeint n = Number (Nativeint.to_float n)
+  let char c      = String (String.make 1 c)
+  let string s    = String s
+  let float n     = Number n
+  let list f xs   = Array (List.map f xs)
+  let array f xs  = Array (List.map f (Array.to_list xs))
+  let bool b      = Bool b
+  let lazy_t f v  = f (Lazy.force v)
+  let option f    = function
+    | None -> Null
+    | Some v -> f v
+  let unit ()     = Null
+ 
+  let tuple ts       = Array ts
+  let variant tag = function
+    | [] -> String tag
+    | ts -> Object [tag, Array ts]
+  let record tag_ts  = Object tag_ts
+end
+
+let json_of_int       = Encode.int
+let json_of_int32     = Encode.int32
+let json_of_int64     = Encode.int64
+let json_of_nativeint = Encode.nativeint
+let json_of_char      = Encode.char
+let json_of_string    = Encode.string
+let json_of_float     = Encode.float
+let json_of_list      = Encode.list
+let json_of_array     = Encode.array
+let json_of_bool      = Encode.bool
+let json_of_lazy_t    = Encode.lazy_t
+let json_of_option    = Encode.option
+let json_of_unit      = Encode.unit
+
+let errorf fmt = Printf.ksprintf (fun s -> raise (Failure s)) fmt
+
+module Decode = Meta_conv.Conv.Make_Decode_Adrs(struct
+  type t = Json.t
+  let tuple = function 
+    | Array ts -> ts
+    | _ -> errorf "Array expected for array"
+
+  let variant = function 
+    | String tag -> tag, [] 
+    | Object [tag, Array ts] -> tag, ts
+    | _ -> errorf "Object expected for variant"
+
+  let record = function
+    | Object alist -> alist
+    | _ -> errorf "Object expected for record"
+end)
+
+open Printf
+open Meta_conv.Conv
+
+type 'a decoder = ('a, Json.t) Meta_conv.Conv.decoder
+exception Error of Json.t error * Address.t
+
+let errorf v adrs fmt = 
+  kprintf (fun s -> `Error (Primitive_decoding_failure s, v, adrs)) fmt
+
+let string_of_json ?(adrs=Address.top) = function
+  | String s -> `Ok s
+  | v -> errorf v adrs "string_of_json: String expected"
+
+let char_of_json ?(adrs=Address.top) = function
+  | String s when String.length s = 1 -> `Ok s.[0]
+  | v -> errorf v adrs "char_of_json: a char expected"
+
+let int_check name min max conv ?(adrs=Address.top) v = match v with
+  | Number n -> 
+      begin match integer_of_float min max conv n with
+      | `Ok i -> `Ok i
+      | `Error s -> errorf v adrs "%s_of_json: %s" name s
+      end
+  | _ -> errorf v adrs "%s_of_json: Number expected" name
+
+let int_of_json =
+  int_check "int" (float min_int) (float max_int) int_of_float
+
+let int64_of_json =
+  let open Int64 in
+  int_check "int64" (to_float min_int) (to_float max_int) of_float
+      
+let int32_of_json =
+  let open Int32 in
+  int_check "int32" (to_float min_int) (to_float max_int) of_float
+      
+let nativeint_of_json = 
+  let open Nativeint in
+  int_check "nativeint" (to_float min_int) (to_float max_int) of_float
+      
+let float_of_json ?(adrs=Address.top) = function
+  | Number n -> `Ok n
+  | n -> errorf n adrs "float_of_json: Number expected"
+
+let bool_of_json ?(adrs=Address.top) = function
+  | Bool b -> `Ok b
+  | v -> errorf v adrs "bool_of_json: Bool expected"
+
+let unit_of_json ?(adrs=Address.top) = function
+  | Null -> `Ok ()
+  | v -> errorf v adrs "unit_of_json: Null expected"
+  
+let list_of_json d = generic_list_of (function
+  | Array xs -> Some xs
+  | _ -> None) d
+
+let array_of_json d = generic_array_of (function
+  | Array xs -> Some xs
+  | _ -> None) d
+
+let option_of_json d = generic_option_of (function
+  | Null -> true
+  | _ -> false) d
+
+let lazy_t_of_json f = generic_lazy_t_of f
+
+

lib/json_conv.mli

+open Tiny_json
+open Meta_conv.Conv
+
+module Encode : sig
+  val tuple : Json.t list -> Json.t
+  val variant : string -> Json.t list -> Json.t
+  val record : Json.obj -> Json.t
+end
+
+val json_of_int : int -> Json.t
+val json_of_int32 : int32 -> Json.t
+val json_of_int64 : int64 -> Json.t
+val json_of_nativeint : nativeint -> Json.t
+val json_of_char : char -> Json.t
+val json_of_string : string -> Json.t
+val json_of_float : float -> Json.t
+val json_of_bool : bool -> Json.t
+val json_of_unit : unit -> Json.t
+val json_of_list : ('a -> Json.t) -> 'a list -> Json.t
+val json_of_array : ('a -> Json.t) -> 'a array -> Json.t
+val json_of_lazy_t : ('a -> 'b) -> 'a Lazy.t -> 'b
+val json_of_option : ('a -> Json.t) -> 'a option -> Json.t
+
+module Decode : sig
+  val tuple : Json.t * Address.t -> (Json.t * Address.t) list
+  val variant : Json.t * Address.t -> string * (Json.t * Address.t) list
+  val record : Json.t * Address.t -> (string * (Json.t * Address.t)) list
+end
+
+type 'a decoder = ('a, Json.t) Meta_conv.Conv.decoder
+exception Error of Json.t error * Address.t
+
+val string_of_json    : string decoder
+val char_of_json      : char decoder
+val int_of_json       : int decoder
+val int64_of_json     : int64 decoder
+val int32_of_json     : int32 decoder
+val nativeint_of_json : nativeint decoder
+val float_of_json     : float decoder
+val bool_of_json      : bool decoder
+val unit_of_json      : unit decoder
+val list_of_json      : 'a decoder -> 'a list decoder
+val array_of_json     : 'a decoder -> 'a array decoder
+val option_of_json    : 'a decoder -> 'a option decoder
+val lazy_t_of_json    : 'a decoder -> 'a lazy_t decoder

opam/template/descr

+Meta conv for Tiny Json
+Converters for meta_conv + tiny_json

opam/template/opam

+ocaml-version: [>= "4.0.0"]
+depends: ["ocamlfind" "omake" "tiny_json" "meta_conv"]
+(* setup.ml generated for the first time by OASIS v0.3.0 *)
+
+(* OASIS_START *)
+(* DO NOT EDIT (digest: 24b5a5cd7dcc0c1b1e3608e69b8a691f) *)
+(*
+   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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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_ "<empty>"
+              else
+                String.concat
+                  (s_ ", ")
+                  (List.map
+                     (fun (cond, vl) ->
+                        match printer with
+                          | Some p -> p vl
+                          | None -> s_ "<no printer>")
+                     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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/src/oasis/OASISBuildSection.ml"
+
+end
+
+module OASISExecutable = struct
+# 21 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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 "/mnt/home/jun/.opam/system/build/oasis.0.3.0/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