[m-rev.] for review: further Cygwin / MS C# fixes

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Feb 10 04:36:43 AEDT 2012


For review by Peter Ross.

Branche: main, 11.07

Fix further problems with building the csharp grade on Cygwin using the
Microsoft compiler.  There were two main problems:

(1) Mercury.config.bootstrap had not been updated so the environment
and csharp compiler types for the stage 1 compiler were incorrect.

(2) The '/' in Microsoft style /OPTIONS was sometimes being treated
as a path separator for the purposes of path conversion.

scripts/Mercury.config.bootstrap.in:
 	Bring this file back into sync with Mercury.config.

compiler/compile_target_code.m:
 	Use - style options with the csharp compiler rather than / style
 	ones.
 	(In addition to causing the above problem, the use of / also tends
 	to cause trouble with POSIX style shells in general - we already avoid
 	the use of / style options with MSVC for the same reason.)

 	Break some overlong lines.

compiler/handle_options.m:
 	Break an overlong line.

Julien.

Index: compiler/compile_target_code.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/compile_target_code.m,v
retrieving revision 1.185
diff -u -r1.185 compile_target_code.m
--- compiler/compile_target_code.m	18 Jan 2012 03:16:18 -0000	1.185
+++ compiler/compile_target_code.m	9 Feb 2012 17:05:47 -0000
@@ -362,14 +362,14 @@
      % XXX Should we use a separate dll_directories options?
      globals.lookup_accumulating_option(Globals, link_library_directories,
          DLLDirs),
