Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cabal/Cabal.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ library
Distribution.Simple.FileMonitor.Types
Distribution.Simple.Flag
Distribution.Simple.GHC
Distribution.Simple.GHCJS
Distribution.Simple.Haddock
Distribution.Simple.Glob
Distribution.Simple.Glob.Internal
Expand Down
16 changes: 0 additions & 16 deletions Cabal/src/Distribution/Simple/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ import Distribution.Backpack
import Distribution.Backpack.DescribeUnitId
import Distribution.Package
import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.GHCJS as GHCJS
import qualified Distribution.Simple.PackageIndex as Index
import qualified Distribution.Simple.UHC as UHC

Expand Down Expand Up @@ -311,7 +310,6 @@ dumpBuildInfo verbosity distPref dumpBuildInfoFlag pkg_descr lbi flags = do
-- which program we need.
flavorToProgram :: CompilerFlavor -> Maybe Program
flavorToProgram GHC = Just ghcProgram
flavorToProgram GHCJS = Just ghcjsProgram
flavorToProgram UHC = Just uhcProgram
flavorToProgram JHC = Just jhcProgram
flavorToProgram _ = Nothing
Expand Down Expand Up @@ -443,7 +441,6 @@ startInterpreter
startInterpreter verbosity programDb comp platform packageDBs =
case compilerFlavor comp of
GHC -> GHC.startInterpreter verbosity programDb comp platform packageDBs
GHCJS -> GHCJS.startInterpreter verbosity programDb comp platform packageDBs
_ -> dieWithException verbosity REPLNotSupported

buildComponent
Expand Down Expand Up @@ -983,7 +980,6 @@ buildLib verbHandles flags numJobs pkg_descr lbi lib clbi =
let verbosity = mkVerbosity verbHandles $ fromFlag $ buildVerbosity flags
in case compilerFlavor (compiler lbi) of
GHC -> GHC.buildLib verbHandles flags numJobs pkg_descr lbi lib clbi
GHCJS -> GHCJS.buildLib verbosity numJobs pkg_descr lbi lib clbi
UHC -> UHC.buildLib verbosity pkg_descr lbi lib clbi
_ -> dieWithException verbosity BuildingNotSupportedWithCompiler

Expand Down Expand Up @@ -1015,7 +1011,6 @@ buildExe
buildExe verbosity numJobs pkg_descr lbi exe clbi =
case compilerFlavor (compiler lbi) of
GHC -> GHC.buildExe verbosity numJobs pkg_descr lbi exe clbi
GHCJS -> GHCJS.buildExe verbosity numJobs pkg_descr lbi exe clbi
UHC -> UHC.buildExe verbosity pkg_descr lbi exe clbi
_ -> dieWithException verbosity BuildingNotSupportedWithCompiler

Expand All @@ -1029,12 +1024,10 @@ replLib
-> IO ()
replLib verbHandles replFlags pkg_descr lbi lib clbi =
let verbosity = mkVerbosity verbHandles (fromFlag $ replVerbosity replFlags)
opts = replReplOptions replFlags
in case compilerFlavor (compiler lbi) of
-- 'cabal repl' doesn't need to support 'ghc --make -j', so we just pass
-- NoFlag as the numJobs parameter.
GHC -> GHC.replLib verbHandles replFlags NoFlag pkg_descr lbi lib clbi
GHCJS -> GHCJS.replLib (replOptionsFlags opts) verbosity NoFlag pkg_descr lbi lib clbi
_ -> dieWithException verbosity REPLNotSupported

replExe
Expand All @@ -1049,15 +1042,6 @@ replExe verbHandles flags pkg_descr lbi exe clbi =
let verbosity = mkVerbosity verbHandles $ fromFlag $ replVerbosity flags
in case compilerFlavor (compiler lbi) of
GHC -> GHC.replExe verbHandles flags NoFlag pkg_descr lbi exe clbi
GHCJS ->
GHCJS.replExe
(replOptionsFlags $ replReplOptions flags)
verbosity
NoFlag
pkg_descr
lbi
exe
clbi
_ -> dieWithException verbosity REPLNotSupported

