diff options
Diffstat (limited to 'CabalHelper')
-rw-r--r-- | CabalHelper/Main.hs | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/CabalHelper/Main.hs b/CabalHelper/Main.hs index 7c0d15a..a48c2bc 100644 --- a/CabalHelper/Main.hs +++ b/CabalHelper/Main.hs @@ -306,10 +306,10 @@ getLibrary pd = unsafePerformIO $ do readIORef lr getLibraryClbi pd lbi = unsafePerformIO $ do - lr <- newIORef (error "getLibraryClbi: empty IORef") + lr <- newIORef Nothing withLibLBI pd lbi $ \ lib clbi -> - writeIORef lr (lib,clbi) + writeIORef lr $ Just (lib,clbi) readIORef lr @@ -417,21 +417,26 @@ removeInplaceDeps :: Verbosity -> ComponentLocalBuildInfo -> (ComponentLocalBuildInfo, GhcOptions) removeInplaceDeps v lbi pd clbi = let - (lib, libclbi) = getLibraryClbi pd lbi - libbi = libBuildInfo lib - liboutdir = componentOutDir lbi (CLib lib) - libopts = (componentGhcOptions normal lbi libbi libclbi liboutdir) { - ghcOptPackageDBs = [] + (ideps, deps) = partition isInplaceDep (componentPackageDeps clbi) + hasIdeps = not $ null ideps + libopts = + case getLibraryClbi pd lbi of + Just (lib, libclbi) | hasIdeps -> + let + libbi = libBuildInfo lib + liboutdir = componentOutDir lbi (CLib lib) + in + (componentGhcOptions normal lbi libbi libclbi liboutdir) { + ghcOptPackageDBs = [] #if CABAL_MAJOR == 1 && CABAL_MINOR > 22 && CABAL_MINOR < 23 - , ghcOptComponentId = NoFlag + , ghcOptComponentId = NoFlag #endif - } - (ideps, deps) = partition isInplaceDep (componentPackageDeps clbi) - hasIdeps = not $ null ideps + } + _ -> mempty clbi' = clbi { componentPackageDeps = deps } - in (clbi', if hasIdeps then libopts else mempty) + in (clbi', libopts) where isInplaceDep :: (InstalledPackageId, PackageId) -> Bool |