From f0de77604553ef8df7ffa85e7d689b97e8c16500 Mon Sep 17 00:00:00 2001 From: hallgren Date: Wed, 30 Jan 2013 15:48:36 +0000 Subject: [PATCH] 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. --- Setup.hs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/Setup.hs b/Setup.hs index 1a4c8fea5..a0bc630b0 100644 --- a/Setup.hs +++ b/Setup.hs @@ -51,8 +51,8 @@ main = defaultMainWithHooks simpleUserHooks{ preBuild =gfPreBuild -- Commands for building the Resource Grammar Library -------------------------------------------------------- -data Mode = AllTenses | Present | Minimal deriving Show -all_modes = ["minimal","present","alltenses"] +data Mode = AllTenses | Present deriving Show +all_modes = ["present","alltenses"] default_modes = [Present,AllTenses] data RGLCommand @@ -282,7 +282,6 @@ gfc1 mode pkg lbi file = do preproc = case mode of AllTenses -> "" Present -> "-preproc="++({-rgl_src_dir -} "mkPresent") - Minimal -> "-preproc="++({-rgl_src_dir -} "mkMinimal") createDirectoryIfMissing True dir putStrLn $ "Compiling [" ++ show mode ++ "] " ++ file run_gfc pkg lbi ["-s", "-no-pmcfg", preproc, "--gfo-dir="++dir, file] @@ -317,7 +316,6 @@ getOptMode args = else explicit_modes where explicit_modes = - [Minimal|have "minimal"]++ [Present|have "present"]++ [AllTenses|have "alltenses"] @@ -344,7 +342,7 @@ getRGLBuildSubDir lbi mode = case mode of AllTenses -> "alltenses" Present -> "present" - Minimal -> "minimal" + 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. run_gfc :: PackageDescription -> LocalBuildInfo -> [String] -> IO () 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_cmdline = gf ++ " " ++ unwords (map showArg args') -- putStrLn $ "Running: " ++ gf_cmdline @@ -409,11 +409,14 @@ extractDarcsVersion distFlag = [] -> [] tag:_ -> ["--from-tag="++tag] 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"] "" return (listToMaybe tags,listToMaybe dates, length dates,either (const 0) length whatsnew) + init' [] = [] + init' xs = init xs + -- | Only update the file if contents has changed updateFile path new = do old <- E.try $ readFile path