Read build.mk from files at build time

This commit is contained in:
Julian Ospald 2021-09-04 15:09:14 +02:00
parent 8c72bf697e
commit c54dc05d92
Signed by: hasufell
GPG Key ID: 3786C5262ECB4A3F

View File

@ -65,9 +65,10 @@ import Data.Time.Format.ISO8601
import Data.Versions import Data.Versions
import GHC.IO.Exception import GHC.IO.Exception
import Haskus.Utils.Variant.Excepts import Haskus.Utils.Variant.Excepts
import Language.Haskell.TH
import Language.Haskell.TH.Syntax ( Quasi(qAddDependentFile) )
import Optics import Optics
import Prelude hiding ( abs import Prelude hiding ( abs
, readFile
, writeFile , writeFile
) )
import Safe hiding ( at ) import Safe hiding ( at )
@ -1922,26 +1923,12 @@ compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour had
pure tver pure tver
where where
defaultConf = case targetGhc of defaultConf =
Left (GHCTargetVersion (Just _) _) -> [s| let cross_mk = $(LitE . StringL <$> (qAddDependentFile "data/build_mk/cross" >> runIO (readFile "data/build_mk/default")))
V=0 default_mk = $(LitE . StringL <$> (qAddDependentFile "data/build_mk/default" >> runIO (readFile "data/build_mk/default")))
BUILD_MAN = NO in case targetGhc of
BUILD_SPHINX_HTML = NO Left (GHCTargetVersion (Just _) _) -> cross_mk
BUILD_SPHINX_PDF = NO _ -> default_mk
HADDOCK_DOCS = NO
ifneq "$(BuildFlavour)" ""
include mk/flavours/$(BuildFlavour).mk
endif
Stage1Only = YES|]
_ -> [s|
V=0
BUILD_MAN = NO
BUILD_SPHINX_HTML = NO
BUILD_SPHINX_PDF = NO
HADDOCK_DOCS = YES
ifneq "$(BuildFlavour)" ""
include mk/flavours/$(BuildFlavour).mk
endif|]
compileHadrianBindist :: ( MonadReader env m compileHadrianBindist :: ( MonadReader env m
, HasDirs env , HasDirs env