replFLib
Expand Down
1 change: 0 additions & 1 deletion Cabal/src/Distribution/Simple/Build/PathsModule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ generatePathsModule pkg_descr lbi clbi =
_ -> False

supportsRelocatableProgs GHC = isWindows
supportsRelocatableProgs GHCJS = isWindows
supportsRelocatableProgs _ = False

cid = componentUnitId clbi
Expand Down
5 changes: 1 addition & 4 deletions Cabal/src/Distribution/Simple/Compiler.hs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ compilerVersion = (\(CompilerId _ v) -> v) . compilerId
-- | Is this compiler compatible with the compiler flavour we're interested in?
--
-- For example this checks if the compiler is actually GHC or is another
-- compiler that claims to be compatible with some version of GHC, e.g. GHCJS.
-- compiler that claims to be compatible with some version of GHC.
--
-- > if compilerCompatFlavor GHC compiler then ... else ...
compilerCompatFlavor :: CompilerFlavor -> Compiler -> Bool
Expand Down Expand Up @@ -517,15 +517,13 @@ coverageSupported :: Compiler -> Bool
coverageSupported comp =
case compilerFlavor comp of
GHC -> True
GHCJS -> True
_ -> False

-- | Does this compiler support profiling?
profilingSupported :: Compiler -> Bool
profilingSupported comp =
case compilerFlavor comp of
GHC -> True
GHCJS -> True
_ -> False

-- | Returns Just if we can certainly determine whether a way is supported
Expand Down Expand Up @@ -595,7 +593,6 @@ ghcSupported :: String -> Compiler -> Bool
ghcSupported key comp =
case compilerFlavor comp of
GHC -> checkProp
GHCJS -> checkProp
_ -> False
where
checkProp =
Expand Down
15 changes: 2 additions & 13 deletions Cabal/src/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,6 @@ import Distribution.Verbosity
import Distribution.Version

import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.GHCJS as GHCJS
import qualified Distribution.Simple.UHC as UHC

import Control.Exception
Expand Down Expand Up @@ -823,8 +822,6 @@ buildOptionsFromConfigFlags verbosity cfg comp = do
-- been changed to read shared libraries instead of archive
-- files (see next code block).
GHC.compilerBuildWay comp `notElem` [DynWay, ProfDynWay]
CompilerId GHCJS _ ->
not (GHCJS.isDynamic comp)
_ -> False

let sharedLibsByDefault
Expand All @@ -837,8 +834,6 @@ buildOptionsFromConfigFlags verbosity cfg comp = do
-- if ghc is dynamic, then ghci needs a shared
-- library, so we build one by default.
GHC.compilerBuildWay comp == DynWay
CompilerId GHCJS _ ->
GHCJS.isDynamic comp
_ -> False
withSharedLib_ =
-- build shared libraries if required by GHC or by the
Expand Down Expand Up @@ -932,13 +927,11 @@ adjustBuildOptions comp programDb opts =
| GHC <- compilerFlavor comp
, compilerVersion comp >= mkVersion [8, 0] =
True
| GHCJS <- compilerFlavor comp = True
| otherwise = False -- not supported by this compiler
splitObj
| not (LBC.splitObjs opts) = False
| splitSec = False -- mutually exclusive with split-sections
| GHC <- compilerFlavor comp = True
| GHCJS <- compilerFlavor comp = True
| otherwise = False -- not supported by this compiler
linkerSupportsRelocations :: Maybe Bool
linkerSupportsRelocations =
Expand Down Expand Up @@ -2254,7 +2247,6 @@ getInstalledPackages verbosity comp mbWorkDir packageDBs progdb = do
packageDBs' <- filterM packageDBExists packageDBs
case compilerFlavor comp of
GHC -> GHC.getInstalledPackages verbosity mbWorkDir packageDBs' progdb
GHCJS -> GHCJS.getInstalledPackages verbosity mbWorkDir packageDBs' progdb
UHC -> UHC.getInstalledPackages verbosity comp mbWorkDir packageDBs' progdb
flv ->
dieWithException verbosity $ HowToFindInstalledPackages flv
Expand Down Expand Up @@ -2289,8 +2281,6 @@ getPackageDBContents verbosity comp mbWorkDir packageDB progdb = do
info verbosity "Reading installed packages..."
case compilerFlavor comp of
GHC -> GHC.getPackageDBContents verbosity mbWorkDir packageDB progdb
GHCJS -> GHCJS.getPackageDBContents verbosity mbWorkDir packageDB progdb
-- For other compilers, try to fall back on 'getInstalledPackages'.
_ -> getInstalledPackages verbosity comp mbWorkDir [packageDB] progdb

