summaryrefslogtreecommitdiff
path: root/WebSetup.hs
diff options
context:
space:
mode:
authorJohn J. Camilleri <john@digitalgrammars.com>2018-07-19 12:36:39 +0200
committerJohn J. Camilleri <john@digitalgrammars.com>2018-07-19 12:36:39 +0200
commitcd1942a8454d569363b201f2345953e648ec9b53 (patch)
tree705d59c07fa78d9f92a01d267ad2b6fde59c67df /WebSetup.hs
parent6a8d0038eda22e34e7aeb006a08c1e931df6ce7f (diff)
WebSetup: fail silently when example grammars don't build
Also used installed RGL not built
Diffstat (limited to 'WebSetup.hs')
-rw-r--r--WebSetup.hs14
1 files changed, 8 insertions, 6 deletions
diff --git a/WebSetup.hs b/WebSetup.hs
index e6c776bb9..02123f5bd 100644
--- a/WebSetup.hs
+++ b/WebSetup.hs
@@ -6,7 +6,6 @@ import System.Process(rawSystem)
import System.Exit(ExitCode(..))
import Distribution.Simple.Setup(BuildFlags(..),Flag(..),CopyFlags(..),CopyDest(..),copyDest)
import Distribution.Simple.LocalBuildInfo(LocalBuildInfo(..),datadir,buildDir,absoluteInstallDirs)
-import Distribution.Simple.Utils(die) -- deprecated as of Cabal >= 2
import Distribution.PackageDescription(PackageDescription(..))
{-
@@ -68,9 +67,11 @@ buildWeb gf (flags,pkg,lbi) = do
where
tmp_dir = gfo_dir</>subdir
dir = contrib_dir</>subdir
+ dest = NoCopyDest
+ gf_lib_path = datadir (absoluteInstallDirs pkg lbi dest) </> "lib"
args = numJobs flags++["-make","-s"] -- ,"-optimize-pgf"
++["--gfo-dir="++tmp_dir,
- "--gf-lib-path="++buildDir lbi </> "rgl",
+ "--gf-lib-path="++gf_lib_path,
"--name="++dropExtension pgf,
"--output-dir="++gfo_dir]
++[dir</>file|file<-src]
@@ -111,15 +112,16 @@ setupWeb dest (pkg,lbi) = do
do createDirectoryIfMissing True logo_dir
copyFile ("doc"</>"Logos"</>gf_logo) (logo_dir</>gf_logo)
--- | Run an arbitrary system command
-execute :: String -> [String] -> IO ()
+-- | Run an arbitrary system command, returning False on failure
+execute :: String -> [String] -> IO Bool
execute command args =
do let cmdline = command ++ " " ++ unwords (map showArg args)
e <- rawSystem command args
case e of
- ExitSuccess -> return ()
+ ExitSuccess -> return True
ExitFailure i -> do putStrLn $ "Ran: " ++ cmdline
- die $ command++" exited with exit code: " ++ show i
+ putStrLn $ command++" exited with exit code: " ++ show i
+ return False
where
showArg arg = if ' ' `elem` arg then "'" ++ arg ++ "'" else arg