Skip to content

Commit 1ffbc3f

Browse files
committed
needsProfilingLib cannot per per compiler just yet
I would need to rework packagesWithLibDepsDownwardClosedProperty. It has to be done but not now.
1 parent 71b2c21 commit 1ffbc3f

File tree

1 file changed

+35
-32
lines changed

1 file changed

+35
-32
lines changed

cabal-install/src/Distribution/Client/ProjectPlanning.hs

Lines changed: 35 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2486,9 +2486,10 @@ elaborateInstallPlan
24862486
pkgDynExe = perPkgOptionMaybe pkgid packageConfigDynExe
24872487
pkgProf = perPkgOptionMaybe pkgid packageConfigProf
24882488

2489-
needsProfilingLib compiler pkg =
2490-
fromFlagOrDefault compilerShouldUseProfilingLibByDefault (profBothFlag <> profLibFlag)
2489+
needsProfilingLib pkg = fromFlagOrDefault False (profBothFlag <> profLibFlag)
24912490
where
2491+
-- fromFlagOrDefault compilerShouldUseProfilingLibByDefault (profBothFlag <> profLibFlag)
2492+
24922493
pkgid = packageId pkg
24932494
profBothFlag = lookupPerPkgOption pkgid packageConfigProf
24942495
profLibFlag = lookupPerPkgOption pkgid packageConfigProfLib
@@ -2497,24 +2498,26 @@ elaborateInstallPlan
24972498
pkgsUseProfilingLibraryShared =
24982499
packagesWithLibDepsDownwardClosedProperty needsProfilingLibShared
24992500

2501+
-- TODO: review this logic
25002502
needsProfilingLibShared pkg =
2501-
fromMaybe
2502-
compilerShouldUseProfilingSharedLibByDefault
2503-
-- case 1: If --enable-profiling-shared is passed explicitly, honour that
2504-
( case profLibSharedFlag of
2505-
Just v -> Just v
2506-
Nothing -> case pkgDynExe of
2507-
Just True ->
2508-
case pkgProf of
2509-
-- case 2: --enable-executable-dynamic + --enable-profiling
2510-
-- turn on shared profiling libraries
2511-
Just True -> if canBuildProfilingSharedLibs then Just True else Nothing
2512-
_ -> Nothing
2513-
-- But don't necessarily turn off shared library generation is
2514-
-- --disable-executable-dynamic is passed. The shared objects might
2515-
-- be needed for something different.
2516-
_ -> Nothing
2517-
)
2503+
-- fromMaybe
2504+
-- compilerShouldUseProfilingSharedLibByDefault
2505+
-- -- case 1: If --enable-profiling-shared is passed explicitly, honour that
2506+
case profLibSharedFlag of
2507+
Just v -> v
2508+
Nothing -> case pkgDynExe of
2509+
Just True ->
2510+
case pkgProf of
2511+
-- case 2: --enable-executable-dynamic + --enable-profiling
2512+
-- turn on shared profiling libraries
2513+
-- Just True -> if canBuildProfilingSharedLibs then Just True else Nothing
2514+
Just True -> True
2515+
_ -> False
2516+
-- But don't necessarily turn off shared library generation is
2517+
-- --disable-executable-dynamic is passed. The shared objects might
2518+
-- be needed for something different.
2519+
-- _ -> Nothing
2520+
_ -> False
25182521
where
25192522
pkgid = packageId pkg
25202523
profLibSharedFlag = perPkgOptionMaybe pkgid packageConfigProfShared
@@ -2554,19 +2557,19 @@ compilerShouldUseSharedLibByDefault compiler =
25542557
GHCJS -> GHCJS.isDynamic compiler
25552558
_ -> False
25562559

2557-
-- TODO: [code cleanup] move this into the Cabal lib.
2558-
compilerShouldUseProfilingLibByDefault :: Compiler -> Bool
2559-
compilerShouldUseProfilingLibByDefault compiler =
2560-
case compilerFlavor compiler of
2561-
GHC -> GHC.compilerBuildWay compiler == ProfWay && canBuildProfilingLibs compiler
2562-
_ -> False
2563-
2564-
-- TODO: [code cleanup] move this into the Cabal lib.
2565-
compilerShouldUseProfilingSharedLibByDefault :: Compiler -> Bool
2566-
compilerShouldUseProfilingSharedLibByDefault compiler =
2567-
case compilerFlavor compiler of
2568-
GHC -> GHC.compilerBuildWay compiler == ProfDynWay && canBuildProfilingSharedLibs compiler
2569-
_ -> False
2560+
-- -- TODO: [code cleanup] move this into the Cabal lib.
2561+
-- compilerShouldUseProfilingLibByDefault :: Compiler -> Bool
2562+
-- compilerShouldUseProfilingLibByDefault compiler =
2563+
-- case compilerFlavor compiler of
2564+
-- GHC -> GHC.compilerBuildWay compiler == ProfWay && canBuildProfilingLibs compiler
2565+
-- _ -> False
2566+
2567+
-- -- TODO: [code cleanup] move this into the Cabal lib.
2568+
-- compilerShouldUseProfilingSharedLibByDefault :: Bool
2569+
-- compilerShouldUseProfilingSharedLibByDefault =
2570+
-- case compilerFlavor compiler of
2571+
-- GHC -> GHC.compilerBuildWay compiler == ProfDynWay && canBuildProfilingSharedLibs compiler
2572+
-- _ -> False
25702573

25712574
-- Returns False if we definitely can't build shared libs
25722575
-- TODO: [code cleanup] move this into the Cabal lib.

0 commit comments

Comments
 (0)