mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-12-27 22:03:54 +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
|
||||
--- 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
|
||||
@@ -4,10 +4,24 @@
|
||||
+++ ghc-paths-0.1.0.9-new/GHC/Paths.hs 2012-12-16 17:22:12.765576568 +0100
|
||||
@@ -1,13 +1,35 @@
|
||||
{-# LANGUAGE CPP #-}
|
||||
+{-# LANGUAGE ScopedTypeVariables #-}
|
||||
|
||||
module GHC.Paths (
|
||||
ghc, ghc_pkg, libdir, docdir
|
||||
) where
|
||||
|
||||
+import Control.Exception as E
|
||||
+import Data.Maybe
|
||||
+import System.Environment
|
||||
+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 = unsafePerformIO (lookupEnv "NIX_GHC_LIBDIR")
|
||||
+nixDocdir = unsafePerformIO (lookupEnv "NIX_GHC_DOCDIR")
|
||||
+nixGhc = unsafePerformIO (lookupEnv "NIX_GHC")
|
||||
+nixGhcPkg = unsafePerformIO (lookupEnv "NIX_GHCPKG")
|
||||
+nixLibdir = unsafePerformIO (checkEnv "NIX_GHC_LIBDIR")
|
||||
+nixDocdir = unsafePerformIO (checkEnv "NIX_GHC_DOCDIR")
|
||||
+nixGhc = unsafePerformIO (checkEnv "NIX_GHC")
|
||||
+nixGhcPkg = unsafePerformIO (checkEnv "NIX_GHCPKG")
|
||||
+{-# NOINLINE nixLibdir #-}
|
||||
+{-# NOINLINE nixDocdir #-}
|
||||
+{-# NOINLINE nixGhc #-}
|
||||
|
Loading…
Reference in New Issue
Block a user