Rodrigo Mesquita pushed to branch wip/T23675 at Glasgow Haskell Compiler / GHC

Commits:

3 changed files:

Changes:

  • hadrian/src/Builder.hs
    ... ... @@ -34,7 +34,6 @@ import Base
    34 34
     import Context
    
    35 35
     import Oracles.Flag
    
    36 36
     import Oracles.Setting (setting, Setting(..))
    
    37
    -import Oracles.Setting (settingsFileSetting, ToolchainSetting(..))
    
    38 37
     import Packages
    
    39 38
     
    
    40 39
     import GHC.IO.Encoding (getFileSystemEncoding)
    
    ... ... @@ -240,7 +239,7 @@ instance H.Builder Builder where
    240 239
             Ghc _ st -> do
    
    241 240
                 root <- buildRoot
    
    242 241
                 unlitPath  <- builderPath Unlit
    
    243
    -            distro_mingw <- settingsFileSetting ToolchainSetting_DistroMinGW
    
    242
    +            distro_mingw <- lookupSystemConfig "settings-use-distro-mingw"
    
    244 243
                 libffi_adjustors <- useLibffiForAdjustors
    
    245 244
                 use_system_ffi <- flag UseSystemFfi
    
    246 245
     
    

  • hadrian/src/Oracles/Setting.hs
    ... ... @@ -2,7 +2,6 @@ module Oracles.Setting (
    2 2
         configFile,
    
    3 3
         -- * Settings
    
    4 4
         Setting (..), setting, getSetting,
    
    5
    -    ToolchainSetting (..), settingsFileSetting,
    
    6 5
     
    
    7 6
         -- * Helpers
    
    8 7
         ghcCanonVersion, cmdLineLengthLimit, targetSupportsRPaths, topDirectory,
    
    ... ... @@ -75,19 +74,6 @@ data Setting = CursesIncludeDir
    75 74
                  | BourneShell
    
    76 75
                  | EmsdkVersion
    
    77 76
     
    
    78
    --- TODO compute solely in Hadrian, removing these variables' definitions
    
    79
    --- from aclocal.m4 whenever they can be calculated from other variables
    
    80
    --- already fed into Hadrian.
    
    81
    -
    
    82
    --- | All 'ToolchainSetting's are computed by the ghc-toolchain utility for configuring toolchains.
    
    83
    --- This used to be defined by 'FP_SETTINGS' in aclocal.m4.
    
    84
    ---
    
    85
    --- TODO: We should be able to drop this completely, after moving all the toolchain settings to ghc-toolchain
    
    86
    --- Move to ghc-toolchain and to the Target files generated by configure and ghc-toolchain
    
    87
    --- * First we will get rid of DistroMinGW when we fix the windows build
    
    88
    -data ToolchainSetting
    
    89
    -    = ToolchainSetting_DistroMinGW
    
    90
    -
    
    91 77
     -- | Look up the value of a 'Setting' in @cfg/system.config@, tracking the
    
    92 78
     -- result.
    
    93 79
     setting :: Setting -> Action String
    
    ... ... @@ -128,14 +114,6 @@ setting key = lookupSystemConfig $ case key of
    128 114
         BourneShell        -> "bourne-shell"
    
    129 115
         EmsdkVersion       -> "emsdk-version"
    
    130 116
     
    
    131
    --- | Look up the value of a 'SettingList' in @cfg/system.config@, tracking the
    
    132
    --- result.
    
    133
    --- See Note [tooldir: How GHC finds mingw on Windows]
    
    134
    --- ROMES:TODO: This should be queryTargetTargetConfig
    
    135
    -settingsFileSetting :: ToolchainSetting -> Action String
    
    136
    -settingsFileSetting key = lookupSystemConfig $ case key of
    
    137
    -    ToolchainSetting_DistroMinGW            -> "settings-use-distro-mingw" -- ROMES:TODO: This option doesn't seem to be in ghc-toolchain yet. It corresponds to EnableDistroToolchain
    
    138
    -
    
    139 117
     -- | An expression that looks up the value of a 'Setting' in @cfg/system.config@,
    
    140 118
     -- tracking the result.
    
    141 119
     getSetting :: Setting -> Expr c b String
    

  • hadrian/src/Rules/Generate.hs
    ... ... @@ -424,7 +424,7 @@ bindistRules = do
    424 424
         , interpolateSetting "LlvmMinVersion" LlvmMinVersion
    
    425 425
         , interpolateVar "LlvmTarget" $ getTarget tgtLlvmTarget
    
    426 426
         , interpolateSetting "ProjectVersion" ProjectVersion
    
    427
    -    , interpolateVar "SettingsUseDistroMINGW" $ settingsFileSetting ToolchainSetting_DistroMinGW
    
    427
    +    , interpolateVar "SettingsUseDistroMINGW" $ lookupSystemConfig "settings-use-distro-mingw"
    
    428 428
         , interpolateVar "TablesNextToCode" $ yesNo <$> getTarget tgtTablesNextToCode
    
    429 429
         , interpolateVar "TargetHasLibm" $ lookupSystemConfig "target-has-libm"
    
    430 430
         , interpolateVar "TargetPlatform" $ getTarget targetPlatformTriple
    
    ... ... @@ -529,7 +529,7 @@ generateSettings settingsFile = do
    529 529
             , ("LLVM opt command", queryTarget optPath)
    
    530 530
             , ("LLVM llvm-as command", queryTarget llvmAsPath)
    
    531 531
             , ("LLVM llvm-as flags", queryTarget llvmAsFlags)
    
    532
    -        , ("Use inplace MinGW toolchain", expr $ settingsFileSetting ToolchainSetting_DistroMinGW)
    
    532
    +        , ("Use inplace MinGW toolchain", expr $ lookupSystemConfig "settings-use-distro-mingw")
    
    533 533
     
    
    534 534
             , ("target RTS linker only supports shared libraries", expr $ yesNo <$> targetRTSLinkerOnlySupportsSharedLibs)
    
    535 535
             , ("Use interpreter", expr $ yesNo <$> ghcWithInterpreter (predStage stage))