From 3038f315bfef091393cd12af300ac5f87d5c6d60 Mon Sep 17 00:00:00 2001 From: Florian Angeletti Date: Mon, 4 Jul 2022 14:39:07 +0200 Subject: [PATCH] ocamlmktop: add a new initialization module --- tools/Makefile | 7 +++++++ tools/ocamlmktop.ml | 6 ++++-- tools/ocamlmktop_init.ml | 17 +++++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) create mode 100644 tools/ocamlmktop_init.ml diff --git a/tools/Makefile b/tools/Makefile index afbae6fae36a..c6ef01a1dd1d 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -144,6 +144,13 @@ OCAMLMKTOP=config.cmo build_path_prefix_map.cmo misc.cmo \ ocamlmktop$(EXE): $(OCAMLMKTOP) ocamlmktop.opt$(EXE): $(call byte2native, $(OCAMLMKTOP)) +all: ocamlmktop_init.cmo +INSTALL_LIBDIR_OCAMLMKTOP = $(INSTALL_LIBDIR)/ocamlmktop +install:: + $(MKDIR) "$(INSTALL_LIBDIR_OCAMLMKTOP)" + $(INSTALL_DATA) \ + ocamlmktop_init.cmi ocamlmktop_init.cmo \ + "$(INSTALL_LIBDIR_OCAMLMKTOP)" # Converter olabl/ocaml 2.99 to ocaml 3 diff --git a/tools/ocamlmktop.ml b/tools/ocamlmktop.ml index 2b47ebb074eb..449b90781262 100644 --- a/tools/ocamlmktop.ml +++ b/tools/ocamlmktop.ml @@ -24,8 +24,10 @@ let _ = let extra_quote = if Sys.win32 then "\"" else "" in let ocamlc = Filename.(quote (concat (dirname ocamlmktop) ocamlc)) in let cmdline = - extra_quote ^ ocamlc ^ " -I +compiler-libs -linkall ocamlcommon.cma " ^ - "ocamlbytecomp.cma ocamltoplevel.cma " ^ args ^ " topstart.cmo" ^ + extra_quote ^ ocamlc ^ + " -I +compiler-libs -I +ocamlmktop " ^ + "-linkall ocamlcommon.cma ocamlbytecomp.cma ocamltoplevel.cma " ^ + "ocamlmktop_init.cmo " ^ args ^ " topstart.cmo" ^ extra_quote in exit(Sys.command cmdline) diff --git a/tools/ocamlmktop_init.ml b/tools/ocamlmktop_init.ml new file mode 100644 index 000000000000..9f780a9b3bf4 --- /dev/null +++ b/tools/ocamlmktop_init.ml @@ -0,0 +1,17 @@ +(**************************************************************************) +(* *) +(* OCaml *) +(* *) +(* Florian Angeletti, projet Cambium, Inria Paris *) +(* *) +(* Copyright 2022 Institut National de Recherche en Informatique et *) +(* en Automatique. *) +(* *) +(* All rights reserved. This file is distributed under the terms of *) +(* the GNU Lesser General Public License version 2.1, with the *) +(* special exception on linking described in the file LICENSE. *) +(* *) +(**************************************************************************) + +let () = + Topcommon.load_topdirs_signature ()