diff options
Diffstat (limited to 'compiler/main/SysTools.hs')
-rw-r--r-- | compiler/main/SysTools.hs | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/compiler/main/SysTools.hs b/compiler/main/SysTools.hs index 35935cacb0..baf70df8a9 100644 --- a/compiler/main/SysTools.hs +++ b/compiler/main/SysTools.hs @@ -134,6 +134,8 @@ initSysTools mbMinusB -- see Note [topdir: How GHC finds its files] -- NB: top_dir is assumed to be in standard Unix -- format, '/' separated + mtool_dir <- findToolDir top_dir + -- see Note [tooldir: How GHC finds mingw and perl on Windows] let settingsFile = top_dir </> "settings" platformConstantsFile = top_dir </> "platformConstants" @@ -158,6 +160,7 @@ initSysTools mbMinusB let getSetting key = case lookup key mySettings of Just xs -> return $ expandTopDir top_dir xs Nothing -> pgmError ("No entry for " ++ show key ++ " in " ++ show settingsFile) + getToolSetting key = expandToolDir mtool_dir <$> getSetting key getBooleanSetting key = case lookup key mySettings of Just "YES" -> return True Just "NO" -> return False @@ -179,14 +182,15 @@ initSysTools mbMinusB targetHasSubsectionsViaSymbols <- readSetting "target has subsections via symbols" myExtraGccViaCFlags <- getSetting "GCC extra via C opts" -- On Windows, mingw is distributed with GHC, - -- so we look in TopDir/../mingw/bin + -- so we look in TopDir/../mingw/bin, + -- as well as TopDir/../../mingw/bin for hadrian. -- 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 <- getSetting "C compiler command" + gcc_prog <- getToolSetting "C compiler command" gcc_args_str <- getSetting "C compiler flags" gccSupportsNoPie <- getBooleanSetting "C compiler supports -no-pie" - cpp_prog <- getSetting "Haskell CPP command" + cpp_prog <- getToolSetting "Haskell CPP command" cpp_args_str <- getSetting "Haskell CPP flags" let unreg_gcc_args = if targetUnregisterised then ["-DNO_REGS", "-DUSE_MINIINTERPRETER"] @@ -204,7 +208,7 @@ initSysTools mbMinusB ldSupportsBuildId <- getBooleanSetting "ld supports build-id" ldSupportsFilelist <- getBooleanSetting "ld supports filelist" ldIsGnuLd <- getBooleanSetting "ld is GNU ld" - perl_path <- getSetting "perl command" + perl_path <- getToolSetting "perl command" let pkgconfig_path = installed "package.conf.d" ghc_usage_msg_path = installed "ghc-usage.txt" @@ -217,14 +221,14 @@ initSysTools mbMinusB -- split is a Perl script split_script = libexec cGHC_SPLIT_PGM - windres_path <- getSetting "windres command" - libtool_path <- getSetting "libtool command" - ar_path <- getSetting "ar command" - ranlib_path <- getSetting "ranlib command" + windres_path <- getToolSetting "windres command" + libtool_path <- getToolSetting "libtool command" + ar_path <- getToolSetting "ar command" + ranlib_path <- getToolSetting "ranlib command" tmpdir <- getTemporaryDirectory - touch_path <- getSetting "touch command" + touch_path <- getToolSetting "touch command" let -- On Win32 we don't want to rely on #!/bin/perl, so we prepend -- a call to Perl to get the invocation of split. @@ -235,7 +239,7 @@ initSysTools mbMinusB (split_prog, split_args) | isWindowsHost = (perl_path, [Option split_script]) | otherwise = (split_script, []) - mkdll_prog <- getSetting "dllwrap command" + mkdll_prog <- getToolSetting "dllwrap command" let mkdll_args = [] -- cpp is derived from gcc on all platforms |