-- | A set of files (or directories) that can be monitored to detect when
Expand Down Expand Up @@ -2688,8 +2678,8 @@ configCompilerEx Nothing _ _ _ verbosity = dieWithException verbosity UnknownCom
configCompilerEx (Just hcFlavor) hcPath hcPkg progdb verbosity = do
(comp, maybePlatform, programDb) <- case hcFlavor of
GHC -> GHC.configure verbosity hcPath hcPkg progdb
GHCJS -> GHCJS.configure verbosity hcPath hcPkg progdb
UHC -> UHC.configure verbosity hcPath progdb
GHCJS -> dieWithException verbosity GHCJSNotSupported
_ -> dieWithException verbosity UnknownCompilerException
return (comp, fromMaybe buildPlatform maybePlatform, programDb)

Expand All @@ -2708,8 +2698,8 @@ configCompiler mbFlavor hcPath progdb verbosity = do
Just hcFlavor ->
case hcFlavor of
GHC -> GHC.configureCompiler verbosity hcPath progdb
GHCJS -> GHCJS.configureCompiler verbosity hcPath progdb
UHC -> UHC.configure verbosity hcPath progdb
GHCJS -> dieWithException verbosity GHCJSNotSupported
_ -> dieWithException verbosity UnknownCompilerException
return (comp, fromMaybe buildPlatform maybePlatform, programDb)

Expand All @@ -2726,7 +2716,6 @@ configCompilerProgDb
configCompilerProgDb verbosity comp hcProgDb hcPkgPath = do
case compilerFlavor comp of
GHC -> GHC.compilerProgramDb verbosity comp hcProgDb hcPkgPath
GHCJS -> GHCJS.compilerProgramDb verbosity comp hcProgDb hcPkgPath
_ -> return hcProgDb

