ocaml-obuild/obuild-arg-parsing.patch

35 lines
1.6 KiB
Diff

From 6bdda41644e9b5e5dd059885a0f3bacdfa946f9a Mon Sep 17 00:00:00 2001
From: Andy Li <andy@onthewings.net>
Date: Sun, 19 Nov 2017 21:26:07 +0800
Subject: [PATCH] do not call set_target_options when just parsing -g -pg
---
src/main.ml | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/src/main.ml b/src/main.ml
index 67fd4b0..cae01d8 100644
--- a/src/main.ml
+++ b/src/main.ml
@@ -42,12 +42,14 @@ let configure argv =
("--flag", Arg.String user_set_flags, "enable or disable a project's flag");
("--executable-as-obj", Arg.Unit (set_target_options "executable-as-obj" true), "output executable as obj file");
("--annot", Arg.Unit (set_target_options "annot" true), "generate .annot files");
- ("-g", Arg.Unit (
- (set_target_options "library-debugging" true) ();
- (set_target_options "executable-debugging" true)), "compilation with debugging");
- ("-pg", Arg.Unit (
- (set_target_options "library-profiling" true) ();
- (set_target_options "executable-profiling" true)), "compilation with profiling")
+ ("-g", Arg.Unit (fun () ->
+ (set_target_options "library-debugging" true)();
+ (set_target_options "executable-debugging" true)();
+ ), "compilation with debugging");
+ ("-pg", Arg.Unit (fun () ->
+ (set_target_options "library-profiling" true)();
+ (set_target_options "executable-profiling" true)();
+ ), "compilation with profiling")
] in
Arg.parse_argv (Array.of_list argv) (
enable_disable_opt "library-bytecode" "library compilation as bytecode"