Skip to content

Commit

Permalink
pkg-config: Use --libs --static when building with using --enable-exe…
Browse files Browse the repository at this point in the history
…cutable-static
  • Loading branch information
Alex Biehl committed Jun 30, 2020
1 parent b9eeda1 commit b604606
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Cabal/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ configure (pkg_descr0, pbi) cfg = do
>>= configureRequiredPrograms verbosity requiredBuildTools

(pkg_descr', programDb'') <-
configurePkgconfigPackages verbosity pkg_descr programDb' enabled
configurePkgconfigPackages verbosity pkg_descr programDb' enabled cfg

-- Compute internal component graph
--
Expand Down Expand Up @@ -1566,8 +1566,9 @@ configureRequiredProgram verbosity progdb

configurePkgconfigPackages :: Verbosity -> PackageDescription
-> ProgramDb -> ComponentRequestedSpec
-> ConfigFlags
-> IO (PackageDescription, ProgramDb)
configurePkgconfigPackages verbosity pkg_descr progdb enabled
configurePkgconfigPackages verbosity pkg_descr progdb enabled cfg
| null allpkgs = return (pkg_descr, progdb)
| otherwise = do
(_, _, progdb') <- requireProgramVersion
Expand Down Expand Up @@ -1640,8 +1641,9 @@ configurePkgconfigPackages verbosity pkg_descr progdb enabled
pkgconfigBuildInfo [] = return mempty
pkgconfigBuildInfo pkgdeps = do
let pkgs = nub [ prettyShow pkg | PkgconfigDependency pkg _ <- pkgdeps ]
static = [ "--static" | fromFlag (configFullyStaticExe cfg) ]
ccflags <- pkgconfig ("--cflags" : pkgs)
ldflags <- pkgconfig ("--libs" : pkgs)
ldflags <- pkgconfig ("--libs" : static ++ pkgs)
return (ccLdOptionsBuildInfo (words ccflags) (words ldflags))

-- | Makes a 'BuildInfo' from C compiler and linker flags.
Expand Down

0 comments on commit b604606

Please sign in to comment.