Compare commits

..

No commits in common. "c0c70f5c9b87ac0188ee95867e11693fa5d9c22c" and "f8448cf02b20e4d6a694fdfeefaeb36c981c6f16" have entirely different histories.

3 changed files with 36 additions and 33 deletions

View File

@ -63,6 +63,7 @@ data Options = Options
, optCache :: Bool
, optUrlSource :: Maybe URI
, optNoVerify :: Bool
, optPlatform :: Maybe PlatformRequest
-- commands
, optCommand :: Command
}
@ -85,8 +86,7 @@ data InstallCommand = InstallGHC InstallOptions
| InstallCabal InstallOptions
data InstallOptions = InstallOptions
{ instVer :: Maybe ToolVersion
, instPlatform :: Maybe PlatformRequest
{ instVer :: Maybe ToolVersion
}
data SetGHCOptions = SetGHCOptions
@ -146,6 +146,18 @@ opts =
(short 'n' <> long "no-verify" <> help
"Skip tarball checksum verification (default: False)"
)
<*> (optional
(option
(eitherReader platformParser)
( short 'p'
<> long "platform"
<> metavar "PLATFORM"
<> help
"Override for platform (triple matching ghc tarball names), e.g. x86_64-fedora27-linux"
<> internal
)
)
)
<*> com
where
parseUri s' =
@ -236,21 +248,7 @@ installP = subparser
)
installOpts :: Parser InstallOptions
installOpts =
InstallOptions
<$> optional toolVersionParser
<*> (optional
(option
(eitherReader platformParser)
( short 'p'
<> long "platform"
<> metavar "PLATFORM"
<> help
"Override for platform (triple matching ghc tarball names), e.g. x86_64-fedora27-linux"
)
)
)
installOpts = InstallOptions <$> optional toolVersionParser
setGHCOpts :: Parser SetGHCOptions
setGHCOpts = SetGHCOptions <$> optional toolVersionParser
@ -614,7 +612,7 @@ main = do
void
$ (runInstTool $ do
v <- liftE $ fromVersion dls instVer GHC
liftE $ installGHCBin dls v instPlatform
liftE $ installGHCBin dls v optPlatform
)
>>= \case
VRight _ -> runLogger
@ -637,7 +635,7 @@ Check the logs at ~/.ghcup/logs and the build directory #{tmpdir} for more clues
void
$ (runInstTool $ do
v <- liftE $ fromVersion dls instVer Cabal
liftE $ installCabalBin dls v instPlatform
liftE $ installCabalBin dls v optPlatform
)
>>= \case
VRight _ -> runLogger

View File

@ -140,7 +140,12 @@ installGHCBin bDls ver mpfReq = do
[rel|ghc-configure.log|]
(Just path)
Nothing
lEM $ liftIO $ make [[s|install|]] (Just path)
lEM $ liftIO $ execLogged [s|make|]
True
[[s|install|]]
[rel|ghc-make.log|]
(Just path)
Nothing
pure ()
@ -536,11 +541,20 @@ GhcWithLlvmCodeGen = YES|]
lift
$ $(logInfo)
[i|Building (this may take a while)... Run 'tail -f ~/.ghcup/logs/ghc-make.log' to see the progress.|]
lEM $ liftIO $ make (maybe [] (\j -> [[s|-j|] <> fS (show j)]) jobs)
(Just workdir)
lEM $ liftIO $ execLogged [s|make|]
True
(maybe [] (\j -> [[s|-j|] <> fS (show j)]) jobs)
[rel|ghc-make.log|]
(Just workdir)
Nothing
lift $ $(logInfo) [i|Installing...|]
lEM $ liftIO $ make [[s|install|]] (Just workdir)
lEM $ liftIO $ execLogged [s|make|]
True
[[s|install|]]
[rel|ghc-make.log|]
(Just workdir)
Nothing
markSrcBuilt ghcdir workdir = do
let dest = (ghcdir </> ghcUpSrcBuiltFile)

View File

@ -44,7 +44,7 @@ import Prelude hiding ( abs
)
import Safe
import System.IO.Error
import System.Posix.FilePath ( getSearchPath, takeFileName )
import System.Posix.FilePath ( takeFileName )
import System.Posix.Files.ByteString ( readSymbolicLink )
import URI.ByteString
@ -325,12 +325,3 @@ ghcToolFiles ver = do
-- this GHC was built from source. It contains the build config.
ghcUpSrcBuiltFile :: Path Rel
ghcUpSrcBuiltFile = [rel|.ghcup_src_built|]
-- | Calls gmake if it exists in PATH, otherwise make.
make :: [ByteString] -> Maybe (Path Abs) -> IO (Either ProcessError ())
make args workdir = do
spaths <- catMaybes . fmap parseAbs <$> getSearchPath
has_gmake <- isJust <$> searchPath spaths [rel|gmake|]
let mymake = if has_gmake then [s|gmake|] else [s|make|]
execLogged mymake True args [rel|ghc-make.log|] workdir Nothing