Skip to content

Commit

Permalink
As in haskell#3974 and haskell#4105, but also dedupe PD.includeDirs
Browse files Browse the repository at this point in the history
… and `PD.extraLibDirs`.

Should help with big invocations as found in
NixOS/nixpkgs#41340.
  • Loading branch information
nh2 authored and 23Skidoo committed Jun 20, 2018
1 parent f2dd0ea commit fd6ff29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion Cabal/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@
do. This may lead to files unexpectedly being included by `sdist`;
please audit your package descriptions if you rely on this
behaviour to keep sensitive data out of distributed packages.

* Cabal now deduplicates more `-I` and `-L` and flags to avoid `E2BIG`
([#5356](https://github.com/haskell/cabal/issues/5356)).
----

## 2.2.0.1 (current 2.2 development version)
Expand Down
8 changes: 4 additions & 4 deletions Cabal/Distribution/Simple/Configure.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1712,12 +1712,12 @@ checkForeignDeps pkg lbi verbosity =
-- should NOT be glomming everything together.)
++ [ "-I" ++ buildDir lbi </> "autogen" ]
-- `configure' may generate headers in the build directory
++ [ "-I" ++ buildDir lbi </> dir | dir <- collectField PD.includeDirs
++ [ "-I" ++ buildDir lbi </> dir | dir <- ordNub (collectField PD.includeDirs)
, not (isAbsolute dir)]
-- we might also reference headers from the packages directory.
++ [ "-I" ++ baseDir lbi </> dir | dir <- collectField PD.includeDirs
++ [ "-I" ++ baseDir lbi </> dir | dir <- ordNub (collectField PD.includeDirs)
, not (isAbsolute dir)]
++ [ "-I" ++ dir | dir <- collectField PD.includeDirs
++ [ "-I" ++ dir | dir <- ordNub (collectField PD.includeDirs)
, isAbsolute dir]
++ ["-I" ++ baseDir lbi]
++ collectField PD.cppOptions
Expand All @@ -1739,7 +1739,7 @@ checkForeignDeps pkg lbi verbosity =
| dep <- deps
, opt <- Installed.ccOptions dep ]

commonLdArgs = [ "-L" ++ dir | dir <- collectField PD.extraLibDirs ]
commonLdArgs = [ "-L" ++ dir | dir <- ordNub (collectField PD.extraLibDirs) ]
++ collectField PD.ldOptions
++ [ "-L" ++ dir
| dir <- ordNub [ dir
Expand Down

0 comments on commit fd6ff29

Please sign in to comment.