[commit: ghc] master: Move gcc's and perl's location to the settings file (33514c2)

Ian Lynagh igloo at earth.li
Fri Apr 22 21:22:49 CEST 2011


Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

http://hackage.haskell.org/trac/ghc/changeset/33514c22d560184cd1f32f4e60197b477be91dc2

>---------------------------------------------------------------

commit 33514c22d560184cd1f32f4e60197b477be91dc2
Author: Ian Lynagh <igloo at earth.li>
Date:   Fri Apr 22 18:42:38 2011 +0100

    Move gcc's and perl's location to the settings file
    
    They were hardcoded in Config.hs

>---------------------------------------------------------------

 compiler/ghc.mk            |    4 ----
 compiler/main/SysTools.lhs |   28 +++++++++++++++-------------
 settings.in                |    4 +++-
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/compiler/ghc.mk b/compiler/ghc.mk
index a7a353d..76b393f 100644
--- a/compiler/ghc.mk
+++ b/compiler/ghc.mk
@@ -134,8 +134,6 @@ compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/.
 	@echo 'cLeadingUnderscore    = "$(LeadingUnderscore)"'              >> $@
 	@echo 'cRAWCPP_FLAGS         :: String'                             >> $@
 	@echo 'cRAWCPP_FLAGS         = "$(RAWCPP_FLAGS)"'                   >> $@
-	@echo 'cGCC                  :: String'                             >> $@
-	@echo 'cGCC                  = "$(WhatGccIsCalled)"'                >> $@
 	@echo 'cMKDLL                :: String'                             >> $@
 	@echo 'cMKDLL                = "$(BLD_DLL)"'                        >> $@
 	@echo 'cLdIsGNULd            :: String'                             >> $@
@@ -162,8 +160,6 @@ compiler/stage%/build/Config.hs : mk/config.mk mk/project.mk | $$(dir $$@)/.
 	@echo 'cGHC_SYSMAN_PGM       = "$(GHC_SYSMAN)"'                     >> $@
 	@echo 'cGHC_SYSMAN_DIR       :: String'                             >> $@
 	@echo 'cGHC_SYSMAN_DIR       = "$(GHC_SYSMAN_DIR)"'                 >> $@
-	@echo 'cGHC_PERL             :: String'                             >> $@
-	@echo 'cGHC_PERL             = "$(GHC_PERL)"'                       >> $@
 	@echo 'cDEFAULT_TMPDIR       :: String'                             >> $@
 	@echo 'cDEFAULT_TMPDIR       = "$(DEFAULT_TMPDIR)"'                 >> $@
 	@echo 'cRelocatableBuild     :: Bool'                               >> $@
diff --git a/compiler/main/SysTools.lhs b/compiler/main/SysTools.lhs
index cd19945..656ece1 100644
--- a/compiler/main/SysTools.lhs
+++ b/compiler/main/SysTools.lhs
@@ -159,6 +159,11 @@ initSysTools mbMinusB
                 -- format, '/' separated
 
         ; let settingsFile = top_dir </> "settings"
+              installed :: FilePath -> FilePath
+              installed file = top_dir </> file
+              installed_mingw_bin file = top_dir </> ".." </> "mingw" </> "bin" </> file
+              installed_perl_bin file = top_dir </> ".." </> "perl" </> file
+
         ; settingsStr <- readFile settingsFile
         ; mySettings <- case maybeReadFuzzy settingsStr of
                         Just s ->
@@ -170,11 +175,16 @@ initSysTools mbMinusB
                                    return xs
                                Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile)
         ; myExtraGccViaCFlags <- getSetting "GCC extra via C opts"
-
-        ; let installed :: FilePath -> FilePath
-              installed file = top_dir </> file
-              installed_mingw_bin file = top_dir </> ".." </> "mingw" </> "bin" </> file
-              installed_perl_bin file = top_dir </> ".." </> "perl" </> file
+        -- On Windows, mingw is distributed with GHC,
+        -- so we look in TopDir/../mingw/bin
+        -- It would perhaps be nice to be able to override this
+        -- with the settings file, but it would be a little fiddly
+        -- to make that possible, so for now you can't.
+        ; gcc_prog <- if isWindowsHost then return $ installed_mingw_bin "gcc"
+                                       else getSetting "GCC command"
+        ; perl_path <- if isWindowsHost
+                       then return $ installed_perl_bin "perl"
+                       else getSetting "perl command"
 
         ; let pkgconfig_path = installed "package.conf.d"
               ghc_usage_msg_path  = installed "ghc-usage.txt"
@@ -191,15 +201,7 @@ initSysTools mbMinusB
 
         ; tmpdir <- getTemporaryDirectory
 
-        -- On Windows, mingw is distributed with GHC,
-        --      so we look in TopDir/../mingw/bin
         ; let
-              gcc_prog
-                | isWindowsHost = installed_mingw_bin "gcc"
-                | otherwise     = cGCC
-              perl_path
-                | isWindowsHost = installed_perl_bin cGHC_PERL
-                | otherwise     = cGHC_PERL
               -- 'touch' is a GHC util for Windows
               touch_path
                 | isWindowsHost = installed cGHC_TOUCHY_PGM
diff --git a/settings.in b/settings.in
index d1a8077..0c1c87a 100644
--- a/settings.in
+++ b/settings.in
@@ -1,2 +1,4 @@
-[("GCC extra via C opts", "@GccExtraViaCOpts@")]
+[("GCC extra via C opts", "@GccExtraViaCOpts@"),
+ ("GCC command", "@WhatGccIsCalled@"),
+ ("perl command", "@WhatGccIsCalled@")]
 





More information about the Cvs-ghc mailing list