UNREG: fix PackageKey emission into .hc files
authorSergei Trofimovich <slyfox@gentoo.org>
Tue, 19 Aug 2014 02:45:11 +0000 (21:45 -0500)
committerAustin Seipp <austin@well-typed.com>
Tue, 19 Aug 2014 04:26:19 +0000 (23:26 -0500)
Summary:
Fixes ./configure --unable-unregisterised build failure:
    HC [stage 1] (one of the first calls)
    ...
    <command line>: unknown package: transformers-0.4.1.0

The reason of bug is how UNREG build stores package information
in .hc files:
    compiler/main/CodeOutput.lhs generates first line as
        /* GHC_PACKAGES pkg-name-ver1 pkg-name-ver2 ...
    while DriverPipeline.hs (getHCFilePackages) expects
        /* GHC_PACKAGES pkg-key1 pkg-key2 ...

Fix it by emitting ghc's PackageKey in CodeOutput

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
Test Plan: build-tested on ./configure --enable-unregistersied

Reviewers: simonmar, ezyang, austin

Reviewed By: ezyang, austin

Subscribers: simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D164

compiler/main/CodeOutput.lhs

index 7a554f4..72803c0 100644 (file)
@@ -124,8 +124,7 @@ outputC dflags filenm cmm_stream packages
                '<':_      -> "#include "++h_file
                _          -> "#include \""++h_file++"\""
 
-       pkg_configs <- getPreloadPackagesAnd dflags packages
-       let pkg_names = map (display.sourcePackageId) pkg_configs
+       let pkg_names = map packageKeyString packages
 
        doOutput filenm $ \ h -> do
           hPutStr h ("/* GHC_PACKAGES " ++ unwords pkg_names ++ "\n*/\n")