@@ -72,7 +72,7 @@ configureToolchain :: GhcImplInfo
7272 -> M. Map String String
7373 -> ProgramConfiguration
7474 -> ProgramConfiguration
75- configureToolchain implInfo ghcProg ghcInfo =
75+ configureToolchain _implInfo ghcProg ghcInfo =
7676 addKnownProgram gccProgram {
7777 programFindLocation = findProg gccProgramName extraGccPath,
7878 programPostConf = configureGcc
@@ -91,8 +91,6 @@ configureToolchain implInfo ghcProg ghcInfo =
9191 compilerDir = takeDirectory (programPath ghcProg)
9292 baseDir = takeDirectory compilerDir
9393 mingwBinDir = baseDir </> " mingw" </> " bin"
94- libDir = baseDir </> " gcc-lib"
95- includeDir = baseDir </> " include" </> " mingw"
9694 isWindows = case buildOS of Windows -> True ; _ -> False
9795 binPrefix = " "
9896
@@ -117,9 +115,7 @@ configureToolchain implInfo ghcProg ghcInfo =
117115
118116 -- on Windows finding and configuring ghc's gcc & binutils is a bit special
119117 (windowsExtraGccDir, windowsExtraLdDir,
120- windowsExtraArDir, windowsExtraStripDir)
121- | separateGccMingw implInfo = (baseDir, libDir, libDir, libDir)
122- | otherwise = -- GHC >= 6.12
118+ windowsExtraArDir, windowsExtraStripDir) =
123119 let b = mingwBinDir </> binPrefix
124120 in (b, b, b, b)
125121
@@ -157,28 +153,12 @@ configureToolchain implInfo ghcProg ghcInfo =
157153 | otherwise -> tokenizeQuotedWords flags
158154
159155 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
164159 ++ ccFlags ++ gccLinkerFlags
165160 }
166161
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-
182162 configureLd :: Verbosity -> ConfiguredProgram -> IO ConfiguredProgram
183163 configureLd v ldProg = do
184164 ldProg' <- configureLd' v ldProg
@@ -218,8 +198,7 @@ getLanguages _ implInfo _
218198
219199getGhcInfo :: Verbosity -> GhcImplInfo -> ConfiguredProgram
220200 -> IO [(String , String )]
221- getGhcInfo verbosity implInfo ghcProg
222- | flagInfoLanguages implInfo = do
201+ getGhcInfo verbosity _implInfo ghcProg = do
223202 xs <- getProgramOutput verbosity (suppressOverrideArgs ghcProg)
224203 [" --info" ]
225204 case reads xs of
@@ -228,13 +207,10 @@ getGhcInfo verbosity implInfo ghcProg
228207 return i
229208 _ ->
230209 die " Can't parse --info output of GHC"
231- | otherwise =
232- return []
233210
234211getExtensions :: Verbosity -> GhcImplInfo -> ConfiguredProgram
235212 -> IO [(Extension , String )]
236- getExtensions verbosity implInfo ghcProg
237- | flagInfoLanguages implInfo = do
213+ getExtensions verbosity implInfo ghcProg = do
238214 str <- getProgramOutput verbosity (suppressOverrideArgs ghcProg)
239215 [" --supported-languages" ]
240216 let extStrs = if reportsNoExt implInfo
@@ -250,88 +226,21 @@ getExtensions verbosity implInfo ghcProg
250226 ]
251227 let extensions0 = [ (ext, " -X" ++ display ext)
252228 | 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
265230 then -- ghc-7.2 split NondecreasingIndentation off
266231 -- into a proper extension. Before that it
267232 -- was always on.
268233 (EnableExtension NondecreasingIndentation , " " ) :
269234 (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
329238
330239componentCcGhcOptions :: Verbosity -> GhcImplInfo -> LocalBuildInfo
331240 -> BuildInfo -> ComponentLocalBuildInfo
332241 -> FilePath -> FilePath
333242 -> GhcOptions
334- componentCcGhcOptions verbosity implInfo lbi bi clbi pref filename =
243+ componentCcGhcOptions verbosity _implInfo lbi bi clbi odir filename =
335244 mempty {
336245 ghcOptVerbosity = toFlag verbosity,
337246 ghcOptMode = toFlag GhcModeCompile ,
@@ -353,10 +262,6 @@ componentCcGhcOptions verbosity implInfo lbi bi clbi pref filename =
353262 PD. ccOptions bi,
354263 ghcOptObjDir = toFlag odir
355264 }
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.
360265
361266componentGhcOptions :: Verbosity -> LocalBuildInfo
362267 -> BuildInfo -> ComponentLocalBuildInfo -> FilePath
@@ -431,11 +336,9 @@ ghcLookupProperty prop comp =
431336-- Module_split directory for each module.
432337getHaskellObjects :: GhcImplInfo -> Library -> LocalBuildInfo
433338 -> 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
435340 | 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"
439342 dirs = [ pref </> (ModuleName. toFilePath x ++ splitSuffix)
440343 | x <- libModules lib ]
441344 objss <- mapM getDirectoryContents dirs
@@ -448,10 +351,11 @@ getHaskellObjects implInfo lib lbi pref wanted_obj_ext allow_split_objs
448351 return [ pref </> ModuleName. toFilePath x <.> wanted_obj_ext
449352 | x <- libModules lib ]
450353
354+ -- TODO: rework me
451355mkGhcOptPackages :: ComponentLocalBuildInfo
452- -> [(UnitId , PackageId , ModuleRenaming )]
356+ -> [(UnitId , ModuleRenaming )]
453357mkGhcOptPackages clbi =
454- map (\ (i,p) -> (i,p, lookupRenaming p (componentPackageRenaming clbi)))
358+ map (\ (i,p) -> (i,lookupRenaming p (componentPackageRenaming clbi)))
455359 (componentPackageDeps clbi)
456360
457361substTopDir :: FilePath -> InstalledPackageInfo -> InstalledPackageInfo
0 commit comments