Drop 'ghcup compile cabal'
Upstream has discontinued the old bootstrap shell script. The new python shell script doesn't work like the old one and is only useful for bootstrapping to a new architecture. If you miss this feature, consider running: cabal install cabal-install with the appropriate GHC version set (this might need some experimenting). This also fixes #64
This commit is contained in:
parent
40a1cc98c6
commit
965d2a3ba8
@ -148,7 +148,6 @@ data RmOptions = RmOptions
|
||||
|
||||
|
||||
data CompileCommand = CompileGHC GHCCompileOptions
|
||||
| CompileCabal CabalCompileOptions
|
||||
|
||||
|
||||
data GHCCompileOptions = GHCCompileOptions
|
||||
@ -612,16 +611,6 @@ compileP = subparser
|
||||
)
|
||||
)
|
||||
)
|
||||
<> command
|
||||
"cabal"
|
||||
( CompileCabal
|
||||
<$> (info
|
||||
(cabalCompileOpts <**> helper)
|
||||
( progDesc "Compile Cabal from source"
|
||||
<> footerDoc (Just $ text compileCabalFooter)
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
where
|
||||
compileFooter = [s|Discussion:
|
||||
@ -642,13 +631,6 @@ Examples:
|
||||
ghcup compile ghc -j 4 -v 8.4.2 -b /usr/bin/ghc-8.2.2
|
||||
# build cross compiler
|
||||
ghcup compile ghc -j 4 -v 8.4.2 -b 8.2.2 -x armv7-unknown-linux-gnueabihf --config $(pwd)/build.mk -- --enable-unregisterised|]
|
||||
compileCabalFooter = [i|Discussion:
|
||||
Compiles and installs the specified Cabal version
|
||||
into "~/.ghcup/bin".
|
||||
|
||||
Examples:
|
||||
ghcup compile cabal -j 4 -v 3.2.0.0 -b 8.6.5
|
||||
ghcup compile cabal -j 4 -v 3.2.0.0 -b /usr/bin/ghc-8.6.5|]
|
||||
|
||||
|
||||
ghcCompileOpts :: Parser GHCCompileOptions
|
||||
@ -1060,26 +1042,6 @@ Report bugs at <https://gitlab.haskell.org/haskell/ghcup-hs/issues>|]
|
||||
#endif
|
||||
]
|
||||
|
||||
let runCompileCabal =
|
||||
runLogger
|
||||
. flip runReaderT settings
|
||||
. runResourceT
|
||||
. runE
|
||||
@'[ AlreadyInstalled
|
||||
, BuildFailed
|
||||
, CopyError
|
||||
, DigestError
|
||||
, DownloadFailed
|
||||
, NoDownload
|
||||
, NotInstalled
|
||||
, PatchFailed
|
||||
, UnknownArchive
|
||||
, TarDirDoesNotExist
|
||||
#if !defined(TAR)
|
||||
, ArchiveResult
|
||||
#endif
|
||||
]
|
||||
|
||||
let runUpgrade =
|
||||
runLogger
|
||||
. flip runReaderT settings
|
||||
@ -1385,28 +1347,6 @@ Make sure to clean up #{tmpdir} afterwards.|])
|
||||
runLogger ($(logError) [i|#{e}|])
|
||||
pure $ ExitFailure 9
|
||||
|
||||
Compile (CompileCabal CabalCompileOptions {..}) ->
|
||||
(runCompileCabal $ do
|
||||
liftE $ compileCabal dls targetVer bootstrapGhc jobs patchDir pfreq
|
||||
)
|
||||
>>= \case
|
||||
VRight _ -> do
|
||||
runLogger
|
||||
($(logInfo)
|
||||
"Cabal successfully compiled and installed"
|
||||
)
|
||||
pure ExitSuccess
|
||||
VLeft (V (BuildFailed tmpdir e)) -> do
|
||||
case keepDirs of
|
||||
Never -> runLogger ($(logError) [i|Build failed with #{e}|])
|
||||
_ -> runLogger ($(logError) [i|Build failed with #{e}
|
||||
Check the logs at #{logsDir} and the build directory #{tmpdir} for more clues.
|
||||
Make sure to clean up #{tmpdir} afterwards.|])
|
||||
pure $ ExitFailure 10
|
||||
VLeft e -> do
|
||||
runLogger ($(logError) [i|#{e}|])
|
||||
pure $ ExitFailure 10
|
||||
|
||||
Upgrade (uOpts) force -> do
|
||||
target <- case uOpts of
|
||||
UpgradeInplace -> do
|
||||
|
@ -1197,10 +1197,6 @@ ghcupDownloads:
|
||||
2.4.1.0:
|
||||
viTags: []
|
||||
viChangeLog: https://downloads.haskell.org/~cabal/cabal-install-2.4.1.0/changelog
|
||||
viSourceDL:
|
||||
dlUri: https://github.com/haskell/cabal/archive/cabal-install-v2.4.1.0.tar.gz
|
||||
dlSubdir: cabal-cabal-install-v2.4.1.0/cabal-install
|
||||
dlHash: 61eb64a5addafca026aff9277291f4643fe07e83886f76d059d42c734fed829c
|
||||
viArch:
|
||||
A_64:
|
||||
Linux_Alpine:
|
||||
@ -1232,10 +1228,6 @@ ghcupDownloads:
|
||||
3.0.0.0:
|
||||
viTags: []
|
||||
viChangeLog: https://downloads.haskell.org/~cabal/cabal-install-3.0.0.0/changelog
|
||||
viSourceDL:
|
||||
dlUri: https://github.com/haskell/cabal/archive/cabal-install-v3.0.0.0.tar.gz
|
||||
dlSubdir: cabal-cabal-install-v3.0.0.0/cabal-install
|
||||
dlHash: c0b26817a7b7c2907e45cb38235ce1157e732211880f62e92eaff4066202e674
|
||||
viArch:
|
||||
A_64:
|
||||
Linux_Alpine:
|
||||
@ -1268,10 +1260,6 @@ ghcupDownloads:
|
||||
- Recommended
|
||||
- Latest
|
||||
viChangeLog: https://downloads.haskell.org/~cabal/cabal-install-3.2.0.0/changelog
|
||||
viSourceDL:
|
||||
dlUri: https://github.com/haskell/cabal/archive/cabal-install-v3.2.0.0.tar.gz
|
||||
dlSubdir: cabal-cabal-install-v3.2.0.0/cabal-install
|
||||
dlHash: 77202358bdf0b481c09326268ce18880df14194c5aaa840f99510bdd1a124b75
|
||||
viArch:
|
||||
A_64:
|
||||
Linux_Alpine:
|
||||
|
116
lib/GHCup.hs
116
lib/GHCup.hs
@ -1261,122 +1261,6 @@ Stage1Only = YES|]
|
||||
|
||||
|
||||
|
||||
-- | Compile a cabal from source. This behaves wrt symlinks and installation
|
||||
-- the same as 'installCabalBin'.
|
||||
compileCabal :: ( MonadReader Settings m
|
||||
, MonadResource m
|
||||
, MonadMask m
|
||||
, MonadLogger m
|
||||
, MonadIO m
|
||||
, MonadFail m
|
||||
)
|
||||
=> GHCupDownloads
|
||||
-> Version -- ^ version to install
|
||||
-> Either Version (Path Abs) -- ^ version to bootstrap with
|
||||
-> Maybe Int
|
||||
-> Maybe (Path Abs)
|
||||
-> PlatformRequest
|
||||
-> Excepts
|
||||
'[ AlreadyInstalled
|
||||
, BuildFailed
|
||||
, CopyError
|
||||
, DigestError
|
||||
, DownloadFailed
|
||||
, NoDownload
|
||||
, NotInstalled
|
||||
, PatchFailed
|
||||
, UnknownArchive
|
||||
, TarDirDoesNotExist
|
||||
#if !defined(TAR)
|
||||
, ArchiveResult
|
||||
#endif
|
||||
]
|
||||
m
|
||||
()
|
||||
compileCabal dls tver bghc jobs patchdir PlatformRequest{..} = do
|
||||
lift $ $(logDebug) [i|Requested to compile: #{tver} with ghc-#{bghc}|]
|
||||
|
||||
Settings {dirs = Dirs {..}} <- lift ask
|
||||
|
||||
whenM
|
||||
(lift (cabalInstalled tver) >>= \a -> liftIO $
|
||||
handleIO (\_ -> pure False)
|
||||
$ fmap (\x -> a && isSymbolicLink x)
|
||||
-- ignore when the installation is a legacy cabal (binary, not symlink)
|
||||
$ getSymbolicLinkStatus (toFilePath (binDir </> [rel|cabal|]))
|
||||
)
|
||||
$ (throwE $ AlreadyInstalled Cabal tver)
|
||||
|
||||
-- download source tarball
|
||||
dlInfo <- preview (ix Cabal % ix tver % viSourceDL % _Just) dls ?? NoDownload
|
||||
dl <- liftE $ downloadCached dlInfo Nothing
|
||||
|
||||
-- unpack
|
||||
tmpUnpack <- lift mkGhcupTmpDir
|
||||
liftE $ unpackToDir tmpUnpack dl
|
||||
void $ liftIO $ darwinNotarization _rPlatform tmpUnpack
|
||||
|
||||
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlInfo)
|
||||
|
||||
cbin <- liftE $ runBuildAction tmpUnpack Nothing (compile workdir)
|
||||
|
||||
destFileName <- lift $ parseRel ("cabal-" <> verToBS tver)
|
||||
handleIO (throwE . CopyError . show) $ liftIO $ copyFile
|
||||
cbin
|
||||
(binDir </> destFileName)
|
||||
Overwrite
|
||||
|
||||
-- create symlink if this is the latest version
|
||||
cVers <- lift $ fmap rights $ getInstalledCabals
|
||||
let lInstCabal = headMay . reverse . sort $ cVers
|
||||
when (maybe True (tver >=) lInstCabal) $ liftE $ setCabal tver
|
||||
|
||||
pure ()
|
||||
|
||||
where
|
||||
compile :: (MonadReader Settings m, MonadThrow m, MonadLogger m, MonadIO m, MonadResource m)
|
||||
=> Path Abs
|
||||
-> Excepts '[ProcessError , PatchFailed] m (Path Abs)
|
||||
compile workdir = do
|
||||
lift $ $(logInfo) [i|Building (this may take a while)...|]
|
||||
|
||||
forM_ patchdir $ \dir -> liftE $ applyPatches dir workdir
|
||||
|
||||
ghcEnv <- case bghc of
|
||||
Right path -> do
|
||||
-- recover the version from /foo/ghc-6.5.4
|
||||
bn <- basename path
|
||||
let dn = toFilePath $ dirname path
|
||||
let ver = snd . B.break (== _hyphen) . toFilePath $ bn
|
||||
|
||||
pure
|
||||
[ ("GHC" , toFilePath path)
|
||||
, ("GHC_PKG", dn <> "/" <> "ghc-pkg" <> ver)
|
||||
, ("HADDOCK", dn <> "/" <> "haddock" <> ver)
|
||||
]
|
||||
Left bver -> do
|
||||
let v' = verToBS bver
|
||||
pure
|
||||
[ ("GHC" , "ghc-" <> v')
|
||||
, ("GHC_PKG", "ghc-pkg-" <> v')
|
||||
, ("HADDOCK", "haddock-" <> v')
|
||||
]
|
||||
|
||||
tmp <- lift withGHCupTmpDir
|
||||
liftIO $ createDirRecursive' (tmp </> [rel|bin|])
|
||||
newEnv <- lift $ addToCurrentEnv (("PREFIX", toFilePath tmp) : ghcEnv)
|
||||
lift $ $(logDebug) [i|Environment: #{newEnv}|]
|
||||
|
||||
lEM $ execLogged "./bootstrap.sh"
|
||||
False
|
||||
(maybe [] (\j -> ["-j", fS (show j)]) jobs)
|
||||
[rel|cabal-bootstrap|]
|
||||
(Just workdir)
|
||||
(Just newEnv)
|
||||
pure $ (tmp </> [rel|bin/cabal|])
|
||||
|
||||
|
||||
|
||||
|
||||
---------------------
|
||||
--[ Upgrade GHCup ]--
|
||||
|
Loading…
Reference in New Issue
Block a user