[commit: ghc] wip/angerman/llvmng: OMG. (8138968)
git at git.haskell.org
git at git.haskell.org
Sat Nov 18 15:24:48 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/angerman/llvmng
Link : http://ghc.haskell.org/trac/ghc/changeset/813896854854a866386205f3bb895cc058e6d176/ghc
>---------------------------------------------------------------
commit 813896854854a866386205f3bb895cc058e6d176
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date: Sat Nov 18 16:35:17 2017 +0800
OMG.
>---------------------------------------------------------------
813896854854a866386205f3bb895cc058e6d176
utils/ghc-pkg/Main.hs | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 3dafffd..4886264 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -64,7 +64,7 @@ import System.Directory ( doesDirectoryExist, getDirectoryContents,
doesFileExist, removeFile,
getCurrentDirectory )
import System.Exit ( exitWith, ExitCode(..) )
-import System.Environment ( getArgs, getProgName, getEnv )
+import System.Environment ( getArgs, getProgName, getEnv, getExecutablePath )
import System.IO
import System.IO.Error
import GHC.IO.Exception (IOErrorType(InappropriateType))
@@ -2076,6 +2076,7 @@ dieForcible s = die (s ++ " (use --force to override)")
-----------------------------------------
-- Cut and pasted from ghc/compiler/main/SysTools
+getLibDir :: IO (Maybe String)
#if defined(mingw32_HOST_OS)
subst :: Char -> Char -> String -> String
subst a b ls = map (\ x -> if x == a then b else x) ls
@@ -2083,7 +2084,6 @@ subst a b ls = map (\ x -> if x == a then b else x) ls
unDosifyPath :: FilePath -> FilePath
unDosifyPath xs = subst '\\' '/' xs
-getLibDir :: IO (Maybe String)
getLibDir = do base <- getExecDir "/ghc-pkg.exe"
case base of
Nothing -> return Nothing
@@ -2116,7 +2116,7 @@ getExecPath = try_size 2048 -- plenty, PATH_MAX is 512 under Win32.
foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"
c_GetModuleFileName :: Ptr () -> CWString -> Word32 -> IO Word32
-#elfi defined(darwin_HOST_OS) || defined(linux_HOST_OS)
+#elif defined(darwin_HOST_OS) || defined(linux_HOST_OS)
-- TODO: a) this is copy-pasta from SysTools.hs / getBaseDir. Why can't we reuse
-- this here? and parameterise getBaseDir over the executable (for
-- windows)?
@@ -2128,7 +2128,6 @@ foreign import WINDOWS_CCONV unsafe "windows.h GetModuleFileNameW"
-- Answer: yes this should happen. No one has found the time just yet.
getLibDir = Just . (\p -> p </> "lib") . takeDirectory . takeDirectory <$> getExecutablePath
#else
-getLibDir :: IO (Maybe String)
getLibDir = return Nothing
#endif
More information about the ghc-commits
mailing list