From: Stefano Zacchiroli Date: Mon, 6 Apr 2009 11:59:18 +0000 (+0200) Subject: new patch ocamldoc_natdynlink: dyn-loading for ocamldoc.opt X-Git-Tag: archive/raspbian/4.08.1-4+rpi1~3^2~416 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=560cd164675e5f7d3b86c9d6bde0c58350105409;p=ocaml.git new patch ocamldoc_natdynlink: dyn-loading for ocamldoc.opt --- diff --git a/debian/changelog b/debian/changelog index 4ab1b00d..71dc9d9f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -8,6 +8,9 @@ ocaml (3.11.0-6) UNRELEASED; urgency=low * debian/control - remove recommends to ledit from ocaml-nox (does not ship "ocaml") - change recommends from ledit to "ledit | rlwrap" for ocaml-interp + * debian/patches/ + - add new patch ocamldoc_natdynlink (from upstream): enable + dynamic loading of ocamldoc custom printers also for ocamldoc.opt -- Samuel Mimram Mon, 16 Mar 2009 15:07:00 +0100 diff --git a/debian/patches/00list b/debian/patches/00list index 3c086553..a5be651c 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -2,6 +2,7 @@ alpha_ld_no-relax.dpatch call_ld_with_proper_flags.dpatch no_rpath.dpatch stdlib_man_section.dpatch +ocamldoc_natdynlink.dpatch install_scripts_config.dpatch install_ocamlbuild.dpatch dbm_ldopts.dpatch diff --git a/debian/patches/ocamldoc_natdynlink.dpatch b/debian/patches/ocamldoc_natdynlink.dpatch new file mode 100755 index 00000000..99aaf809 --- /dev/null +++ b/debian/patches/ocamldoc_natdynlink.dpatch @@ -0,0 +1,183 @@ +#! /bin/sh /usr/share/dpatch/dpatch-run +## ocamldoc_natdynlink.dpatch by Stefano Zacchiroli +## +## All lines beginning with `## DP:' are a description of the patch. +## DP: Add to ocamldoc support for native code dynamic loading. +## DP: That enables using ocamldoc flags such as "-g" also with +## DP: ocamldoc.opt. Patch is taken from OCaml CVS and is already +## DP: integrated upstream for future releases. + +@DPATCH@ +diff -urNad ocaml~/man/ocamldoc.m ocaml/man/ocamldoc.m +--- ocaml~/man/ocamldoc.m 2009-02-21 12:54:30.000000000 +0100 ++++ ocaml/man/ocamldoc.m 2009-04-06 13:57:21.520452487 +0200 +@@ -110,10 +110,7 @@ + .TP + .BI \-g \ file + Dynamically load the given file (which extension usually is .cmo or .cma), +-which defines a custom documentation generator. This option is supported by the +-.BR ocamldoc (1) +-command, but not by its native-code version +-.BR ocamldoc.opt . ++which defines a custom documentation generator. + If the given file is a simple one and does not exist in + the current directory, then ocamldoc looks for it in the custom + generators default directory, and in the directories specified with the +diff -urNad ocaml~/ocamldoc/Makefile ocaml/ocamldoc/Makefile +--- ocaml~/ocamldoc/Makefile 2009-04-06 13:56:34.000451820 +0200 ++++ ocaml/ocamldoc/Makefile 2009-04-06 13:56:34.272459850 +0200 +@@ -111,16 +111,17 @@ + CMXFILES= $(CMOFILES:.cmo=.cmx) + CMIFILES= $(CMOFILES:.cmo=.cmi) + +-EXECMOFILES=$(CMOFILES)\ +- odoc_dag2html.cmo\ +- odoc_to_text.cmo\ +- odoc_ocamlhtml.cmo\ +- odoc_html.cmo\ +- odoc_man.cmo\ ++EXECMOFILES=$(CMOFILES) \ ++ odoc_dag2html.cmo \ ++ odoc_to_text.cmo \ ++ odoc_ocamlhtml.cmo \ ++ odoc_html.cmo \ ++ odoc_man.cmo \ + odoc_latex_style.cmo \ +- odoc_latex.cmo\ +- odoc_texi.cmo\ +- odoc_dot.cmo ++ odoc_latex.cmo \ ++ odoc_texi.cmo \ ++ odoc_dot.cmo \ ++ odoc.cmo + + EXECMXFILES= $(EXECMOFILES:.cmo=.cmx) + EXECMIFILES= $(EXECMOFILES:.cmo=.cmi) +@@ -199,10 +200,10 @@ + debug: + make OCAMLPP="" + +-$(OCAMLDOC): $(EXECMOFILES) odoc.cmo +- $(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES) odoc.cmo +-$(OCAMLDOC_OPT): $(EXECMXFILES) odoc_opt.cmx +- $(OCAMLOPT) -o $@ unix.cmxa str.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES) odoc_opt.cmx ++$(OCAMLDOC): $(EXECMOFILES) ++ $(OCAMLC) -o $@ -linkall unix.cma str.cma dynlink.cma $(LINKFLAGS) $(OCAMLCMOFILES) $(EXECMOFILES) ++$(OCAMLDOC_OPT): $(EXECMXFILES) ++ $(OCAMLOPT) -o $@ unix.cmxa str.cmxa dynlink.cmxa $(LINKFLAGS) $(OCAMLCMXFILES) $(EXECMXFILES) + + $(OCAMLDOC_LIBCMA): $(LIBCMOFILES) + $(OCAMLC) -a -o $@ $(LINKFLAGS) $(OCAMLCMOFILES) $(LIBCMOFILES) +@@ -211,7 +212,7 @@ + + manpages: stdlib_man/Pervasives.3o + +-dot: $(EXECMOFILES) odoc.cmo ++dot: $(EXECMOFILES) + $(OCAMLDOC_RUN) -dot -dot-reduce -o ocamldoc.dot $(INCLUDES) \ + odoc*.ml + +diff -urNad ocaml~/ocamldoc/odoc.ml ocaml/ocamldoc/odoc.ml +--- ocaml~/ocamldoc/odoc.ml 2009-04-06 13:52:17.000000000 +0200 ++++ ocaml/ocamldoc/odoc.ml 2009-04-06 13:56:34.272459850 +0200 +@@ -25,17 +25,18 @@ + + (* we check if we must load a module given on the command line *) + let arg_list = Array.to_list Sys.argv +-let (cmo_or_cma_opt, paths) = ++let (cm_opt, paths) = + let rec iter (f_opt, inc) = function + [] | _ :: [] -> (f_opt, inc) + | "-g" :: file :: q when + ((Filename.check_suffix file "cmo") or +- (Filename.check_suffix file "cma")) & ++ (Filename.check_suffix file "cma") or ++ (Filename.check_suffix file "cmxs")) & + (f_opt = None) -> +- iter (Some file, inc) q +- | "-i" :: dir :: q -> +- iter (f_opt, inc @ [dir]) q +- | _ :: q -> ++ iter (Some file, inc) q ++ | "-i" :: dir :: q -> ++ iter (f_opt, inc @ [dir]) q ++ | _ :: q -> + iter (f_opt, inc) q + in + iter (None, []) arg_list +@@ -63,12 +64,11 @@ + ) + + let _ = +- match cmo_or_cma_opt with ++ match cm_opt with + None -> + () + | Some file -> +- (* initializations for dynamic loading *) +- Dynlink.init (); ++ let file = Dynlink.adapt_filename file in + Dynlink.allow_unsafe_modules true; + try + let real_file = get_real_filename file in +diff -urNad ocaml~/ocamldoc/odoc_args.ml ocaml/ocamldoc/odoc_args.ml +--- ocaml~/ocamldoc/odoc_args.ml 2009-04-06 13:52:17.000000000 +0200 ++++ ocaml/ocamldoc/odoc_args.ml 2009-04-06 13:56:34.272459850 +0200 +@@ -24,8 +24,6 @@ + + let include_dirs = Clflags.include_dirs + +-let bytecode_mode = ref true +- + class type doc_generator = + object + method generate : Odoc_module.t_module list -> unit +@@ -254,10 +252,8 @@ + "-dot", Arg.Unit (fun () -> set_doc_generator !default_dot_generator), M.generate_dot ; + "-customdir", Arg.Unit (fun () -> Printf.printf "%s\n" Odoc_config.custom_generators_path; exit 0), + M.display_custom_generators_dir ; +- "-i", Arg.String (fun s -> if !bytecode_mode then () else (prerr_endline (M.option_not_in_native_code "-i"); exit 1)), +- M.add_load_dir ; +- "-g", Arg.String (fun s -> if !bytecode_mode then () else (prerr_endline (M.option_not_in_native_code "-g"); exit 1)), +- M.load_file ^ ++ "-i", Arg.String (fun s -> ()), M.add_load_dir ; ++ "-g", Arg.String (fun s -> ()), M.load_file ^ + "\n\n *** HTML options ***\n"; + + (* html only options *) +diff -urNad ocaml~/ocamldoc/odoc_args.mli ocaml/ocamldoc/odoc_args.mli +--- ocaml~/ocamldoc/odoc_args.mli 2009-04-06 13:52:17.000000000 +0200 ++++ ocaml/ocamldoc/odoc_args.mli 2009-04-06 13:56:34.272459850 +0200 +@@ -22,10 +22,6 @@ + (** The include_dirs in the OCaml compiler. *) + val include_dirs : string list ref + +-(** Indicate if we are in bytecode mode or not. +- (For the [ocamldoc] command).*) +-val bytecode_mode : bool ref +- + (** The class type of documentation generators. *) + class type doc_generator = + object method generate : Odoc_module.t_module list -> unit end +diff -urNad ocaml~/ocamldoc/odoc_messages.ml ocaml/ocamldoc/odoc_messages.ml +--- ocaml~/ocamldoc/odoc_messages.ml 2009-04-06 13:52:17.000000000 +0200 ++++ ocaml/ocamldoc/odoc_messages.ml 2009-04-06 13:56:34.272459850 +0200 +@@ -24,7 +24,6 @@ + let usage = "Usage : "^(Sys.argv.(0))^" [options] \n" + let options_are = "Options are :" + let option_version = "\tPrint version and exit" +-let bytecode_only = "(bytecode version only)" + let latex_only = "(LaTeX only)" + let texi_only = "(TeXinfo only)" + let latex_texi_only = "(LaTeX and TeXinfo only)" +@@ -41,8 +40,8 @@ + let option_text ="\tConsider as a .txt file" + let display_custom_generators_dir = "\tDisplay custom generators standard directory and exit" + let add_load_dir = "\tAdd the given directory to the search path for custom\n"^ +- "\t\tgenerators "^bytecode_only +-let load_file = "\n\t\tLoad file defining a new documentation generator\n\t\t"^bytecode_only ++ "\t\tgenerators" ++let load_file = "\n\t\tLoad file defining a new documentation generator" + let nolabels = "\tIgnore non-optional labels in types" + let werr = "\tTreat ocamldoc warnings as errors" + let hide_warnings = "\n\t\tdo not print ocamldoc warnings"