-----------------------------------------------------------------------------
\begin{code}
+{-# OPTIONS -fno-cse #-}
+-- -fno-cse is needed for GLOBAL_VAR's to behave properly
+
module SysTools (
-- Initialisation
initSysTools,
-- format, '/' separated
; let installed, installed_bin :: FilePath -> FilePath
- installed_bin pgm = top_dir </> pgm
- installed file = top_dir </> file
- inplace dir pgm = top_dir </> dir </> pgm
+ installed_bin pgm = top_dir </> pgm
+ installed file = top_dir </> file
+ real_top_dir
+ | isWindowsHost = top_dir </> ".." </> ".."
+ | otherwise = top_dir </> ".."
+ inplace dir pgm = real_top_dir </> dir </> pgm
; let pkgconfig_path
| am_installed = installed "package.conf"
- | otherwise = inplace cGHC_DRIVER_DIR_REL "package.conf.inplace"
+ | otherwise = inplace "inplace-datadir" "package.conf"
ghc_usage_msg_path
| am_installed = installed "ghc-usage.txt"
findTopDir mbMinusB
= do { top_dir <- get_proto
-- Discover whether we're running in a build tree or in an installation,
- -- by looking for the package configuration file.
- ; am_installed <- doesFileExist (top_dir </> "package.conf")
+ -- by looking for a file we use for that purpose
+ ; am_inplace <- doesFileExist (top_dir </> "inplace")
- ; return (am_installed, top_dir)
+ ; return (not am_inplace, top_dir)
}
where
-- get_proto returns a Unix-format path (relying on getBaseDir to do so too)