[m-rev.] diff: fix another bug with mmc --make

Julien Fischer juliensf at csse.unimelb.edu.au
Wed Nov 1 15:38:54 AEDT 2006


On Wed, 1 Nov 2006, Julien Fischer wrote:

>
> Estimated hours taken: 1.5
> Branches: main, release
>
> Fix a bug with mmc --make that shows up on Mac OS X.
>
> compiler/make.program_target.m:
> 	Quote the command used to invoke ranlib correctly.

Actually, the above change is not really satisfactorily either.
I've changed it into a workaround and started implementing a more
robust fix.

Estimated hours taken: 1.5
Branches: main, release

Workaround a bug with mmc --make that shows up on Mac OS X.
Implement the first stage of a proper fix for this bug.

compiler/make.program_target.m:
 	Workaround a bug with the quoting of the command used to invoke
 	ranlib.

compiler/options.m:
 	Add a flag that for use as part of a proper fix for this
 	problem.  This will need to bootstrap before the rest of the
 	fix, changing the configuration files to use the flag, can be
 	added.

Julien.

Index: make.program_target.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/make.program_target.m,v
retrieving revision 1.47.2.2
diff -u -r1.47.2.2 make.program_target.m
--- make.program_target.m	24 Oct 2006 08:29:49 -0000	1.47.2.2
+++ make.program_target.m	1 Nov 2006 04:29:00 -0000
@@ -1230,9 +1230,26 @@
              io.write_string(InstallDir, !IO),
              io.nl(!IO)
          ), !IO),
-    globals.io_lookup_string_option(ranlib_command, RanLibCommand, !IO),
+    globals.io_lookup_string_option(ranlib_command, RanLibCommand0, !IO),
+    %
+    % XXX: because some systems, e.g. Mac OS X, need to invoke ranlib 
+    % with an option we need to break the ranlib command up in order to get
+    % the quoting correct, e.g. we want
+    % 
+    %   "ranlib" "-c" <archive>
+    %
+    % rather than
+    %
+    %   "ranlib -c" <archive>
+    %
+    % on such systems. 
+    % 
+    % This is just a workaround until the change to introduce a separate
+    % `--ranlib-flags' option has bootstrapped.
+    % 
+    RanLibCommand = string.words(RanLibCommand0),
      Command = string.join_list("    ", list.map(quote_arg,
-        [RanLibCommand, InstallDir / FileName ])),
+        RanLibCommand ++ [ InstallDir / FileName ])),
      io.output_stream(OutputStream, !IO),
      invoke_system_command(OutputStream, verbose, Command, Succeeded, !IO).

Index: options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/options.m,v
retrieving revision 1.509.2.2
diff -u -r1.509.2.2 options.m
--- options.m	30 May 2006 07:25:46 -0000	1.509.2.2
+++ options.m	1 Nov 2006 04:26:02 -0000
@@ -691,6 +691,7 @@
      ;       create_archive_command_output_flag
      ;       create_archive_command_flags
      ;       ranlib_command
+    ;       ranlib_flags
      ;       mkinit_command
      ;       demangle_command
      ;       trace_libs
@@ -1406,6 +1407,7 @@
      create_archive_command_output_flag  -   string(""),
      create_archive_command_flags        -   accumulating([]), % "cr"
      ranlib_command                      -   string(""),
+    ranlib_flags                        -   string(""),
      mkinit_command                      -   string("mkinit"),
      demangle_command                    -   string("mdemangle"),
      trace_libs                          -   string(""),
@@ -2143,6 +2145,7 @@
  long_option("link-executable-command",  link_executable_command).
  long_option("link-shared-lib-command",  link_shared_lib_command).
  long_option("ranlib-command",       ranlib_command).
+long_option("ranlib-flags",         ranlib_flags).
  long_option("mkinit-command",       mkinit_command).
  long_option("demangle-command",     demangle_command).
  long_option("trace-libs",           trace_libs).
@@ -4383,8 +4386,8 @@
          % The --shared-library-extension,
          % --library-extension, --executable-file-extension
          % --create-archive-command, --create-archive-command-flags
-        % --create-archive-command-output-flag, --ranlib-command
-        % --link-executable-command, --link-shared-lib-command,
+        % --create-archive-command-output-flag, --ranlib-command,
+        % --ranlib-flags, --link-executable-command, --link-shared-lib-command,
          % --mkinit-command, --demangle-command, --trace-libs,
          % --thread-libs, --shared-libs, --math-lib, --readline-libs,
          % --linker-opt-separator,
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list