Trigger -output-complete-exe on -custom with an environment variable
authorStephane Glondu <steph@glondu.net>
Thu, 3 Sep 2020 13:21:10 +0000 (15:21 +0200)
committerStéphane Glondu <glondu@debian.org>
Wed, 19 Jan 2022 10:14:42 +0000 (11:14 +0100)
Gbp-Pq: Name 0005-Trigger-output-complete-exe-on-custom-with-an-enviro.patch

driver/main_args.ml

index 3c6faac7ec8a5c0a9c290face191c1a0dcea9a43..a2080562a1bf7cc80661a5c65b77c0a890630ebb 100644 (file)
@@ -1976,7 +1976,6 @@ third-party libraries such as Lwt, but with a different API."
     include Core
     include Compiler
     let _compat_32 = set bytecode_compatible_32
-    let _custom = set custom_runtime
     let _dcamlprimc = set keep_camlprimc_file
     let _dinstr = set dump_instr
     let _dllib s = Compenv.defer (ProcessDLLs (Misc.rev_split_words s))
@@ -1995,6 +1994,15 @@ third-party libraries such as Lwt, but with a different API."
     let _use_runtime s = use_runtime := s
     let _v () = Compenv.print_version_and_library "compiler"
     let _vmthread () = Compenv.fatal vmthread_removed_message
+    let _custom () =
+      if
+        match Sys.getenv_opt "OCAML_CUSTOM_USE_OUTPUT_COMPLETE_EXE" with
+        | None | Some "" -> false
+        | Some _ -> true
+      then
+        _output_complete_exe ()
+      else
+        set custom_runtime ()
   end
 
 end