mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-28 14:22:50 +03:00
ghc-paths: Fix patch to hopefully work with older GHCs.
This commit is contained in:
parent
5a475f7250
commit
0f5976b599
@ -1,19 +1,30 @@
|
|||||||
diff -Naur ghc-paths-0.1.0.9/GHC/Paths.hs ghc-paths-0.1.0.9-new/GHC/Paths.hs
|
diff -Naur ghc-paths-0.1.0.9/GHC/Paths.hs ghc-paths-0.1.0.9-new/GHC/Paths.hs
|
||||||
--- ghc-paths-0.1.0.9/GHC/Paths.hs 2012-12-16 13:53:45.720148396 +0100
|
--- ghc-paths-0.1.0.9/GHC/Paths.hs 2012-12-16 13:53:45.720148396 +0100
|
||||||
+++ ghc-paths-0.1.0.9-new/GHC/Paths.hs 2012-12-16 13:51:50.073070123 +0100
|
+++ ghc-paths-0.1.0.9-new/GHC/Paths.hs 2012-12-16 17:22:12.765576568 +0100
|
||||||
@@ -4,10 +4,24 @@
|
@@ -1,13 +1,35 @@
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
+{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
|
|
||||||
|
module GHC.Paths (
|
||||||
ghc, ghc_pkg, libdir, docdir
|
ghc, ghc_pkg, libdir, docdir
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
+import Control.Exception as E
|
||||||
+import Data.Maybe
|
+import Data.Maybe
|
||||||
+import System.Environment
|
+import System.Environment
|
||||||
+import System.IO.Unsafe
|
+import System.IO.Unsafe
|
||||||
+
|
+
|
||||||
|
+-- Yes, there's lookupEnv now, but we want to be compatible
|
||||||
|
+-- with older GHCs.
|
||||||
|
+checkEnv :: String -> IO (Maybe String)
|
||||||
|
+checkEnv var = E.catch (fmap Just (getEnv var))
|
||||||
|
+ (\ (e :: IOException) -> return Nothing)
|
||||||
|
+
|
||||||
+nixLibdir, nixDocdir, nixGhc, nixGhcPkg :: Maybe FilePath
|
+nixLibdir, nixDocdir, nixGhc, nixGhcPkg :: Maybe FilePath
|
||||||
+nixLibdir = unsafePerformIO (lookupEnv "NIX_GHC_LIBDIR")
|
+nixLibdir = unsafePerformIO (checkEnv "NIX_GHC_LIBDIR")
|
||||||
+nixDocdir = unsafePerformIO (lookupEnv "NIX_GHC_DOCDIR")
|
+nixDocdir = unsafePerformIO (checkEnv "NIX_GHC_DOCDIR")
|
||||||
+nixGhc = unsafePerformIO (lookupEnv "NIX_GHC")
|
+nixGhc = unsafePerformIO (checkEnv "NIX_GHC")
|
||||||
+nixGhcPkg = unsafePerformIO (lookupEnv "NIX_GHCPKG")
|
+nixGhcPkg = unsafePerformIO (checkEnv "NIX_GHCPKG")
|
||||||
+{-# NOINLINE nixLibdir #-}
|
+{-# NOINLINE nixLibdir #-}
|
||||||
+{-# NOINLINE nixDocdir #-}
|
+{-# NOINLINE nixDocdir #-}
|
||||||
+{-# NOINLINE nixGhc #-}
|
+{-# NOINLINE nixGhc #-}
|
||||||
|
Loading…
Reference in New Issue
Block a user