@@ -71,7 +71,7 @@ configureToolchain :: GhcImplInfo
71
71
-> M. Map String String
72
72
-> ProgramConfiguration
73
73
-> ProgramConfiguration
74
- configureToolchain implInfo ghcProg ghcInfo =
74
+ configureToolchain _implInfo ghcProg ghcInfo =
75
75
addKnownProgram gccProgram {
76
76
programFindLocation = findProg gccProgram extraGccPath,
77
77
programPostConf = configureGcc
@@ -90,8 +90,6 @@ configureToolchain implInfo ghcProg ghcInfo =
90
90
compilerDir = takeDirectory (programPath ghcProg)
91
91
baseDir = takeDirectory compilerDir
92
92
mingwBinDir = baseDir </> " mingw" </> " bin"
93
- libDir = baseDir </> " gcc-lib"
94
- includeDir = baseDir </> " include" </> " mingw"
95
93
isWindows = case buildOS of Windows -> True ; _ -> False
96
94
binPrefix = " "
97
95
@@ -108,9 +106,7 @@ configureToolchain implInfo ghcProg ghcInfo =
108
106
109
107
-- on Windows finding and configuring ghc's gcc & binutils is a bit special
110
108
(windowsExtraGccDir, windowsExtraLdDir,
111
- windowsExtraArDir, windowsExtraStripDir)
112
- | separateGccMingw implInfo = (baseDir, libDir, libDir, libDir)
113
- | otherwise = -- GHC >= 6.12
109
+ windowsExtraArDir, windowsExtraStripDir) =
114
110
let b = mingwBinDir </> binPrefix
115
111
in (b, b, b, b)
116
112
@@ -148,28 +144,12 @@ configureToolchain implInfo ghcProg ghcInfo =
148
144
| otherwise -> tokenizeQuotedWords flags
149
145
150
146
configureGcc :: Verbosity -> ConfiguredProgram -> IO ConfiguredProgram
151
- configureGcc v gccProg = do
152
- gccProg' <- configureGcc' v gccProg
153
- return gccProg' {
154
- programDefaultArgs = programDefaultArgs gccProg'
147
+ configureGcc _v gccProg = do
148
+ return gccProg {
149
+ programDefaultArgs = programDefaultArgs gccProg
155
150
++ ccFlags ++ gccLinkerFlags
156
151
}
157
152
158
- configureGcc' :: Verbosity -> ConfiguredProgram -> IO ConfiguredProgram
159
- configureGcc'
160
- | isWindows = \ _ gccProg -> case programLocation gccProg of
161
- -- if it's found on system then it means we're using the result
162
- -- of programFindLocation above rather than a user-supplied path
163
- -- Pre GHC 6.12, that meant we should add these flags to tell
164
- -- ghc's gcc where it lives and thus where gcc can find its
165
- -- various files:
166
- FoundOnSystem {}
167
- | separateGccMingw implInfo ->
168
- return gccProg { programDefaultArgs = [" -B" ++ libDir,
169
- " -I" ++ includeDir] }
170
- _ -> return gccProg
171
- | otherwise = \ _ gccProg -> return gccProg
172
-
173
153
configureLd :: Verbosity -> ConfiguredProgram -> IO ConfiguredProgram
174
154
configureLd v ldProg = do
175
155
ldProg' <- configureLd' v ldProg
@@ -209,8 +189,7 @@ getLanguages _ implInfo _
209
189
210
190
getGhcInfo :: Verbosity -> GhcImplInfo -> ConfiguredProgram
211
191
-> IO [(String , String )]
212
- getGhcInfo verbosity implInfo ghcProg
213
- | flagInfoLanguages implInfo = do
192
+ getGhcInfo verbosity _implInfo ghcProg = do
214
193
xs <- getProgramOutput verbosity (suppressOverrideArgs ghcProg)
215
194
[" --info" ]
216
195
case reads xs of
@@ -219,13 +198,10 @@ getGhcInfo verbosity implInfo ghcProg
219
198
return i
220
199
_ ->
221
200
die " Can't parse --info output of GHC"
222
- | otherwise =
223
- return []
224
201
225
202
getExtensions :: Verbosity -> GhcImplInfo -> ConfiguredProgram
226
203
-> IO [(Extension , String )]
227
- getExtensions verbosity implInfo ghcProg
228
- | flagInfoLanguages implInfo = do
204
+ getExtensions verbosity implInfo ghcProg = do
229
205
str <- getProgramOutput verbosity (suppressOverrideArgs ghcProg)
230
206
[" --supported-languages" ]
231
207
let extStrs = if reportsNoExt implInfo
@@ -241,88 +217,21 @@ getExtensions verbosity implInfo ghcProg
241
217
]
242
218
let extensions0 = [ (ext, " -X" ++ display ext)
243
219
| Just ext <- map simpleParse extStrs ]
244
- extensions1 = if fakeRecordPuns implInfo
245
- then -- ghc-6.8 introduced RecordPuns however it
246
- -- should have been NamedFieldPuns. We now
247
- -- encourage packages to use NamedFieldPuns
248
- -- so for compatibility we fake support for
249
- -- it in ghc-6.8 by making it an alias for
250
- -- the old RecordPuns extension.
251
- (EnableExtension NamedFieldPuns , " -XRecordPuns" ) :
252
- (DisableExtension NamedFieldPuns , " -XNoRecordPuns" ) :
253
- extensions0
254
- else extensions0
255
- extensions2 = if alwaysNondecIndent implInfo
220
+ extensions1 = if alwaysNondecIndent implInfo
256
221
then -- ghc-7.2 split NondecreasingIndentation off
257
222
-- into a proper extension. Before that it
258
223
-- was always on.
259
224
(EnableExtension NondecreasingIndentation , " " ) :
260
225
(DisableExtension NondecreasingIndentation , " " ) :
261
- extensions1
262
- else extensions1
263
- return extensions2
264
-
265
- | otherwise = return oldLanguageExtensions
266
-
267
- -- | For GHC 6.6.x and earlier, the mapping from supported extensions to flags
268
- oldLanguageExtensions :: [(Extension , String )]
269
- oldLanguageExtensions =
270
- let doFlag (f, (enable, disable)) = [(EnableExtension f, enable),
271
- (DisableExtension f, disable)]
272
- fglasgowExts = (" -fglasgow-exts" ,
273
- " " ) -- This is wrong, but we don't want to turn
274
- -- all the extensions off when asked to just
275
- -- turn one off
276
- fFlag flag = (" -f" ++ flag, " -fno-" ++ flag)
277
- in concatMap doFlag
278
- [(OverlappingInstances , fFlag " allow-overlapping-instances" )
279
- ,(TypeSynonymInstances , fglasgowExts)
280
- ,(TemplateHaskell , fFlag " th" )
281
- ,(ForeignFunctionInterface , fFlag " ffi" )
282
- ,(MonomorphismRestriction , fFlag " monomorphism-restriction" )
283
- ,(MonoPatBinds , fFlag " mono-pat-binds" )
284
- ,(UndecidableInstances , fFlag " allow-undecidable-instances" )
285
- ,(IncoherentInstances , fFlag " allow-incoherent-instances" )
286
- ,(Arrows , fFlag " arrows" )
287
- ,(Generics , fFlag " generics" )
288
- ,(ImplicitPrelude , fFlag " implicit-prelude" )
289
- ,(ImplicitParams , fFlag " implicit-params" )
290
- ,(CPP , (" -cpp" , " " {- Wrong -} ))
291
- ,(BangPatterns , fFlag " bang-patterns" )
292
- ,(KindSignatures , fglasgowExts)
293
- ,(RecursiveDo , fglasgowExts)
294
- ,(ParallelListComp , fglasgowExts)
295
- ,(MultiParamTypeClasses , fglasgowExts)
296
- ,(FunctionalDependencies , fglasgowExts)
297
- ,(Rank2Types , fglasgowExts)
298
- ,(RankNTypes , fglasgowExts)
299
- ,(PolymorphicComponents , fglasgowExts)
300
- ,(ExistentialQuantification , fglasgowExts)
301
- ,(ScopedTypeVariables , fFlag " scoped-type-variables" )
302
- ,(FlexibleContexts , fglasgowExts)
303
- ,(FlexibleInstances , fglasgowExts)
304
- ,(EmptyDataDecls , fglasgowExts)
305
- ,(PatternGuards , fglasgowExts)
306
- ,(GeneralizedNewtypeDeriving , fglasgowExts)
307
- ,(MagicHash , fglasgowExts)
308
- ,(UnicodeSyntax , fglasgowExts)
309
- ,(PatternSignatures , fglasgowExts)
310
- ,(UnliftedFFITypes , fglasgowExts)
311
- ,(LiberalTypeSynonyms , fglasgowExts)
312
- ,(TypeOperators , fglasgowExts)
313
- ,(GADTs , fglasgowExts)
314
- ,(RelaxedPolyRec , fglasgowExts)
315
- ,(ExtendedDefaultRules , fFlag " extended-default-rules" )
316
- ,(UnboxedTuples , fglasgowExts)
317
- ,(DeriveDataTypeable , fglasgowExts)
318
- ,(ConstrainedClassMethods , fglasgowExts)
319
- ]
226
+ extensions0
227
+ else extensions0
228
+ return extensions1
320
229
321
230
componentCcGhcOptions :: Verbosity -> GhcImplInfo -> LocalBuildInfo
322
231
-> BuildInfo -> ComponentLocalBuildInfo
323
232
-> FilePath -> FilePath
324
233
-> GhcOptions
325
- componentCcGhcOptions verbosity implInfo lbi bi clbi pref filename =
234
+ componentCcGhcOptions verbosity _implInfo lbi bi clbi odir filename =
326
235
mempty {
327
236
ghcOptVerbosity = toFlag verbosity,
328
237
ghcOptMode = toFlag GhcModeCompile ,
@@ -344,10 +253,6 @@ componentCcGhcOptions verbosity implInfo lbi bi clbi pref filename =
344
253
PD. ccOptions bi,
345
254
ghcOptObjDir = toFlag odir
346
255
}
347
- where
348
- odir | hasCcOdirBug implInfo = pref </> takeDirectory filename
349
- | otherwise = pref
350
- -- ghc 6.4.0 had a bug in -odir handling for C compilations.
351
256
352
257
componentGhcOptions :: Verbosity -> LocalBuildInfo
353
258
-> BuildInfo -> ComponentLocalBuildInfo -> FilePath
@@ -422,11 +327,9 @@ ghcLookupProperty prop comp =
422
327
-- Module_split directory for each module.
423
328
getHaskellObjects :: GhcImplInfo -> Library -> LocalBuildInfo
424
329
-> FilePath -> String -> Bool -> IO [FilePath ]
425
- getHaskellObjects implInfo lib lbi pref wanted_obj_ext allow_split_objs
330
+ getHaskellObjects _implInfo lib lbi pref wanted_obj_ext allow_split_objs
426
331
| splitObjs lbi && allow_split_objs = do
427
- let splitSuffix = if noExtInSplitSuffix implInfo
428
- then " _split"
429
- else " _" ++ wanted_obj_ext ++ " _split"
332
+ let splitSuffix = " _" ++ wanted_obj_ext ++ " _split"
430
333
dirs = [ pref </> (ModuleName. toFilePath x ++ splitSuffix)
431
334
| x <- libModules lib ]
432
335
objss <- mapM getDirectoryContents dirs
@@ -439,10 +342,11 @@ getHaskellObjects implInfo lib lbi pref wanted_obj_ext allow_split_objs
439
342
return [ pref </> ModuleName. toFilePath x <.> wanted_obj_ext
440
343
| x <- libModules lib ]
441
344
345
+ -- TODO: rework me
442
346
mkGhcOptPackages :: ComponentLocalBuildInfo
443
- -> [(UnitId , PackageId , ModuleRenaming )]
347
+ -> [(UnitId , ModuleRenaming )]
444
348
mkGhcOptPackages clbi =
445
- map (\ (i,p) -> (i,p, lookupRenaming p (componentPackageRenaming clbi)))
349
+ map (\ (i,p) -> (i,lookupRenaming p (componentPackageRenaming clbi)))
446
350
(componentPackageDeps clbi)
447
351
448
352
substTopDir :: FilePath -> InstalledPackageInfo -> InstalledPackageInfo
0 commit comments