Setup.hs: eliminate "minimal" mode, fix darcs version info

The reported number of recorded changes since the last tagged version was off
by one (because it counted the change that set the tag).
Also added a note that -K32M is not needed when using new-comp. But -old-comp
is still available as a configuration option, so I'm keeping -K32M for now.
This commit is contained in:
hallgren
2013-01-30 15:48:36 +00:00
parent c1aa0b04be
commit 08569c6e8a

View File

@@ -51,8 +51,8 @@ main = defaultMainWithHooks simpleUserHooks{ preBuild =gfPreBuild
-- Commands for building the Resource Grammar Library -- Commands for building the Resource Grammar Library
-------------------------------------------------------- --------------------------------------------------------
data Mode = AllTenses | Present | Minimal deriving Show data Mode = AllTenses | Present deriving Show
all_modes = ["minimal","present","alltenses"] all_modes = ["present","alltenses"]
default_modes = [Present,AllTenses] default_modes = [Present,AllTenses]
data RGLCommand data RGLCommand
@@ -282,7 +282,6 @@ gfc1 mode pkg lbi file = do
preproc = case mode of preproc = case mode of
AllTenses -> "" AllTenses -> ""
Present -> "-preproc="++({-rgl_src_dir </>-} "mkPresent") Present -> "-preproc="++({-rgl_src_dir </>-} "mkPresent")
Minimal -> "-preproc="++({-rgl_src_dir </>-} "mkMinimal")
createDirectoryIfMissing True dir createDirectoryIfMissing True dir
putStrLn $ "Compiling [" ++ show mode ++ "] " ++ file putStrLn $ "Compiling [" ++ show mode ++ "] " ++ file
run_gfc pkg lbi ["-s", "-no-pmcfg", preproc, "--gfo-dir="++dir, file] run_gfc pkg lbi ["-s", "-no-pmcfg", preproc, "--gfo-dir="++dir, file]
@@ -317,7 +316,6 @@ getOptMode args =
else explicit_modes else explicit_modes
where where
explicit_modes = explicit_modes =
[Minimal|have "minimal"]++
[Present|have "present"]++ [Present|have "present"]++
[AllTenses|have "alltenses"] [AllTenses|have "alltenses"]
@@ -344,7 +342,7 @@ getRGLBuildSubDir lbi mode =
case mode of case mode of
AllTenses -> "alltenses" AllTenses -> "alltenses"
Present -> "present" Present -> "present"
Minimal -> "minimal"
getRGLBuildDir lbi mode = rgl_dst_dir lbi </> getRGLBuildSubDir lbi mode getRGLBuildDir lbi mode = rgl_dst_dir lbi </> getRGLBuildSubDir lbi mode
@@ -372,7 +370,9 @@ unlexer abstr ls =
-- | Runs the gf executable in compile mode with the given arguments. -- | Runs the gf executable in compile mode with the given arguments.
run_gfc :: PackageDescription -> LocalBuildInfo -> [String] -> IO () run_gfc :: PackageDescription -> LocalBuildInfo -> [String] -> IO ()
run_gfc pkg lbi args = run_gfc pkg lbi args =
do let args' = ["-batch","-gf-lib-path="++rgl_src_dir,"+RTS","-K32M","-RTS"] ++ filter (not . null) args do let args' = ["-batch","-gf-lib-path="++rgl_src_dir]
++ ["+RTS","-K32M","-RTS"] -- not needed with new-comp
++ filter (not . null) args
gf = default_gf pkg lbi gf = default_gf pkg lbi
gf_cmdline = gf ++ " " ++ unwords (map showArg args') gf_cmdline = gf ++ " " ++ unwords (map showArg args')
-- putStrLn $ "Running: " ++ gf_cmdline -- putStrLn $ "Running: " ++ gf_cmdline
@@ -409,11 +409,14 @@ extractDarcsVersion distFlag =
[] -> [] [] -> []
tag:_ -> ["--from-tag="++tag] tag:_ -> ["--from-tag="++tag]
changes <- lines `fmap` readProcess "darcs" ("changes":from) "" changes <- lines `fmap` readProcess "darcs" ("changes":from) ""
let dates = filter ((`notElem` [""," "]).take 1) changes let dates = init' (filter ((`notElem` [""," "]).take 1) changes)
whatsnew<-E.try $ lines `fmap` readProcess "darcs" ["whatsnew","-s"] "" whatsnew<-E.try $ lines `fmap` readProcess "darcs" ["whatsnew","-s"] ""
return (listToMaybe tags,listToMaybe dates, return (listToMaybe tags,listToMaybe dates,
length dates,either (const 0) length whatsnew) length dates,either (const 0) length whatsnew)
init' [] = []
init' xs = init xs
-- | Only update the file if contents has changed -- | Only update the file if contents has changed
updateFile path new = updateFile path new =
do old <- E.try $ readFile path do old <- E.try $ readFile path