From b678999a0e5436c6fd3b1b3fa80f2cccb1a55639 Mon Sep 17 00:00:00 2001 From: Rodrigo Mesquita Date: Fri, 12 Jan 2024 18:27:21 +0000 Subject: [PATCH] Formatting --- Cabal/src/Distribution/Simple/GHC.hs | 82 +++++++++---------- Cabal/src/Distribution/Simple/GHC/Build.hs | 6 +- .../src/Distribution/Simple/GHC/Build/Link.hs | 64 +++++++-------- 3 files changed, 77 insertions(+), 75 deletions(-) diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 20d6d142329..2d84189ed84 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -837,47 +837,47 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do whenGHCi $ installOrdinary builtDir targetDir ghciProfLibName whenShared $ if - -- The behavior for "extra-bundled-libraries" changed in version 2.5.0. - -- See ghc issue #15837 and Cabal PR #5855. - | specVersion pkg < CabalSpecV3_0 -> do - sequence_ - [ installShared - builtDir - dynlibTargetDir - (mkGenericSharedLibName platform compiler_id (l ++ f)) - | l <- getHSLibraryName uid : extraBundledLibs (libBuildInfo lib) - , f <- "" : extraDynLibFlavours (libBuildInfo lib) - ] - | otherwise -> do - sequence_ - [ installShared - builtDir - dynlibTargetDir - ( mkGenericSharedLibName - platform - compiler_id - (getHSLibraryName uid ++ f) - ) - | f <- "" : extraDynLibFlavours (libBuildInfo lib) - ] - sequence_ - [ do - files <- getDirectoryContents builtDir - let l' = - mkGenericSharedBundledLibName - platform - compiler_id - l - forM_ files $ \file -> - when (l' `isPrefixOf` file) $ do - isFile <- doesFileExist (builtDir file) - when isFile $ do - installShared - builtDir - dynlibTargetDir - file - | l <- extraBundledLibs (libBuildInfo lib) - ] + -- The behavior for "extra-bundled-libraries" changed in version 2.5.0. + -- See ghc issue #15837 and Cabal PR #5855. + | specVersion pkg < CabalSpecV3_0 -> do + sequence_ + [ installShared + builtDir + dynlibTargetDir + (mkGenericSharedLibName platform compiler_id (l ++ f)) + | l <- getHSLibraryName uid : extraBundledLibs (libBuildInfo lib) + , f <- "" : extraDynLibFlavours (libBuildInfo lib) + ] + | otherwise -> do + sequence_ + [ installShared + builtDir + dynlibTargetDir + ( mkGenericSharedLibName + platform + compiler_id + (getHSLibraryName uid ++ f) + ) + | f <- "" : extraDynLibFlavours (libBuildInfo lib) + ] + sequence_ + [ do + files <- getDirectoryContents builtDir + let l' = + mkGenericSharedBundledLibName + platform + compiler_id + l + forM_ files $ \file -> + when (l' `isPrefixOf` file) $ do + isFile <- doesFileExist (builtDir file) + when isFile $ do + installShared + builtDir + dynlibTargetDir + file + | l <- extraBundledLibs (libBuildInfo lib) + ] where builtDir = componentBuildDir lbi clbi diff --git a/Cabal/src/Distribution/Simple/GHC/Build.hs b/Cabal/src/Distribution/Simple/GHC/Build.hs index d31b8e2b608..9e3829803b0 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build.hs @@ -89,8 +89,10 @@ build numJobs pkg_descr = do -- See Note [Build Target Dir vs Target Dir] as well targetDir <- makeRelativeToCurrentDirectory targetDir_absolute & liftIO - buildTargetDir <- if isLib then makeRelativeToCurrentDirectory buildTargetDir_absolute & liftIO - else return buildTargetDir_absolute + buildTargetDir <- + if isLib + then makeRelativeToCurrentDirectory buildTargetDir_absolute & liftIO + else return buildTargetDir_absolute (ghcProg, _) <- requireProgram verbosity ghcProgram (withPrograms lbi) & liftIO diff --git a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs index 8cfe7b30c06..8483c83e531 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs @@ -304,27 +304,27 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li toNubListR $ PD.extraFrameworkDirs libBi , ghcOptRPaths = rpaths } - -- dynOpts - -- { ghcOptMode = toFlag GhcModeLink - -- , ghcOptShared = toFlag True - -- , ghcOptInputFiles = toNubListR 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 - -- , ghcOptNoAutoLinkPackages = toFlag True - -- , ghcOptLinkLibs = extraLibs libBi - -- , ghcOptLinkLibPath = toNubListR $ cleanedExtraLibDirs - -- , ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi - -- , ghcOptLinkFrameworkDirs = - -- toNubListR $ PD.extraFrameworkDirs libBi - -- , ghcOptRPaths = rpaths - -- } + -- dynOpts + -- { ghcOptMode = toFlag GhcModeLink + -- , ghcOptShared = toFlag True + -- , ghcOptInputFiles = toNubListR 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 + -- , ghcOptNoAutoLinkPackages = toFlag True + -- , ghcOptLinkLibs = extraLibs libBi + -- , ghcOptLinkLibPath = toNubListR $ cleanedExtraLibDirs + -- , ghcOptLinkFrameworks = toNubListR $ PD.frameworks libBi + -- , ghcOptLinkFrameworkDirs = + -- toNubListR $ PD.extraFrameworkDirs libBi + -- , ghcOptRPaths = rpaths + -- } ghcStaticLinkArgs staticObjectFiles = ghcBaseLinkArgs { ghcOptStaticLib = toFlag True @@ -333,15 +333,15 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li , ghcOptLinkLibs = extraLibs libBi , ghcOptLinkLibPath = toNubListR $ cleanedExtraLibDirs -- ROMES:TODO: why not extra dirs *static*??? } - -- staticOpts - -- { ghcOptMode = toFlag GhcModeLink - -- , ghcOptStaticLib = toFlag True - -- , ghcOptInputFiles = toNubListR staticObjectFiles - -- , ghcOptOutputFile = toFlag staticLibFilePath - -- , ghcOptNoAutoLinkPackages = toFlag True - -- , ghcOptLinkLibs = extraLibs libBi - -- , ghcOptLinkLibPath = toNubListR $ cleanedExtraLibDirs -- ROMES:TODO: why not extra dirs *static*??? - -- } + -- staticOpts + -- { ghcOptMode = toFlag GhcModeLink + -- , ghcOptStaticLib = toFlag True + -- , ghcOptInputFiles = toNubListR staticObjectFiles + -- , ghcOptOutputFile = toFlag staticLibFilePath + -- , ghcOptNoAutoLinkPackages = toFlag True + -- , ghcOptLinkLibs = extraLibs libBi + -- , ghcOptLinkLibPath = toNubListR $ cleanedExtraLibDirs -- ROMES:TODO: why not extra dirs *static*??? + -- } staticObjectFiles <- getObjFiles StaticWay profObjectFiles <- getObjFiles ProfWay @@ -409,8 +409,8 @@ linkExecutable (linkerOpts, rpaths) (wantedWays, buildOpts) targetDir targetName let baseOpts = buildOpts way linkOpts = (baseOpts `mappend` linkerOpts) - { ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty) - } + { ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty) + } & (if withDynExe lbi then \x -> x{ghcOptRPaths = rpaths} else id) comp = compiler lbi