Pass --disable-ld-override when installing/compiling GHC
Fixes #1032 Users can still run 'ghcup install ghc <ver> -- enable-ld-override'
This commit is contained in:
parent
63e714d1b1
commit
7a684add89
@ -440,38 +440,16 @@ installUnpackedGHC path inst tver forceInstall addConfArgs
|
|||||||
| otherwise = do
|
| otherwise = do
|
||||||
PlatformRequest {..} <- lift getPlatformReq
|
PlatformRequest {..} <- lift getPlatformReq
|
||||||
|
|
||||||
let ldOverride
|
|
||||||
| _tvVersion tver >= [vver|8.2.2|]
|
|
||||||
, _rPlatform `elem` [Linux Alpine, Darwin]
|
|
||||||
= ["--disable-ld-override"]
|
|
||||||
| otherwise
|
|
||||||
= []
|
|
||||||
|
|
||||||
lift $ logInfo "Installing GHC (this may take a while)"
|
lift $ logInfo "Installing GHC (this may take a while)"
|
||||||
env <- case _rPlatform of
|
|
||||||
-- https://github.com/haskell/ghcup-hs/issues/967
|
|
||||||
Linux Alpine
|
|
||||||
-- lets not touch LD for cross targets
|
|
||||||
| Nothing <- _tvTarget tver -> do
|
|
||||||
cEnv <- liftIO getEnvironment
|
|
||||||
spaths <- liftIO getSearchPath
|
|
||||||
has_ld_bfd <- isJust <$> liftIO (searchPath spaths "ld.bfd")
|
|
||||||
let ldSet = isJust $ lookup "LD" cEnv
|
|
||||||
-- only set LD if ld.bfd exists in PATH and LD is not set
|
|
||||||
-- already
|
|
||||||
if has_ld_bfd && not ldSet
|
|
||||||
then do
|
|
||||||
lift $ logInfo "Detected alpine linux... setting LD=ld.bfd"
|
|
||||||
pure $ Just (("LD", "ld.bfd") : cEnv)
|
|
||||||
else pure Nothing
|
|
||||||
_ -> pure Nothing
|
|
||||||
lEM $ execLogged "sh"
|
lEM $ execLogged "sh"
|
||||||
("./configure" : ("--prefix=" <> fromInstallDir inst)
|
("./configure" : ("--prefix=" <> fromInstallDir inst)
|
||||||
: (maybe mempty (\x -> ["--target=" <> T.unpack x]) (_tvTarget tver) <> ldOverride <> (T.unpack <$> addConfArgs))
|
: (maybe mempty (\x -> ["--target=" <> T.unpack x]) (_tvTarget tver)
|
||||||
|
<> ldOverride (_tvVersion tver)
|
||||||
|
<> (T.unpack <$> addConfArgs))
|
||||||
)
|
)
|
||||||
(Just $ fromGHCupPath path)
|
(Just $ fromGHCupPath path)
|
||||||
"ghc-configure"
|
"ghc-configure"
|
||||||
env
|
Nothing
|
||||||
tmpInstallDest <- lift withGHCupTmpDir
|
tmpInstallDest <- lift withGHCupTmpDir
|
||||||
lEM $ make ["DESTDIR=" <> fromGHCupPath tmpInstallDest, "install"] (Just $ fromGHCupPath path)
|
lEM $ make ["DESTDIR=" <> fromGHCupPath tmpInstallDest, "install"] (Just $ fromGHCupPath path)
|
||||||
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform (fromGHCupPath tmpInstallDest)
|
liftE $ catchWarn $ lEM @_ @'[ProcessError] $ darwinNotarization _rPlatform (fromGHCupPath tmpInstallDest)
|
||||||
@ -479,6 +457,7 @@ installUnpackedGHC path inst tver forceInstall addConfArgs
|
|||||||
pure ()
|
pure ()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
mergeGHCFileTree :: ( MonadReader env m
|
mergeGHCFileTree :: ( MonadReader env m
|
||||||
, HasPlatformReq env
|
, HasPlatformReq env
|
||||||
, HasDirs env
|
, HasDirs env
|
||||||
@ -1313,6 +1292,8 @@ compileGHC targetGhc crossTarget vps bstrap jobs mbuildConfig patches aargs buil
|
|||||||
(_tvTarget tver)
|
(_tvTarget tver)
|
||||||
++ ["--prefix=" <> ghcdir]
|
++ ["--prefix=" <> ghcdir]
|
||||||
++ (if isWindows then ["--enable-tarballs-autodownload"] else [])
|
++ (if isWindows then ["--enable-tarballs-autodownload"] else [])
|
||||||
|
-- https://github.com/haskell/ghcup-hs/issues/1032
|
||||||
|
++ ldOverride (_tvVersion tver)
|
||||||
++ fmap T.unpack aargs
|
++ fmap T.unpack aargs
|
||||||
)
|
)
|
||||||
(Just workdir)
|
(Just workdir)
|
||||||
@ -1387,3 +1368,11 @@ postGHCInstall ver@GHCTargetVersion {..} = do
|
|||||||
forM_ v' $ \(mj, mi) -> lift (getGHCForPVP (PVP (fromIntegral mj :| [fromIntegral mi])) _tvTarget)
|
forM_ v' $ \(mj, mi) -> lift (getGHCForPVP (PVP (fromIntegral mj :| [fromIntegral mi])) _tvTarget)
|
||||||
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY Nothing)
|
>>= mapM_ (\v -> liftE $ setGHC v SetGHC_XY Nothing)
|
||||||
|
|
||||||
|
|
||||||
|
ldOverride :: Version -> [String]
|
||||||
|
ldOverride ver
|
||||||
|
| ver >= [vver|8.2.2|]
|
||||||
|
= ["--disable-ld-override"]
|
||||||
|
| otherwise
|
||||||
|
= []
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user