Skip to content

Commit

Permalink
Adds custom handling of the GHC.Prim module during copy
Browse files Browse the repository at this point in the history
This used to be done in `ghc-cabal`. With the long term goal of getting rid of ghc-cabal eventually, it's functionality needs to end up in cabal.

While this is a custom hack, it is restricted to the GHC module only. A more generic solution would be to add `virtual-modules` I suppose. GHC does custom handling for `GHC.Prim`, and there is no support for `virtual-modules` in the package config file either as far as I can see. As such this seems to be the least invasive solution.
  • Loading branch information
angerman committed Nov 8, 2017
1 parent 26426fc commit 63db5ea
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Cabal/Distribution/Simple/GHC.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE CPP #-}

Expand Down Expand Up @@ -1734,8 +1735,11 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir _pkg lib clbi = do
installOrdinary = install False
installShared = install True

gHC_PRIM = "GHC.Prim" :: ModuleName
-- We ignore any "GHC.Prim" module. Which doesn't physically exist. It is part of
-- the @base@ package, and containes wired-in primitives.
copyModuleFiles ext =
findModuleFiles [builtDir] [ext] (allLibModules lib clbi)
findModuleFiles [builtDir] [ext] (filter (/= gHC_PRIM) $ allLibModules lib clbi)
>>= installOrdinaryFiles verbosity targetDir

compiler_id = compilerId (compiler lbi)
Expand Down

0 comments on commit 63db5ea

Please sign in to comment.