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 committed Jun 1, 2018
1 parent 5c9cade commit 806001c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Cabal/ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
is present in a component.
* `cabal check` now warns if `-j` is used in `ghc-options` in a Cabal
file. (#5277)
* Cabal now dedupliates more `-I` and `-L` and flags to avoid `E2BIG`
(#5356)

----

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 @@ -1715,12 +1715,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 @@ -1742,7 +1742,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 806001c

Please sign in to comment.