From 254713316ce47f7ec02e2dcb7a8747a469b20f29 Mon Sep 17 00:00:00 2001 From: Ilia Baryshnikov Date: Tue, 17 Mar 2026 21:52:05 +0300 Subject: [PATCH 1/5] Remove old mkVersion --- Cabal/src/Distribution/Simple/Build.hs | 2 +- .../Simple/Build/PackageInfoModule.hs | 26 ++++---- .../Distribution/Simple/Build/PathsModule.hs | 13 +--- Cabal/src/Distribution/Simple/Compiler.hs | 9 +-- Cabal/src/Distribution/Simple/Configure.hs | 7 +-- .../src/Distribution/Simple/GHC/Build/Link.hs | 61 ++----------------- Cabal/src/Distribution/Simple/GHCJS.hs | 7 +-- .../Distribution/Simple/Program/Builtin.hs | 21 +------ .../src/Distribution/Client/CmdRepl.hs | 23 +++---- .../Client/Init/NonInteractive/Heuristics.hs | 7 +-- .../Client/ProjectPlanning/SetupPolicy.hs | 4 -- cabal-install/tests/IntegrationTests2.hs | 13 ++-- .../Client/Init/NonInteractive.hs | 5 -- .../Distribution/Client/ProjectConfig.hs | 11 +--- 14 files changed, 41 insertions(+), 168 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Build.hs b/Cabal/src/Distribution/Simple/Build.hs index 86a8133d742..4353fce9380 100644 --- a/Cabal/src/Distribution/Simple/Build.hs +++ b/Cabal/src/Distribution/Simple/Build.hs @@ -1190,7 +1190,7 @@ builtinAutogenFiles pkg lbi clbi = pathsFile = AutogenModule (autogenPathsModuleName pkg) (Suffix "hs") pathsContents = toUTF8LBS $ generatePathsModule pkg lbi clbi packageInfoFile = AutogenModule (autogenPackageInfoModuleName pkg) (Suffix "hs") - packageInfoContents = toUTF8LBS $ generatePackageInfoModule pkg lbi + packageInfoContents = toUTF8LBS $ generatePackageInfoModule pkg cppHeaderFile = AutogenFile $ toShortText cppHeaderName cppHeaderContents = toUTF8LBS $ generateCabalMacrosHeader pkg lbi clbi diff --git a/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs b/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs index be5aa378796..33b86a8b3b2 100644 --- a/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs @@ -19,11 +19,14 @@ import Distribution.Compat.Prelude import Prelude () import Distribution.Package -import Distribution.PackageDescription -import Distribution.Simple.Compiler -import Distribution.Simple.LocalBuildInfo -import Distribution.Utils.ShortText -import Distribution.Version + ( PackageName + , packageName + , packageVersion + , unPackageName + ) +import Distribution.Types.PackageDescription (PackageDescription (..)) +import Distribution.Types.Version (versionNumbers) +import Distribution.Utils.ShortText (fromShortText) import qualified Distribution.Simple.Build.PackageInfoModule.Z as Z @@ -33,8 +36,8 @@ import qualified Distribution.Simple.Build.PackageInfoModule.Z as Z -- ------------------------------------------------------------ -generatePackageInfoModule :: PackageDescription -> LocalBuildInfo -> String -generatePackageInfoModule pkg_descr lbi = +generatePackageInfoModule :: PackageDescription -> String +generatePackageInfoModule pkg_descr = Z.render Z.Z { Z.zPackageName = showPkgName $ packageName pkg_descr @@ -42,15 +45,8 @@ generatePackageInfoModule pkg_descr lbi = , Z.zSynopsis = fromShortText $ synopsis pkg_descr , Z.zCopyright = fromShortText $ copyright pkg_descr , Z.zHomepage = fromShortText $ homepage pkg_descr - , Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax + , Z.zSupportsNoRebindableSyntax = True } - where - supports_rebindable_syntax = ghc_newer_than (mkVersion [7, 0, 1]) - - ghc_newer_than minVersion = - case compilerCompatVersion GHC (compiler lbi) of - Nothing -> False - Just version -> version `withinRange` orLaterVersion minVersion showPkgName :: PackageName -> String showPkgName = map fixchar . unPackageName diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule.hs b/Cabal/src/Distribution/Simple/Build/PathsModule.hs index 9392acf3cef..f014d3169e2 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule.hs @@ -44,8 +44,8 @@ generatePathsModule pkg_descr lbi clbi = Z.Z { Z.zPackageName = packageName pkg_descr , Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr - , Z.zSupportsCpp = supports_cpp - , Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax + , Z.zSupportsCpp = True + , Z.zSupportsNoRebindableSyntax = True , Z.zAbsolute = absolute , Z.zRelocatable = relocatable lbi , Z.zIsWindows = isWindows @@ -63,15 +63,6 @@ generatePathsModule pkg_descr lbi clbi = , Z.zSysconfdir = zSysconfdir } where - supports_cpp = supports_language_pragma - supports_rebindable_syntax = ghc_newer_than (mkVersion [7, 0, 1]) - supports_language_pragma = ghc_newer_than (mkVersion [6, 6, 1]) - - ghc_newer_than minVersion = - case compilerCompatVersion GHC (compiler lbi) of - Nothing -> False - Just version -> version `withinRange` orLaterVersion minVersion - -- In several cases we cannot make relocatable installations absolute = hasLibs pkg_descr -- we can only make progs relocatable diff --git a/Cabal/src/Distribution/Simple/Compiler.hs b/Cabal/src/Distribution/Simple/Compiler.hs index 38478a71b4c..4f66f90eea8 100644 --- a/Cabal/src/Distribution/Simple/Compiler.hs +++ b/Cabal/src/Distribution/Simple/Compiler.hs @@ -492,15 +492,8 @@ reexportedAsSupported comp = case compilerFlavor comp of -- "dynamic-library-dirs"? libraryDynDirSupported :: Compiler -> Bool libraryDynDirSupported comp = case compilerFlavor comp of - GHC -> - -- Not just v >= mkVersion [8,0,1,20161022], as there - -- are many GHC 8.1 nightlies which don't support this. - ( (v >= mkVersion [8, 0, 1, 20161022] && v < mkVersion [8, 1]) - || v >= mkVersion [8, 1, 20161021] - ) + GHC -> True _ -> False - where - v = compilerVersion comp -- | Does this compiler's "ar" command supports response file -- arguments (i.e. @file-style arguments). diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index b9ce731a33d..c5d81ce94f1 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -2923,12 +2923,7 @@ checkForeignLibSupported :: Compiler -> Platform -> ForeignLib -> Maybe String checkForeignLibSupported comp platform flib = go (compilerFlavor comp) where go :: CompilerFlavor -> Maybe String - go GHC - | compilerVersion comp < mkVersion [7, 8] = - unsupported - [ "Building foreign libraries is only supported with GHC >= 7.8" - ] - | otherwise = goGhcPlatform platform + go GHC = goGhcPlatform platform go _ = unsupported [ "Building foreign libraries is currently only supported with ghc" diff --git a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs index 32e23de4438..f3b2fad7eae 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs @@ -17,7 +17,6 @@ import Distribution.Compat.ResponseFile import Distribution.InstalledPackageInfo (InstalledPackageInfo) import qualified Distribution.InstalledPackageInfo as IPI import qualified Distribution.InstalledPackageInfo as InstalledPackageInfo -import qualified Distribution.ModuleName as ModuleName import Distribution.Package import Distribution.PackageDescription as PD import Distribution.PackageDescription.Utils (cabalBug) @@ -32,7 +31,6 @@ import Distribution.Simple.GHC.ImplInfo import qualified Distribution.Simple.GHC.Internal as Internal import Distribution.Simple.LocalBuildInfo import qualified Distribution.Simple.PackageIndex as PackageIndex -import Distribution.Simple.PreProcess.Types import Distribution.Simple.Program import qualified Distribution.Simple.Program.Ar as Ar import Distribution.Simple.Program.GHC @@ -51,8 +49,6 @@ import Distribution.Version import System.Directory ( createDirectoryIfMissing , doesDirectoryExist - , doesFileExist - , removeFile , renameFile ) import System.FilePath @@ -260,18 +256,14 @@ linkLibrary -> [BuildWay] -- ^ Wanted build ways and corresponding build options -> IO () -linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do +linkLibrary buildTargetDir cleanedExtraLibDirs _pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do let - common = configCommonFlags $ configFlags lbi - mbWorkDir = flagToMaybe $ setupWorkingDir common - compiler_id = compilerId comp comp = compiler lbi - ghcVersion = compilerVersion comp implInfo = getImplInfo comp uid = componentUnitId clbi libBi = libBuildInfo lib - Platform _hostArch hostOS = hostPlatform lbi + Platform _hostArch _hostOS = hostPlatform lbi vanillaLibFilePath = buildTargetDir makeRelativePathEx (mkLibName uid) profileLibFilePath = buildTargetDir makeRelativePathEx (mkProfLibName uid) sharedLibFilePath = @@ -288,19 +280,6 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li makeRelativePathEx (mkBytecodeLibName compiler_id uid) ghciLibFilePath = buildTargetDir makeRelativePathEx (Internal.mkGHCiLibName uid) ghciProfLibFilePath = buildTargetDir makeRelativePathEx (Internal.mkGHCiProfLibName uid) - libInstallPath = - libdir $ - absoluteComponentInstallDirs - pkg_descr - lbi - uid - NoCopyDest - sharedLibInstallPath = - libInstallPath - mkSharedLibName (hostPlatform lbi) compiler_id uid - profSharedLibInstallPath = - libInstallPath - mkProfSharedLibName (hostPlatform lbi) compiler_id uid getObjWayFiles :: BuildWay -> IO [SymbolicPath Pkg File] getObjWayFiles w = getObjFiles (buildWayObjectExtension objExtension w) (buildWayObjectExtension objExtension w) @@ -322,16 +301,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li , pure $ map (srcObjPath obj_ext) extraSources , catMaybes <$> sequenceA - [ findFileCwdWithExtension - mbWorkDir - [Suffix obj_ext] - [buildTargetDir] - xPath - | ghcVersion < mkVersion [7, 2] -- ghc-7.2+ does not make _stub.o files - , x <- allLibModules lib clbi - , let xPath :: RelativePath Artifacts File - xPath = makeRelativePathEx $ ModuleName.toFilePath x ++ "_stub" - ] + [] ] -- Get the @.o@ path from a source path (e.g. @.hs@), @@ -399,14 +369,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li , ghcOptDynLinkMode = toFlag GhcDynamicOnly , ghcOptInputFiles = toNubListR $ map coerceSymbolicPath dynObjectFiles , ghcOptOutputFile = toFlag sharedLibFilePath - , -- For dynamic libs, Mac OS/X needs to know the install location - -- at build time. This only applies to GHC < 7.8 - see the - -- discussion in #1660. - ghcOptDylibName = - if hostOS == OSX - && ghcVersion < mkVersion [7, 8] - then toFlag sharedLibInstallPath - else mempty + , ghcOptDylibName = mempty , ghcOptLinkLibs = extraLibs libBi , ghcOptLinkLibPath = toNubListR cleanedExtraLibDirs , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD.frameworks libBi @@ -425,14 +388,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li , ghcOptDynLinkMode = toFlag GhcDynamicOnly , ghcOptInputFiles = toNubListR pdynObjectFiles , ghcOptOutputFile = toFlag profSharedLibFilePath - , -- For dynamic libs, Mac OS/X needs to know the install location - -- at build time. This only applies to GHC < 7.8 - see the - -- discussion in #1660. - ghcOptDylibName = - if hostOS == OSX - && ghcVersion < mkVersion [7, 8] - then toFlag profSharedLibInstallPath - else mempty + , ghcOptDylibName = mempty , ghcOptLinkLibs = extraLibs libBi , ghcOptLinkLibPath = toNubListR cleanedExtraLibDirs , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD.frameworks libBi @@ -545,16 +501,11 @@ linkExecutable linkerOpts (way, buildOpts) targetDir targetName runGhcProg lbi = -- assume there is a main function in another non-haskell object ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty && ghcOptInputScripts baseOpts == mempty) } - comp = compiler lbi -- Work around old GHCs not relinking in this -- situation, see #3294 let target = targetDir makeRelativePathEx (exeTargetName (hostPlatform lbi) targetName) - when (compilerVersion comp < mkVersion [7, 7]) $ do - let targetPath = interpretSymbolicPathLBI lbi target - e <- doesFileExist targetPath - when e (removeFile targetPath) runGhcProg linkOpts{ghcOptOutputFile = toFlag target} -- | Link a foreign library component @@ -661,7 +612,7 @@ getRPaths pbci = do supportRPaths OSX = True supportRPaths FreeBSD = case compid of - CompilerId GHC ver | ver >= mkVersion [7, 10, 2] -> True + CompilerId GHC _ver -> True _ -> False supportRPaths OpenBSD = False supportRPaths NetBSD = False diff --git a/Cabal/src/Distribution/Simple/GHCJS.hs b/Cabal/src/Distribution/Simple/GHCJS.hs index e139e2a5962..4b2538c21cd 100644 --- a/Cabal/src/Distribution/Simple/GHCJS.hs +++ b/Cabal/src/Distribution/Simple/GHCJS.hs @@ -97,7 +97,6 @@ import System.Directory , createDirectoryIfMissing , doesFileExist , getAppUserDataDirectory - , removeFile , renameFile ) import System.FilePath @@ -1570,10 +1569,6 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do -- Work around old GHCs not relinking in this -- situation, see #3294 let target = targetDir makeRelativePathEx targetName - when (compilerVersion comp < mkVersion [7, 7]) $ do - let targetPath = i target - e <- doesFileExist targetPath - when e (removeFile targetPath) runGhcProg linkOpts{ghcOptOutputFile = toFlag target} GBuildFLib flib -> do let rtsInfo = extractRtsInfo lbi @@ -1742,7 +1737,7 @@ getRPaths lbi clbi | supportRPaths hostOS = do supportRPaths OSX = True supportRPaths FreeBSD = case compid of - CompilerId GHC ver | ver >= mkVersion [7, 10, 2] -> True + CompilerId GHC _ -> True _ -> False supportRPaths OpenBSD = False supportRPaths NetBSD = False diff --git a/Cabal/src/Distribution/Simple/Program/Builtin.hs b/Cabal/src/Distribution/Simple/Program/Builtin.hs index 7934d3be6b5..89379e3ab44 100644 --- a/Cabal/src/Distribution/Simple/Program/Builtin.hs +++ b/Cabal/src/Distribution/Simple/Program/Builtin.hs @@ -105,20 +105,7 @@ ghcProgram = } where ghcPostConf _verbosity ghcProg = do - let setLanguageEnv prog = - prog - { programOverrideEnv = - ("LANGUAGE", Just "en") - : programOverrideEnv ghcProg - } - - ignorePackageEnv prog = prog{programDefaultArgs = "-package-env=-" : programDefaultArgs prog} - - -- Only the 7.8 branch seems to be affected. Fixed in 7.8.4. - affectedVersionRange = - intersectVersionRanges - (laterVersion $ mkVersion [7, 8, 0]) - (earlierVersion $ mkVersion [7, 8, 4]) + let ignorePackageEnv prog = prog{programDefaultArgs = "-package-env=-" : programDefaultArgs prog} canIgnorePackageEnv = orLaterVersion $ mkVersion [8, 4, 4] @@ -130,11 +117,7 @@ ghcProgram = ( \v -> -- By default, ignore GHC_ENVIRONMENT variable of any package environment -- files. See #10759 - applyWhen (withinRange v canIgnorePackageEnv) ignorePackageEnv - -- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/8825 - -- (spurious warning on non-english locales) - $ - applyWhen (withinRange v affectedVersionRange) setLanguageEnv ghcProg + applyWhen (withinRange v canIgnorePackageEnv) ignorePackageEnv ghcProg ) (programVersion ghcProg) diff --git a/cabal-install/src/Distribution/Client/CmdRepl.hs b/cabal-install/src/Distribution/Client/CmdRepl.hs index e27a4d18642..8d485e717ae 100644 --- a/cabal-install/src/Distribution/Client/CmdRepl.hs +++ b/cabal-install/src/Distribution/Client/CmdRepl.hs @@ -522,7 +522,7 @@ targetedRepl -- into the multi-out directory. replOpts'' <- case targetCtx of ProjectContext -> return $ replOpts'{replOptionsFlagOutput = Flag dir} - _ -> usingGhciScript compiler projectRoot replOpts' + _ -> usingGhciScript projectRoot replOpts' let buildCtx' = buildCtx & lElaboratedShared . lPkgConfigReplOptions .~ replOpts'' printPlan verbosity baseCtx'' buildCtx' @@ -591,7 +591,7 @@ targetedRepl -- single target repl replOpts'' <- case targetCtx of ProjectContext -> return replOpts' - _ -> usingGhciScript compiler projectRoot replOpts' + _ -> usingGhciScript projectRoot replOpts' let buildCtx' = buildCtx & lElaboratedShared . lPkgConfigReplOptions .~ replOpts'' printPlan verbosity baseCtx'' buildCtx' @@ -762,19 +762,12 @@ generateReplFlags includeTransitive elaboratedPlan OriginalComponentInfo{..} = f -- -- The @-ghci-script@ flag is path to the ghci script responsible for changing to the -- correct directory. Only works on GHC >= 7.6, though. 🙁 -usingGhciScript :: Compiler -> FilePath -> ReplOptions -> IO ReplOptions -usingGhciScript compiler projectRoot replOpts - | compilerCompatVersion GHC compiler >= Just minGhciScriptVersion = do - let ghciScriptPath = projectRoot "setcwd.ghci" - cwd <- getCurrentDirectory - writeFile ghciScriptPath (":cd " ++ cwd) - return $ replOpts & lReplOptionsFlags %~ (("-ghci-script" ++ ghciScriptPath) :) - | otherwise = return replOpts - --- | First version of GHC where GHCi supported the flag we need. --- https://downloads.haskell.org/~ghc/7.6.1/docs/html/users_guide/release-7-6-1.html -minGhciScriptVersion :: Version -minGhciScriptVersion = mkVersion [7, 6] +usingGhciScript :: FilePath -> ReplOptions -> IO ReplOptions +usingGhciScript projectRoot replOpts = do + let ghciScriptPath = projectRoot "setcwd.ghci" + cwd <- getCurrentDirectory + writeFile ghciScriptPath (":cd " ++ cwd) + return $ replOpts & lReplOptionsFlags %~ (("-ghci-script" ++ ghciScriptPath) :) -- | This defines what a 'TargetSelector' means for the @repl@ command. -- It selects the 'AvailableTarget's that the 'TargetSelector' refers to, diff --git a/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs b/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs index 923dd289dc0..76b98a5279a 100644 --- a/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs +++ b/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs @@ -73,11 +73,8 @@ guessCabalSpecVersion = do -- | Guess the language specification based on the GHC version guessLanguage :: Interactive m => Compiler -> m Language -guessLanguage Compiler{compilerId = CompilerId GHC ver} = - return $ - if ver < mkVersion [7, 0, 1] - then Haskell98 - else Haskell2010 +guessLanguage Compiler{compilerId = CompilerId GHC _ver} = + return Haskell2010 guessLanguage _ = return defaultLanguage -- | Guess the package name based on the given root directory. diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs b/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs index 0ef3b872286..e3a6595ecdb 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs @@ -237,9 +237,5 @@ legacyCustomSetupPkgs compiler (Platform _ os) = ++ ["unix" | os /= Windows] ++ ["ghc-prim" | isGHC] ++ ["template-haskell" | isGHC] - ++ ["old-time" | notGHC710] where isGHC = compilerCompatFlavor GHC compiler - notGHC710 = case compilerCompatVersion GHC compiler of - Nothing -> False - Just v -> v <= mkVersion [7, 9] diff --git a/cabal-install/tests/IntegrationTests2.hs b/cabal-install/tests/IntegrationTests2.hs index f0fb930b1f9..fbfecde7788 100644 --- a/cabal-install/tests/IntegrationTests2.hs +++ b/cabal-install/tests/IntegrationTests2.hs @@ -1913,16 +1913,11 @@ testSetupScriptStyles config reportSubCase = do plan0@(_, _, sharedConfig) <- planProject testdir1 config - let isOSX (Platform _ OSX) = True - isOSX _ = False - compilerVer = compilerVersion (pkgConfigCompiler sharedConfig) + let compilerVer = compilerVersion (pkgConfigCompiler sharedConfig) -- Skip the Custom tests when the shipped Cabal library is buggy - unless - ( (isOSX (pkgConfigPlatform sharedConfig) && (compilerVer < mkVersion [7, 10])) - -- 9.10 ships Cabal 3.12.0.0 affected by #9940 - || (mkVersion [9, 10] <= compilerVer && compilerVer < mkVersion [9, 11]) - ) - $ do + -- 9.10 ships Cabal 3.12.0.0 affected by #9940 + unless (mkVersion [9, 10] <= compilerVer && compilerVer < mkVersion [9, 11]) $ + do (plan1, res1) <- executePlan plan0 pkg1 <- expectPackageInstalled plan1 res1 pkgidA elabSetupScriptStyle pkg1 @?= SetupCustomExplicitDeps diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs b/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs index 528e29f06a0..1cafc2d263e 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs @@ -1179,11 +1179,6 @@ nonInteractiveTests pkgIx srcDb comp = (`languageHeuristics` (comp{compilerId = CompilerId GHC $ mkVersion [8, 10, 4]})) Haskell2010 [] - , testSimple - "Lower version compiler" - (`languageHeuristics` (comp{compilerId = CompilerId GHC $ mkVersion [6, 0, 1]})) - Haskell98 - [] ] , testGroup "Check extraDocFileHeuristics output" diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs index ea286554201..a27e46b2c2d 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs @@ -27,7 +27,6 @@ import System.IO.Unsafe (unsafePerformIO) import Distribution.Deprecated.ParseUtils import qualified Distribution.Deprecated.ReadP as Parse -import Distribution.Compiler import Distribution.Package import Distribution.PackageDescription import qualified Distribution.Simple.InstallDirs as InstallDirs @@ -36,7 +35,6 @@ import Distribution.Simple.Program.Types import Distribution.Simple.Utils (toUTF8BS) import Distribution.System (OS (Windows), buildOS) import Distribution.Types.PackageVersionConstraint -import Distribution.Version import Distribution.Parsec import Distribution.Pretty @@ -78,11 +76,11 @@ tests = -- a couple tests seem to trigger a RTS fault in ghc-7.6 and older -- unclear why as of yet concat - [ [ testProperty "shared" prop_roundtrip_legacytypes_shared + [ + [ testProperty "shared" prop_roundtrip_legacytypes_shared , testProperty "local" prop_roundtrip_legacytypes_local , testProperty "all" prop_roundtrip_legacytypes_all ] - | not usingGhc76orOlder ] , testGroup "individual parser tests" @@ -103,11 +101,6 @@ tests = , testGetProjectRootUsability , testFindProjectRoot ] - where - usingGhc76orOlder = - case buildCompilerId of - CompilerId GHC v -> v < mkVersion [7, 7] - _ -> False testGetProjectRootUsability :: TestTree testGetProjectRootUsability = From 5b7eb4bf24021577f6fe5a8fdbbde9f982cf2f74 Mon Sep 17 00:00:00 2001 From: Ilia Baryshnikov Date: Wed, 18 Mar 2026 14:35:40 +0300 Subject: [PATCH 2/5] changelog.d/11630.md --- changelog.d/11630.md | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 changelog.d/11630.md diff --git a/changelog.d/11630.md b/changelog.d/11630.md new file mode 100644 index 00000000000..3b702d42a51 --- /dev/null +++ b/changelog.d/11630.md @@ -0,0 +1,11 @@ +--- +synopsis: "Remove old mkVersion" +packages: [cabal-install, Cabal] +prs: 11630 +--- + +We don't have any testing for such old versions of ghc. +Since this code isn't used, I assume it doesn't work, +but it's difficult to confirm otherwise. + +We just dropped everything below 8.0.0 From 95bed894a2ec04dafd08fbc4e4fcd5d3b6d22cce Mon Sep 17 00:00:00 2001 From: Ilia Baryshnikov Date: Wed, 18 Mar 2026 19:03:45 +0300 Subject: [PATCH 3/5] Add review notes --- .../src/Distribution/Simple/Build/PackageInfoModule.hs | 1 - .../Distribution/Simple/Build/PackageInfoModule/Z.hs | 10 ++-------- Cabal/src/Distribution/Simple/Build/PathsModule.hs | 1 - Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs | 10 ++-------- Cabal/src/Distribution/Simple/GHC/Build/Link.hs | 10 ++-------- cabal-dev-scripts/src/GenPathsModule.hs | 1 - 6 files changed, 6 insertions(+), 27 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs b/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs index 33b86a8b3b2..ea576ce3227 100644 --- a/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs @@ -45,7 +45,6 @@ generatePackageInfoModule pkg_descr = , Z.zSynopsis = fromShortText $ synopsis pkg_descr , Z.zCopyright = fromShortText $ copyright pkg_descr , Z.zHomepage = fromShortText $ homepage pkg_descr - , Z.zSupportsNoRebindableSyntax = True } showPkgName :: PackageName -> String diff --git a/Cabal/src/Distribution/Simple/Build/PackageInfoModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PackageInfoModule/Z.hs index 6fdbfb176b7..015c3ea3058 100644 --- a/Cabal/src/Distribution/Simple/Build/PackageInfoModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PackageInfoModule/Z.hs @@ -2,7 +2,7 @@ module Distribution.Simple.Build.PackageInfoModule.Z (render, Z (..)) where -import Distribution.ZinzaPrelude +import Distribution.ZinzaPrelude (Generic, execWriter, tell) data Z = Z { zPackageName :: String @@ -10,18 +10,12 @@ data Z = Z , zSynopsis :: String , zCopyright :: String , zHomepage :: String - , zSupportsNoRebindableSyntax :: Bool } deriving (Generic) render :: Z -> String render z_root = execWriter $ do - if (zSupportsNoRebindableSyntax z_root) - then do - tell "{-# LANGUAGE NoRebindableSyntax #-}\n" - return () - else do - return () + tell "{-# LANGUAGE NoRebindableSyntax #-}\n" tell "{-# OPTIONS_GHC -w #-}\n" tell "\n" tell "{-|\n" diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule.hs b/Cabal/src/Distribution/Simple/Build/PathsModule.hs index f014d3169e2..6a9345c36ee 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule.hs @@ -45,7 +45,6 @@ generatePathsModule pkg_descr lbi clbi = { Z.zPackageName = packageName pkg_descr , Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr , Z.zSupportsCpp = True - , Z.zSupportsNoRebindableSyntax = True , Z.zAbsolute = absolute , Z.zRelocatable = relocatable lbi , Z.zIsWindows = isWindows diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index d401ce305c4..55a7cac7175 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -1,12 +1,11 @@ {- FOURMOLU_DISABLE -} {-# LANGUAGE DeriveGeneric #-} module Distribution.Simple.Build.PathsModule.Z (render, Z(..)) where -import Distribution.ZinzaPrelude +import Distribution.ZinzaPrelude (Generic, PackageName, execWriter, tell) data Z = Z {zPackageName :: PackageName, zVersionDigits :: String, zSupportsCpp :: Bool, - zSupportsNoRebindableSyntax :: Bool, zAbsolute :: Bool, zRelocatable :: Bool, zIsWindows :: Bool, @@ -31,12 +30,7 @@ render z_root = execWriter $ do return () else do return () - if (zSupportsNoRebindableSyntax z_root) - then do - tell "{-# LANGUAGE NoRebindableSyntax #-}\n" - return () - else do - return () + tell "{-# LANGUAGE NoRebindableSyntax #-}\n" if (zNot z_root (zAbsolute z_root)) then do tell "{-# LANGUAGE ForeignFunctionInterface #-}\n" diff --git a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs index f3b2fad7eae..587f0a03745 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs @@ -226,7 +226,7 @@ linkOrLoadComponent CLib lib -> do let libWays = wantedLibWays isIndef rpaths <- get_rpaths (Set.fromList libWays) - linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths libWays + linkLibrary buildTargetDir cleanedExtraLibDirs verbosity runGhcProg lib lbi clbi extraSources rpaths libWays CFLib flib -> do let flib_way = wantedFLibWay (withDynFLib flib) rpaths <- get_rpaths (Set.singleton flib_way) @@ -241,8 +241,6 @@ linkLibrary -- ^ The library target build directory -> [SymbolicPath Pkg (Dir Lib)] -- ^ The list of extra lib dirs that exist (aka "cleaned") - -> PackageDescription - -- ^ The package description containing this library -> Verbosity -> (GhcOptions -> IO ()) -- ^ Run the configured Ghc program @@ -256,14 +254,13 @@ linkLibrary -> [BuildWay] -- ^ Wanted build ways and corresponding build options -> IO () -linkLibrary buildTargetDir cleanedExtraLibDirs _pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do +linkLibrary buildTargetDir cleanedExtraLibDirs verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do let compiler_id = compilerId comp comp = compiler lbi implInfo = getImplInfo comp uid = componentUnitId clbi libBi = libBuildInfo lib - Platform _hostArch _hostOS = hostPlatform lbi vanillaLibFilePath = buildTargetDir makeRelativePathEx (mkLibName uid) profileLibFilePath = buildTargetDir makeRelativePathEx (mkProfLibName uid) sharedLibFilePath = @@ -299,9 +296,6 @@ linkLibrary buildTargetDir cleanedExtraLibDirs _pkg_descr verbosity runGhcProg l hs_ext True , pure $ map (srcObjPath obj_ext) extraSources - , catMaybes - <$> sequenceA - [] ] -- Get the @.o@ path from a source path (e.g. @.hs@), diff --git a/cabal-dev-scripts/src/GenPathsModule.hs b/cabal-dev-scripts/src/GenPathsModule.hs index 7c5c947a5b7..b5ea6f5fd45 100644 --- a/cabal-dev-scripts/src/GenPathsModule.hs +++ b/cabal-dev-scripts/src/GenPathsModule.hs @@ -26,7 +26,6 @@ $(capture "decls" [d| { zPackageName :: PackageName , zVersionDigits :: String , zSupportsCpp :: Bool - , zSupportsNoRebindableSyntax :: Bool , zAbsolute :: Bool , zRelocatable :: Bool , zIsWindows :: Bool From d9c5b128fb1bae6298af6d1d048e0105e0bbbd2a Mon Sep 17 00:00:00 2001 From: Ilia Baryshnikov Date: Wed, 18 Mar 2026 19:38:31 +0300 Subject: [PATCH 4/5] Fix templates --- Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs | 2 +- cabal-dev-scripts/cabal-dev-scripts.cabal | 4 ++-- cabal-dev-scripts/src/GenUtils.hs | 1 - templates/Paths_pkg.template.hs | 2 -- 4 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index 55a7cac7175..c4acf88bec9 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -1,7 +1,7 @@ {- FOURMOLU_DISABLE -} {-# LANGUAGE DeriveGeneric #-} module Distribution.Simple.Build.PathsModule.Z (render, Z(..)) where -import Distribution.ZinzaPrelude (Generic, PackageName, execWriter, tell) +import Distribution.ZinzaPrelude data Z = Z {zPackageName :: PackageName, zVersionDigits :: String, diff --git a/cabal-dev-scripts/cabal-dev-scripts.cabal b/cabal-dev-scripts/cabal-dev-scripts.cabal index 92002387ee7..8951c30dc7d 100644 --- a/cabal-dev-scripts/cabal-dev-scripts.cabal +++ b/cabal-dev-scripts/cabal-dev-scripts.cabal @@ -18,7 +18,7 @@ executable gen-spdx ghc-options: -Wall build-depends: , aeson ^>=2.2.3.0 - , base >=4.13 && <4.21 + , base >=4.13 && <4.22 , bytestring , containers , Diff ^>=0.4 @@ -35,7 +35,7 @@ executable gen-spdx-exc ghc-options: -Wall build-depends: , aeson ^>=2.2.3.0 - , base >=4.13 && <4.21 + , base >=4.13 && <4.22 , bytestring , containers , Diff ^>=0.4 diff --git a/cabal-dev-scripts/src/GenUtils.hs b/cabal-dev-scripts/src/GenUtils.hs index 5751f99a1aa..0bf24c23d27 100644 --- a/cabal-dev-scripts/src/GenUtils.hs +++ b/cabal-dev-scripts/src/GenUtils.hs @@ -7,7 +7,6 @@ module GenUtils where import Control.Lens (each, ix, (%~), (&)) import Data.Char (toUpper) -import Data.Maybe (fromMaybe) import Data.Proxy (Proxy (..)) import Data.Text (Text) import GHC.Generics (Generic) diff --git a/templates/Paths_pkg.template.hs b/templates/Paths_pkg.template.hs index 9577070e169..b575f548053 100644 --- a/templates/Paths_pkg.template.hs +++ b/templates/Paths_pkg.template.hs @@ -1,9 +1,7 @@ {% if supportsCpp %} {-# LANGUAGE CPP #-} {% endif %} -{% if supportsNoRebindableSyntax %} {-# LANGUAGE NoRebindableSyntax #-} -{% endif %} {% if not absolute %} {-# LANGUAGE ForeignFunctionInterface #-} {% endif %} From 314c399a62b18cfa6a7a7e756a362148636d7818 Mon Sep 17 00:00:00 2001 From: Ilia Baryshnikov Date: Wed, 18 Mar 2026 19:40:33 +0300 Subject: [PATCH 5/5] fix comment --- cabal-install/src/Distribution/Client/CmdRepl.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cabal-install/src/Distribution/Client/CmdRepl.hs b/cabal-install/src/Distribution/Client/CmdRepl.hs index 8d485e717ae..af73fa9002a 100644 --- a/cabal-install/src/Distribution/Client/CmdRepl.hs +++ b/cabal-install/src/Distribution/Client/CmdRepl.hs @@ -761,7 +761,7 @@ generateReplFlags includeTransitive elaboratedPlan OriginalComponentInfo{..} = f -- so we need to tell ghci to change back to the correct directory. -- -- The @-ghci-script@ flag is path to the ghci script responsible for changing to the --- correct directory. Only works on GHC >= 7.6, though. 🙁 +-- correct directory. usingGhciScript :: FilePath -> ReplOptions -> IO ReplOptions usingGhciScript projectRoot replOpts = do let ghciScriptPath = projectRoot "setcwd.ghci"