[commit: ghc] master: Remove executable filename check on windows (1bf70b2)
git at git.haskell.org
git at git.haskell.org
Mon Jan 15 19:22:24 UTC 2018
Repository : ssh://git@git.haskell.org/ghc
On branch : master
Link : http://ghc.haskell.org/trac/ghc/changeset/1bf70b2041dc2b7c89565fcb46cad8f151f96790/ghc
>---------------------------------------------------------------
commit 1bf70b2041dc2b7c89565fcb46cad8f151f96790
Author: klebinger.andreas at gmx.at <klebinger.andreas at gmx.at>
Date: Mon Jan 15 13:52:15 2018 -0500
Remove executable filename check on windows
On Windows GHC enforces currently that the real executable is named
ghc.exe/ghc-stage[123].exe.
I don't see a good reason why this is neccessary.
This patch removes this restriction and fixes #14652
Test Plan: ci
Reviewers: bgamari, Phyx
Reviewed By: Phyx
Subscribers: Phyx, rwbarton, thomie, carter
GHC Trac Issues: #14652
Differential Revision: https://phabricator.haskell.org/D4296
>---------------------------------------------------------------
1bf70b2041dc2b7c89565fcb46cad8f151f96790
compiler/main/SysTools/BaseDir.hs | 17 ++++-------------
1 file changed, 4 insertions(+), 13 deletions(-)
diff --git a/compiler/main/SysTools/BaseDir.hs b/compiler/main/SysTools/BaseDir.hs
index 343be82..2c264b8 100644
--- a/compiler/main/SysTools/BaseDir.hs
+++ b/compiler/main/SysTools/BaseDir.hs
@@ -34,7 +34,6 @@ import qualified System.Win32.Types as Win32
#else
import qualified System.Win32.Info as Win32
#endif
-import Data.Char
import Exception
import Foreign
import Foreign.C.String
@@ -111,7 +110,7 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32.
_ | ret < size -> do
path <- peekCWString buf
real <- getFinalPath path -- try to resolve symlinks paths
- let libdir = (rootDir . sanitize . maybe path id) real
+ let libdir = (buildLibDir . sanitize . maybe path id) real
exists <- doesDirectoryExist libdir
if exists
then return $ Just libdir
@@ -126,19 +125,11 @@ getBaseDir = try_size 2048 -- plenty, PATH_MAX is 512 under Win32.
then drop 4 s
else s
- rootDir s = case splitFileName $ normalise s of
- (d, ghc_exe)
- | lower ghc_exe `elem` ["ghc.exe",
- "ghc-stage1.exe",
- "ghc-stage2.exe",
- "ghc-stage3.exe"] ->
- case splitFileName $ takeDirectory d of
- -- ghc is in $topdir/bin/ghc.exe
- (d', _) -> takeDirectory d' </> "lib"
- _ -> fail s
+ buildLibDir :: FilePath -> FilePath
+ buildLibDir s =
+ (takeDirectory . takeDirectory . normalise $ s) </> "lib"
fail s = panic ("can't decompose ghc.exe path: " ++ show s)
- lower = map toLower
foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"
c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32
More information about the ghc-commits
mailing list