diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2018-06-17 16:05:35 +0200 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2018-06-17 16:05:35 +0200 |
commit | 5e2eb803e82e663caa6cd1252a790ba4a1c43adb (patch) | |
tree | c666c758bbe454daf898cffcbc46ab8a733901b6 /src/CabalHelper/Compiletime/Compile.hs | |
parent | 95b76d1a98f8225216a338979503fe2d991149c3 (diff) |
ci: Limit compile-test build concurrency
Diffstat (limited to 'src/CabalHelper/Compiletime/Compile.hs')
-rw-r--r-- | src/CabalHelper/Compiletime/Compile.hs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/CabalHelper/Compiletime/Compile.hs b/src/CabalHelper/Compiletime/Compile.hs index bd15537..b39e86f 100644 --- a/src/CabalHelper/Compiletime/Compile.hs +++ b/src/CabalHelper/Compiletime/Compile.hs @@ -36,10 +36,12 @@ import Data.String import Data.Version import GHC.IO.Exception (IOErrorType(OtherError)) import Text.Printf +import Text.Read import System.Directory import System.FilePath import System.Process import System.Exit +import System.Environment import System.IO import System.IO.Error import System.IO.Temp @@ -452,16 +454,20 @@ runSetupHs opts@Options {..} db srcdir ever CabalInstallVersion {..} SetupProgram {..} <- compileSetupHs opts db srcdir go $ callProcessStderr opts (Just srcdir) setupProgram where - parmake_opt - | Left _ <- ever = ["-j"] - | Right ver <- ever, ver >= Version [1,20] [] = ["-j"] + parmake_opt :: Maybe Int -> [String] + parmake_opt nproc' + | Left _ <- ever = ["-j"++nproc] + | Right ver <- ever, ver >= Version [1,20] [] = ["-j"++nproc] | otherwise = [] + where + nproc = fromMaybe "" $ show <$> nproc' go :: ([String] -> IO ()) -> IO () go run = do run $ [ "configure", "--package-db", db, "--prefix", db </> "prefix" ] ++ withGHCProgramOptions opts - run $ [ "build" ] ++ parmake_opt + mnproc <- join . fmap readMaybe <$> lookupEnv "NPROC" + run $ [ "build" ] ++ parmake_opt mnproc run [ "copy" ] run [ "register" ] |