diff options
| author | John Ericson <John.Ericson@Obsidian.Systems> | 2021-11-13 03:59:48 +0000 |
|---|---|---|
| committer | John Ericson <John.Ericson@Obsidian.Systems> | 2021-11-27 19:47:09 +0000 |
| commit | f67060c6dcc2ba14949ab5e8a4ffe46bceadc14f (patch) | |
| tree | 84b5821d2fa4ca215c6e1b0b03024059fd3ee7b7 /compiler/GHC/SysTools/BaseDir.hs | |
| parent | 88481c942a24e8ffa1705fc51b0bc900ca311ea7 (diff) | |
| download | haskell-f67060c6dcc2ba14949ab5e8a4ffe46bceadc14f.tar.gz | |
Make ambient MinGW support a proper settings
Get rid of `USE_INPLACE_MINGW_TOOLCHAIN` and use a settings file entry
instead.
The CPP setting was originally introduced in f065b6b012.
Diffstat (limited to 'compiler/GHC/SysTools/BaseDir.hs')
| -rw-r--r-- | compiler/GHC/SysTools/BaseDir.hs | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/compiler/GHC/SysTools/BaseDir.hs b/compiler/GHC/SysTools/BaseDir.hs index 03169523c6..c0a1fa2cee 100644 --- a/compiler/GHC/SysTools/BaseDir.hs +++ b/compiler/GHC/SysTools/BaseDir.hs @@ -139,12 +139,16 @@ play nice with the system compiler instead. -- | Expand occurrences of the @$tooldir@ interpolation in a string -- on Windows, leave the string untouched otherwise. -expandToolDir :: Maybe FilePath -> String -> String -#if defined(mingw32_HOST_OS) && !defined(USE_INPLACE_MINGW_TOOLCHAIN) -expandToolDir (Just tool_dir) s = expandPathVar "tooldir" tool_dir s -expandToolDir Nothing _ = panic "Could not determine $tooldir" +expandToolDir + :: Bool -- ^ whether we are use the ambiant mingw toolchain + -> Maybe FilePath -- ^ tooldir + -> String -> String +#if defined(mingw32_HOST_OS) +expandToolDir False (Just tool_dir) s = expandPathVar "tooldir" tool_dir s +expandToolDir False Nothing _ = panic "Could not determine $tooldir" +expandToolDir True _ s = s #else -expandToolDir _ s = s +expandToolDir _ _ s = s #endif -- | Returns a Unix-format path pointing to TopDir. @@ -180,10 +184,11 @@ tryFindTopDir Nothing -- tooldir can't be located, or returns @Just tooldirpath@. -- If the distro toolchain is being used we treat Windows the same as Linux findToolDir - :: FilePath -- ^ topdir + :: Bool -- ^ whether we are use the ambiant mingw toolchain + -> FilePath -- ^ topdir -> IO (Maybe FilePath) -#if defined(mingw32_HOST_OS) && !defined(USE_INPLACE_MINGW_TOOLCHAIN) -findToolDir top_dir = go 0 (top_dir </> "..") [] +#if defined(mingw32_HOST_OS) +findToolDir False top_dir = go 0 (top_dir </> "..") [] where maxDepth = 3 go :: Int -> FilePath -> [FilePath] -> IO (Maybe FilePath) go k path tried @@ -196,6 +201,7 @@ findToolDir top_dir = go 0 (top_dir </> "..") [] if oneLevel then return (Just path) else go (k+1) (path </> "..") tried +findToolDir True _ = return Nothing #else -findToolDir _ = return Nothing +findToolDir _ _ = return Nothing #endif |
