From b6a11fa08805f5b25493c63bc8c6a3085d48bb65 Mon Sep 17 00:00:00 2001 From: Ian Lynagh Date: Tue, 12 Mar 2013 18:21:55 +0000 Subject: Follow changes in Cabal --- utils/ghc-cabal/Main.hs | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) (limited to 'utils/ghc-cabal/Main.hs') diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 3ecae9bbc4..f3e64f4d42 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -220,10 +220,12 @@ doRegister ghc ghcpkg topdir directory distDir let installedPkgs' = PackageIndex.fromList instInfos let updateComponentConfig (cn, clbi, deps) = (cn, updateComponentLocalBuildInfo clbi, deps) - updateComponentLocalBuildInfo (ComponentLocalBuildInfo cpds) - = ComponentLocalBuildInfo - [ (fixupPackageId instInfos ipid, pid) - | (ipid,pid) <- cpds ] + updateComponentLocalBuildInfo clbi + = clbi { + componentPackageDeps = + [ (fixupPackageId instInfos ipid, pid) + | (ipid,pid) <- componentPackageDeps clbi ] + } ccs' = map updateComponentConfig (componentsConfigs lbi) lbi' = lbi { componentsConfigs = ccs', @@ -306,31 +308,18 @@ generate config_args distdir directory -- generate Paths_.hs and cabal-macros.h writeAutogenFiles verbosity pd lbi - let findLibraryConfig [] = Nothing - findLibraryConfig ((CLibName, clbi, _) : _) = Just clbi - findLibraryConfig (_ : xs) = findLibraryConfig xs - mLibraryConfig = findLibraryConfig (componentsConfigs lbi) - -- generate inplace-pkg-config - case (library pd, mLibraryConfig) of - (Nothing, Nothing) -> return () - (Just lib, Just clbi) -> do - cwd <- getCurrentDirectory - let ipid = InstalledPackageId (display (packageId pd) ++ "-inplace") - let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir - pd lib lbi clbi - final_ipi = installedPkgInfo { - Installed.installedPackageId = ipid, - Installed.haddockHTMLs = [] - } - content = Installed.showInstalledPackageInfo final_ipi ++ "\n" - writeFileAtomic (distdir "inplace-pkg-config") (BS.pack $ toUTF8 content) - (Just _, Nothing) -> - -- There is a library, but we aren't building it - -- Happens e.g. with haddock, which has both a library - -- and executable in its .cabal file. - return () - (Nothing, Just _) -> die ["Library local build info, but no library in package description"] + withLibLBI pd lbi $ \lib clbi -> + do cwd <- getCurrentDirectory + let ipid = InstalledPackageId (display (packageId pd) ++ "-inplace") + let installedPkgInfo = inplaceInstalledPackageInfo cwd distdir + pd lib lbi clbi + final_ipi = installedPkgInfo { + Installed.installedPackageId = ipid, + Installed.haddockHTMLs = [] + } + content = Installed.showInstalledPackageInfo final_ipi ++ "\n" + writeFileAtomic (distdir "inplace-pkg-config") (BS.pack $ toUTF8 content) let libBiModules lib = (libBuildInfo lib, libModules lib) -- cgit v1.2.1