Add defGHCConfOptions option
This commit is contained in:
parent
700cf74001
commit
243b200fb8
@ -90,6 +90,7 @@ toSettings options = do
|
||||
gpgSetting = fromMaybe (fromMaybe (Types.gpgSetting defaultSettings) uGPGSetting) optGpg
|
||||
platformOverride = optPlatform <|> (uPlatformOverride <|> Types.platformOverride defaultSettings)
|
||||
mirrors = fromMaybe (Types.mirrors defaultSettings) uMirrors
|
||||
defGHCConfOptions = fromMaybe (Types.defGHCConfOptions defaultSettings) uDefGHCConfOptions
|
||||
in (Settings {..}, keyBindings)
|
||||
#if defined(INTERNAL_DOWNLOADER)
|
||||
defaultDownloader = Internal
|
||||
|
@ -128,3 +128,12 @@ mirrors:
|
||||
authority:
|
||||
host: "mirror.sjtu.edu.cn"
|
||||
|
||||
# Arguments to pass to the configure script of the prebuilt bindist.
|
||||
#
|
||||
# Do not pass '--prefix' here.
|
||||
#
|
||||
# GHCup by default passes '--disable-ld-override', so if you want to enable
|
||||
# the vanilla way, which aggressively favors 'ld.gold' linker, add the following:
|
||||
def-ghc-conf-options:
|
||||
- "--enable-ld-override"
|
||||
|
||||
|
@ -360,6 +360,28 @@ mirrors:
|
||||
|
||||
The configuration depends on the host of the mirror and they have to provide the correct configuration.
|
||||
|
||||
## Linkers
|
||||
|
||||
The GHC bindist configure script by default doesn't honour the system `ld` that is set, but instead
|
||||
probes for `ld.lld`, `ld.gold` and only then `ld` in order, see
|
||||
[find_ld.m4](https://gitlab.haskell.org/ghc/ghc/-/blob/master/m4/find_ld.m4?ref_type=heads).
|
||||
|
||||
This is controlled by the configure switch `--enable-ld-override`/`--disable-ld-override`, which is enabled by default in GHC.
|
||||
GHCup however [has decided](https://github.com/haskell/ghcup-hs/issues/1032) **to disable this switch by default**,
|
||||
for reasons of stability and simplicity.
|
||||
|
||||
That means, when `--disable-ld-override` is passed, the linker is picked simply by:
|
||||
|
||||
* checking if `LD` env var is set, then use whatever is specified
|
||||
* otherwise use `ld` binary in PATH (system/distro default)
|
||||
|
||||
You can restore the GHC vanilla default by adding this to your `~/.ghcup/config.yaml`:
|
||||
|
||||
```yaml
|
||||
def-ghc-conf-options:
|
||||
- "--enable-ld-override"
|
||||
```
|
||||
|
||||
# More on installation
|
||||
|
||||
## Customisation of the installation scripts
|
||||
|
@ -133,7 +133,8 @@ updateSettings usl usr =
|
||||
gpgSetting' = uGPGSetting usl <|> uGPGSetting usr
|
||||
platformOverride' = uPlatformOverride usl <|> uPlatformOverride usr
|
||||
mirrors' = uMirrors usl <|> uMirrors usr
|
||||
in UserSettings cache' metaCache' metaMode' noVerify' verbose' keepDirs' downloader' (updateKeyBindings (uKeyBindings usl) (uKeyBindings usr)) urlSource' noNetwork' gpgSetting' platformOverride' mirrors'
|
||||
defGHCconfOptions' = uDefGHCConfOptions usl <|> uDefGHCConfOptions usr
|
||||
in UserSettings cache' metaCache' metaMode' noVerify' verbose' keepDirs' downloader' (updateKeyBindings (uKeyBindings usl) (uKeyBindings usr)) urlSource' noNetwork' gpgSetting' platformOverride' mirrors' defGHCconfOptions'
|
||||
where
|
||||
updateKeyBindings :: Maybe UserKeyBindings -> Maybe UserKeyBindings -> Maybe UserKeyBindings
|
||||
updateKeyBindings Nothing Nothing = Nothing
|
||||
|
@ -439,13 +439,18 @@ installUnpackedGHC path inst tver forceInstall addConfArgs
|
||||
liftE $ mergeGHCFileTree path inst tver forceInstall
|
||||
| otherwise = do
|
||||
PlatformRequest {..} <- lift getPlatformReq
|
||||
Settings {..} <- lift getSettings
|
||||
|
||||
addConfArgs' <- sanitizefGHCconfOptions (T.unpack <$> addConfArgs)
|
||||
defGHCConfOptions' <- sanitizefGHCconfOptions defGHCConfOptions
|
||||
|
||||
lift $ logInfo "Installing GHC (this may take a while)"
|
||||
lEM $ execLogged "sh"
|
||||
("./configure" : ("--prefix=" <> fromInstallDir inst)
|
||||
: (maybe mempty (\x -> ["--target=" <> T.unpack x]) (_tvTarget tver)
|
||||
<> ldOverride (_tvVersion tver)
|
||||
<> (T.unpack <$> addConfArgs))
|
||||
<> defGHCConfOptions'
|
||||
<> addConfArgs')
|
||||
)
|
||||
(Just $ fromGHCupPath path)
|
||||
"ghc-configure"
|
||||
@ -1376,3 +1381,8 @@ ldOverride ver
|
||||
| otherwise
|
||||
= []
|
||||
|
||||
sanitizefGHCconfOptions :: MonadFail m => [String] -> m [String]
|
||||
sanitizefGHCconfOptions args
|
||||
| "--prefix" `elem` fmap (takeWhile (/= '=')) args = fail "Don't explicitly set --prefix ...aborting"
|
||||
| otherwise = pure args
|
||||
|
||||
|
@ -392,11 +392,12 @@ data UserSettings = UserSettings
|
||||
, uGPGSetting :: Maybe GPGSetting
|
||||
, uPlatformOverride :: Maybe PlatformRequest
|
||||
, uMirrors :: Maybe DownloadMirrors
|
||||
, uDefGHCConfOptions :: Maybe [String]
|
||||
}
|
||||
deriving (Show, GHC.Generic, Eq)
|
||||
|
||||
defaultUserSettings :: UserSettings
|
||||
defaultUserSettings = UserSettings Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
|
||||
defaultUserSettings = UserSettings Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing Nothing
|
||||
|
||||
fromSettings :: Settings -> Maybe KeyBindings -> UserSettings
|
||||
fromSettings Settings{..} Nothing =
|
||||
@ -414,6 +415,7 @@ fromSettings Settings{..} Nothing =
|
||||
, uGPGSetting = Just gpgSetting
|
||||
, uPlatformOverride = platformOverride
|
||||
, uMirrors = Just mirrors
|
||||
, uDefGHCConfOptions = Just defGHCConfOptions
|
||||
}
|
||||
fromSettings Settings{..} (Just KeyBindings{..}) =
|
||||
let ukb = UserKeyBindings
|
||||
@ -440,6 +442,7 @@ fromSettings Settings{..} (Just KeyBindings{..}) =
|
||||
, uGPGSetting = Just gpgSetting
|
||||
, uPlatformOverride = platformOverride
|
||||
, uMirrors = Just mirrors
|
||||
, uDefGHCConfOptions = Just defGHCConfOptions
|
||||
}
|
||||
|
||||
data UserKeyBindings = UserKeyBindings
|
||||
@ -525,6 +528,7 @@ data Settings = Settings
|
||||
, noColor :: Bool -- this also exists in LoggerConfig
|
||||
, platformOverride :: Maybe PlatformRequest
|
||||
, mirrors :: DownloadMirrors
|
||||
, defGHCConfOptions :: [String]
|
||||
}
|
||||
deriving (Show, GHC.Generic)
|
||||
|
||||
@ -532,7 +536,7 @@ defaultMetaCache :: Integer
|
||||
defaultMetaCache = 300 -- 5 minutes
|
||||
|
||||
defaultSettings :: Settings
|
||||
defaultSettings = Settings False defaultMetaCache Lax False Never Curl False GHCupURL False GPGNone False Nothing (DM mempty)
|
||||
defaultSettings = Settings False defaultMetaCache Lax False Never Curl False GHCupURL False GPGNone False Nothing (DM mempty) []
|
||||
|
||||
instance NFData Settings
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user