-- -----------------------------------------------------------------------------
Expand Down
29 changes: 7 additions & 22 deletions Cabal/src/Distribution/Simple/Errors.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ data CabalException
| PkgDumpFailed
| FailedToParseOutput
| CantFindSourceModule ModuleName
| VersionMismatchJS FilePath Version FilePath Version
| VersionMismatchGHCJS FilePath Version FilePath Version
| GlobalPackageDBLimitation
| GlobalPackageDBSpecifiedFirst
| MatchDirFileGlob String
Expand Down Expand Up @@ -133,6 +131,7 @@ data CabalException
| PkgConfigNotFound String String
| BadVersion String String PkgconfigVersion
| UnknownCompilerException
| GHCJSNotSupported
| NoWorkingGcc
| NoOSSupport OS String
| NoCompilerSupport String
Expand Down Expand Up @@ -214,8 +213,8 @@ exceptionCode e = case e of
PkgDumpFailed{} -> 2291
FailedToParseOutput{} -> 5500
CantFindSourceModule{} -> 8870
VersionMismatchJS{} -> 9001
VersionMismatchGHCJS{} -> 4001
-- Retired: VersionMismatchJS{} -> 9001
-- Retired: VersionMismatchGHCJS{} -> 4001
GlobalPackageDBLimitation{} -> 5002
GlobalPackageDBSpecifiedFirst{} -> 3901
MatchDirFileGlob{} -> 9760
Expand Down Expand Up @@ -267,6 +266,7 @@ exceptionCode e = case e of
PkgConfigNotFound{} -> 7123
BadVersion{} -> 7600
UnknownCompilerException{} -> 3022
GHCJSNotSupported{} -> 4002
NoWorkingGcc{} -> 1088
NoOSSupport{} -> 3339
NoCompilerSupport{} -> 2290
Expand Down Expand Up @@ -368,24 +368,6 @@ exceptionMessage e = case e of
PkgDumpFailed -> "pkg dump failed"
FailedToParseOutput -> "failed to parse output of 'pkg dump'"
CantFindSourceModule moduleName -> "can't find source for module " ++ prettyShow moduleName
VersionMismatchJS ghcjsProgPath ghcjsVersion ghcjsPkgProgPath ghcjsPkgGhcjsVersion ->
"Version mismatch between ghcjs and ghcjs-pkg: "
++ show ghcjsProgPath
++ " is version "
++ prettyShow ghcjsVersion
++ " "
++ show ghcjsPkgProgPath
++ " is version "
++ prettyShow ghcjsPkgGhcjsVersion
VersionMismatchGHCJS ghcjsProgPath ghcjsGhcVersion ghcjsPkgProgPath ghcjsPkgVersion ->
"Version mismatch between ghcjs and ghcjs-pkg: "
++ show ghcjsProgPath
++ " was built with GHC version "
++ prettyShow ghcjsGhcVersion
++ " "
++ show ghcjsPkgProgPath
++ " was built with GHC version "
++ prettyShow ghcjsPkgVersion
GlobalPackageDBLimitation ->
"With current ghc versions the global package db is always used "
++ "and must be listed first. This ghc limitation may be lifted in "
Expand Down Expand Up @@ -607,6 +589,9 @@ exceptionMessage e = case e of
++ " system is version "
++ prettyShow v
UnknownCompilerException -> "Unknown compiler"
GHCJSNotSupported ->
"GHCJS is no longer supported. Use the JavaScript backend of GHC instead, "
++ "for example with --with-compiler=javascript-unknown-ghcjs-ghc."
NoWorkingGcc ->
unlines
[ "No working gcc"
Expand Down
32 changes: 2 additions & 30 deletions Cabal/src/Distribution/Simple/GHC/ImplInfo.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ module Distribution.Simple.GHC.ImplInfo
( GhcImplInfo (..)
, getImplInfo
, ghcVersionImplInfo
, ghcjsVersionImplInfo
) where

import Distribution.Compat.Prelude
Expand All @@ -22,7 +21,6 @@ import Prelude ()
import Distribution.Simple.Compiler
( Compiler
, CompilerFlavor (..)
, compilerCompatVersion
, compilerFlavor
, compilerVersion
)
Expand Down Expand Up @@ -60,17 +58,10 @@ getImplInfo :: Compiler -> GhcImplInfo
getImplInfo comp =
case compilerFlavor comp of
GHC -> ghcVersionImplInfo (compilerVersion comp)
GHCJS -> case compilerCompatVersion GHC comp of
Just ghcVer -> ghcjsVersionImplInfo (compilerVersion comp) ghcVer
_ ->
error
( "Distribution.Simple.GHC.Props.getImplProps: "
++ "could not find GHC version for GHCJS compiler"
)
x ->
error
( "Distribution.Simple.GHC.Props.getImplProps only works"
++ "for GHC-like compilers (GHC, GHCJS)"
( "Distribution.Simple.GHC.ImplInfo.getImplInfo only works"
++ " for GHC"
++ ", but found "
++ show x
)
Expand All @@ -88,22 +79,3 @@ ghcVersionImplInfo ver =
}
where
v = versionNumbers ver

ghcjsVersionImplInfo
:: Version
-- ^ The GHCJS version
-> Version
-- ^ The GHC version
-> GhcImplInfo
ghcjsVersionImplInfo _ghcjsver ghcver =
GhcImplInfo
{ supportsGHC2021 = ghcv >= [9, 1]
, supportsGHC2024 = ghcv >= [9, 9]
, flagProfLate = ghcv >= [9, 4]
, flagHie = ghcv >= [8, 8]
, supportsPkgEnvFiles = ghcv >= [8, 0, 2] -- TODO: check this works in ghcjs
, flagWarnMissingHomeModules = ghcv >= [8, 2]
, unitIdForExes = ghcv >= [9, 2]
}
where
ghcv = versionNumbers ghcver
Loading
Loading