[commit: ghc] wip/angerman/llvmng: [reloc] ghc-pkg baseDir (d390e35)

git at git.haskell.org git at git.haskell.org
Sat Nov 11 08:34:54 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/angerman/llvmng
Link       : http://ghc.haskell.org/trac/ghc/changeset/d390e35ef7db64975358efc431997c14b843a3be/ghc

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

commit d390e35ef7db64975358efc431997c14b843a3be
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Sat Oct 28 09:19:18 2017 +0800

    [reloc] ghc-pkg baseDir


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

d390e35ef7db64975358efc431997c14b843a3be
 utils/ghc-pkg/Main.hs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
index 6420dd4..9917621f 100644
--- a/utils/ghc-pkg/Main.hs
+++ b/utils/ghc-pkg/Main.hs
@@ -2116,6 +2116,12 @@ 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)
+-- 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)?
+--       b) why is the windows getBaseDir logic, not part of getExecutablePath?
+--          it would be much wider available then and we could drop all the custom logic?
+getBaseDir = Just . (\p -> p </> "lib") . takeDirectory . takeDirectory <$> getExecutablePath
 #else
 getLibDir :: IO (Maybe String)
 getLibDir = return Nothing



More information about the ghc-commits mailing list