tools: fix make ghci, ghciweb
In general, when cabal CPP macros like min_PKG are used, they should be made optional. If they are not present, assume a developer is building and choose the latest libs.
This commit is contained in:
parent
9c04cb96c8
commit
39f6ec9f04
@ -34,7 +34,18 @@ import System.Process (readProcessWithExitCode)
|
|||||||
import System.Time (ClockTime, getClockTime, diffClockTimes, TimeDiff(TimeDiff))
|
import System.Time (ClockTime, getClockTime, diffClockTimes, TimeDiff(TimeDiff))
|
||||||
import Test.HUnit
|
import Test.HUnit
|
||||||
import Text.Printf
|
import Text.Printf
|
||||||
|
|
||||||
|
-- kludge - adapt to whichever directory version is installed, or when
|
||||||
|
-- cabal macros aren't available, assume the new directory
|
||||||
|
#ifdef MIN_VERSION_directory
|
||||||
#if MIN_VERSION_directory(1,2,0)
|
#if MIN_VERSION_directory(1,2,0)
|
||||||
|
#define directory_1_2
|
||||||
|
#endif
|
||||||
|
#else
|
||||||
|
#define directory_1_2
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef directory_1_2
|
||||||
import System.Time (ClockTime(TOD))
|
import System.Time (ClockTime(TOD))
|
||||||
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
|
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
|
||||||
#endif
|
#endif
|
||||||
@ -103,7 +114,7 @@ fileModificationTime :: FilePath -> IO ClockTime
|
|||||||
fileModificationTime f
|
fileModificationTime f
|
||||||
| null f = getClockTime
|
| null f = getClockTime
|
||||||
| otherwise = (do
|
| otherwise = (do
|
||||||
#if MIN_VERSION_directory(1,2,0)
|
#ifdef directory_1_2
|
||||||
utc <- getModificationTime f
|
utc <- getModificationTime f
|
||||||
let nom = utcTimeToPOSIXSeconds utc
|
let nom = utcTimeToPOSIXSeconds utc
|
||||||
let clo = TOD (read $ takeWhile (`elem` "0123456789") $ show nom) 0 -- XXX read
|
let clo = TOD (read $ takeWhile (`elem` "0123456789") $ show nom) 0 -- XXX read
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user