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