Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix predicate which determines whether to build a shared library #10054

Closed
wants to merge 1 commit into from
Closed
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
3 changes: 2 additions & 1 deletion cabal-install/src/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ import Distribution.Solver.Types.ProjectConfigPath
import System.FilePath
import Text.PrettyPrint (colon, comma, fsep, hang, punctuate, quotes, text, vcat, ($$))
import qualified Text.PrettyPrint as Disp
import Data.Semigroup

-- | Check that an 'ElaboratedConfiguredPackage' actually makes
-- sense under some 'ElaboratedSharedConfig'.
Expand Down Expand Up @@ -2365,7 +2366,7 @@ elaborateInstallPlan
needsSharedLib pkg =
fromMaybe
compilerShouldUseSharedLibByDefault
(liftM2 (||) pkgSharedLib pkgDynExe)
(getMax <$> ((Max <$> pkgSharedLib) <> (Max <$> pkgDynExe)))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly, I find this unreadable. I don't think the Monoid instance for Max is quite natural here. Indeed you comment below suggests that it is not quite right.

where
pkgid = packageId pkg
pkgSharedLib = perPkgOptionMaybe pkgid packageConfigSharedLib
Expand Down
10 changes: 10 additions & 0 deletions changelog.d/issue-10050
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
synopsis: Fix behaviour of --disable-shared
packages: cabal-install
prs: #10054
issues: #10050

description: Previously `--disable-shared` was not applied unless `--disable-executable-dynamic` was
also explicitly configured.

Now `--disable-shared` will turn off building shared libraries irrespective of whether
`--disable-executable-dynamic` is specified.
Loading