-    DLLDirOpts = "/lib:Mercury/dlls " ++
+    DLLDirOpts = "-lib:Mercury/dlls " ++
          string.append_list(list.condense(list.map(
              (func(DLLDir) = ["/lib:", DLLDir, " "]), DLLDirs))),

      ( mercury_std_library_module_name(Imports ^ mai_module_name) ->
-        Prefix = "/addmodule:"
+        Prefix = "-addmodule:"
      ;
-        Prefix = "/r:"
+        Prefix = "-r:"
      ),
      ForeignDeps = list.map(
          (func(M) =
@@ -2382,7 +2382,7 @@
          ( TargetType = csharp_executable
          ; TargetType = csharp_library
          ),
-        LinkLibOpt = "/r:",
+        LinkLibOpt = "-r:",
          Suffix = ".dll",
          LinkOpt = quote_arg(LinkLibOpt ++ LibName ++ Suffix)
      ;
@@ -2688,7 +2688,7 @@
      ;
          Target = target_csharp,
          MercuryLinkage = "shared",
-        LinkOpt = "/r:",
+        LinkOpt = "-r:",
          LibSuffix = ".dll"
      ;
          Target = target_il,
@@ -2807,14 +2807,16 @@
      get_host_env_type(Globals, EnvType),
      get_csharp_compiler_type(Globals, CSharpCompilerType),

-    OutputFileName = csharp_file_name(EnvType, CSharpCompilerType, OutputFileName0),
-    SourceList = list.map(csharp_file_name(EnvType, CSharpCompilerType), SourceList0),
+    OutputFileName = csharp_file_name(EnvType, CSharpCompilerType,
+        OutputFileName0),
+    SourceList = list.map(csharp_file_name(EnvType, CSharpCompilerType),
+        SourceList0),

      globals.lookup_string_option(Globals, csharp_compiler, CSharpCompiler),
      globals.lookup_bool_option(Globals, highlevel_data, HighLevelData),
      (
          HighLevelData = yes,
-        HighLevelDataOpt = "/define:MR_HIGHLEVEL_DATA"
+        HighLevelDataOpt = "-define:MR_HIGHLEVEL_DATA"
      ;
          HighLevelData = no,
          HighLevelDataOpt = ""
@@ -2822,7 +2824,7 @@
      globals.lookup_bool_option(Globals, target_debug, Debug),
      (
          Debug = yes,
-        DebugOpt = "/debug "
+        DebugOpt = "-debug "
      ;
          Debug = no,
          DebugOpt = ""
@@ -2830,10 +2832,10 @@
      globals.lookup_accumulating_option(Globals, csharp_flags, CSCFlagsList),
      (
          LinkTargetType = csharp_executable,
-        TargetOption = "/target:exe"
+        TargetOption = "-target:exe"
      ;
          LinkTargetType = csharp_library,
-        TargetOption = "/target:library"
+        TargetOption = "-target:library"
      ;
          ( LinkTargetType = executable
          ; LinkTargetType = static_library
@@ -2848,15 +2850,19 @@

      globals.lookup_accumulating_option(Globals, link_library_directories,
          LinkLibraryDirectoriesList0),
-    LinkLibraryDirectoriesList = list.map(csharp_file_name(EnvType, CSharpCompilerType), LinkLibraryDirectoriesList0),
-    LinkerPathFlag = "/lib:",
+    LinkLibraryDirectoriesList =
+        list.map(csharp_file_name(EnvType, CSharpCompilerType),
+        LinkLibraryDirectoriesList0),
+    LinkerPathFlag = "-lib:",
      join_quoted_string_list(LinkLibraryDirectoriesList, LinkerPathFlag, "",
          " ", LinkLibraryDirectories),

      get_link_libraries(Globals, MaybeLinkLibraries, !IO),
      (
          MaybeLinkLibraries = yes(LinkLibrariesList0),
-        LinkLibrariesList = list.map(csharp_file_name(EnvType, CSharpCompilerType), LinkLibrariesList0),
+        LinkLibrariesList =
+            list.map(csharp_file_name(EnvType, CSharpCompilerType),
+            LinkLibrariesList0),
          join_quoted_string_list(LinkLibrariesList, "", "", " ",
              LinkLibraries)
      ;
@@ -2871,7 +2877,7 @@
          HighLevelDataOpt,
          DebugOpt,
          TargetOption,
-        "/out:" ++ OutputFileName,
+        "-out:" ++ OutputFileName,
          LinkLibraryDirectories,
          LinkLibraries,
          MercuryStdLibs] ++
Index: compiler/handle_options.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/handle_options.m,v
retrieving revision 1.375
diff -u -r1.375 handle_options.m
--- compiler/handle_options.m	15 Jan 2012 23:38:20 -0000	1.375
+++ compiler/handle_options.m	9 Feb 2012 16:55:57 -0000
@@ -406,7 +406,8 @@
      map.lookup(!.OptionTable, csharp_compiler_type, CSharp_CompilerType0),
      (
          CSharp_CompilerType0 = string(CSharp_CompilerTypeStr),
-        convert_csharp_compiler_type(CSharp_CompilerTypeStr, CSharp_CompilerTypePrime)
+        convert_csharp_compiler_type(CSharp_CompilerTypeStr,
+            CSharp_CompilerTypePrime)
      ->
          CSharp_CompilerType = CSharp_CompilerTypePrime
      ;
Index: scripts/Mercury.config.bootstrap.in
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/scripts/Mercury.config.bootstrap.in,v
retrieving revision 1.11
diff -u -r1.11 Mercury.config.bootstrap.in
--- scripts/Mercury.config.bootstrap.in	14 Dec 2010 07:01:55 -0000	1.11
+++ scripts/Mercury.config.bootstrap.in	9 Feb 2012 17:14:20 -0000
@@ -27,10 +27,15 @@
  MERCURY_DEFAULT_OPT_LEVEL=-O2
  MERCURY_DEFAULT_GRADE=@DEFAULT_GRADE@
  MERCURY_C_COMPILER=@CC@
+MERCURY_C_COMPILER_TYPE=@C_COMPILER_TYPE@
  MERCURY_MATH_LIB=@MATH_LIB@
  MERCURY_JAVA_COMPILER=@JAVAC@
  MERCURY_JAVA_INTERPRETER=@JAVA_INTERPRETER@
  MERCURY_CSHARP_COMPILER=@CSC@
+MERCURY_CSHARP_COMPILER_TYPE=@CSHARP_COMPILER_TYPE@
+MERCURY_CLI_INTERPRETER=@CLI_INTERPRETER@
+MERCURY_ERLANG_COMPILER=@ERLC@
+MERCURY_ERLANG_INTERPRETER=@ERL@
  # $(MATH_LIB) needs to be defined because it may
  # be used by the substitution for SHARED_LIBS.
  MATH_LIB=$(MERCURY_MATH_LIB)
@@ -51,9 +56,14 @@
  		@ALL_LOCAL_C_INCL_DIR_MMC_OPTS@ \
  		@ALL_LOCAL_C_LIB_DIR_MMC_OPTS@ \
  		--cc "$(MERCURY_C_COMPILER)" \
+		--c-compiler-type "$(MERCURY_C_COMPILER_TYPE)" \
  		--java-compiler "$(MERCURY_JAVA_COMPILER)" \
  		--java-interpreter "$(MERCURY_JAVA_INTERPRETER)" \
  		--csharp-compiler "$(MERCURY_CSHARP_COMPILER)" \
+		--csharp-compiler-type "$(MERCURY_CSHARP_COMPILER_TYPE)" \
+		--cli-interpreter "$(MERCURY_CLI_INTERPRETER)" \
+		--erlang-compiler "$(MERCURY_ERLANG_COMPILER)" \
+		--erlang-interpreter "$(MERCURY_ERLANG_INTERPRETER)" \
  		--grade "$(MERCURY_DEFAULT_GRADE)" \
  		--cflags-for-ansi "@CFLAGS_FOR_ANSI@" \
  		--cflags-for-optimization "@CFLAGS_FOR_OPT@" \
@@ -116,6 +126,8 @@
  		--bytes-per-word "@BYTES_PER_WORD@" \
  		--sync-term-size "@SYNC_TERM_SIZE@" \
  		--dotnet-library-version "@MS_DOTNET_LIBRARY_VERSION@" \
+		--host-env-type "@HOST_ENV_TYPE@" \
+		--target-env-type "@TARGET_ENV_TYPE@" \
  		@HAVE_DELAY_SLOT@ \
  		@HAVE_BOXED_FLOATS@ \
  		@MCFLAGS_FOR_CC@ \


--------------------------------------------------------------------------
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