X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=utils%2Fghc-cabal%2Fghc-cabal.hs;h=b940a2dff561f6a9b0755d38021509c5407205b5;hb=7f4b8d9bfbfb0556d51ba1fb25f18e424bd5bf9c;hp=29e0f5c500bd69d239648fd832cd59ef21468aec;hpb=6e998535044b9565b46d1d0d5453427c4051a7b4;p=ghc-hetmet.git diff --git a/utils/ghc-cabal/ghc-cabal.hs b/utils/ghc-cabal/ghc-cabal.hs index 29e0f5c..b940a2d 100644 --- a/utils/ghc-cabal/ghc-cabal.hs +++ b/utils/ghc-cabal/ghc-cabal.hs @@ -34,10 +34,10 @@ main = do args <- getArgs runHaddock distDir dir args' "check" : dir : [] -> doCheck dir - "install" : ghc : ghcpkg : topdir : directory : distDir + "install" : ghc : ghcpkg : strip : topdir : directory : distDir : myDestDir : myPrefix : myLibdir : myDocdir : relocatableBuild : args' -> - doInstall ghc ghcpkg topdir directory distDir + doInstall ghc ghcpkg strip topdir directory distDir myDestDir myPrefix myLibdir myDocdir relocatableBuild args' "configure" : args' -> case break (== "--") args' of @@ -139,10 +139,10 @@ runHaddock distdir directory args = f pd lbi us flags doInstall :: FilePath -> FilePath -> FilePath -> FilePath -> FilePath - -> FilePath -> FilePath -> FilePath -> FilePath -> String - -> [String] + -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath + -> String -> [String] -> IO () -doInstall ghc ghcpkg topdir directory distDir +doInstall ghc ghcpkg strip topdir directory distDir myDestDir myPrefix myLibdir myDocdir relocatableBuildStr args = withCurrentDirectory directory $ do @@ -198,8 +198,8 @@ doInstall ghc ghcpkg topdir directory distDir libsubdir = toPathTemplate "$pkgid", docdir = toPathTemplate $ if relocatableBuild - then "$topdir/$pkg" - else (myDocdir "$pkg"), + then "$topdir/$pkgid" + else (myDocdir "$pkgid"), htmldir = toPathTemplate "$docdir" } progs = withPrograms lbi @@ -220,18 +220,26 @@ doInstall ghc ghcpkg topdir directory distDir else [], programLocation = UserSpecified ghcpkg } + stripProg = ConfiguredProgram { + programId = programName stripProgram, + programVersion = Nothing, + programArgs = [], + programLocation = UserSpecified strip + } progs' = updateProgram ghcProg - $ updateProgram ghcPkgProg progs + $ updateProgram ghcPkgProg + $ updateProgram stripProg + progs instInfos <- dump verbosity ghcPkgProg GlobalPackageDB - let installedPkgs' = PackageIndex.listToInstalledPackageIndex - instInfos + let installedPkgs' = PackageIndex.fromList instInfos let mlc = libraryConfig lbi mlc' = case mlc of Just lc -> - let cipds = componentInstalledPackageDeps lc - cipds' = map (fixupPackageId instInfos) cipds + let cipds = componentPackageDeps lc + cipds' = [ (fixupPackageId instInfos ipid, pid) + | (ipid,pid) <- cipds ] in Just $ lc { - componentInstalledPackageDeps = cipds' + componentPackageDeps = cipds' } Nothing -> Nothing lbi' = lbi { @@ -335,12 +343,11 @@ generate config_args distdir directory -- stricter than gnu ld). Thus we remove the ldOptions for -- GHC's rts package: hackRtsPackage index = - case PackageIndex.lookupInstalledPackageByName index (PackageName "rts") of - [rts] -> PackageIndex.addToInstalledPackageIndex rts { Installed.ldOptions = [] } index + case PackageIndex.lookupPackageName index (PackageName "rts") of + [(_,[rts])] -> PackageIndex.insert rts{ Installed.ldOptions = [] } index _ -> error "No (or multiple) ghc rts package is registered!!" - dep_ids = map (packageId.getLocalPackageInfo lbi) $ - externalPackageDeps lbi + dep_ids = map snd (externalPackageDeps lbi) let variablePrefix = directory ++ '_':distdir let xs = [variablePrefix ++ "_VERSION = " ++ display (pkgVersion (package pd)), @@ -364,12 +371,12 @@ generate config_args distdir directory variablePrefix ++ "_CC_OPTS = " ++ unwords (ccOptions bi), variablePrefix ++ "_CPP_OPTS = " ++ unwords (cppOptions bi), variablePrefix ++ "_LD_OPTS = " ++ unwords (ldOptions bi), - variablePrefix ++ "_DEP_INCLUDE_DIRS = " ++ unwords (forDeps Installed.includeDirs), + variablePrefix ++ "_DEP_INCLUDE_DIRS = " ++ unwords (wrap $ forDeps Installed.includeDirs), variablePrefix ++ "_DEP_CC_OPTS = " ++ unwords (forDeps Installed.ccOptions), - variablePrefix ++ "_DEP_LIB_DIRS = " ++ unwords (forDeps Installed.libraryDirs), + variablePrefix ++ "_DEP_LIB_DIRS = " ++ unwords (wrap $ forDeps Installed.libraryDirs), variablePrefix ++ "_DEP_EXTRA_LIBS = " ++ unwords (forDeps Installed.extraLibraries), variablePrefix ++ "_DEP_LD_OPTS = " ++ unwords (forDeps Installed.ldOptions)] writeFile (distdir ++ "/package-data.mk") $ unlines xs where escape = foldr (\c xs -> if c == '#' then '\\':'#':xs else c:xs) [] - + wrap = map (\s -> "\'" ++ s ++ "\'")