From e30fa8933f508d363215e3367dd86174bbc27676 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 31 Oct 2018 08:43:48 +0100 Subject: [PATCH 1/3] Own definition of `die` for base < 4.8.0.0 --- Make.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Make.hs b/Make.hs index 2fccdaae0..b2a6784c0 100644 --- a/Make.hs +++ b/Make.hs @@ -6,7 +6,7 @@ import Data.List (find,isPrefixOf,isSuffixOf,(\\),unfoldr) import Data.Maybe (catMaybes) import System.IO (hPutStrLn,stderr) import System.IO.Error (catchIOError) -import System.Exit (ExitCode(..),die) +import System.Exit (ExitCode(..),exitFailure) import System.Environment (getArgs,lookupEnv) import System.Process (rawSystem) import System.FilePath (()) -- ,takeFileName,addExtension,dropExtension) @@ -447,3 +447,8 @@ parallel_ ms = sequence_ ms putErrLn :: String -> IO () putErrLn = hPutStrLn stderr + +die :: String -> IO a +die s = do + hPutStrLn stderr s + exitFailure From 62ea7c82a9084f26e76bc0e26544277cc50577c9 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 31 Oct 2018 09:13:52 +0100 Subject: [PATCH 2/3] If directory < 1.2.3.0 then don't set modification times on copy --- Make.hs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Make.hs b/Make.hs index b2a6784c0..19bfd8734 100644 --- a/Make.hs +++ b/Make.hs @@ -1,6 +1,6 @@ +{-# LANGUAGE CPP #-} + -- | Main build script for RGL --- There is no associated cabal file, but these dependencies are known: --- * directory >= 1.2.3.0 import Data.List (find,isPrefixOf,isSuffixOf,(\\),unfoldr) import Data.Maybe (catMaybes) @@ -10,7 +10,10 @@ import System.Exit (ExitCode(..),exitFailure) import System.Environment (getArgs,lookupEnv) import System.Process (rawSystem) import System.FilePath (()) -- ,takeFileName,addExtension,dropExtension) -import System.Directory (createDirectoryIfMissing,copyFile,getModificationTime,setModificationTime,getDirectoryContents,removeDirectoryRecursive,findFile) +import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents,removeDirectoryRecursive,findFile) +#if MIN_VERSION_directory(1,2,3) +import System.Directory (getModificationTime,setModificationTime) +#endif import Control.Monad (when,unless) main :: IO () @@ -78,7 +81,9 @@ copyAll msg from to = do copyFileWithModificationTime :: FilePath -> FilePath -> IO () copyFileWithModificationTime source destination = do copyFile source destination +#if MIN_VERSION_directory(1,2,3) getModificationTime source >>= setModificationTime destination +#endif -- | Remove dist directory clean :: IO () From 5172586aa8f19793f8256a65b55b91ee09f67ee6 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 31 Oct 2018 11:10:05 +0100 Subject: [PATCH 3/3] Check GHC version instead of `directory` version Explanation by Thomas Hallgren: These MIN_VERSION macros are traditionally provided by Cabal, in dist/build/autogen/cabal_macros.h. It is only with ghc>=8.0 that ghc itself provides them, so with ghc<8, runghc Make.hs fails, as can be seen in the included message. Incidentally, ghc-8.0.1 also comes with directory-1.3, so I suggest using #if __GLASGOW_HASKELL__>=800 instead. Then Make.hs will work with older versions of ghc, and set the modification times if you are using ghc>=8.0. --- Make.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Make.hs b/Make.hs index 19bfd8734..2a40e3989 100644 --- a/Make.hs +++ b/Make.hs @@ -11,7 +11,7 @@ import System.Environment (getArgs,lookupEnv) import System.Process (rawSystem) import System.FilePath (()) -- ,takeFileName,addExtension,dropExtension) import System.Directory (createDirectoryIfMissing,copyFile,getDirectoryContents,removeDirectoryRecursive,findFile) -#if MIN_VERSION_directory(1,2,3) +#if __GLASGOW_HASKELL__>=800 import System.Directory (getModificationTime,setModificationTime) #endif import Control.Monad (when,unless) @@ -81,7 +81,7 @@ copyAll msg from to = do copyFileWithModificationTime :: FilePath -> FilePath -> IO () copyFileWithModificationTime source destination = do copyFile source destination -#if MIN_VERSION_directory(1,2,3) +#if __GLASGOW_HASKELL__>=800 getModificationTime source >>= setModificationTime destination #endif