parent
a6108f8319
commit
9e181b8820
@ -182,6 +182,7 @@ data GHCCompileOptions = GHCCompileOptions
|
|||||||
, addConfArgs :: [Text]
|
, addConfArgs :: [Text]
|
||||||
, setCompile :: Bool
|
, setCompile :: Bool
|
||||||
, ovewrwiteVer :: Maybe Version
|
, ovewrwiteVer :: Maybe Version
|
||||||
|
, buildFlavour :: Maybe String
|
||||||
}
|
}
|
||||||
|
|
||||||
data UpgradeOpts = UpgradeInplace
|
data UpgradeOpts = UpgradeInplace
|
||||||
@ -987,6 +988,13 @@ ghcCompileOpts =
|
|||||||
"Allows to overwrite the finally installed VERSION with a different one, e.g. when you build 8.10.4 with your own patches, you might want to set this to '8.10.4-p1'"
|
"Allows to overwrite the finally installed VERSION with a different one, e.g. when you build 8.10.4 with your own patches, you might want to set this to '8.10.4-p1'"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
<*> optional
|
||||||
|
(option
|
||||||
|
str
|
||||||
|
(short 'f' <> long "flavour" <> metavar "BUILD_FLAVOUR" <> help
|
||||||
|
"Set the compile build flavour (this value depends on the build system type: 'make' vs 'hadrian')"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
toolVersionParser :: Parser ToolVersion
|
toolVersionParser :: Parser ToolVersion
|
||||||
@ -1926,6 +1934,7 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
|||||||
buildConfig
|
buildConfig
|
||||||
patchDir
|
patchDir
|
||||||
addConfArgs
|
addConfArgs
|
||||||
|
buildFlavour
|
||||||
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
||||||
let vi = getVersionInfo (_tvVersion targetVer) GHC dls
|
let vi = getVersionInfo (_tvVersion targetVer) GHC dls
|
||||||
when setCompile $ void $ liftE $
|
when setCompile $ void $ liftE $
|
||||||
|
48
lib/GHCup.hs
48
lib/GHCup.hs
@ -1667,10 +1667,11 @@ compileGHC :: ( MonadMask m
|
|||||||
=> Either GHCTargetVersion GitBranch -- ^ version to install
|
=> Either GHCTargetVersion GitBranch -- ^ version to install
|
||||||
-> Maybe Version -- ^ overwrite version
|
-> Maybe Version -- ^ overwrite version
|
||||||
-> Either Version FilePath -- ^ version to bootstrap with
|
-> Either Version FilePath -- ^ version to bootstrap with
|
||||||
-> Maybe Int -- ^ jobs
|
-> Maybe Int -- ^ jobs
|
||||||
-> Maybe FilePath -- ^ build config
|
-> Maybe FilePath -- ^ build config
|
||||||
-> Maybe FilePath -- ^ patch directory
|
-> Maybe FilePath -- ^ patch directory
|
||||||
-> [Text] -- ^ additional args to ./configure
|
-> [Text] -- ^ additional args to ./configure
|
||||||
|
-> Maybe String -- ^ build flavour
|
||||||
-> Excepts
|
-> Excepts
|
||||||
'[ AlreadyInstalled
|
'[ AlreadyInstalled
|
||||||
, BuildFailed
|
, BuildFailed
|
||||||
@ -1689,7 +1690,7 @@ compileGHC :: ( MonadMask m
|
|||||||
]
|
]
|
||||||
m
|
m
|
||||||
GHCTargetVersion
|
GHCTargetVersion
|
||||||
compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs
|
compileGHC targetGhc ov bstrap jobs mbuildConfig patchdir aargs buildFlavour
|
||||||
= do
|
= do
|
||||||
PlatformRequest { .. } <- lift getPlatformReq
|
PlatformRequest { .. } <- lift getPlatformReq
|
||||||
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
GHCupInfo { _ghcupDownloads = dls } <- lift getGHCupInfo
|
||||||
@ -1806,13 +1807,19 @@ BUILD_MAN = NO
|
|||||||
BUILD_SPHINX_HTML = NO
|
BUILD_SPHINX_HTML = NO
|
||||||
BUILD_SPHINX_PDF = NO
|
BUILD_SPHINX_PDF = NO
|
||||||
HADDOCK_DOCS = NO
|
HADDOCK_DOCS = NO
|
||||||
|
ifneq "$(BuildFlavour)" ""
|
||||||
|
include mk/flavours/$(BuildFlavour).mk
|
||||||
|
endif
|
||||||
Stage1Only = YES|]
|
Stage1Only = YES|]
|
||||||
_ -> [s|
|
_ -> [s|
|
||||||
V=0
|
V=0
|
||||||
BUILD_MAN = NO
|
BUILD_MAN = NO
|
||||||
BUILD_SPHINX_HTML = NO
|
BUILD_SPHINX_HTML = NO
|
||||||
BUILD_SPHINX_PDF = NO
|
BUILD_SPHINX_PDF = NO
|
||||||
HADDOCK_DOCS = YES|]
|
HADDOCK_DOCS = YES
|
||||||
|
ifneq "$(BuildFlavour)" ""
|
||||||
|
include mk/flavours/$(BuildFlavour).mk
|
||||||
|
endif|]
|
||||||
|
|
||||||
compileBindist :: ( MonadReader env m
|
compileBindist :: ( MonadReader env m
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
@ -1834,7 +1841,6 @@ HADDOCK_DOCS = YES|]
|
|||||||
(Maybe FilePath) -- ^ output path of bindist, None for cross
|
(Maybe FilePath) -- ^ output path of bindist, None for cross
|
||||||
compileBindist bghc tver workdir ghcdir = do
|
compileBindist bghc tver workdir ghcdir = do
|
||||||
lift $ $(logInfo) [i|configuring build|]
|
lift $ $(logInfo) [i|configuring build|]
|
||||||
liftE checkBuildConfig
|
|
||||||
|
|
||||||
Dirs {..} <- lift getDirs
|
Dirs {..} <- lift getDirs
|
||||||
pfreq <- lift getPlatformReq
|
pfreq <- lift getPlatformReq
|
||||||
@ -1887,7 +1893,9 @@ HADDOCK_DOCS = YES|]
|
|||||||
(FileDoesNotExistError bc)
|
(FileDoesNotExistError bc)
|
||||||
(liftIO $ copyFile bc (build_mk workdir))
|
(liftIO $ copyFile bc (build_mk workdir))
|
||||||
Nothing ->
|
Nothing ->
|
||||||
liftIO $ B.writeFile (build_mk workdir) defaultConf
|
liftIO $ B.writeFile (build_mk workdir) (addBuildFlavourToConf defaultConf)
|
||||||
|
|
||||||
|
liftE $ checkBuildConfig (build_mk workdir)
|
||||||
|
|
||||||
lift $ $(logInfo) [i|Building (this may take a while)...|]
|
lift $ $(logInfo) [i|Building (this may take a while)...|]
|
||||||
lEM $ make (maybe [] (\j -> ["-j" <> fS (show j)]) jobs) (Just workdir)
|
lEM $ make (maybe [] (\j -> ["-j" <> fS (show j)]) jobs) (Just workdir)
|
||||||
@ -1924,19 +1932,17 @@ HADDOCK_DOCS = YES|]
|
|||||||
|
|
||||||
build_mk workdir = workdir </> "mk" </> "build.mk"
|
build_mk workdir = workdir </> "mk" </> "build.mk"
|
||||||
|
|
||||||
checkBuildConfig :: (MonadCatch m, MonadIO m)
|
checkBuildConfig :: (MonadCatch m, MonadIO m, MonadLogger m)
|
||||||
=> Excepts
|
=> FilePath
|
||||||
|
-> Excepts
|
||||||
'[FileDoesNotExistError, InvalidBuildConfig]
|
'[FileDoesNotExistError, InvalidBuildConfig]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
checkBuildConfig = do
|
checkBuildConfig bc = do
|
||||||
c <- case mbuildConfig of
|
c <- liftIOException
|
||||||
Just bc -> do
|
doesNotExistErrorType
|
||||||
liftIOException
|
(FileDoesNotExistError bc)
|
||||||
doesNotExistErrorType
|
(liftIO $ B.readFile bc)
|
||||||
(FileDoesNotExistError bc)
|
|
||||||
(liftIO $ B.readFile bc)
|
|
||||||
Nothing -> pure defaultConf
|
|
||||||
let lines' = fmap T.strip . T.lines $ decUTF8Safe c
|
let lines' = fmap T.strip . T.lines $ decUTF8Safe c
|
||||||
|
|
||||||
-- for cross, we need Stage1Only
|
-- for cross, we need Stage1Only
|
||||||
@ -1947,6 +1953,16 @@ HADDOCK_DOCS = YES|]
|
|||||||
)
|
)
|
||||||
_ -> pure ()
|
_ -> pure ()
|
||||||
|
|
||||||
|
forM_ buildFlavour $ \bf ->
|
||||||
|
when ([i|BuildFlavour = #{bf}|] `notElem` lines') $ do
|
||||||
|
lift $ $(logWarn) [i|Customly specified build config overwrites --flavour=#{bf} switch! Waiting 5 seconds...|]
|
||||||
|
liftIO $ threadDelay 5000000
|
||||||
|
|
||||||
|
addBuildFlavourToConf bc = case buildFlavour of
|
||||||
|
Just bf -> [i|BuildFlavour = #{bf}
|
||||||
|
#{bc}|]
|
||||||
|
Nothing -> bc
|
||||||
|
|
||||||
isCross :: GHCTargetVersion -> Bool
|
isCross :: GHCTargetVersion -> Bool
|
||||||
isCross = isJust . _tvTarget
|
isCross = isJust . _tvTarget
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user