Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
alt-romes committed Jan 12, 2024
1 parent 13800dd commit b678999
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 75 deletions.
82 changes: 41 additions & 41 deletions Cabal/src/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 4 additions & 2 deletions Cabal/src/Distribution/Simple/GHC/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
64 changes: 32 additions & 32 deletions Cabal/src/Distribution/Simple/GHC/Build/Link.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit b678999

Please sign in to comment.