X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fext-core%2FSetup.lhs;h=35661d4b2a4c4e92aa23b539bd0af39326b32446;hb=883d980815437736c486bf69b2f066ef918d2989;hp=806e9ff946d394b5194833425dcd8a8ed54ead62;hpb=bca61eb59ad615793175e4d1a3de7a243b41de44;p=ghc-hetmet.git diff --git a/utils/ext-core/Setup.lhs b/utils/ext-core/Setup.lhs index 806e9ff..35661d4 100644 --- a/utils/ext-core/Setup.lhs +++ b/utils/ext-core/Setup.lhs @@ -1,9 +1,8 @@ #!/usr/bin/env runhaskell \begin{code} -{-# OPTIONS -Wall #-} +{-# OPTIONS -Wall -cpp #-} import Control.Monad -import Data.List import Distribution.PackageDescription import Distribution.Simple import Distribution.Simple.LocalBuildInfo @@ -12,13 +11,13 @@ import System.Cmd import System.FilePath import System.Exit import System.Directory -import Control.Exception (try) +import Control.Exception main :: IO () main = do - let hooks = defaultUserHooks { + let hooks = simpleUserHooks { buildHook = build_primitive_sources - $ buildHook defaultUserHooks + $ buildHook simpleUserHooks } defaultMainWithHooks hooks \end{code} @@ -44,7 +43,7 @@ build_primitive_sources f pd lbi uhs x primEnvExists <- doesFileExist primhs genprimopcodeExists <- doesFileExist genprimopcode primopsExists <- doesFileExist primops - unless (primEnvExists && !genprimopcodeExists && !primopsExists) do + unless (primEnvExists && not genprimopcodeExists && not primopsExists) $ do maybeExit $ system (genprimopcode ++ " --make-ext-core-source < " ++ primops ++ " > " ++ primhs_tmp) maybeUpdateFile primhs_tmp primhs @@ -58,7 +57,12 @@ maybeUpdateFile source target = do r <- rawSystem "cmp" ["-s" {-quiet-}, source, target] case r of ExitSuccess -> removeFile source - ExitFailure _ -> do try (removeFile target); renameFile source target - - + ExitFailure _ -> do +#if __GLASGOW_HASKELL__ >= 610 + (try :: IO () -> IO (Either IOException ())) +#else + try +#endif + (removeFile target) + renameFile source target \end{code} \ No newline at end of file