diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2016-06-20 09:02:34 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2016-06-30 20:02:23 +0200 |
commit | 0701db125eb32ed0a518d962c9e4ee279e3296fd (patch) | |
tree | ed9102cd788355570475234673106c3afd33f933 /utils | |
parent | b8b3e30a6eedf9f213b8a718573c4827cfa230ba (diff) | |
download | haskell-0701db125eb32ed0a518d962c9e4ee279e3296fd.tar.gz |
Updates to handle new Cabal
Specifically per-component macros and multiple libraries.
Contains Cabal submodule update.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: austin, bgamari
Reviewed By: austin, bgamari
Subscribers: hvr, thomie
Differential Revision: https://phabricator.haskell.org/D2059
Diffstat (limited to 'utils')
-rw-r--r-- | utils/ghc-cabal/Main.hs | 19 | ||||
-rw-r--r-- | utils/ghc-pkg/Main.hs | 4 | ||||
-rw-r--r-- | utils/ghctags/Main.hs | 13 |
3 files changed, 18 insertions, 18 deletions
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs index 575f8f341a..99f34d9e6e 100644 --- a/utils/ghc-cabal/Main.hs +++ b/utils/ghc-cabal/Main.hs @@ -150,14 +150,16 @@ doCopy directory distDir noGhcPrimHook f pd lbi us flags = let pd' | packageName pd == PackageName "ghc-prim" = - case library pd of - Just lib -> + case libraries pd of + [lib] -> let ghcPrim = fromJust (simpleParse "GHC.Prim") ems = filter (ghcPrim /=) (exposedModules lib) lib' = lib { exposedModules = ems } - in pd { library = Just lib' } - Nothing -> + in pd { libraries = [lib'] } + [] -> error "Expected a library, but none found" + _ -> + error "Expected a single library, but multiple found" | otherwise = pd in f pd' lbi us flags modHook relocatableBuild f pd lbi us flags @@ -227,8 +229,8 @@ doRegister directory distDir ghc ghcpkg topdir progs' <- configurePrograms [ghcProgram', ghcPkgProgram'] progs instInfos <- dump (hcPkgInfo progs') verbosity GlobalPackageDB let installedPkgs' = PackageIndex.fromList instInfos - let updateComponentConfig (cn, clbi, deps) - = (cn, updateComponentLocalBuildInfo clbi, deps) + let updateComponentConfig (clbi, deps) + = (updateComponentLocalBuildInfo clbi, deps) updateComponentLocalBuildInfo clbi = clbi -- TODO: remove ccs' = map updateComponentConfig (componentsConfigs lbi) lbi' = lbi { @@ -308,7 +310,8 @@ generate directory distdir dll0Modules config_args let pd = updatePackageDescription hooked_bi pd0 -- generate Paths_<pkg>.hs and cabal-macros.h - writeAutogenFiles verbosity pd lbi + withAllComponentsInBuildOrder pd lbi $ \_ clbi -> + writeAutogenFiles verbosity pd lbi clbi -- generate inplace-pkg-config withLibLBI pd lbi $ \lib clbi -> @@ -328,7 +331,7 @@ generate directory distdir dll0Modules config_args comp = compiler lbi libBiModules lib = (libBuildInfo lib, libModules lib) exeBiModules exe = (buildInfo exe, ModuleName.main : exeModules exe) - biModuless = (maybeToList $ fmap libBiModules $ library pd) + biModuless = (map libBiModules $ libraries pd) ++ (map exeBiModules $ executables pd) buildableBiModuless = filter isBuildable biModuless where isBuildable (bi', _) = buildable bi' diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs index e000a8fa5b..1b5f5e08f7 100644 --- a/utils/ghc-pkg/Main.hs +++ b/utils/ghc-pkg/Main.hs @@ -447,8 +447,8 @@ runit verbosity cli nonopts = do (Just (Substring pkgarg_str m)) Nothing ["dot"] -> do showPackageDot verbosity cli - ["find-module", moduleName] -> do - let match = maybe (==moduleName) id (substringCheck moduleName) + ["find-module", mod_name] -> do + let match = maybe (==mod_name) id (substringCheck mod_name) listPackages verbosity cli Nothing (Just match) ["latest", pkgid_str] -> do pkgid <- readGlobPkgId pkgid_str diff --git a/utils/ghctags/Main.hs b/utils/ghctags/Main.hs index ba116b6bd4..9a2ab2cccf 100644 --- a/utils/ghctags/Main.hs +++ b/utils/ghctags/Main.hs @@ -21,7 +21,7 @@ import SrcLoc import Distribution.Simple.GHC ( componentGhcOptions ) import Distribution.Simple.Configure ( getPersistBuildConfig ) import Distribution.Simple.Program.GHC ( renderGhcOptions ) -import Distribution.PackageDescription ( library, libBuildInfo ) +import Distribution.PackageDescription ( libBuildInfo ) import Distribution.Simple.LocalBuildInfo import qualified Distribution.Verbosity as V @@ -179,13 +179,10 @@ flagsFromCabal :: FilePath -> IO [String] flagsFromCabal distPref = do lbi <- getPersistBuildConfig distPref let pd = localPkgDescr lbi - findLibraryConfig [] = Nothing - findLibraryConfig ((CLibName, clbi, _) : _) = Just clbi - findLibraryConfig (_ : xs) = findLibraryConfig xs - mLibraryConfig = findLibraryConfig (componentsConfigs lbi) - case (library pd, mLibraryConfig) of - (Just lib, Just clbi) -> - let bi = libBuildInfo lib + case maybeGetDefaultLibraryLocalBuildInfo lbi of + Just clbi -> + let CLib lib = getComponent pd (componentLocalName clbi) + bi = libBuildInfo lib odir = buildDir lbi opts = componentGhcOptions V.normal lbi bi clbi odir in return $ renderGhcOptions (compiler lbi) (hostPlatform lbi) opts |