summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Graf <sebastian.graf@kit.edu>2019-02-26 18:17:25 +0100
committerSebastian Graf <sebastian.graf@kit.edu>2019-02-26 18:21:27 +0100
commit05e6129ea31ea3e57bdfe4573bf769f257241f2b (patch)
tree6fba56ed11ae4acbd70745f52702b36389dd5691
parent14586f5d737ec5dc828633267b50dcf0d47e1696 (diff)
downloadhaskell-wip/dont-leak-libffi.tar.gz
Don't shadow libffi tarballs with boot libffi installationwip/dont-leak-libffi
In Trac #16368, I realised that `ghc-cabal` picked up the libffi installation from the boot GHC and inserted it into include and library paths of stage 1 libraries. That's rectified by this commit. Fixes Trac #16368.
-rw-r--r--utils/ghc-cabal/Main.hs22
1 files changed, 15 insertions, 7 deletions
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index 8b776499fd..f4a2313194 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -338,14 +338,22 @@ generate directory distdir config_args
[(_,[rts])] ->
PackageIndex.insert rts{
Installed.ldOptions = [],
- Installed.libraryDirs = filter (not . ("gcc-lib" `isSuffixOf`)) (Installed.libraryDirs rts)} index
- -- GHC <= 6.12 had $topdir/gcc-lib in their
- -- library-dirs for the rts package, which causes
- -- problems when we try to use the in-tree mingw,
- -- due to accidentally picking up the incompatible
- -- libraries there. So we filter out gcc-lib from
- -- the RTS's library-dirs here.
+ Installed.libraryDirs = filter_dirs (Installed.libraryDirs rts),
+ Installed.includeDirs = filter_dirs (Installed.includeDirs rts)
+ } index
_ -> error "No (or multiple) ghc rts package is registered!!"
+ filter_dirs = filter (\dir -> not (or [is_gcc_lib dir, is_libffi dir]))
+ -- GHC <= 6.12 had $topdir/gcc-lib in their
+ -- library-dirs for the rts package, which causes
+ -- problems when we try to use the in-tree mingw,
+ -- due to accidentally picking up the incompatible
+ -- libraries there. So we filter out gcc-lib from
+ -- the RTS's library-dirs here.
+ is_gcc_lib = ("gcc-lib" `isSuffixOf`)
+ -- In Trac #16368, we noticed that libffi paths
+ -- from the boot GHC shadow the local libffi tarballs
+ -- in a similar manner.
+ is_libffi = ("libffi" `isInfixOf`)
dep_ids = map snd (externalPackageDeps lbi)
deps = map display dep_ids